Function hydra_dx_math::xyk::calculate_liquidity_in
source · pub fn calculate_liquidity_in(
asset_a_reserve: u128,
asset_b_reserve: u128,
amount: u128
) -> Result<u128, MathError>
Expand description
Calculating required amount of asset b given asset a. Formula : AMOUNT * ASSET_B_RESERVE / ASSET_A_RESERVE
asset_a_reserve
- reserve amount of asset aasset_b_reserve
- reserve amount of asset bamount
- liquidity amount
Returns MathError in case of error