-
Notifications
You must be signed in to change notification settings - Fork 751
feat(transfer): add ShouldBeForwarded convenience method to msg transfer #6595
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
Changes from all commits
1ac722b
8ab0989
1c02410
09995a5
188c2cb
bdd52a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,7 +107,7 @@ func (msg MsgTransfer) ValidateBasic() error { | |
| } | ||
|
|
||
| // We cannot have non-empty memo and non-empty forwarding hops at the same time. | ||
| if len(msg.Forwarding.Hops) > 0 && msg.Memo != "" { | ||
| if msg.ShouldBeForwarded() && msg.Memo != "" { | ||
| return errorsmod.Wrapf(ErrInvalidMemo, "memo must be empty if forwarding path hops is not empty: %s, %s", msg.Memo, msg.Forwarding.Hops) | ||
| } | ||
|
|
||
|
|
@@ -131,6 +131,11 @@ func (msg MsgTransfer) GetCoins() sdk.Coins { | |
| return coins | ||
| } | ||
|
|
||
| // ShouldBeForwarded determines if the transfer should be forwarded to the next hop. | ||
| func (msg MsgTransfer) ShouldBeForwarded() bool { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wdyt about Usually would prefer this kind of naming convention with
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That could make sense as well. I can change this if that is our usual convention
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. considering the restructuring we will do might be best to leave on hold for time being until it becomes clear what these conditions will end up being (for e.g
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or smash it in now and refactor, same to me 😅
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. I'll merge this now to get it out of the way, but we can revisit this later when we know more about the unwind and all the other discussion related to this. |
||
| return len(msg.Forwarding.Hops) > 0 | ||
| } | ||
|
|
||
| // isValidIBCCoin returns true if the token provided is valid, | ||
| // and should be used to transfer tokens. | ||
| func isValidIBCCoin(coin sdk.Coin) bool { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.