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

Check coin sendable status #446

Merged
merged 2 commits into from
Mar 10, 2021
Merged

Check coin sendable status #446

merged 2 commits into from
Mar 10, 2021

Conversation

alpe
Copy link
Contributor

@alpe alpe commented Mar 10, 2021

Fixes #414

This also includes some minor refactoring towards interfaces in Keeper and an extension point to customize the SendCoins precondition checks

@alpe alpe requested a review from ethanfrey March 10, 2021 12:02
@codecov
Copy link

codecov bot commented Mar 10, 2021

Codecov Report

Merging #446 (5c52ab7) into master (78d5581) will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #446      +/-   ##
==========================================
+ Coverage   55.51%   55.63%   +0.11%     
==========================================
  Files          39       39              
  Lines        4305     4312       +7     
==========================================
+ Hits         2390     2399       +9     
+ Misses       1713     1712       -1     
+ Partials      202      201       -1     
Impacted Files Coverage Δ
x/wasm/internal/keeper/query_plugins.go 59.74% <ø> (ø)
x/wasm/internal/keeper/keeper.go 86.35% <100.00%> (+0.52%) ⬆️
x/wasm/internal/keeper/options.go 100.00% <100.00%> (ø)

Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good


// TransferCoins transfers coins from source to destination account when coin send was enabled for them and the recipient
// is not in the blocked address list.
func (c CoinTransferrer) TransferCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds the logic well.

I was wondering about the abstraction here and why we don't just use the msg service. But maybe that requires a much larger refactor? Also the reasoning for your interfaces usually becomes clear to me a few weeks later, so I trust you on this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks but this might be over engineered. Keep challenging me. :-)
Main motivation was to not get into the type conversions for address and context (yet).

@alpe alpe merged commit 10a1fef into master Mar 10, 2021
@alpe alpe deleted the send_coins_enabled_414 branch March 10, 2021 14:17
@iramiller
Copy link
Contributor

Very nice to see this resolved. 🥳

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.

Keeper Send Coins does not perform expected validation
3 participants