Skip to content

Commit

Permalink
chore: gov audit (secondary reviewer) (#16870)
Browse files Browse the repository at this point in the history
  • Loading branch information
atheeshp committed Jul 7, 2023
1 parent 317fb0b commit a897642
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions x/gov/keeper/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,18 @@ func (keeper Keeper) ChargeDeposit(ctx context.Context, proposalID uint64, destA

var remainingAmount sdk.Coins

for _, coins := range deposit.Amount {
burnAmount := sdkmath.LegacyNewDecFromInt(coins.Amount).Mul(rate).TruncateInt()
for _, coin := range deposit.Amount {
burnAmount := sdkmath.LegacyNewDecFromInt(coin.Amount).Mul(rate).TruncateInt()
// remaining amount = deposits amount - burn amount
remainingAmount = remainingAmount.Add(
sdk.NewCoin(
coins.Denom,
coins.Amount.Sub(burnAmount),
coin.Denom,
coin.Amount.Sub(burnAmount),
),
)
cancellationCharges = cancellationCharges.Add(
sdk.NewCoin(
coins.Denom,
coin.Denom,
burnAmount,
),
)
Expand All @@ -190,7 +190,7 @@ func (keeper Keeper) ChargeDeposit(ctx context.Context, proposalID uint64, destA
// get the distribution module account address
distributionAddress := keeper.authKeeper.GetModuleAddress(disttypes.ModuleName)
switch {
case len(destAddress) == 0:
case destAddress == "":
// burn the cancellation charges from deposits
err := keeper.bankKeeper.BurnCoins(ctx, types.ModuleName, cancellationCharges)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion x/gov/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos
}, nil
}

// CancelProposals implements the MsgServer.CancelProposal method.
// CancelProposal implements the MsgServer.CancelProposal method.
func (k msgServer) CancelProposal(goCtx context.Context, msg *v1.MsgCancelProposal) (*v1.MsgCancelProposalResponse, error) {
_, err := k.authKeeper.AddressCodec().StringToBytes(msg.Proposer)
if err != nil {
Expand Down

0 comments on commit a897642

Please sign in to comment.