Skip to content

Commit

Permalink
Problem: blocked addresses are not handled (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-nguy committed Jan 23, 2023
1 parent ce0216d commit ca80160
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions module/x/gravity/keeper/ethereum_event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ func (k Keeper) Handle(ctx sdk.Context, eve types.EthereumEvent) (err error) {
return err
}
} else {
if k.bankKeeper.BlockedAddr(addr) {
// keep the minted coin in module account and return there
k.Logger(ctx).Info(
"SendToCosmos to a blocked address: ", addr.String(),
"event type", fmt.Sprintf("%T", event),
"id", types.MakeEthereumEventVoteRecordKey(event.GetEventNonce(), event.Hash()),
"nonce", fmt.Sprint(event.GetEventNonce()),
)
return nil
}
if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, coins); err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions module/x/gravity/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type BankKeeper interface {
GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetDenomMetaData(ctx sdk.Context, denom string) (bank.Metadata, bool)
SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
BlockedAddr(addr sdk.AccAddress) bool
}

type SlashingKeeper interface {
Expand Down

0 comments on commit ca80160

Please sign in to comment.