Skip to content

Commit

Permalink
Merge pull request #4756 from zhangyelong/yelong/4443-coinswap
Browse files Browse the repository at this point in the history
Fix GetInputAmount formula
  • Loading branch information
colin-axner authored Aug 8, 2019
2 parents e640d5a + 6398e9b commit cf88b4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion x/coinswap/internal/keeper/swap.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (k Keeper) GetInputAmount(ctx sdk.Context, outputAmt sdk.Int, inputDenom, o
outputBalance := reservePool.AmountOf(outputDenom)
fee := k.GetFeeParam(ctx)

numerator := inputBalance.Mul(outputBalance).Mul(fee.Denominator)
numerator := inputBalance.Mul(outputAmt).Mul(fee.Denominator)
denominator := (outputBalance.Sub(outputAmt)).Mul(fee.Numerator)
return numerator.Quo(denominator).Add(sdk.OneInt())
}
Expand Down

0 comments on commit cf88b4f

Please sign in to comment.