This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! This example demonstrates the use of the `anchor_spl::token` CPI client to freeze account. | |
use anchor_lang::prelude::*; | |
use anchor_spl::token::{self, SetAuthority}; | |
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); | |
#[program] | |
mod token_proxy { | |
use super::*; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use anchor_lang::prelude::*; | |
use anchor_spl::token::{self, Mint, TokenAccount, Transfer, MintTo}; | |
use anchor_lang::solana_program::program_option::COption; | |
#[program] | |
pub mod dog_money { | |
use super::*; | |
pub fn initialize_user(ctx: Context<InitializeUser>, amount: u64, nonce: u8) -> ProgramResult { | |
let user_data = &mut ctx.accounts.user_data; | |
user_data.first_deposit = ctx.accounts.clock.unix_timestamp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
escrow_info.expected_amount = amount; | |
Escrow::pack(escrow_info, &mut escrow_account.try_borrow_mut_data()?)?; | |
let (pda, _bump_seed) = Pubkey::find_program_address(&[b"escrow"], program_id); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use solana_program::{ | |
account_info::{next_account_info, AccountInfo}, | |
entrypoint::ProgramResult, | |
program_error::ProgramError, | |
msg, | |
pubkey::Pubkey, | |
program_pack::{Pack, IsInitialized}, | |
sysvar::{rent::Rent, Sysvar}, | |
program::invoke | |
}; |
NewerOlder