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 support for permanent locked vesting accounts #8520

Merged
merged 19 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@
- [DelayedVestingAccount](#cosmos.vesting.v1beta1.DelayedVestingAccount)
- [Period](#cosmos.vesting.v1beta1.Period)
- [PeriodicVestingAccount](#cosmos.vesting.v1beta1.PeriodicVestingAccount)
- [PermanentLockedAccount](#cosmos.vesting.v1beta1.PermanentLockedAccount)

- [Scalar Value Types](#scalar-value-types)

Expand Down Expand Up @@ -8192,6 +8193,23 @@ periodically vests by unlocking coins during each specified period.




<a name="cosmos.vesting.v1beta1.PermanentLockedAccount"></a>

### PermanentLockedAccount
PermanentLockedAccount implements the VestingAccount interface. It does
not ever release coins, locking them indefinitely. Coins in this account can
still be used for delegating and for governance votes even while locked.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `base_vesting_account` | [BaseVestingAccount](#cosmos.vesting.v1beta1.BaseVestingAccount) | | |





<!-- end messages -->

<!-- end enums -->
Expand Down
10 changes: 10 additions & 0 deletions proto/cosmos/vesting/v1beta1/vesting.proto
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,13 @@ message PeriodicVestingAccount {
int64 start_time = 2 [(gogoproto.moretags) = "yaml:\"start_time\""];
repeated Period vesting_periods = 3 [(gogoproto.moretags) = "yaml:\"vesting_periods\"", (gogoproto.nullable) = false];
}

// PermanentLockedAccount implements the VestingAccount interface. It does
// not ever release coins, locking them indefinitely. Coins in this account can
// still be used for delegating and for governance votes even while locked.
message PermanentLockedAccount {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true];
Copy link
Collaborator

Choose a reason for hiding this comment

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

we don't need to repeat type name in the attribute name. How about base_account?

Copy link
Contributor

Choose a reason for hiding this comment

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

I changed PermanentLockedVestingAccount to PermanentLockedAccount, but I disagree with this one: BaseVestingAccount has a field BaseAccount. I dont want to do permanentAccount.BaseAccount.BaseAccount.*

}
3 changes: 2 additions & 1 deletion x/auth/vesting/exported/exported.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (
type VestingAccount interface {
types.AccountI

// LockedCoins returns the set of coins that are not spendable (i.e. locked).
// LockedCoins returns the set of coins that are not spendable (i.e. locked),
// defined as the vesting coins that are not delegated.
//
// To get spendable coins of a vesting account, first the total balance must
// be retrieved and the locked tokens can be subtracted from the total balance.
Expand Down
4 changes: 4 additions & 0 deletions x/auth/vesting/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&ContinuousVestingAccount{}, "cosmos-sdk/ContinuousVestingAccount", nil)
cdc.RegisterConcrete(&DelayedVestingAccount{}, "cosmos-sdk/DelayedVestingAccount", nil)
cdc.RegisterConcrete(&PeriodicVestingAccount{}, "cosmos-sdk/PeriodicVestingAccount", nil)
cdc.RegisterConcrete(&PermanentLockedAccount{}, "cosmos-sdk/PermanentLockedAccount", nil)
}

// RegisterInterface associates protoName with AccountI and VestingAccount
Expand All @@ -28,6 +29,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&ContinuousVestingAccount{},
&DelayedVestingAccount{},
&PeriodicVestingAccount{},
&PermanentLockedAccount{},
)

registry.RegisterImplementations(
Expand All @@ -36,6 +38,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&DelayedVestingAccount{},
&ContinuousVestingAccount{},
&PeriodicVestingAccount{},
&PermanentLockedAccount{},
)

registry.RegisterImplementations(
Expand All @@ -44,6 +47,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&DelayedVestingAccount{},
&ContinuousVestingAccount{},
&PeriodicVestingAccount{},
&PermanentLockedAccount{},
)

registry.RegisterImplementations(
Expand Down
3 changes: 1 addition & 2 deletions x/auth/vesting/types/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ import (
)

var (
app = simapp.Setup(false)
appCodec = simapp.MakeTestEncodingConfig().Marshaler
Copy link
Contributor

Choose a reason for hiding this comment

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

unused var

app = simapp.Setup(false)
)
251 changes: 213 additions & 38 deletions x/auth/vesting/types/vesting.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading