pub fn redeem_tokens_fn(
program_id: &Pubkey,
accounts: &[AccountInfo<'_>],
amount: u64,
nonce: u8,
) -> ProgramResult
Expand description
Redeems an amount of a user’s tokens against the mint proxy.
Returns Result
that can be :
- [
Ok(())
] : Redeeming the [Redeemer::iou_mint] for the [Redeemer::redemption_mint].
or
ProgramError
: If their is an error while redeemer tokens , that’s can be :- [
Err(ProgramError::InvalidArgument)
] : The arguments provided to a program instruction where invalid. - [
Err(PortfolioError::ErrorFromExternalTransaction)
] : The result of invoke signe of claim rewards returnedProgramError
not [Ok(())
]. - [
Err(ProgramError::IncorrectProgramId)
] : The program id is incorrect.
- [
§Arguments
-
program_id
[]
: The portfolio program id. -
accounts : List of
AccountInfo
contain :-
source_authority_account
[signer]
: Authority of the source of the redeemed tokens. -
redeemer_account
[writable]
: Redeemer PDA. -
iou_mint_account
[writable]
: Mint of the IOU tokens. -
redemption_mint_account
[writable]
:Mint of the redemption token. -
redemption_vault_account
[writable]
: Vault of the redemption token.. -
token_program_account
[]
: The spl_token program. -
iou_source_account
[writable]
: Source of the IOU tokens. -
redemption_destination
[writable]
: Destination of the IOU tokens. -
mint_proxy_state
[]
: Mint proxy state. -
proxy_mint_authority
[]
: Proxy mint authority. Owned by the mint proxy. -
mint_proxy_program
[]
: Mint proxy program. -
minter_info
[writable]
: Minter information. -
authority_account
[]
: Program address generate a derived program address. -
create_program_ppu_info
[]
: The account program used to derive the key. -
saber_redeemer_account
[]
: The Saber redeemer program id.
-
-
amount : The amount of tokens that the [Miner] may claim.
-
nonce : Nonce used in program address for invoke a cross-program instruction to
redeemer
program.
§Example (Typescript)