pub trait SwapMarketMutExt<const DECIMALS: u8>: SwapMarketMut<DECIMALS> {
// Provided methods
fn swap(
&mut self,
is_token_in_long: bool,
token_in_amount: Self::Num,
prices: Prices<Self::Num>,
) -> Result<Swap<&mut Self, DECIMALS>>
where Self: Sized { ... }
fn apply_swap_impact_value_with_cap(
&mut self,
is_long_token: bool,
price: &Price<Self::Num>,
usd_impact: &Self::Signed,
) -> Result<Self::Num> { ... }
}
Expand description
Extension trait for SwapMarketMut
.
Provided Methods§
Sourcefn swap(
&mut self,
is_token_in_long: bool,
token_in_amount: Self::Num,
prices: Prices<Self::Num>,
) -> Result<Swap<&mut Self, DECIMALS>>where
Self: Sized,
fn swap(
&mut self,
is_token_in_long: bool,
token_in_amount: Self::Num,
prices: Prices<Self::Num>,
) -> Result<Swap<&mut Self, DECIMALS>>where
Self: Sized,
Create a Swap
.
Sourcefn apply_swap_impact_value_with_cap(
&mut self,
is_long_token: bool,
price: &Price<Self::Num>,
usd_impact: &Self::Signed,
) -> Result<Self::Num>
fn apply_swap_impact_value_with_cap( &mut self, is_long_token: bool, price: &Price<Self::Num>, usd_impact: &Self::Signed, ) -> Result<Self::Num>
Apply a swap impact value to the price impact pool.
- If it is a positive impact amount, cap the impact amount to the amount available in the price impact pool, and the price impact pool will be decreased by this amount and return.
- If it is a negative impact amount, the price impact pool will be increased by this amount and return.