Function hydra_dx_math::lbp::calculate_in_given_out
source · pub fn calculate_in_given_out(
in_reserve: Balance,
out_reserve: Balance,
in_weight: LBPWeight,
out_weight: LBPWeight,
amount: Balance
) -> Result<Balance, MathError>
Expand description
Calculating buying price given reserve of selling asset and reserve of buying asset. Formula :
in_reserve
- reserve amount of selling assetout_reserve
- reserve amount of buying assetin_weight
- pool weight of selling assetout_weight
- pool weight of buying assetamount
- buy amount
Returns None in case of error