Struct stable_swap::pool_converter::PoolTokenConverter
source · [−]pub struct PoolTokenConverter<'a> {
pub supply: u64,
pub token_a: u64,
pub token_b: u64,
pub fees: &'a Fees,
}
Expand description
Converter to determine how much to deposit / withdraw, along with proper initialization
Fields
supply: u64
Total supply
token_a: u64
Token A amount
token_b: u64
Token B amount
fees: &'a Fees
Fees
Implementations
sourceimpl<'_> PoolTokenConverter<'_>
impl<'_> PoolTokenConverter<'_>
sourcepub fn token_a_rate(&self, pool_tokens: u64) -> Option<(u64, u64, u64)>
pub fn token_a_rate(&self, pool_tokens: u64) -> Option<(u64, u64, u64)>
Computes the amount of token A backing the given amount of pool tokens.
sourcepub fn token_b_rate(&self, pool_tokens: u64) -> Option<(u64, u64, u64)>
pub fn token_b_rate(&self, pool_tokens: u64) -> Option<(u64, u64, u64)>
Computes the amount of token B backing the given amount of pool tokens.
sourcepub fn lp_tokens_for_a_excluding_fees(&self, token_a_amount: u64) -> Option<u64>
pub fn lp_tokens_for_a_excluding_fees(&self, token_a_amount: u64) -> Option<u64>
Calculates the number of LP tokens that correspond to an amount of token A. This does not take withdraw fees into account.
sourcepub fn lp_tokens_for_b_excluding_fees(&self, token_b_amount: u64) -> Option<u64>
pub fn lp_tokens_for_b_excluding_fees(&self, token_b_amount: u64) -> Option<u64>
Calculates the number of LP tokens that correspond to an amount of token B. This does not take withdraw fees into account.
Auto Trait Implementations
impl<'a> RefUnwindSafe for PoolTokenConverter<'a>
impl<'a> Send for PoolTokenConverter<'a>
impl<'a> Sync for PoolTokenConverter<'a>
impl<'a> Unpin for PoolTokenConverter<'a>
impl<'a> UnwindSafe for PoolTokenConverter<'a>
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more