fn pool_tokens_to_trading_tokens(
        &self,
        pool_tokens: u128,
        pool_token_supply: u128,
        swap_token_a_amount: u128,
        swap_token_b_amount: u128,
    ) -> Option<TradingTokenResult> {
        let token_a_amount = pool_tokens
            .checked_mul(swap_token_a_amount)?
            .checked_div(pool_token_supply)?;
        let token_b_amount = pool_tokens
            .checked_mul(swap_token_b_amount)?
            .checked_div(pool_token_supply)?;
        Some(TradingTokenResult {
            token_a_amount,
            token_b_amount,
        })
    }
/// Get the amount of trading tokens for the given amount of pool tokens,
/// provided the total trading tokens and supply of pool tokens.
///
/// The default implementation is a simple ratio calculation for how many
/// trading tokens correspond to a certain number of pool tokens
Get the amount of trading tokens for the given amount of pool tokens,
provided the total trading tokens and supply of pool tokens.

The default implementation is a simple ratio calculation for how many
trading tokens correspond to a certain number of pool tokens
Get the amount of trading tokens for the given amount of pool tokens provided the total trading tokens and supply of pool tokens . The default implementation is a simple ratio calculation for how many trading tokens correspond to a certain number of pool tokens
fn pool_tokens_to_trading_tokens(
        &self,
        pool_tokens: u128,
        pool_token_supply: u128,
        swap_token_a_amount: u128,
        swap_token_b_amount: u128,
    ) -> Option<TradingTokenResult> {
        let token_a_amount = pool_tokens
            .checked_mul(swap_token_a_amount)?
            .checked_div(pool_token_supply)?;
        let token_b_amount = pool_tokens
            .checked_mul(swap_token_b_amount)?
            .checked_div(pool_token_supply)?;
        Some(TradingTokenResult {
            token_a_amount,
            token_b_amount,
        })
    }
fn pool_tokens_to_trading_tokens ( & self , pool_tokens : u128 , pool_token_supply : u128 , swap_token_a_amount : u128 , swap_token_b_amount : u128 , ) -> Option < TradingTokenResult > { let token_a_amount = pool_tokens . checked_mul ( swap_token_a_amount ) ? . checked_div ( pool_token_supply ) ? ; let token_b_amount = pool_tokens . checked_mul ( swap_token_b_amount ) ? . checked_div ( pool_token_supply ) ? ; Some ( TradingTokenResult { token_a_amount , token_b_amount , } ) }
Get the amount of trading tokens for the given amount of pool tokens,
provided the total trading tokens and supply of pool tokens.
Get the amount of trading tokens for the given amount of pool tokens provided the total trading tokens and supply of pool tokens .
&self
pool_tokens
u128
pool_token_supply
u128
swap_token_a_amount
u128
swap_token_b_amount
u128
&self
pool_tokens
u128
pool_token_supply
u128
swap_token_a_amount
u128
swap_token_b_amount
u128