Skip to content

Commit

Permalink
Fix GetInputAmount formula
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyelong committed Jul 22, 2019
1 parent e640d5a commit 6398e9b
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 6398e9b

Please sign in to comment.