pub fn calculate_out_given_in_with_fee<const N: u8, const N_Y: u8>(
    balances: &[Balance],
    idx_in: usize,
    idx_out: usize,
    amount_in: Balance,
    amplification: Balance,
    fee: Permill
) -> Option<(Balance, Balance)>
Expand description

Calculating amount to be received from the pool given the amount to be sent to the pool and both reserves and apply a fee.