Trait jupiter_amm_interface::Amm

source ·
pub trait Amm {
Show 19 methods // Required methods fn from_keyed_account( keyed_account: &KeyedAccount, amm_context: &AmmContext ) -> Result<Self> where Self: Sized; fn label(&self) -> String; fn program_id(&self) -> Pubkey; fn key(&self) -> Pubkey; fn get_reserve_mints(&self) -> Vec<Pubkey>; fn get_accounts_to_update(&self) -> Vec<Pubkey>; fn update(&mut self, account_map: &AccountMap) -> Result<()>; fn quote(&self, quote_params: &QuoteParams) -> Result<Quote>; fn get_swap_and_account_metas( &self, swap_params: &SwapParams<'_, '_> ) -> Result<SwapAndAccountMetas>; fn clone_amm(&self) -> Box<dyn Amm + Send + Sync>; // Provided methods fn has_dynamic_accounts(&self) -> bool { ... } fn requires_update_for_reserve_mints(&self) -> bool { ... } fn supports_exact_out(&self) -> bool { ... } fn get_user_setup(&self) -> Option<AmmUserSetup> { ... } fn unidirectional(&self) -> bool { ... } fn program_dependencies(&self) -> Vec<(Pubkey, String)> { ... } fn get_accounts_len(&self) -> usize { ... } fn underlying_liquidities(&self) -> Option<HashSet<Pubkey>> { ... } fn is_active(&self) -> bool { ... }
}

Required Methods§

source

fn from_keyed_account( keyed_account: &KeyedAccount, amm_context: &AmmContext ) -> Result<Self>
where Self: Sized,

source

fn label(&self) -> String

A human readable label of the underlying DEX

source

fn program_id(&self) -> Pubkey

source

fn key(&self) -> Pubkey

The pool state or market state address

source

fn get_reserve_mints(&self) -> Vec<Pubkey>

The mints that can be traded

source

fn get_accounts_to_update(&self) -> Vec<Pubkey>

The accounts necessary to produce a quote

source

fn update(&mut self, account_map: &AccountMap) -> Result<()>

Picks necessary accounts to update it’s internal state Heavy deserialization and precomputation caching should be done in this function

source

fn quote(&self, quote_params: &QuoteParams) -> Result<Quote>

source

fn get_swap_and_account_metas( &self, swap_params: &SwapParams<'_, '_> ) -> Result<SwapAndAccountMetas>

Indicates which Swap has to be performed along with all the necessary account metas

source

fn clone_amm(&self) -> Box<dyn Amm + Send + Sync>

Provided Methods§

source

fn has_dynamic_accounts(&self) -> bool

Indicates if get_accounts_to_update might return a non constant vec

source

fn requires_update_for_reserve_mints(&self) -> bool

Indicates whether update needs to be called before get_reserve_mints

source

fn supports_exact_out(&self) -> bool

source

fn get_user_setup(&self) -> Option<AmmUserSetup>

source

fn unidirectional(&self) -> bool

It can only trade in one direction from its first mint to second mint, assuming it is a two mint AMM

source

fn program_dependencies(&self) -> Vec<(Pubkey, String)>

For testing purposes, provide a mapping of dependency programs to function

source

fn get_accounts_len(&self) -> usize

source

fn underlying_liquidities(&self) -> Option<HashSet<Pubkey>>

The identifier of the underlying liquidity

Example: For RaydiumAmm uses Openbook market A this will return Some(A) For Openbook market A, it will also return Some(A)

source

fn is_active(&self) -> bool

Provides a shortcut to establish if the AMM can be used for trading If the market is active at all

Trait Implementations§

source§

impl Clone for Box<dyn Amm + Send + Sync>

source§

fn clone(&self) -> Box<dyn Amm + Send + Sync>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§