pub struct MockPool { /* private fields */ }Implementations§
Source§impl MockPool
impl MockPool
pub fn new( address: Address, token0: Address, token1: Address, reserve0: U256, reserve1: U256, fee: f64, pool_type: PoolType, ) -> Self
Sourcepub fn new_boxed() -> Box<dyn PoolInterface + Send + Sync>
pub fn new_boxed() -> Box<dyn PoolInterface + Send + Sync>
Create a default boxed MockPool for testing
pub fn new_v2( address: Address, token0: Address, token1: Address, reserve0: U256, reserve1: U256, ) -> Self
pub fn new_v3( address: Address, token0: Address, token1: Address, reserve0: U256, reserve1: U256, fee: f64, ) -> Self
pub fn set_reserves(&mut self, reserve0: U256, reserve1: U256)
Trait Implementations§
Source§impl EventApplicable for MockPool
impl EventApplicable for MockPool
Source§impl PoolInterface for MockPool
impl PoolInterface for MockPool
Source§fn calculate_output(&self, token_in: &Address, amount_in: U256) -> Result<U256>
fn calculate_output(&self, token_in: &Address, amount_in: U256) -> Result<U256>
Calculate output amount for a swap given an input amount and token
Source§fn calculate_input(&self, token_out: &Address, amount_out: U256) -> Result<U256>
fn calculate_input(&self, token_out: &Address, amount_out: U256) -> Result<U256>
Calculate input amount for a swap given an output amount and token
Source§fn apply_swap(
&mut self,
token_in: &Address,
amount_in: U256,
amount_out: U256,
) -> Result<()>
fn apply_swap( &mut self, token_in: &Address, amount_in: U256, amount_out: U256, ) -> Result<()>
Apply a swap to the pool state
Source§fn log_summary(&self) -> String
fn log_summary(&self) -> String
Log summary of the pool
fn fee_raw(&self) -> u64
Source§fn contains_token(&self, token: &Address) -> bool
fn contains_token(&self, token: &Address) -> bool
Check if the pool contains a token
fn as_any_mut(&mut self) -> &mut dyn Any
Source§impl TopicList for MockPool
impl TopicList for MockPool
fn topics() -> Vec<FixedBytes<32>>
fn profitable_topics() -> Vec<FixedBytes<32>>
Auto Trait Implementations§
impl Freeze for MockPool
impl RefUnwindSafe for MockPool
impl Send for MockPool
impl Sync for MockPool
impl Unpin for MockPool
impl UnsafeUnpin for MockPool
impl UnwindSafe for MockPool
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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