Skip to content

Commit

Permalink
disallow to device by zero in ibc tx flow
Browse files Browse the repository at this point in the history
  • Loading branch information
RustNinja committed Apr 24, 2024
1 parent f7d9311 commit 36d003c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom/ibc-transfer/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ

newAmount := msg.Token.Amount.Sub(charge)

if newAmount.IsPositive() {
if newAmount.IsPositive() && coin.Percentage != 0 {
percentageCharge := newAmount.QuoRaw(coin.Percentage)
newAmount = newAmount.Sub(percentageCharge)
charge = charge.Add(percentageCharge)
Expand Down

0 comments on commit 36d003c

Please sign in to comment.