Enum stable_swap::instruction::SwapInstruction
source · [−]#[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.
Swap(SwapData)
Swap the tokens in the pool.
[]
StableSwap[]
$authority[signer]
User 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
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[signer]
User 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
Withdraw(WithdrawData)
Withdraw tokens from the pool at the current ratio.
[]
StableSwap[]
$authority[signer]
User 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)
Withdraw one token from the pool at the current ratio.
[]
StableSwap[]
$authority[signer]
User 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
Implementations
Trait Implementations
sourceimpl Clone for SwapInstruction
impl Clone for SwapInstruction
sourcefn clone(&self) -> SwapInstruction
fn clone(&self) -> SwapInstruction
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SwapInstruction
impl Debug for SwapInstruction
sourceimpl PartialEq<SwapInstruction> for SwapInstruction
impl PartialEq<SwapInstruction> for SwapInstruction
sourcefn eq(&self, other: &SwapInstruction) -> bool
fn eq(&self, other: &SwapInstruction) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SwapInstruction) -> bool
fn ne(&self, other: &SwapInstruction) -> bool
This method tests for !=
.
impl Copy for SwapInstruction
impl StructuralPartialEq for SwapInstruction
Auto Trait Implementations
impl RefUnwindSafe for SwapInstruction
impl Send for SwapInstruction
impl Sync for SwapInstruction
impl Unpin for SwapInstruction
impl UnwindSafe for SwapInstruction
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more