Skip to content

Commit

Permalink
fix syntax error and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tuantran1702 committed Mar 28, 2024
1 parent 48d8543 commit b4540b5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
31 changes: 17 additions & 14 deletions x/interchainstaking/keeper/ibc_packet_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/golang/protobuf/proto" // nolint:staticcheck

"cosmossdk.io/math"
sdkmath "cosmossdk.io/math"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/telemetry"
Expand Down Expand Up @@ -502,20 +503,22 @@ func (k *Keeper) HandleWithdrawForUser(ctx sdk.Context, zone *types.Zone, msg *b

// New method to process per-validator withdrawals
func (k Keeper) processPerValidatorWithdrawal(ctx sdk.Context, withdrawalRecord *types.WithdrawalRecord, msg *banktypes.MsgSend) error {
dlist := make(map[int]struct{})
for i, dist := range withdrawalRecord.Distribution {
if msg.Amount[0].Amount.Equal(dist.Amount) { // check valoper here too?
dlist[i] = struct{}{}
// matched amount
if len(withdrawalRecord.Distribution) == len(dlist) {
// we just removed the last element
k.Logger(ctx).Info("found matching withdrawal; marking as completed")
k.UpdateWithdrawalRecordStatus(ctx, &withdrawalRecord, types.WithdrawStatusCompleted)
if err := k.BankKeeper.BurnCoins(ctx, types.EscrowModuleAccount, sdk.NewCoins(withdrawalRecord.BurnAmount)); err != nil {
// if we can't burn the coins, fail.
return err
}
k.Logger(ctx).Info("burned coins post-withdrawal", "coins", withdrawalRecord.BurnAmount)
dlist := make(map[int]struct{})
for i, dist := range withdrawalRecord.Distribution {
if msg.Amount[0].Amount.Equal(dist.Amount) { // check valoper here too?
dlist[i] = struct{}{}
// matched amount
if len(withdrawalRecord.Distribution) == len(dlist) {
// we just removed the last element
k.Logger(ctx).Info("found matching withdrawal; marking as completed")
k.UpdateWithdrawalRecordStatus(ctx, withdrawalRecord, types.WithdrawStatusCompleted)
if err := k.BankKeeper.BurnCoins(ctx, types.EscrowModuleAccount, sdk.NewCoins(withdrawalRecord.BurnAmount)); err != nil {
// if we can't burn the coins, fail.
return err
}
k.Logger(ctx).Info("burned coins post-withdrawal", "coins", withdrawalRecord.BurnAmount)
}
}
}
if len(dlist) > 0 {
withdrawalRecord.Distribution = k.removeMatchedDistributions(withdrawalRecord.Distribution, dlist)
Expand Down
11 changes: 3 additions & 8 deletions x/participationrewards/keeper/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,11 @@ func (k *Keeper) CalcTokenValues(ctx sdk.Context) (TokenValues, error) {
baseIBCDenom = ibcDenom
} else {
zone, ok := k.icsKeeper.GetZone(ctx, pool.Denoms[ibcDenom].ChainID)
if !ok {
return false
}

if pool.Denoms[ibcDenom].Denom == zone.BaseDenom {
queryIBCDenom = ibcDenom
valueDenom = zone.BaseDenom
} else {
if !ok || pool.Denoms[ibcDenom].Denom != zone.BaseDenom {
return false
}
queryIBCDenom = ibcDenom
valueDenom = zone.BaseDenom
}
}

Expand Down
2 changes: 0 additions & 2 deletions x/participationrewards/keeper/submodule_osmosis.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,10 @@ func (m *OsmosisModule) Hooks(ctx sdk.Context, k *Keeper) {
})
}


func (*OsmosisModule) ValidateClaim(ctx sdk.Context, k *Keeper, msg *types.MsgSubmitClaim) (math.Int, error) {
amount := sdk.ZeroInt()
var lock osmolockup.PeriodLock
for _, proof := range msg.Proofs {
var lock osmolockup.PeriodLock
var err error

switch proof.ProofType {
Expand Down

0 comments on commit b4540b5

Please sign in to comment.