fn swap_without_fees(
        &self,
        source_amount: u128,
        swap_source_amount: u128,
        swap_destination_amount: u128,
        trade_direction: TradeDirection,
    ) -> Option<SwapWithoutFeesResult> {
        let token_b_offset = self.token_b_offset as u128;
        let swap_source_amount = match trade_direction {
            TradeDirection::AtoB => swap_source_amount,
            TradeDirection::BtoA => swap_source_amount.checked_add(token_b_offset)?,
        };
        let swap_destination_amount = match trade_direction {
            TradeDirection::AtoB => swap_destination_amount.checked_add(token_b_offset)?,
            TradeDirection::BtoA => swap_destination_amount,
        };
        swap(source_amount, swap_source_amount, swap_destination_amount)
    }
/// Constant product swap ensures token a * (token b + offset) = constant
Constant product swap ensures token a * (token b + offset) = constant
Constant product swap ensures token a * ( token b + offset ) = constant
fn swap_without_fees(
        &self,
        source_amount: u128,
        swap_source_amount: u128,
        swap_destination_amount: u128,
        trade_direction: TradeDirection,
    ) -> Option<SwapWithoutFeesResult> {
        let token_b_offset = self.token_b_offset as u128;
        let swap_source_amount = match trade_direction {
            TradeDirection::AtoB => swap_source_amount,
            TradeDirection::BtoA => swap_source_amount.checked_add(token_b_offset)?,
        };
        let swap_destination_amount = match trade_direction {
            TradeDirection::AtoB => swap_destination_amount.checked_add(token_b_offset)?,
            TradeDirection::BtoA => swap_destination_amount,
        };
        swap(source_amount, swap_source_amount, swap_destination_amount)
    }
fn swap_without_fees ( & self , source_amount : u128 , swap_source_amount : u128 , swap_destination_amount : u128 , trade_direction : TradeDirection , ) -> Option < SwapWithoutFeesResult > { let token_b_offset = self . token_b_offset as u128 ; let swap_source_amount = match trade_direction { TradeDirection :: AtoB => swap_source_amount , TradeDirection :: BtoA => swap_source_amount . checked_add ( token_b_offset ) ? , } ; let swap_destination_amount = match trade_direction { TradeDirection :: AtoB => swap_destination_amount . checked_add ( token_b_offset ) ? , TradeDirection :: BtoA => swap_destination_amount , } ; swap ( source_amount , swap_source_amount , swap_destination_amount ) }
Constant product swap ensures token a * (token b + offset) = constant
Constant product swap ensures token a * ( token b + offset ) = constant
&self
source_amount
u128
swap_source_amount
u128
swap_destination_amount
u128
trade_direction
TradeDirection
&self
source_amount
u128
swap_source_amount
u128
swap_destination_amount
u128
trade_direction
TradeDirection