#[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§
Source§impl SwapInstruction
impl SwapInstruction
Sourcepub fn unpack(input: &[u8]) -> Result<Self, ProgramError>
pub fn unpack(input: &[u8]) -> Result<Self, ProgramError>
Unpacks a byte buffer into a SwapInstruction.
Trait Implementations§
Source§impl Clone for SwapInstruction
impl Clone for SwapInstruction
Source§fn clone(&self) -> SwapInstruction
fn clone(&self) -> SwapInstruction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SwapInstruction
impl Debug for SwapInstruction
Source§impl PartialEq for SwapInstruction
impl PartialEq for SwapInstruction
impl Copy for SwapInstruction
impl StructuralPartialEq for SwapInstruction
Auto Trait Implementations§
impl Freeze for SwapInstruction
impl RefUnwindSafe for SwapInstruction
impl Send for SwapInstruction
impl Sync for SwapInstruction
impl Unpin for SwapInstruction
impl UnwindSafe for SwapInstruction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more