fn calc_add_liquidity(
        &self, 
        amounts: &Vec<Balance>, 
        fees: &AdminFees,
    ) -> (Balance, Balance) {
        let invariant = self.get_invariant();

        // make amounts into comparable-amounts
        let c_amounts = self.amounts_to_c_amounts(amounts);

        if self.shares_total_supply == 0 {
            // Bootstrapping the pool, request providing all non-zero balances,
            // and all fee free.
            for c_amount in &c_amounts {
                assert!(*c_amount > 0, "{}", ERR65_INIT_TOKEN_BALANCE);
            }
            (
                invariant
                    .compute_d(&c_amounts)
                    .expect(ERR66_INVARIANT_CALC_ERR)
                    .as_u128(),
                0,
            )
        } else {
            // Subsequent add liquidity will charge fee according to difference with ideal balance portions
            invariant
                .compute_lp_amount_for_deposit(
                    &c_amounts,
                    &self.c_amounts,
                    self.shares_total_supply,
                    &Fees::new(self.total_fee, &fees),
                )
                .expect(ERR67_LPSHARE_CALC_ERR)
        }
    }
/// caculate mint share and related fee for adding liquidity
/// return (share, fee_part)
caculate mint share and related fee for adding liquidity
return (share, fee_part)
caculate mint share and related fee for adding liquidity return ( share fee_part )
fn calc_add_liquidity(
        &self, 
        amounts: &Vec<Balance>, 
        fees: &AdminFees,
    ) -> (Balance, Balance) {
        let invariant = self.get_invariant();
        // make amounts into comparable-amounts
        let c_amounts = self.amounts_to_c_amounts(amounts);
        if self.shares_total_supply == 0 {
            // Bootstrapping the pool, request providing all non-zero balances,
            // and all fee free.
            for c_amount in &c_amounts {
                assert!(*c_amount > 0, "{}", ERR65_INIT_TOKEN_BALANCE);
            }
            (
                invariant
                    .compute_d(&c_amounts)
                    .expect(ERR66_INVARIANT_CALC_ERR)
                    .as_u128(),
                0,
            )
        } else {
            // Subsequent add liquidity will charge fee according to difference with ideal balance portions
            invariant
                .compute_lp_amount_for_deposit(
                    &c_amounts,
                    &self.c_amounts,
                    self.shares_total_supply,
                    &Fees::new(self.total_fee, &fees),
                )
                .expect(ERR67_LPSHARE_CALC_ERR)
        }
    }
fn calc_add_liquidity ( & self , amounts : & Vec < Balance > , fees : & AdminFees , ) -> ( Balance , Balance ) { let invariant = self . get_invariant ( ) ; // make amounts into comparable-amounts let c_amounts = self . amounts_to_c_amounts ( amounts ) ; if self . shares_total_supply == 0 { // Bootstrapping the pool, request providing all non-zero balances, // and all fee free. for c_amount in & c_amounts { assert ! ( c_amount 0 " " ERR65_INIT_TOKEN_BALANCE ) ; } ( invariant . compute_d ( & c_amounts ) . expect ( ERR66_INVARIANT_CALC_ERR ) . as_u128 ( ) , 0 , ) } else { // Subsequent add liquidity will charge fee according to difference with ideal balance portions invariant . compute_lp_amount_for_deposit ( & c_amounts , & self . c_amounts , self . shares_total_supply , & Fees :: new ( self . total_fee , & fees ) , ) . expect ( ERR67_LPSHARE_CALC_ERR ) } }
caculate mint share and related fee for adding liquidity
return (share, fee_part)
caculate mint share and related fee for adding liquidity return ( share fee_part )
&self
amounts
&Vec<Balance>
fees
&AdminFees
&self
amounts
&Vec<Balance>
fees
&AdminFees