fn internal_pool_swap(
        &mut self,
        pool_id: u64,
        token_in: &AccountId,
        amount_in: u128,
        token_out: &AccountId,
        min_amount_out: u128,
        referral_id: &Option<AccountId>,
    ) -> u128 {
        let mut pool = self.pools.get(pool_id).expect("ERR_NO_POOL");
        let amount_out = pool.swap(
            token_in,
            amount_in,
            token_out,
            min_amount_out,
            AdminFees {
                exchange_fee: self.exchange_fee,
                exchange_id: env::current_account_id(),
                referral_fee: self.referral_fee,
                referral_id: referral_id.clone(),
            },
        );
        self.pools.replace(pool_id, &pool);
        amount_out
    }
/// Swaps given amount_in of token_in into token_out via given pool.
/// Should be at least min_amount_out or swap will fail (prevents front running and other slippage issues).
Swaps given amount_in of token_in into token_out via given pool.
Should be at least min_amount_out or swap will fail (prevents front running and other slippage issues).
Swaps given amount_in of token_in into token_out via given pool . Should be at least min_amount_out or swap will fail ( prevents front running and other slippage issues ) .
fn internal_pool_swap(
        &mut self,
        pool_id: u64,
        token_in: &AccountId,
        amount_in: u128,
        token_out: &AccountId,
        min_amount_out: u128,
        referral_id: &Option<AccountId>,
    ) -> u128 {
        let mut pool = self.pools.get(pool_id).expect("ERR_NO_POOL");
        let amount_out = pool.swap(
            token_in,
            amount_in,
            token_out,
            min_amount_out,
            AdminFees {
                exchange_fee: self.exchange_fee,
                exchange_id: env::current_account_id(),
                referral_fee: self.referral_fee,
                referral_id: referral_id.clone(),
            },
        );
        self.pools.replace(pool_id, &pool);
        amount_out
    }
fn internal_pool_swap ( & mut self , pool_id : u64 , token_in : & AccountId , amount_in : u128 , token_out : & AccountId , min_amount_out : u128 , referral_id : & Option < AccountId > , ) -> u128 { let mut pool = self . pools . get ( pool_id ) . expect ( " " ) ; let amount_out = pool . swap ( token_in , amount_in , token_out , min_amount_out , AdminFees { exchange_fee : self . exchange_fee , exchange_id : env :: current_account_id ( ) , referral_fee : self . referral_fee , referral_id : referral_id . clone ( ) , } , ) ; self . pools . replace ( pool_id , & pool ) ; amount_out }
Swaps given amount_in of token_in into token_out via given pool.
Swaps given amount_in of token_in into token_out via given pool .
&mut self
pool_id
u64
token_in
&AccountId
amount_in
u128
token_out
&AccountId
min_amount_out
u128
referral_id
&Option<AccountId>
&mut self
pool_id
u64
token_in
&AccountId
amount_in
u128
token_out
&AccountId
min_amount_out
u128
referral_id
&Option<AccountId>