Enum stable_swap_client::instruction::SwapInstruction [−][src]
#[repr(C)]
pub enum SwapInstruction {
Initialize(InitializeData),
Swap(SwapData),
Deposit(DepositData),
Withdraw(WithdrawData),
WithdrawOne(WithdrawOneData),
}Expand description
Instructions supported by the SwapInfo program.
Variants
Initialize(InitializeData)
Tuple Fields
Initializes a new SwapInfo.
[writable, signer]New StableSwap to create.[]$authority derived fromcreate_program_address(&[StableSwap account])[]admin Account.[]admin_fee_a admin fee Account for token_a.[]admin_fee_b admin fee Account for token_b.[]token_a Account. Must be non zero, owned by $authority.[]token_b Account. Must be non zero, owned by $authority.[writable]Pool Token Mint. Must be empty, owned by $authority.
Swap(SwapData)
Tuple Fields
0: SwapDataSwap the tokens in the pool.
[]StableSwap[]$authority[writable]token_(A|B) SOURCE Account, amount is transferable by $authority,[writable]token_(A|B) Base Account to swap INTO. Must be the SOURCE token.[writable]token_(A|B) Base Account to swap FROM. Must be the DESTINATION token.[writable]token_(A|B) DESTINATION Account assigned to USER as the owner.[writable]token_(A|B) admin fee Account. Must have same mint as DESTINATION token.[]Token program id[]Clock sysvar
Deposit(DepositData)
Tuple Fields
0: DepositDataDeposit some tokens into the pool. The output is a “pool” token representing ownership into the pool. Inputs are converted to the current ratio.
[]StableSwap[]$authority[writable]token_a $authority can transfer amount,[writable]token_b $authority can transfer amount,[writable]token_a Base Account to deposit into.[writable]token_b Base Account to deposit into.[writable]Pool MINT account, $authority is the owner.[writable]Pool Account to deposit the generated tokens, user is the owner.[]Token program id[]Clock sysvar
Withdraw(WithdrawData)
Tuple Fields
0: WithdrawDataWithdraw tokens from the pool at the current ratio.
[]StableSwap[]$authority[writable]Pool mint account, $authority is the owner[writable]SOURCE Pool account, amount is transferable by $authority.[writable]token_a Swap Account to withdraw FROM.[writable]token_b Swap Account to withdraw FROM.[writable]token_a user Account to credit.[writable]token_b user Account to credit.[writable]admin_fee_a admin fee Account for token_a.[writable]admin_fee_b admin fee Account for token_b.[]Token program id
WithdrawOne(WithdrawOneData)
Tuple Fields
Withdraw one token from the pool at the current ratio.
[]StableSwap[]$authority[writable]Pool mint account, $authority is the owner[writable]SOURCE Pool account, amount is transferable by $authority.[writable]token_(A|B) BASE token Swap Account to withdraw FROM.[writable]token_(A|B) QUOTE token Swap Account to exchange to base token.[writable]token_(A|B) BASE token user Account to credit.[writable]token_(A|B) admin fee Account. Must have same mint as BASE token.[]Token program id[]Clock sysvar
Implementations
Trait Implementations
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
