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

Calculating amount to be sent to the pool given the amount to be received from the pool and both reserves with fee applied.