forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: clawback vesting accounts can return grants to the funder #342
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3eb71fa
feat: first cut at return-grants
JimLarson 4d6a78d
test: client test
JimLarson 0e8d78c
test: server test for return-grants
JimLarson a0b64ad
fix: simplify vesting exported interfaces
JimLarson ee5bbc0
fix: register return grants message
JimLarson 7b28a13
fix: review feedback
JimLarson ed2d6bf
docs: update agoric commit log
JimLarson 2026faa
fix: one last return value fix
JimLarson 8582326
test: final test tweak
JimLarson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -17,6 +17,9 @@ const ( | |||||
|
||||||
// TypeMsgClawback defines the type value for a MsgClawback. | ||||||
TypeMsgClawback = "msg_clawback" | ||||||
|
||||||
// TypeMsgClawback defines the type value for a MsgClawback. | ||||||
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.
Suggested change
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. Done. |
||||||
TypeMsgReturnGrants = "msg_return_grants" | ||||||
) | ||||||
|
||||||
var ( | ||||||
|
@@ -309,3 +312,45 @@ func (msg MsgClawback) ValidateBasic() error { | |||||
|
||||||
return nil | ||||||
} | ||||||
|
||||||
// NewMsgReturnGrants returns a reference to a new MsgReturnGrants. | ||||||
// | ||||||
//nolint:interfacer | ||||||
func NewMsgReturnGrants(addr sdk.AccAddress) *MsgReturnGrants { | ||||||
return &MsgReturnGrants{ | ||||||
Address: addr.String(), | ||||||
} | ||||||
} | ||||||
|
||||||
// Route returns the message route for a MsgReturnGrants. | ||||||
func (msg MsgReturnGrants) Route() string { return RouterKey } | ||||||
|
||||||
// Type returns the message type for a MsgReturnGrants. | ||||||
func (msg MsgReturnGrants) Type() string { return TypeMsgClawback } | ||||||
|
||||||
// GetSigners returns the expected signers for a MsgReturnGrants. | ||||||
func (msg MsgReturnGrants) GetSigners() []sdk.AccAddress { | ||||||
addr, err := sdk.AccAddressFromBech32(msg.Address) | ||||||
if err != nil { | ||||||
panic(err) | ||||||
} | ||||||
return []sdk.AccAddress{addr} | ||||||
} | ||||||
|
||||||
// GetSignBytes returns the bytes all expected signers must sign over for a | ||||||
// MsgReturnGrants. | ||||||
func (msg MsgReturnGrants) GetSignBytes() []byte { | ||||||
return sdk.MustSortJSON(amino.MustMarshalJSON(&msg)) | ||||||
} | ||||||
|
||||||
// ValidateBasic Implements Msg. | ||||||
func (msg MsgReturnGrants) ValidateBasic() error { | ||||||
addr, err := sdk.AccAddressFromBech32(msg.GetAddress()) | ||||||
if err != nil { | ||||||
return err | ||||||
} | ||||||
if err := sdk.VerifyAddressFormat(addr); err != nil { | ||||||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid account address: %s", err) | ||||||
} | ||||||
return nil | ||||||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update for current algorithm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a generated file, but I made the requested change upstream in
proto/cosmos/vesting/v1beta1/tx.proto
.