}
oppositeAmount := uint64(assetFeeMap[contractArgs.RequestedAsset].FeeAmount)
- receiveAmount := vprMath.MinUint64(calcRequestAmount(input.Amount(), contractArgs), oppositeAmount)
+ receiveAmount := vprMath.MinUint64(CalcRequestAmount(input.Amount(), contractArgs), oppositeAmount)
assetFeeMap[input.AssetID()].MaxFeeAmount = calcMaxFeeAmount(calcShouldPayAmount(receiveAmount, contractArgs), maxFeeRate)
}
return err
}
- requestAmount := calcRequestAmount(order.Utxo.Amount, contractArgs)
+ requestAmount := CalcRequestAmount(order.Utxo.Amount, contractArgs)
receiveAmount := vprMath.MinUint64(requestAmount, oppositeAmount)
shouldPayAmount := calcShouldPayAmount(receiveAmount, contractArgs)
isPartialTrade := requestAmount > receiveAmount
return nil
}
-func calcRequestAmount(fromAmount uint64, contractArg *vmutil.MagneticContractArgs) uint64 {
+func CalcRequestAmount(fromAmount uint64, contractArg *vmutil.MagneticContractArgs) uint64 {
return uint64(int64(fromAmount) * contractArg.RatioNumerator / contractArg.RatioDenominator)
}