/// The conversion for the offset curve needs to take into account the
/// offset
The conversion for the offset curve needs to take into account the
offset
The conversion for the offset curve needs to take into account the offset
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_b_offset = self.token_b_offset as u128;
        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_add(token_b_offset)?)?
            .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_b_offset = self . token_b_offset as u128 ; 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_add ( token_b_offset ) ? ) ? . checked_div ( pool_token_supply ) ? ; Some ( TradingTokenResult { token_a_amount , token_b_amount , } ) }
The conversion for the offset curve needs to take into account the
offset
The conversion for the offset curve needs to take into account the offset
&self
pool_tokens
u128
pool_token_supply
u128
swap_token_a_amount
u128
swap_token_b_amount
u128