Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recipient checker logics to bank send #526

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

codchen
Copy link
Collaborator

@codchen codchen commented Jul 18, 2024

Describe your changes and provide context

Allow checkers to be registered with bank send keeper so that certain recipients can be blocked. For example, to block a temp address (created by EVM module before address association) from receiving after its main address is associated, one would register a checker as follows:

app.BankKeeper.RegisterRecipientChecker(func(ctx sdk.Context, recipient sdk.AccAddress) bool {
    castEvmAddress := common.BytesToAddress(recipient)
    _, isAssociated := app.EvmKeeper.GetSeiAddress(ctx, castEvmAddress)
    return !isAssociated
})

Testing performed to validate your change

unit test

Copy link

codecov bot commented Jul 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.29%. Comparing base (1fa43a5) to head (97c3771).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #526      +/-   ##
==========================================
+ Coverage   55.27%   55.29%   +0.01%     
==========================================
  Files         631      631              
  Lines       54284    54299      +15     
==========================================
+ Hits        30005    30023      +18     
+ Misses      22135    22133       -2     
+ Partials     2144     2143       -1     
Files Coverage Δ
types/errors/errors.go 85.04% <ø> (ø)
x/bank/keeper/send.go 84.83% <100.00%> (+3.15%) ⬆️

... and 1 file with indirect coverage changes

@codchen codchen force-pushed the disallow-sending-to-certain-addresses branch from 97c3771 to 6d246bc Compare July 22, 2024 03:32
@codchen codchen merged commit 8653b19 into main Jul 22, 2024
13 checks passed
@codchen codchen deleted the disallow-sending-to-certain-addresses branch July 22, 2024 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant