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)
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.
Tuple Fields of Initialize
Swap(SwapData)
Swap 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
Tuple Fields of Swap
0: SwapData
Deposit(DepositData)
Deposit 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
Tuple Fields of Deposit
0: DepositData
Withdraw(WithdrawData)
Withdraw 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
Tuple Fields of Withdraw
0: WithdrawData
WithdrawOne(WithdrawOneData)
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
Tuple Fields of WithdrawOne
Implementations
Unpacks a byte buffer into a SwapInstruction.
Packs a SwapInstruction into a byte buffer.
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.