loom_types_entities

Trait Pool

Source
pub trait Pool: Sync + Send {
Show 13 methods // Required methods fn get_address(&self) -> Address; fn calculate_out_amount( &self, state: &dyn DatabaseRef<Error = ErrReport>, env: Env, token_address_from: &Address, token_address_to: &Address, in_amount: U256, ) -> Result<(U256, u64), ErrReport>; fn calculate_in_amount( &self, state: &dyn DatabaseRef<Error = ErrReport>, env: Env, token_address_from: &Address, token_address_to: &Address, out_amount: U256, ) -> Result<(U256, u64), ErrReport>; fn can_flash_swap(&self) -> bool; fn get_encoder(&self) -> &dyn AbiSwapEncoder; fn get_state_required(&self) -> Result<RequiredState>; // Provided methods fn get_class(&self) -> PoolClass { ... } fn get_protocol(&self) -> PoolProtocol { ... } fn get_fee(&self) -> U256 { ... } fn get_tokens(&self) -> Vec<Address> { ... } fn get_swap_directions(&self) -> Vec<(Address, Address)> { ... } fn can_calculate_in_amount(&self) -> bool { ... } fn get_read_only_cell_vec(&self) -> Vec<U256> { ... }
}

Required Methods§

Source

fn get_address(&self) -> Address

Source

fn calculate_out_amount( &self, state: &dyn DatabaseRef<Error = ErrReport>, env: Env, token_address_from: &Address, token_address_to: &Address, in_amount: U256, ) -> Result<(U256, u64), ErrReport>

Source

fn calculate_in_amount( &self, state: &dyn DatabaseRef<Error = ErrReport>, env: Env, token_address_from: &Address, token_address_to: &Address, out_amount: U256, ) -> Result<(U256, u64), ErrReport>

Source

fn can_flash_swap(&self) -> bool

Source

fn get_encoder(&self) -> &dyn AbiSwapEncoder

Source

fn get_state_required(&self) -> Result<RequiredState>

Provided Methods§

Source

fn get_class(&self) -> PoolClass

Source

fn get_protocol(&self) -> PoolProtocol

Source

fn get_fee(&self) -> U256

Source

fn get_tokens(&self) -> Vec<Address>

Source

fn get_swap_directions(&self) -> Vec<(Address, Address)>

Source

fn can_calculate_in_amount(&self) -> bool

Source

fn get_read_only_cell_vec(&self) -> Vec<U256>

Implementors§

Source§

impl Pool for MockPool

Source§

impl<P, T> Pool for MockPoolGeneric<P, T>
where T: Transport + Clone, P: Provider<T, Ethereum> + Send + Sync + Clone + 'static,