pub struct Processor {}Expand description
Program state handler.
Implementations§
Source§impl Processor
impl Processor
Sourcepub fn unpack_token_account(
account_info: &AccountInfo<'_>,
token_program_id: &Pubkey,
) -> Result<Account, SwapError>
pub fn unpack_token_account( account_info: &AccountInfo<'_>, token_program_id: &Pubkey, ) -> Result<Account, SwapError>
Unpacks a spl_token Account.
Sourcepub fn unpack_mint(
account_info: &AccountInfo<'_>,
token_program_id: &Pubkey,
) -> Result<Mint, SwapError>
pub fn unpack_mint( account_info: &AccountInfo<'_>, token_program_id: &Pubkey, ) -> Result<Mint, SwapError>
Unpacks a spl_token Mint.
Calculates the authority id by generating a program address.
Sourcepub fn token_burn<'a>(
swap: &Pubkey,
token_program: AccountInfo<'a>,
burn_account: AccountInfo<'a>,
mint: AccountInfo<'a>,
authority: AccountInfo<'a>,
bump_seed: u8,
amount: u64,
) -> Result<(), ProgramError>
pub fn token_burn<'a>( swap: &Pubkey, token_program: AccountInfo<'a>, burn_account: AccountInfo<'a>, mint: AccountInfo<'a>, authority: AccountInfo<'a>, bump_seed: u8, amount: u64, ) -> Result<(), ProgramError>
Issue a spl_token Burn instruction.
Sourcepub fn token_mint_to<'a>(
swap: &Pubkey,
token_program: AccountInfo<'a>,
mint: AccountInfo<'a>,
destination: AccountInfo<'a>,
authority: AccountInfo<'a>,
bump_seed: u8,
amount: u64,
) -> Result<(), ProgramError>
pub fn token_mint_to<'a>( swap: &Pubkey, token_program: AccountInfo<'a>, mint: AccountInfo<'a>, destination: AccountInfo<'a>, authority: AccountInfo<'a>, bump_seed: u8, amount: u64, ) -> Result<(), ProgramError>
Issue a spl_token MintTo instruction.
Sourcepub fn token_transfer<'a>(
swap: &Pubkey,
token_program: AccountInfo<'a>,
source: AccountInfo<'a>,
destination: AccountInfo<'a>,
authority: AccountInfo<'a>,
bump_seed: u8,
amount: u64,
) -> Result<(), ProgramError>
pub fn token_transfer<'a>( swap: &Pubkey, token_program: AccountInfo<'a>, source: AccountInfo<'a>, destination: AccountInfo<'a>, authority: AccountInfo<'a>, bump_seed: u8, amount: u64, ) -> Result<(), ProgramError>
Issue a spl_token Transfer instruction.
Sourcepub fn process_initialize(
program_id: &Pubkey,
fees: Fees,
swap_curve: SwapCurve,
accounts: &[AccountInfo<'_>],
swap_constraints: &Option<SwapConstraints<'_>>,
) -> ProgramResult
pub fn process_initialize( program_id: &Pubkey, fees: Fees, swap_curve: SwapCurve, accounts: &[AccountInfo<'_>], swap_constraints: &Option<SwapConstraints<'_>>, ) -> ProgramResult
Processes an Initialize.
Sourcepub fn process_swap(
program_id: &Pubkey,
amount_in: u64,
minimum_amount_out: u64,
accounts: &[AccountInfo<'_>],
) -> ProgramResult
pub fn process_swap( program_id: &Pubkey, amount_in: u64, minimum_amount_out: u64, accounts: &[AccountInfo<'_>], ) -> ProgramResult
Processes an Swap.
Sourcepub fn process_deposit_all_token_types(
program_id: &Pubkey,
pool_token_amount: u64,
maximum_token_a_amount: u64,
maximum_token_b_amount: u64,
accounts: &[AccountInfo<'_>],
) -> ProgramResult
pub fn process_deposit_all_token_types( program_id: &Pubkey, pool_token_amount: u64, maximum_token_a_amount: u64, maximum_token_b_amount: u64, accounts: &[AccountInfo<'_>], ) -> ProgramResult
Processes an DepositAllTokenTypes.
Sourcepub fn process_withdraw_all_token_types(
program_id: &Pubkey,
pool_token_amount: u64,
minimum_token_a_amount: u64,
minimum_token_b_amount: u64,
accounts: &[AccountInfo<'_>],
) -> ProgramResult
pub fn process_withdraw_all_token_types( program_id: &Pubkey, pool_token_amount: u64, minimum_token_a_amount: u64, minimum_token_b_amount: u64, accounts: &[AccountInfo<'_>], ) -> ProgramResult
Processes an WithdrawAllTokenTypes.
Sourcepub fn process_deposit_single_token_type_exact_amount_in(
program_id: &Pubkey,
source_token_amount: u64,
minimum_pool_token_amount: u64,
accounts: &[AccountInfo<'_>],
) -> ProgramResult
pub fn process_deposit_single_token_type_exact_amount_in( program_id: &Pubkey, source_token_amount: u64, minimum_pool_token_amount: u64, accounts: &[AccountInfo<'_>], ) -> ProgramResult
Processes DepositSingleTokenTypeExactAmountIn
Sourcepub fn process_withdraw_single_token_type_exact_amount_out(
program_id: &Pubkey,
destination_token_amount: u64,
maximum_pool_token_amount: u64,
accounts: &[AccountInfo<'_>],
) -> ProgramResult
pub fn process_withdraw_single_token_type_exact_amount_out( program_id: &Pubkey, destination_token_amount: u64, maximum_pool_token_amount: u64, accounts: &[AccountInfo<'_>], ) -> ProgramResult
Processes a WithdrawSingleTokenTypeExactAmountOut.
Sourcepub fn process(
program_id: &Pubkey,
accounts: &[AccountInfo<'_>],
input: &[u8],
) -> ProgramResult
pub fn process( program_id: &Pubkey, accounts: &[AccountInfo<'_>], input: &[u8], ) -> ProgramResult
Processes an Instruction.
Sourcepub fn process_with_constraints(
program_id: &Pubkey,
accounts: &[AccountInfo<'_>],
input: &[u8],
swap_constraints: &Option<SwapConstraints<'_>>,
) -> ProgramResult
pub fn process_with_constraints( program_id: &Pubkey, accounts: &[AccountInfo<'_>], input: &[u8], swap_constraints: &Option<SwapConstraints<'_>>, ) -> ProgramResult
Processes an instruction given extra constraint
Auto Trait Implementations§
impl Freeze for Processor
impl RefUnwindSafe for Processor
impl Send for Processor
impl Sync for Processor
impl Unpin for Processor
impl UnwindSafe for Processor
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> 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