diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 93247f7a1b9b..25fe365c0449 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -47,3 +47,4 @@ jobs: env: GIT_DIFF: ${{ env.GIT_DIFF }} LINT_DIFF: 1 + diff --git a/.github/workflows/sims.yml b/.github/workflows/sims.yml.DISABLED similarity index 100% rename from .github/workflows/sims.yml rename to .github/workflows/sims.yml.DISABLED diff --git a/.golangci.yml b/.golangci.yml index 3f61e47a961e..1350d48c6787 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -28,7 +28,8 @@ linters: - ineffassign - misspell - nakedret - - nolintlint + # [AGORIC] Caused false-positives + # - nolintlint - staticcheck - revive - stylecheck diff --git a/.mergify.yml b/.mergify.yml index 23eb45476a4b..f63833e45f1a 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -1,38 +1,15 @@ queue_rules: - name: default - conditions: - - "#approved-reviews-by>1" + queue_conditions: + - "#approved-reviews-by>0" + - base~=^Agoric + - label=automerge + merge_conditions: + - base~=^Agoric + merge_method: merge pull_request_rules: - - name: automerge to main with label automerge and branch protection passing - conditions: - - "#approved-reviews-by>1" - - base=main - - label=A:automerge - actions: - queue: - name: default - method: squash - commit_message_template: | - {{ title }} (#{{ number }}) - {{ body }} - - name: backport patches to v0.50.x branch - conditions: - - base=main - - label=backport/v0.50.x - actions: - backport: - branches: - - release/v0.50.x - - name: backport patches to v0.47.x branch - conditions: - - base=main - - label=backport/v0.47.x - actions: - backport: - branches: - - release/v0.47.x - - name: backport patches to v0.46.x branch + - name: backport patches to Agoric branch conditions: - base=main - label=backport/0.46.x @@ -47,4 +24,8 @@ pull_request_rules: actions: backport: branches: - - release/v0.45.x + - Agoric-ag0 + - name: automerge to Agoric* with label automerge and branch protection passing + conditions: [] + actions: + queue: diff --git a/Agoric-branch-notes.md b/Agoric-branch-notes.md new file mode 100644 index 000000000000..34c190f00545 --- /dev/null +++ b/Agoric-branch-notes.md @@ -0,0 +1,37 @@ +We use the following branches: + +- `Agoric` - the trunk for our cosmos-sdk fork, used by [agoric-sdk](https://github.com/Agoric/agoric-sdk). + - New features which we plan to use in a near-future release are added here. + - Most releases are tagged here. +- `Agoric-vX.Y.Z-alpha.agoric.A.x` - a lazily-created release branch. + - Branched off of release tag `vX.Y.Z-alpha.agoric.A`. + - Created when we need a new release that omits some changes present on trunk. + - Prefer to contain only cherry-picks from trunk. +- Pattern can be extended to sub-sub-branches should the need arise. + +Tag convention: + +- `vX.Y.Z-alpha.agoric.A` for tagged releases on the `Agoric` branch: + - `vX.Y.Z` is the version of the latest integrated cosmos/cosmos-sdk release. + - The `A` is an increasing sequence resetting to `1` after the integration of a new cosmos/cosmos-sdk release. +- `vX.Y.Z-alpha.agoric.A.B` for "patch" releases on branch `Agoric-vX.Y.Z-alpha.agoric.A.x`. + - `B` starts at 1 and increases sequentially. +- Pattern can be extended to releases on sub-sub-branches should the need arise. + +For new features: + +- New features should be landed on `Agoric` first, then cherry-picked to a release branch as needed. +- Create a new development branch off of `Agoric`. +- Make changes, indicating code specific to our fork by ensuring the presence of a preceding or same-line + comment including "[AGORIC]" (e.g., `// [AGORIC] Propagate the event history.`). +- Test, review, merge PR with `automerge` label for mergify.io + - Don't forget to update `CHANGELOG-Agoric.md` with the change and a link to its PR. + +Upon new cosmos-sdk releases, see [upgrading the Interchain Stack](https://github.com/Agoric/agoric-sdk/wiki/Upgrading-the-Interchain-Stack). + +Historical work: +- [ag0](https://github.com/Agoric/ag0) [Agoric mainnet](https://agoric.com) + phase 0's [gaiad-equivalent](https://github.com/cosmos/gaia) +- `Agoric-ag0` - should be identical to + [cosmos/cosmos-sdk](https://github.com/cosmos/cosmos-sdk) + changes needed by + `ag0` diff --git a/CHANGELOG-Agoric.md b/CHANGELOG-Agoric.md new file mode 100644 index 000000000000..6a927c70f348 --- /dev/null +++ b/CHANGELOG-Agoric.md @@ -0,0 +1,128 @@ + + +# Changelog (Agoric fork) + +## Unreleased + +### API Breaking + +* (auth, bank) Agoric/agoric-sdk#8989 Remove deprecated lien support + +### Bug Fixes + +* (baseapp) [#338](https://github.com/agoric-labs/cosmos-sdk/pull/338) Make sure we don't execute blocks beyond the halt height. Restored from [#305](https://github.com/agoric-labs/cosmos-sdk/pull/305) but compatible with older `SIGINT`, `SIGTERM` logic + +## `v0.46.16-alpha.agoric.2.4` - 2024-04-19 + +### Improvements + +* (server) [#419](https://github.com/agoric-labs/cosmos-sdk/pull/419) More unit tests for flag vs toml precedence for ABCI client type. + +## `v0.46.16-alpha.agoric.2.3` - 2024-04-17 + +### Improvements + +* (baseapp) [#415](https://github.com/agoric-labs/cosmos-sdk/pull/415) Unit tests and documentation for event history. +* (server) [#416](https://github.com/agoric-labs/cosmos-sdk/pull/416) Config entry to select ABCI client type. + +### Bug Fixes + +* (baseapp) [#415](https://github.com/agoric-labs/cosmos-sdk/pull/415) Avoid duplicates in event history. + +## `v0.46.16-alpha.agoric.2.2` - 2024-04-12 + +### Improvements + +* (server) [#409](https://github.com/agoric-labs/cosmos-sdk/pull/409) Flag to select ABCI client type. +* (deps) [#412](https://github.com/agoric-labs/cosmos-sdk/pull/412) Bump iavl to v0.19.7 + +### Bug Fixes + +* (baseapp) [#413](https://github.com/agoric-labs/cosmos-sdk/pull/413) Ignore events from simulated transactions + +## `v0.46.16-alpha.agoric.2.1` - 2024-03-08 + +### Improvements + +* (auth) [#407](https://github.com/agoric-labs/cosmos-sdk/pull/407) Configurable fee collector module account in DeductFeeDecorator. (backport #407) + +## `v0.46.16-alpha.agoric.2` - 2024-02-08 + +* Agoric/agoric-sdk#8871 Have `tx gov submit-proposal` accept either new or legacy syntax + +### Bug Fixes + +* (crypto) [#19371](https://github.com/cosmos/cosmos-sdk/pull/19371) Avoid cli redundant log in stdout, log to stderr instead. + +## `v0.46.16-alpha.agoric.1` - 2024-02-05 + +* Agoric/agoric-sdk#8224 Merge [cosmos/cosmos-sdk v0.46.16](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.16) + +### Bug Fixes + +* Agoric/agoric-sdk#8719 MsgClawback returns the wrong Type + +## `v0.45.16-alpha.agoric.3` - 2023-12-04 + +* (vesting) [#342](https://github.com/agoric-labs/cosmos-sdk/pull/342) recipient can return clawback vesting grant to funder + +## `v0.45.16-alpha.agoric.2` - 2023-11-08 + +### Bug Fixes + +* (baseapp) [#337](https://github.com/agoric-labs/cosmos-sdk/pull/337) revert [#305](https://github.com/agoric-labs/cosmos-sdk/pull/305) which causes test failures in agoric-sdk + +## `v0.45.16-alpha.agoric.1` - 2023-09-22 + +### Improvements + +* Agoric/agoric-sdk#8223 Merge [cosmos/cosmos-sdk v0.45.16](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.16) +* (vesting) [#303](https://github.com/agoric-labs/cosmos-sdk/pull/303) Improve vestcalc comments and documentation. + +### Bug Fixes + +* (snapshots) [#304](https://github.com/agoric-labs/cosmos-sdk/pull/304) raise the per snapshot item limit. Fixes [Agoric/agoric-sdk#8325](https://github.com/Agoric/agoric-sdk/issues/8325) +* (baseapp) [#305](https://github.com/agoric-labs/cosmos-sdk/pull/305) Make sure we don't execute blocks beyond the halt height. Port of [cosmos/cosmos-sdk#16639](https://github.com/cosmos/cosmos-sdk/pull/16639) + +## `v0.45.11-alpha.agoric.2` - 2023-03-23 + +### Improvements + +* (snapshot) [#13400](https://github.com/cosmos/cosmos-sdk/pull/13400) Fix snapshot checksum issue in golang 1.19. + +### API Breaking Changes + +* (store) [#11825](https://github.com/cosmos/cosmos-sdk/pull/11825) Make extension snapshotter interface safer to use, renamed the util function `WriteExtensionItem` to `WriteExtensionPayload`. diff --git a/api/cosmos/vesting/v1beta1/tx.pulsar.go b/api/cosmos/vesting/v1beta1/tx.pulsar.go index 3b6e23692bf3..15e34378bbb0 100644 --- a/api/cosmos/vesting/v1beta1/tx.pulsar.go +++ b/api/cosmos/vesting/v1beta1/tx.pulsar.go @@ -75,6 +75,7 @@ var ( fd_MsgCreateVestingAccount_amount protoreflect.FieldDescriptor fd_MsgCreateVestingAccount_end_time protoreflect.FieldDescriptor fd_MsgCreateVestingAccount_delayed protoreflect.FieldDescriptor + fd_MsgCreateVestingAccount_merge protoreflect.FieldDescriptor ) func init() { @@ -85,6 +86,7 @@ func init() { fd_MsgCreateVestingAccount_amount = md_MsgCreateVestingAccount.Fields().ByName("amount") fd_MsgCreateVestingAccount_end_time = md_MsgCreateVestingAccount.Fields().ByName("end_time") fd_MsgCreateVestingAccount_delayed = md_MsgCreateVestingAccount.Fields().ByName("delayed") + fd_MsgCreateVestingAccount_merge = md_MsgCreateVestingAccount.Fields().ByName("merge") } var _ protoreflect.Message = (*fastReflection_MsgCreateVestingAccount)(nil) @@ -182,6 +184,12 @@ func (x *fastReflection_MsgCreateVestingAccount) Range(f func(protoreflect.Field return } } + if x.Merge != false { + value := protoreflect.ValueOfBool(x.Merge) + if !f(fd_MsgCreateVestingAccount_merge, value) { + return + } + } } // Has reports whether a field is populated. @@ -207,6 +215,8 @@ func (x *fastReflection_MsgCreateVestingAccount) Has(fd protoreflect.FieldDescri return x.EndTime != int64(0) case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.delayed": return x.Delayed != false + case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.merge": + return x.Merge != false default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccount")) @@ -233,6 +243,8 @@ func (x *fastReflection_MsgCreateVestingAccount) Clear(fd protoreflect.FieldDesc x.EndTime = int64(0) case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.delayed": x.Delayed = false + case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.merge": + x.Merge = false default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccount")) @@ -267,6 +279,9 @@ func (x *fastReflection_MsgCreateVestingAccount) Get(descriptor protoreflect.Fie case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.delayed": value := x.Delayed return protoreflect.ValueOfBool(value) + case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.merge": + value := x.Merge + return protoreflect.ValueOfBool(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccount")) @@ -299,6 +314,8 @@ func (x *fastReflection_MsgCreateVestingAccount) Set(fd protoreflect.FieldDescri x.EndTime = value.Int() case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.delayed": x.Delayed = value.Bool() + case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.merge": + x.Merge = value.Bool() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccount")) @@ -333,6 +350,8 @@ func (x *fastReflection_MsgCreateVestingAccount) Mutable(fd protoreflect.FieldDe panic(fmt.Errorf("field end_time of message cosmos.vesting.v1beta1.MsgCreateVestingAccount is not mutable")) case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.delayed": panic(fmt.Errorf("field delayed of message cosmos.vesting.v1beta1.MsgCreateVestingAccount is not mutable")) + case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.merge": + panic(fmt.Errorf("field merge of message cosmos.vesting.v1beta1.MsgCreateVestingAccount is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccount")) @@ -357,6 +376,8 @@ func (x *fastReflection_MsgCreateVestingAccount) NewField(fd protoreflect.FieldD return protoreflect.ValueOfInt64(int64(0)) case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.delayed": return protoreflect.ValueOfBool(false) + case "cosmos.vesting.v1beta1.MsgCreateVestingAccount.merge": + return protoreflect.ValueOfBool(false) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccount")) @@ -446,6 +467,9 @@ func (x *fastReflection_MsgCreateVestingAccount) ProtoMethods() *protoiface.Meth if x.Delayed { n += 2 } + if x.Merge { + n += 2 + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -475,6 +499,16 @@ func (x *fastReflection_MsgCreateVestingAccount) ProtoMethods() *protoiface.Meth i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.Merge { + i-- + if x.Merge { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } if x.Delayed { i-- if x.Delayed { @@ -706,6 +740,26 @@ func (x *fastReflection_MsgCreateVestingAccount) ProtoMethods() *protoiface.Meth } } x.Delayed = bool(v != 0) + case 6: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Merge", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Merge = bool(v != 0) default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -741,24 +795,138 @@ func (x *fastReflection_MsgCreateVestingAccount) ProtoMethods() *protoiface.Meth } } +var _ protoreflect.List = (*_MsgCreateClawbackVestingAccount_4_list)(nil) + +type _MsgCreateClawbackVestingAccount_4_list struct { + list *[]*Period +} + +func (x *_MsgCreateClawbackVestingAccount_4_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgCreateClawbackVestingAccount_4_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgCreateClawbackVestingAccount_4_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Period) + (*x.list)[i] = concreteValue +} + +func (x *_MsgCreateClawbackVestingAccount_4_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Period) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgCreateClawbackVestingAccount_4_list) AppendMutable() protoreflect.Value { + v := new(Period) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgCreateClawbackVestingAccount_4_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgCreateClawbackVestingAccount_4_list) NewElement() protoreflect.Value { + v := new(Period) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgCreateClawbackVestingAccount_4_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_MsgCreateClawbackVestingAccount_5_list)(nil) + +type _MsgCreateClawbackVestingAccount_5_list struct { + list *[]*Period +} + +func (x *_MsgCreateClawbackVestingAccount_5_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgCreateClawbackVestingAccount_5_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgCreateClawbackVestingAccount_5_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Period) + (*x.list)[i] = concreteValue +} + +func (x *_MsgCreateClawbackVestingAccount_5_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Period) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgCreateClawbackVestingAccount_5_list) AppendMutable() protoreflect.Value { + v := new(Period) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgCreateClawbackVestingAccount_5_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgCreateClawbackVestingAccount_5_list) NewElement() protoreflect.Value { + v := new(Period) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgCreateClawbackVestingAccount_5_list) IsValid() bool { + return x.list != nil +} + var ( - md_MsgCreateVestingAccountResponse protoreflect.MessageDescriptor + md_MsgCreateClawbackVestingAccount protoreflect.MessageDescriptor + fd_MsgCreateClawbackVestingAccount_from_address protoreflect.FieldDescriptor + fd_MsgCreateClawbackVestingAccount_to_address protoreflect.FieldDescriptor + fd_MsgCreateClawbackVestingAccount_start_time protoreflect.FieldDescriptor + fd_MsgCreateClawbackVestingAccount_lockup_periods protoreflect.FieldDescriptor + fd_MsgCreateClawbackVestingAccount_vesting_periods protoreflect.FieldDescriptor + fd_MsgCreateClawbackVestingAccount_merge protoreflect.FieldDescriptor ) func init() { file_cosmos_vesting_v1beta1_tx_proto_init() - md_MsgCreateVestingAccountResponse = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgCreateVestingAccountResponse") + md_MsgCreateClawbackVestingAccount = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgCreateClawbackVestingAccount") + fd_MsgCreateClawbackVestingAccount_from_address = md_MsgCreateClawbackVestingAccount.Fields().ByName("from_address") + fd_MsgCreateClawbackVestingAccount_to_address = md_MsgCreateClawbackVestingAccount.Fields().ByName("to_address") + fd_MsgCreateClawbackVestingAccount_start_time = md_MsgCreateClawbackVestingAccount.Fields().ByName("start_time") + fd_MsgCreateClawbackVestingAccount_lockup_periods = md_MsgCreateClawbackVestingAccount.Fields().ByName("lockup_periods") + fd_MsgCreateClawbackVestingAccount_vesting_periods = md_MsgCreateClawbackVestingAccount.Fields().ByName("vesting_periods") + fd_MsgCreateClawbackVestingAccount_merge = md_MsgCreateClawbackVestingAccount.Fields().ByName("merge") } -var _ protoreflect.Message = (*fastReflection_MsgCreateVestingAccountResponse)(nil) +var _ protoreflect.Message = (*fastReflection_MsgCreateClawbackVestingAccount)(nil) -type fastReflection_MsgCreateVestingAccountResponse MsgCreateVestingAccountResponse +type fastReflection_MsgCreateClawbackVestingAccount MsgCreateClawbackVestingAccount -func (x *MsgCreateVestingAccountResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgCreateVestingAccountResponse)(x) +func (x *MsgCreateClawbackVestingAccount) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreateClawbackVestingAccount)(x) } -func (x *MsgCreateVestingAccountResponse) slowProtoReflect() protoreflect.Message { +func (x *MsgCreateClawbackVestingAccount) slowProtoReflect() protoreflect.Message { mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -770,43 +938,43 @@ func (x *MsgCreateVestingAccountResponse) slowProtoReflect() protoreflect.Messag return mi.MessageOf(x) } -var _fastReflection_MsgCreateVestingAccountResponse_messageType fastReflection_MsgCreateVestingAccountResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgCreateVestingAccountResponse_messageType{} +var _fastReflection_MsgCreateClawbackVestingAccount_messageType fastReflection_MsgCreateClawbackVestingAccount_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreateClawbackVestingAccount_messageType{} -type fastReflection_MsgCreateVestingAccountResponse_messageType struct{} +type fastReflection_MsgCreateClawbackVestingAccount_messageType struct{} -func (x fastReflection_MsgCreateVestingAccountResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgCreateVestingAccountResponse)(nil) +func (x fastReflection_MsgCreateClawbackVestingAccount_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreateClawbackVestingAccount)(nil) } -func (x fastReflection_MsgCreateVestingAccountResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgCreateVestingAccountResponse) +func (x fastReflection_MsgCreateClawbackVestingAccount_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreateClawbackVestingAccount) } -func (x fastReflection_MsgCreateVestingAccountResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreateVestingAccountResponse +func (x fastReflection_MsgCreateClawbackVestingAccount_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateClawbackVestingAccount } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgCreateVestingAccountResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreateVestingAccountResponse +func (x *fastReflection_MsgCreateClawbackVestingAccount) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateClawbackVestingAccount } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgCreateVestingAccountResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgCreateVestingAccountResponse_messageType +func (x *fastReflection_MsgCreateClawbackVestingAccount) Type() protoreflect.MessageType { + return _fastReflection_MsgCreateClawbackVestingAccount_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgCreateVestingAccountResponse) New() protoreflect.Message { - return new(fastReflection_MsgCreateVestingAccountResponse) +func (x *fastReflection_MsgCreateClawbackVestingAccount) New() protoreflect.Message { + return new(fastReflection_MsgCreateClawbackVestingAccount) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgCreateVestingAccountResponse) Interface() protoreflect.ProtoMessage { - return (*MsgCreateVestingAccountResponse)(x) +func (x *fastReflection_MsgCreateClawbackVestingAccount) Interface() protoreflect.ProtoMessage { + return (*MsgCreateClawbackVestingAccount)(x) } // Range iterates over every populated field in an undefined order, @@ -814,7 +982,43 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) Interface() protoreflec // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgCreateVestingAccountResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_MsgCreateClawbackVestingAccount) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.FromAddress != "" { + value := protoreflect.ValueOfString(x.FromAddress) + if !f(fd_MsgCreateClawbackVestingAccount_from_address, value) { + return + } + } + if x.ToAddress != "" { + value := protoreflect.ValueOfString(x.ToAddress) + if !f(fd_MsgCreateClawbackVestingAccount_to_address, value) { + return + } + } + if x.StartTime != int64(0) { + value := protoreflect.ValueOfInt64(x.StartTime) + if !f(fd_MsgCreateClawbackVestingAccount_start_time, value) { + return + } + } + if len(x.LockupPeriods) != 0 { + value := protoreflect.ValueOfList(&_MsgCreateClawbackVestingAccount_4_list{list: &x.LockupPeriods}) + if !f(fd_MsgCreateClawbackVestingAccount_lockup_periods, value) { + return + } + } + if len(x.VestingPeriods) != 0 { + value := protoreflect.ValueOfList(&_MsgCreateClawbackVestingAccount_5_list{list: &x.VestingPeriods}) + if !f(fd_MsgCreateClawbackVestingAccount_vesting_periods, value) { + return + } + } + if x.Merge != false { + value := protoreflect.ValueOfBool(x.Merge) + if !f(fd_MsgCreateClawbackVestingAccount_merge, value) { + return + } + } } // Has reports whether a field is populated. @@ -828,13 +1032,25 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) Range(f func(protorefle // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgCreateVestingAccountResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgCreateClawbackVestingAccount) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.from_address": + return x.FromAddress != "" + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.to_address": + return x.ToAddress != "" + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.start_time": + return x.StartTime != int64(0) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.lockup_periods": + return len(x.LockupPeriods) != 0 + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.vesting_periods": + return len(x.VestingPeriods) != 0 + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.merge": + return x.Merge != false default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount does not contain field %s", fd.FullName())) } } @@ -844,13 +1060,25 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) Has(fd protoreflect.Fie // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreateVestingAccountResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgCreateClawbackVestingAccount) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.from_address": + x.FromAddress = "" + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.to_address": + x.ToAddress = "" + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.start_time": + x.StartTime = int64(0) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.lockup_periods": + x.LockupPeriods = nil + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.vesting_periods": + x.VestingPeriods = nil + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.merge": + x.Merge = false default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount does not contain field %s", fd.FullName())) } } @@ -860,13 +1088,37 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) Clear(fd protoreflect.F // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgCreateVestingAccountResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgCreateClawbackVestingAccount) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.from_address": + value := x.FromAddress + return protoreflect.ValueOfString(value) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.to_address": + value := x.ToAddress + return protoreflect.ValueOfString(value) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.start_time": + value := x.StartTime + return protoreflect.ValueOfInt64(value) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.lockup_periods": + if len(x.LockupPeriods) == 0 { + return protoreflect.ValueOfList(&_MsgCreateClawbackVestingAccount_4_list{}) + } + listValue := &_MsgCreateClawbackVestingAccount_4_list{list: &x.LockupPeriods} + return protoreflect.ValueOfList(listValue) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.vesting_periods": + if len(x.VestingPeriods) == 0 { + return protoreflect.ValueOfList(&_MsgCreateClawbackVestingAccount_5_list{}) + } + listValue := &_MsgCreateClawbackVestingAccount_5_list{list: &x.VestingPeriods} + return protoreflect.ValueOfList(listValue) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.merge": + value := x.Merge + return protoreflect.ValueOfBool(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount does not contain field %s", descriptor.FullName())) } } @@ -880,13 +1132,29 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) Get(descriptor protoref // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreateVestingAccountResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgCreateClawbackVestingAccount) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.from_address": + x.FromAddress = value.Interface().(string) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.to_address": + x.ToAddress = value.Interface().(string) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.start_time": + x.StartTime = value.Int() + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.lockup_periods": + lv := value.List() + clv := lv.(*_MsgCreateClawbackVestingAccount_4_list) + x.LockupPeriods = *clv.list + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.vesting_periods": + lv := value.List() + clv := lv.(*_MsgCreateClawbackVestingAccount_5_list) + x.VestingPeriods = *clv.list + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.merge": + x.Merge = value.Bool() default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount does not contain field %s", fd.FullName())) } } @@ -900,36 +1168,70 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) Set(fd protoreflect.Fie // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreateVestingAccountResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgCreateClawbackVestingAccount) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.lockup_periods": + if x.LockupPeriods == nil { + x.LockupPeriods = []*Period{} + } + value := &_MsgCreateClawbackVestingAccount_4_list{list: &x.LockupPeriods} + return protoreflect.ValueOfList(value) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.vesting_periods": + if x.VestingPeriods == nil { + x.VestingPeriods = []*Period{} + } + value := &_MsgCreateClawbackVestingAccount_5_list{list: &x.VestingPeriods} + return protoreflect.ValueOfList(value) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.from_address": + panic(fmt.Errorf("field from_address of message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount is not mutable")) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.to_address": + panic(fmt.Errorf("field to_address of message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount is not mutable")) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.start_time": + panic(fmt.Errorf("field start_time of message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount is not mutable")) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.merge": + panic(fmt.Errorf("field merge of message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgCreateVestingAccountResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgCreateClawbackVestingAccount) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.from_address": + return protoreflect.ValueOfString("") + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.to_address": + return protoreflect.ValueOfString("") + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.start_time": + return protoreflect.ValueOfInt64(int64(0)) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.lockup_periods": + list := []*Period{} + return protoreflect.ValueOfList(&_MsgCreateClawbackVestingAccount_4_list{list: &list}) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.vesting_periods": + list := []*Period{} + return protoreflect.ValueOfList(&_MsgCreateClawbackVestingAccount_5_list{list: &list}) + case "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.merge": + return protoreflect.ValueOfBool(false) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgCreateVestingAccountResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgCreateClawbackVestingAccount) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount", d.FullName())) } panic("unreachable") } @@ -937,7 +1239,7 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) WhichOneof(d protorefle // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgCreateVestingAccountResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgCreateClawbackVestingAccount) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -948,7 +1250,7 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) GetUnknown() protorefle // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreateVestingAccountResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgCreateClawbackVestingAccount) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -960,7 +1262,7 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) SetUnknown(fields proto // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_MsgCreateVestingAccountResponse) IsValid() bool { +func (x *fastReflection_MsgCreateClawbackVestingAccount) IsValid() bool { return x != nil } @@ -970,9 +1272,9 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgCreateVestingAccountResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgCreateClawbackVestingAccount) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgCreateVestingAccountResponse) + x := input.Message.Interface().(*MsgCreateClawbackVestingAccount) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -984,6 +1286,32 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) ProtoMethods() *protoif var n int var l int _ = l + l = len(x.FromAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ToAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.StartTime != 0 { + n += 1 + runtime.Sov(uint64(x.StartTime)) + } + if len(x.LockupPeriods) > 0 { + for _, e := range x.LockupPeriods { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if len(x.VestingPeriods) > 0 { + for _, e := range x.VestingPeriods { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Merge { + n += 2 + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -994,7 +1322,7 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) ProtoMethods() *protoif } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgCreateVestingAccountResponse) + x := input.Message.Interface().(*MsgCreateClawbackVestingAccount) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1013,18 +1341,3020 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) ProtoMethods() *protoif i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ + if x.Merge { + i-- + if x.Merge { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if len(x.VestingPeriods) > 0 { + for iNdEx := len(x.VestingPeriods) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.VestingPeriods[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x2a + } + } + if len(x.LockupPeriods) > 0 { + for iNdEx := len(x.LockupPeriods) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.LockupPeriods[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x22 + } + } + if x.StartTime != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.StartTime)) + i-- + dAtA[i] = 0x18 + } + if len(x.ToAddress) > 0 { + i -= len(x.ToAddress) + copy(dAtA[i:], x.ToAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ToAddress))) + i-- + dAtA[i] = 0x12 + } + if len(x.FromAddress) > 0 { + i -= len(x.FromAddress) + copy(dAtA[i:], x.FromAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.FromAddress))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateClawbackVestingAccount) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateClawbackVestingAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateClawbackVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ToAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + x.StartTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.StartTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LockupPeriods", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.LockupPeriods = append(x.LockupPeriods, &Period{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.LockupPeriods[len(x.LockupPeriods)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field VestingPeriods", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.VestingPeriods = append(x.VestingPeriods, &Period{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.VestingPeriods[len(x.VestingPeriods)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Merge", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Merge = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgCreateVestingAccountResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_vesting_v1beta1_tx_proto_init() + md_MsgCreateVestingAccountResponse = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgCreateVestingAccountResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreateVestingAccountResponse)(nil) + +type fastReflection_MsgCreateVestingAccountResponse MsgCreateVestingAccountResponse + +func (x *MsgCreateVestingAccountResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreateVestingAccountResponse)(x) +} + +func (x *MsgCreateVestingAccountResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCreateVestingAccountResponse_messageType fastReflection_MsgCreateVestingAccountResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreateVestingAccountResponse_messageType{} + +type fastReflection_MsgCreateVestingAccountResponse_messageType struct{} + +func (x fastReflection_MsgCreateVestingAccountResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreateVestingAccountResponse)(nil) +} +func (x fastReflection_MsgCreateVestingAccountResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreateVestingAccountResponse) +} +func (x fastReflection_MsgCreateVestingAccountResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateVestingAccountResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreateVestingAccountResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateVestingAccountResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCreateVestingAccountResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgCreateVestingAccountResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreateVestingAccountResponse) New() protoreflect.Message { + return new(fastReflection_MsgCreateVestingAccountResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreateVestingAccountResponse) Interface() protoreflect.ProtoMessage { + return (*MsgCreateVestingAccountResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCreateVestingAccountResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCreateVestingAccountResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateVestingAccountResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCreateVestingAccountResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateVestingAccountResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateVestingAccountResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCreateVestingAccountResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCreateVestingAccountResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCreateVestingAccountResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateVestingAccountResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCreateVestingAccountResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCreateVestingAccountResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreateVestingAccountResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateVestingAccountResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateVestingAccountResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateVestingAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateVestingAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_MsgCreatePermanentLockedAccount_3_list)(nil) + +type _MsgCreatePermanentLockedAccount_3_list struct { + list *[]*v1beta1.Coin +} + +func (x *_MsgCreatePermanentLockedAccount_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgCreatePermanentLockedAccount_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgCreatePermanentLockedAccount_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + (*x.list)[i] = concreteValue +} + +func (x *_MsgCreatePermanentLockedAccount_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgCreatePermanentLockedAccount_3_list) AppendMutable() protoreflect.Value { + v := new(v1beta1.Coin) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgCreatePermanentLockedAccount_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgCreatePermanentLockedAccount_3_list) NewElement() protoreflect.Value { + v := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgCreatePermanentLockedAccount_3_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgCreatePermanentLockedAccount protoreflect.MessageDescriptor + fd_MsgCreatePermanentLockedAccount_from_address protoreflect.FieldDescriptor + fd_MsgCreatePermanentLockedAccount_to_address protoreflect.FieldDescriptor + fd_MsgCreatePermanentLockedAccount_amount protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_vesting_v1beta1_tx_proto_init() + md_MsgCreatePermanentLockedAccount = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgCreatePermanentLockedAccount") + fd_MsgCreatePermanentLockedAccount_from_address = md_MsgCreatePermanentLockedAccount.Fields().ByName("from_address") + fd_MsgCreatePermanentLockedAccount_to_address = md_MsgCreatePermanentLockedAccount.Fields().ByName("to_address") + fd_MsgCreatePermanentLockedAccount_amount = md_MsgCreatePermanentLockedAccount.Fields().ByName("amount") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreatePermanentLockedAccount)(nil) + +type fastReflection_MsgCreatePermanentLockedAccount MsgCreatePermanentLockedAccount + +func (x *MsgCreatePermanentLockedAccount) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreatePermanentLockedAccount)(x) +} + +func (x *MsgCreatePermanentLockedAccount) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCreatePermanentLockedAccount_messageType fastReflection_MsgCreatePermanentLockedAccount_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreatePermanentLockedAccount_messageType{} + +type fastReflection_MsgCreatePermanentLockedAccount_messageType struct{} + +func (x fastReflection_MsgCreatePermanentLockedAccount_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreatePermanentLockedAccount)(nil) +} +func (x fastReflection_MsgCreatePermanentLockedAccount_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreatePermanentLockedAccount) +} +func (x fastReflection_MsgCreatePermanentLockedAccount_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreatePermanentLockedAccount +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreatePermanentLockedAccount) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreatePermanentLockedAccount +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCreatePermanentLockedAccount) Type() protoreflect.MessageType { + return _fastReflection_MsgCreatePermanentLockedAccount_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreatePermanentLockedAccount) New() protoreflect.Message { + return new(fastReflection_MsgCreatePermanentLockedAccount) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreatePermanentLockedAccount) Interface() protoreflect.ProtoMessage { + return (*MsgCreatePermanentLockedAccount)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCreatePermanentLockedAccount) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.FromAddress != "" { + value := protoreflect.ValueOfString(x.FromAddress) + if !f(fd_MsgCreatePermanentLockedAccount_from_address, value) { + return + } + } + if x.ToAddress != "" { + value := protoreflect.ValueOfString(x.ToAddress) + if !f(fd_MsgCreatePermanentLockedAccount_to_address, value) { + return + } + } + if len(x.Amount) != 0 { + value := protoreflect.ValueOfList(&_MsgCreatePermanentLockedAccount_3_list{list: &x.Amount}) + if !f(fd_MsgCreatePermanentLockedAccount_amount, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCreatePermanentLockedAccount) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.from_address": + return x.FromAddress != "" + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.to_address": + return x.ToAddress != "" + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount": + return len(x.Amount) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePermanentLockedAccount) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.from_address": + x.FromAddress = "" + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.to_address": + x.ToAddress = "" + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount": + x.Amount = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCreatePermanentLockedAccount) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.from_address": + value := x.FromAddress + return protoreflect.ValueOfString(value) + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.to_address": + value := x.ToAddress + return protoreflect.ValueOfString(value) + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount": + if len(x.Amount) == 0 { + return protoreflect.ValueOfList(&_MsgCreatePermanentLockedAccount_3_list{}) + } + listValue := &_MsgCreatePermanentLockedAccount_3_list{list: &x.Amount} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePermanentLockedAccount) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.from_address": + x.FromAddress = value.Interface().(string) + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.to_address": + x.ToAddress = value.Interface().(string) + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount": + lv := value.List() + clv := lv.(*_MsgCreatePermanentLockedAccount_3_list) + x.Amount = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePermanentLockedAccount) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount": + if x.Amount == nil { + x.Amount = []*v1beta1.Coin{} + } + value := &_MsgCreatePermanentLockedAccount_3_list{list: &x.Amount} + return protoreflect.ValueOfList(value) + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.from_address": + panic(fmt.Errorf("field from_address of message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount is not mutable")) + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.to_address": + panic(fmt.Errorf("field to_address of message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCreatePermanentLockedAccount) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.from_address": + return protoreflect.ValueOfString("") + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.to_address": + return protoreflect.ValueOfString("") + case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount": + list := []*v1beta1.Coin{} + return protoreflect.ValueOfList(&_MsgCreatePermanentLockedAccount_3_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCreatePermanentLockedAccount) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCreatePermanentLockedAccount) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePermanentLockedAccount) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCreatePermanentLockedAccount) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCreatePermanentLockedAccount) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreatePermanentLockedAccount) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.FromAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ToAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Amount) > 0 { + for _, e := range x.Amount { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCreatePermanentLockedAccount) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Amount) > 0 { + for iNdEx := len(x.Amount) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Amount[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + } + if len(x.ToAddress) > 0 { + i -= len(x.ToAddress) + copy(dAtA[i:], x.ToAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ToAddress))) + i-- + dAtA[i] = 0x12 + } + if len(x.FromAddress) > 0 { + i -= len(x.FromAddress) + copy(dAtA[i:], x.FromAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.FromAddress))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCreatePermanentLockedAccount) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePermanentLockedAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePermanentLockedAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ToAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Amount = append(x.Amount, &v1beta1.Coin{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount[len(x.Amount)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgCreatePermanentLockedAccountResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_vesting_v1beta1_tx_proto_init() + md_MsgCreatePermanentLockedAccountResponse = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgCreatePermanentLockedAccountResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreatePermanentLockedAccountResponse)(nil) + +type fastReflection_MsgCreatePermanentLockedAccountResponse MsgCreatePermanentLockedAccountResponse + +func (x *MsgCreatePermanentLockedAccountResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreatePermanentLockedAccountResponse)(x) +} + +func (x *MsgCreatePermanentLockedAccountResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCreatePermanentLockedAccountResponse_messageType fastReflection_MsgCreatePermanentLockedAccountResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreatePermanentLockedAccountResponse_messageType{} + +type fastReflection_MsgCreatePermanentLockedAccountResponse_messageType struct{} + +func (x fastReflection_MsgCreatePermanentLockedAccountResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreatePermanentLockedAccountResponse)(nil) +} +func (x fastReflection_MsgCreatePermanentLockedAccountResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreatePermanentLockedAccountResponse) +} +func (x fastReflection_MsgCreatePermanentLockedAccountResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreatePermanentLockedAccountResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreatePermanentLockedAccountResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgCreatePermanentLockedAccountResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) New() protoreflect.Message { + return new(fastReflection_MsgCreatePermanentLockedAccountResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Interface() protoreflect.ProtoMessage { + return (*MsgCreatePermanentLockedAccountResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreatePermanentLockedAccountResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCreatePermanentLockedAccountResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCreatePermanentLockedAccountResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePermanentLockedAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePermanentLockedAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_MsgCreatePeriodicVestingAccount_4_list)(nil) + +type _MsgCreatePeriodicVestingAccount_4_list struct { + list *[]*Period +} + +func (x *_MsgCreatePeriodicVestingAccount_4_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgCreatePeriodicVestingAccount_4_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgCreatePeriodicVestingAccount_4_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Period) + (*x.list)[i] = concreteValue +} + +func (x *_MsgCreatePeriodicVestingAccount_4_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Period) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgCreatePeriodicVestingAccount_4_list) AppendMutable() protoreflect.Value { + v := new(Period) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgCreatePeriodicVestingAccount_4_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgCreatePeriodicVestingAccount_4_list) NewElement() protoreflect.Value { + v := new(Period) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgCreatePeriodicVestingAccount_4_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgCreatePeriodicVestingAccount protoreflect.MessageDescriptor + fd_MsgCreatePeriodicVestingAccount_from_address protoreflect.FieldDescriptor + fd_MsgCreatePeriodicVestingAccount_to_address protoreflect.FieldDescriptor + fd_MsgCreatePeriodicVestingAccount_start_time protoreflect.FieldDescriptor + fd_MsgCreatePeriodicVestingAccount_vesting_periods protoreflect.FieldDescriptor + fd_MsgCreatePeriodicVestingAccount_merge protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_vesting_v1beta1_tx_proto_init() + md_MsgCreatePeriodicVestingAccount = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgCreatePeriodicVestingAccount") + fd_MsgCreatePeriodicVestingAccount_from_address = md_MsgCreatePeriodicVestingAccount.Fields().ByName("from_address") + fd_MsgCreatePeriodicVestingAccount_to_address = md_MsgCreatePeriodicVestingAccount.Fields().ByName("to_address") + fd_MsgCreatePeriodicVestingAccount_start_time = md_MsgCreatePeriodicVestingAccount.Fields().ByName("start_time") + fd_MsgCreatePeriodicVestingAccount_vesting_periods = md_MsgCreatePeriodicVestingAccount.Fields().ByName("vesting_periods") + fd_MsgCreatePeriodicVestingAccount_merge = md_MsgCreatePeriodicVestingAccount.Fields().ByName("merge") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreatePeriodicVestingAccount)(nil) + +type fastReflection_MsgCreatePeriodicVestingAccount MsgCreatePeriodicVestingAccount + +func (x *MsgCreatePeriodicVestingAccount) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreatePeriodicVestingAccount)(x) +} + +func (x *MsgCreatePeriodicVestingAccount) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCreatePeriodicVestingAccount_messageType fastReflection_MsgCreatePeriodicVestingAccount_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreatePeriodicVestingAccount_messageType{} + +type fastReflection_MsgCreatePeriodicVestingAccount_messageType struct{} + +func (x fastReflection_MsgCreatePeriodicVestingAccount_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreatePeriodicVestingAccount)(nil) +} +func (x fastReflection_MsgCreatePeriodicVestingAccount_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreatePeriodicVestingAccount) +} +func (x fastReflection_MsgCreatePeriodicVestingAccount_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreatePeriodicVestingAccount +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreatePeriodicVestingAccount +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) Type() protoreflect.MessageType { + return _fastReflection_MsgCreatePeriodicVestingAccount_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) New() protoreflect.Message { + return new(fastReflection_MsgCreatePeriodicVestingAccount) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) Interface() protoreflect.ProtoMessage { + return (*MsgCreatePeriodicVestingAccount)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.FromAddress != "" { + value := protoreflect.ValueOfString(x.FromAddress) + if !f(fd_MsgCreatePeriodicVestingAccount_from_address, value) { + return + } + } + if x.ToAddress != "" { + value := protoreflect.ValueOfString(x.ToAddress) + if !f(fd_MsgCreatePeriodicVestingAccount_to_address, value) { + return + } + } + if x.StartTime != int64(0) { + value := protoreflect.ValueOfInt64(x.StartTime) + if !f(fd_MsgCreatePeriodicVestingAccount_start_time, value) { + return + } + } + if len(x.VestingPeriods) != 0 { + value := protoreflect.ValueOfList(&_MsgCreatePeriodicVestingAccount_4_list{list: &x.VestingPeriods}) + if !f(fd_MsgCreatePeriodicVestingAccount_vesting_periods, value) { + return + } + } + if x.Merge != false { + value := protoreflect.ValueOfBool(x.Merge) + if !f(fd_MsgCreatePeriodicVestingAccount_merge, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.from_address": + return x.FromAddress != "" + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.to_address": + return x.ToAddress != "" + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.start_time": + return x.StartTime != int64(0) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods": + return len(x.VestingPeriods) != 0 + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.merge": + return x.Merge != false + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.from_address": + x.FromAddress = "" + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.to_address": + x.ToAddress = "" + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.start_time": + x.StartTime = int64(0) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods": + x.VestingPeriods = nil + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.merge": + x.Merge = false + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.from_address": + value := x.FromAddress + return protoreflect.ValueOfString(value) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.to_address": + value := x.ToAddress + return protoreflect.ValueOfString(value) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.start_time": + value := x.StartTime + return protoreflect.ValueOfInt64(value) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods": + if len(x.VestingPeriods) == 0 { + return protoreflect.ValueOfList(&_MsgCreatePeriodicVestingAccount_4_list{}) + } + listValue := &_MsgCreatePeriodicVestingAccount_4_list{list: &x.VestingPeriods} + return protoreflect.ValueOfList(listValue) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.merge": + value := x.Merge + return protoreflect.ValueOfBool(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.from_address": + x.FromAddress = value.Interface().(string) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.to_address": + x.ToAddress = value.Interface().(string) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.start_time": + x.StartTime = value.Int() + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods": + lv := value.List() + clv := lv.(*_MsgCreatePeriodicVestingAccount_4_list) + x.VestingPeriods = *clv.list + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.merge": + x.Merge = value.Bool() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods": + if x.VestingPeriods == nil { + x.VestingPeriods = []*Period{} + } + value := &_MsgCreatePeriodicVestingAccount_4_list{list: &x.VestingPeriods} + return protoreflect.ValueOfList(value) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.from_address": + panic(fmt.Errorf("field from_address of message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount is not mutable")) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.to_address": + panic(fmt.Errorf("field to_address of message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount is not mutable")) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.start_time": + panic(fmt.Errorf("field start_time of message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount is not mutable")) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.merge": + panic(fmt.Errorf("field merge of message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.from_address": + return protoreflect.ValueOfString("") + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.to_address": + return protoreflect.ValueOfString("") + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.start_time": + return protoreflect.ValueOfInt64(int64(0)) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods": + list := []*Period{} + return protoreflect.ValueOfList(&_MsgCreatePeriodicVestingAccount_4_list{list: &list}) + case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.merge": + return protoreflect.ValueOfBool(false) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCreatePeriodicVestingAccount) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreatePeriodicVestingAccount) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.FromAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ToAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.StartTime != 0 { + n += 1 + runtime.Sov(uint64(x.StartTime)) + } + if len(x.VestingPeriods) > 0 { + for _, e := range x.VestingPeriods { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Merge { + n += 2 + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCreatePeriodicVestingAccount) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Merge { + i-- + if x.Merge { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if len(x.VestingPeriods) > 0 { + for iNdEx := len(x.VestingPeriods) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.VestingPeriods[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x22 + } + } + if x.StartTime != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.StartTime)) + i-- + dAtA[i] = 0x18 + } + if len(x.ToAddress) > 0 { + i -= len(x.ToAddress) + copy(dAtA[i:], x.ToAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ToAddress))) + i-- + dAtA[i] = 0x12 + } + if len(x.FromAddress) > 0 { + i -= len(x.FromAddress) + copy(dAtA[i:], x.FromAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.FromAddress))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCreatePeriodicVestingAccount) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePeriodicVestingAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePeriodicVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ToAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + x.StartTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.StartTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field VestingPeriods", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.VestingPeriods = append(x.VestingPeriods, &Period{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.VestingPeriods[len(x.VestingPeriods)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Merge", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Merge = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgCreatePeriodicVestingAccountResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_vesting_v1beta1_tx_proto_init() + md_MsgCreatePeriodicVestingAccountResponse = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgCreatePeriodicVestingAccountResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreatePeriodicVestingAccountResponse)(nil) + +type fastReflection_MsgCreatePeriodicVestingAccountResponse MsgCreatePeriodicVestingAccountResponse + +func (x *MsgCreatePeriodicVestingAccountResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreatePeriodicVestingAccountResponse)(x) +} + +func (x *MsgCreatePeriodicVestingAccountResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType{} + +type fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType struct{} + +func (x fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreatePeriodicVestingAccountResponse)(nil) +} +func (x fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreatePeriodicVestingAccountResponse) +} +func (x fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreatePeriodicVestingAccountResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreatePeriodicVestingAccountResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) New() protoreflect.Message { + return new(fastReflection_MsgCreatePeriodicVestingAccountResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Interface() protoreflect.ProtoMessage { + return (*MsgCreatePeriodicVestingAccountResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreatePeriodicVestingAccountResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCreatePeriodicVestingAccountResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCreatePeriodicVestingAccountResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePeriodicVestingAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePeriodicVestingAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgCreateClawbackVestingAccountResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_vesting_v1beta1_tx_proto_init() + md_MsgCreateClawbackVestingAccountResponse = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgCreateClawbackVestingAccountResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreateClawbackVestingAccountResponse)(nil) + +type fastReflection_MsgCreateClawbackVestingAccountResponse MsgCreateClawbackVestingAccountResponse + +func (x *MsgCreateClawbackVestingAccountResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreateClawbackVestingAccountResponse)(x) +} + +func (x *MsgCreateClawbackVestingAccountResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCreateClawbackVestingAccountResponse_messageType fastReflection_MsgCreateClawbackVestingAccountResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreateClawbackVestingAccountResponse_messageType{} + +type fastReflection_MsgCreateClawbackVestingAccountResponse_messageType struct{} + +func (x fastReflection_MsgCreateClawbackVestingAccountResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreateClawbackVestingAccountResponse)(nil) +} +func (x fastReflection_MsgCreateClawbackVestingAccountResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreateClawbackVestingAccountResponse) +} +func (x fastReflection_MsgCreateClawbackVestingAccountResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateClawbackVestingAccountResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateClawbackVestingAccountResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgCreateClawbackVestingAccountResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) New() protoreflect.Message { + return new(fastReflection_MsgCreateClawbackVestingAccountResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) Interface() protoreflect.ProtoMessage { + return (*MsgCreateClawbackVestingAccountResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCreateClawbackVestingAccountResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreateClawbackVestingAccountResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateClawbackVestingAccountResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, Buf: input.Buf, }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgCreateVestingAccountResponse) + x := input.Message.Interface().(*MsgCreateClawbackVestingAccountResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1056,10 +4386,10 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) ProtoMethods() *protoif fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateVestingAccountResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateClawbackVestingAccountResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateVestingAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateClawbackVestingAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1097,82 +4427,33 @@ func (x *fastReflection_MsgCreateVestingAccountResponse) ProtoMethods() *protoif } } -var _ protoreflect.List = (*_MsgCreatePermanentLockedAccount_3_list)(nil) - -type _MsgCreatePermanentLockedAccount_3_list struct { - list *[]*v1beta1.Coin -} - -func (x *_MsgCreatePermanentLockedAccount_3_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MsgCreatePermanentLockedAccount_3_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MsgCreatePermanentLockedAccount_3_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) - (*x.list)[i] = concreteValue -} - -func (x *_MsgCreatePermanentLockedAccount_3_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgCreatePermanentLockedAccount_3_list) AppendMutable() protoreflect.Value { - v := new(v1beta1.Coin) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgCreatePermanentLockedAccount_3_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MsgCreatePermanentLockedAccount_3_list) NewElement() protoreflect.Value { - v := new(v1beta1.Coin) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgCreatePermanentLockedAccount_3_list) IsValid() bool { - return x.list != nil -} - var ( - md_MsgCreatePermanentLockedAccount protoreflect.MessageDescriptor - fd_MsgCreatePermanentLockedAccount_from_address protoreflect.FieldDescriptor - fd_MsgCreatePermanentLockedAccount_to_address protoreflect.FieldDescriptor - fd_MsgCreatePermanentLockedAccount_amount protoreflect.FieldDescriptor + md_MsgClawback protoreflect.MessageDescriptor + fd_MsgClawback_from_address protoreflect.FieldDescriptor + fd_MsgClawback_funder_address protoreflect.FieldDescriptor + fd_MsgClawback_address protoreflect.FieldDescriptor + fd_MsgClawback_dest_address protoreflect.FieldDescriptor ) func init() { file_cosmos_vesting_v1beta1_tx_proto_init() - md_MsgCreatePermanentLockedAccount = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgCreatePermanentLockedAccount") - fd_MsgCreatePermanentLockedAccount_from_address = md_MsgCreatePermanentLockedAccount.Fields().ByName("from_address") - fd_MsgCreatePermanentLockedAccount_to_address = md_MsgCreatePermanentLockedAccount.Fields().ByName("to_address") - fd_MsgCreatePermanentLockedAccount_amount = md_MsgCreatePermanentLockedAccount.Fields().ByName("amount") + md_MsgClawback = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgClawback") + fd_MsgClawback_from_address = md_MsgClawback.Fields().ByName("from_address") + fd_MsgClawback_funder_address = md_MsgClawback.Fields().ByName("funder_address") + fd_MsgClawback_address = md_MsgClawback.Fields().ByName("address") + fd_MsgClawback_dest_address = md_MsgClawback.Fields().ByName("dest_address") } -var _ protoreflect.Message = (*fastReflection_MsgCreatePermanentLockedAccount)(nil) +var _ protoreflect.Message = (*fastReflection_MsgClawback)(nil) -type fastReflection_MsgCreatePermanentLockedAccount MsgCreatePermanentLockedAccount +type fastReflection_MsgClawback MsgClawback -func (x *MsgCreatePermanentLockedAccount) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgCreatePermanentLockedAccount)(x) +func (x *MsgClawback) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgClawback)(x) } -func (x *MsgCreatePermanentLockedAccount) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[2] +func (x *MsgClawback) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1183,43 +4464,43 @@ func (x *MsgCreatePermanentLockedAccount) slowProtoReflect() protoreflect.Messag return mi.MessageOf(x) } -var _fastReflection_MsgCreatePermanentLockedAccount_messageType fastReflection_MsgCreatePermanentLockedAccount_messageType -var _ protoreflect.MessageType = fastReflection_MsgCreatePermanentLockedAccount_messageType{} +var _fastReflection_MsgClawback_messageType fastReflection_MsgClawback_messageType +var _ protoreflect.MessageType = fastReflection_MsgClawback_messageType{} -type fastReflection_MsgCreatePermanentLockedAccount_messageType struct{} +type fastReflection_MsgClawback_messageType struct{} -func (x fastReflection_MsgCreatePermanentLockedAccount_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgCreatePermanentLockedAccount)(nil) +func (x fastReflection_MsgClawback_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgClawback)(nil) } -func (x fastReflection_MsgCreatePermanentLockedAccount_messageType) New() protoreflect.Message { - return new(fastReflection_MsgCreatePermanentLockedAccount) +func (x fastReflection_MsgClawback_messageType) New() protoreflect.Message { + return new(fastReflection_MsgClawback) } -func (x fastReflection_MsgCreatePermanentLockedAccount_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreatePermanentLockedAccount +func (x fastReflection_MsgClawback_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgClawback } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgCreatePermanentLockedAccount) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreatePermanentLockedAccount +func (x *fastReflection_MsgClawback) Descriptor() protoreflect.MessageDescriptor { + return md_MsgClawback } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgCreatePermanentLockedAccount) Type() protoreflect.MessageType { - return _fastReflection_MsgCreatePermanentLockedAccount_messageType +func (x *fastReflection_MsgClawback) Type() protoreflect.MessageType { + return _fastReflection_MsgClawback_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgCreatePermanentLockedAccount) New() protoreflect.Message { - return new(fastReflection_MsgCreatePermanentLockedAccount) +func (x *fastReflection_MsgClawback) New() protoreflect.Message { + return new(fastReflection_MsgClawback) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgCreatePermanentLockedAccount) Interface() protoreflect.ProtoMessage { - return (*MsgCreatePermanentLockedAccount)(x) +func (x *fastReflection_MsgClawback) Interface() protoreflect.ProtoMessage { + return (*MsgClawback)(x) } // Range iterates over every populated field in an undefined order, @@ -1227,22 +4508,28 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) Interface() protoreflec // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgCreatePermanentLockedAccount) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_MsgClawback) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.FromAddress != "" { value := protoreflect.ValueOfString(x.FromAddress) - if !f(fd_MsgCreatePermanentLockedAccount_from_address, value) { + if !f(fd_MsgClawback_from_address, value) { return } } - if x.ToAddress != "" { - value := protoreflect.ValueOfString(x.ToAddress) - if !f(fd_MsgCreatePermanentLockedAccount_to_address, value) { + if x.FunderAddress != "" { + value := protoreflect.ValueOfString(x.FunderAddress) + if !f(fd_MsgClawback_funder_address, value) { return } } - if len(x.Amount) != 0 { - value := protoreflect.ValueOfList(&_MsgCreatePermanentLockedAccount_3_list{list: &x.Amount}) - if !f(fd_MsgCreatePermanentLockedAccount_amount, value) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgClawback_address, value) { + return + } + } + if x.DestAddress != "" { + value := protoreflect.ValueOfString(x.DestAddress) + if !f(fd_MsgClawback_dest_address, value) { return } } @@ -1259,19 +4546,21 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) Range(f func(protorefle // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgCreatePermanentLockedAccount) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgClawback) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.from_address": + case "cosmos.vesting.v1beta1.MsgClawback.from_address": return x.FromAddress != "" - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.to_address": - return x.ToAddress != "" - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount": - return len(x.Amount) != 0 + case "cosmos.vesting.v1beta1.MsgClawback.funder_address": + return x.FunderAddress != "" + case "cosmos.vesting.v1beta1.MsgClawback.address": + return x.Address != "" + case "cosmos.vesting.v1beta1.MsgClawback.dest_address": + return x.DestAddress != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgClawback")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgClawback does not contain field %s", fd.FullName())) } } @@ -1281,19 +4570,21 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) Has(fd protoreflect.Fie // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePermanentLockedAccount) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgClawback) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.from_address": + case "cosmos.vesting.v1beta1.MsgClawback.from_address": x.FromAddress = "" - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.to_address": - x.ToAddress = "" - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount": - x.Amount = nil + case "cosmos.vesting.v1beta1.MsgClawback.funder_address": + x.FunderAddress = "" + case "cosmos.vesting.v1beta1.MsgClawback.address": + x.Address = "" + case "cosmos.vesting.v1beta1.MsgClawback.dest_address": + x.DestAddress = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgClawback")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgClawback does not contain field %s", fd.FullName())) } } @@ -1303,25 +4594,25 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) Clear(fd protoreflect.F // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgCreatePermanentLockedAccount) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgClawback) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.from_address": + case "cosmos.vesting.v1beta1.MsgClawback.from_address": value := x.FromAddress return protoreflect.ValueOfString(value) - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.to_address": - value := x.ToAddress + case "cosmos.vesting.v1beta1.MsgClawback.funder_address": + value := x.FunderAddress + return protoreflect.ValueOfString(value) + case "cosmos.vesting.v1beta1.MsgClawback.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "cosmos.vesting.v1beta1.MsgClawback.dest_address": + value := x.DestAddress return protoreflect.ValueOfString(value) - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount": - if len(x.Amount) == 0 { - return protoreflect.ValueOfList(&_MsgCreatePermanentLockedAccount_3_list{}) - } - listValue := &_MsgCreatePermanentLockedAccount_3_list{list: &x.Amount} - return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgClawback")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgClawback does not contain field %s", descriptor.FullName())) } } @@ -1335,21 +4626,21 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) Get(descriptor protoref // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePermanentLockedAccount) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgClawback) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.from_address": + case "cosmos.vesting.v1beta1.MsgClawback.from_address": x.FromAddress = value.Interface().(string) - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.to_address": - x.ToAddress = value.Interface().(string) - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount": - lv := value.List() - clv := lv.(*_MsgCreatePermanentLockedAccount_3_list) - x.Amount = *clv.list + case "cosmos.vesting.v1beta1.MsgClawback.funder_address": + x.FunderAddress = value.Interface().(string) + case "cosmos.vesting.v1beta1.MsgClawback.address": + x.Address = value.Interface().(string) + case "cosmos.vesting.v1beta1.MsgClawback.dest_address": + x.DestAddress = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgClawback")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgClawback does not contain field %s", fd.FullName())) } } @@ -1363,53 +4654,52 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) Set(fd protoreflect.Fie // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePermanentLockedAccount) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgClawback) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount": - if x.Amount == nil { - x.Amount = []*v1beta1.Coin{} - } - value := &_MsgCreatePermanentLockedAccount_3_list{list: &x.Amount} - return protoreflect.ValueOfList(value) - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.from_address": - panic(fmt.Errorf("field from_address of message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount is not mutable")) - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.to_address": - panic(fmt.Errorf("field to_address of message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount is not mutable")) + case "cosmos.vesting.v1beta1.MsgClawback.from_address": + panic(fmt.Errorf("field from_address of message cosmos.vesting.v1beta1.MsgClawback is not mutable")) + case "cosmos.vesting.v1beta1.MsgClawback.funder_address": + panic(fmt.Errorf("field funder_address of message cosmos.vesting.v1beta1.MsgClawback is not mutable")) + case "cosmos.vesting.v1beta1.MsgClawback.address": + panic(fmt.Errorf("field address of message cosmos.vesting.v1beta1.MsgClawback is not mutable")) + case "cosmos.vesting.v1beta1.MsgClawback.dest_address": + panic(fmt.Errorf("field dest_address of message cosmos.vesting.v1beta1.MsgClawback is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgClawback")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgClawback does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgCreatePermanentLockedAccount) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgClawback) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.from_address": + case "cosmos.vesting.v1beta1.MsgClawback.from_address": return protoreflect.ValueOfString("") - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.to_address": + case "cosmos.vesting.v1beta1.MsgClawback.funder_address": + return protoreflect.ValueOfString("") + case "cosmos.vesting.v1beta1.MsgClawback.address": + return protoreflect.ValueOfString("") + case "cosmos.vesting.v1beta1.MsgClawback.dest_address": return protoreflect.ValueOfString("") - case "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount": - list := []*v1beta1.Coin{} - return protoreflect.ValueOfList(&_MsgCreatePermanentLockedAccount_3_list{list: &list}) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgClawback")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgClawback does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgCreatePermanentLockedAccount) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgClawback) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgClawback", d.FullName())) } panic("unreachable") } @@ -1417,7 +4707,7 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) WhichOneof(d protorefle // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgCreatePermanentLockedAccount) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgClawback) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1428,7 +4718,7 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) GetUnknown() protorefle // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePermanentLockedAccount) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgClawback) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1440,7 +4730,7 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) SetUnknown(fields proto // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_MsgCreatePermanentLockedAccount) IsValid() bool { +func (x *fastReflection_MsgClawback) IsValid() bool { return x != nil } @@ -1450,9 +4740,9 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgCreatePermanentLockedAccount) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgClawback) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgCreatePermanentLockedAccount) + x := input.Message.Interface().(*MsgClawback) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1468,15 +4758,17 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) ProtoMethods() *protoif if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.ToAddress) + l = len(x.FunderAddress) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if len(x.Amount) > 0 { - for _, e := range x.Amount { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.DestAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -1488,7 +4780,7 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) ProtoMethods() *protoif } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgCreatePermanentLockedAccount) + x := input.Message.Interface().(*MsgClawback) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1507,26 +4799,24 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) ProtoMethods() *protoif i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Amount) > 0 { - for iNdEx := len(x.Amount) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Amount[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x1a - } + if len(x.DestAddress) > 0 { + i -= len(x.DestAddress) + copy(dAtA[i:], x.DestAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DestAddress))) + i-- + dAtA[i] = 0x22 } - if len(x.ToAddress) > 0 { - i -= len(x.ToAddress) - copy(dAtA[i:], x.ToAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ToAddress))) + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0x1a + } + if len(x.FunderAddress) > 0 { + i -= len(x.FunderAddress) + copy(dAtA[i:], x.FunderAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.FunderAddress))) i-- dAtA[i] = 0x12 } @@ -1548,7 +4838,7 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) ProtoMethods() *protoif }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgCreatePermanentLockedAccount) + x := input.Message.Interface().(*MsgClawback) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1580,10 +4870,10 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) ProtoMethods() *protoif fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePermanentLockedAccount: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgClawback: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePermanentLockedAccount: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgClawback: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1620,7 +4910,7 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) ProtoMethods() *protoif iNdEx = postIndex case 2: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field FunderAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1648,13 +4938,13 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) ProtoMethods() *protoif if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.ToAddress = string(dAtA[iNdEx:postIndex]) + x.FunderAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1664,25 +4954,55 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) ProtoMethods() *protoif } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Amount = append(x.Amount, &v1beta1.Coin{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount[len(x.Amount)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DestAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } + x.DestAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1720,24 +5040,24 @@ func (x *fastReflection_MsgCreatePermanentLockedAccount) ProtoMethods() *protoif } var ( - md_MsgCreatePermanentLockedAccountResponse protoreflect.MessageDescriptor + md_MsgClawbackResponse protoreflect.MessageDescriptor ) func init() { file_cosmos_vesting_v1beta1_tx_proto_init() - md_MsgCreatePermanentLockedAccountResponse = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgCreatePermanentLockedAccountResponse") + md_MsgClawbackResponse = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgClawbackResponse") } -var _ protoreflect.Message = (*fastReflection_MsgCreatePermanentLockedAccountResponse)(nil) +var _ protoreflect.Message = (*fastReflection_MsgClawbackResponse)(nil) -type fastReflection_MsgCreatePermanentLockedAccountResponse MsgCreatePermanentLockedAccountResponse +type fastReflection_MsgClawbackResponse MsgClawbackResponse -func (x *MsgCreatePermanentLockedAccountResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgCreatePermanentLockedAccountResponse)(x) +func (x *MsgClawbackResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgClawbackResponse)(x) } -func (x *MsgCreatePermanentLockedAccountResponse) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[3] +func (x *MsgClawbackResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1748,43 +5068,43 @@ func (x *MsgCreatePermanentLockedAccountResponse) slowProtoReflect() protoreflec return mi.MessageOf(x) } -var _fastReflection_MsgCreatePermanentLockedAccountResponse_messageType fastReflection_MsgCreatePermanentLockedAccountResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgCreatePermanentLockedAccountResponse_messageType{} +var _fastReflection_MsgClawbackResponse_messageType fastReflection_MsgClawbackResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgClawbackResponse_messageType{} -type fastReflection_MsgCreatePermanentLockedAccountResponse_messageType struct{} +type fastReflection_MsgClawbackResponse_messageType struct{} -func (x fastReflection_MsgCreatePermanentLockedAccountResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgCreatePermanentLockedAccountResponse)(nil) +func (x fastReflection_MsgClawbackResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgClawbackResponse)(nil) } -func (x fastReflection_MsgCreatePermanentLockedAccountResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgCreatePermanentLockedAccountResponse) +func (x fastReflection_MsgClawbackResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgClawbackResponse) } -func (x fastReflection_MsgCreatePermanentLockedAccountResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreatePermanentLockedAccountResponse +func (x fastReflection_MsgClawbackResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgClawbackResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreatePermanentLockedAccountResponse +func (x *fastReflection_MsgClawbackResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgClawbackResponse } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgCreatePermanentLockedAccountResponse_messageType +func (x *fastReflection_MsgClawbackResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgClawbackResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) New() protoreflect.Message { - return new(fastReflection_MsgCreatePermanentLockedAccountResponse) +func (x *fastReflection_MsgClawbackResponse) New() protoreflect.Message { + return new(fastReflection_MsgClawbackResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Interface() protoreflect.ProtoMessage { - return (*MsgCreatePermanentLockedAccountResponse)(x) +func (x *fastReflection_MsgClawbackResponse) Interface() protoreflect.ProtoMessage { + return (*MsgClawbackResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -1792,7 +5112,7 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Interface() pro // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_MsgClawbackResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { } // Has reports whether a field is populated. @@ -1806,13 +5126,13 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Range(f func(pr // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgClawbackResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgClawbackResponse")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgClawbackResponse does not contain field %s", fd.FullName())) } } @@ -1822,13 +5142,13 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Has(fd protoref // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgClawbackResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgClawbackResponse")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgClawbackResponse does not contain field %s", fd.FullName())) } } @@ -1838,13 +5158,13 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Clear(fd protor // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgClawbackResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgClawbackResponse")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgClawbackResponse does not contain field %s", descriptor.FullName())) } } @@ -1858,13 +5178,13 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Get(descriptor // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgClawbackResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgClawbackResponse")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgClawbackResponse does not contain field %s", fd.FullName())) } } @@ -1878,36 +5198,36 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Set(fd protoref // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgClawbackResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgClawbackResponse")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgClawbackResponse does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgClawbackResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgClawbackResponse")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgClawbackResponse does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgClawbackResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgClawbackResponse", d.FullName())) } panic("unreachable") } @@ -1915,7 +5235,7 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) WhichOneof(d pr // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgClawbackResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1926,7 +5246,7 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) GetUnknown() pr // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgClawbackResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1938,7 +5258,7 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) SetUnknown(fiel // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) IsValid() bool { +func (x *fastReflection_MsgClawbackResponse) IsValid() bool { return x != nil } @@ -1948,9 +5268,9 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) IsValid() bool // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgClawbackResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgCreatePermanentLockedAccountResponse) + x := input.Message.Interface().(*MsgClawbackResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1972,7 +5292,7 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) ProtoMethods() } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgCreatePermanentLockedAccountResponse) + x := input.Message.Interface().(*MsgClawbackResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2002,7 +5322,7 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) ProtoMethods() }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgCreatePermanentLockedAccountResponse) + x := input.Message.Interface().(*MsgClawbackResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2034,10 +5354,10 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) ProtoMethods() fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePermanentLockedAccountResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgClawbackResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePermanentLockedAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgClawbackResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2075,84 +5395,29 @@ func (x *fastReflection_MsgCreatePermanentLockedAccountResponse) ProtoMethods() } } -var _ protoreflect.List = (*_MsgCreatePeriodicVestingAccount_4_list)(nil) - -type _MsgCreatePeriodicVestingAccount_4_list struct { - list *[]*Period -} - -func (x *_MsgCreatePeriodicVestingAccount_4_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MsgCreatePeriodicVestingAccount_4_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MsgCreatePeriodicVestingAccount_4_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Period) - (*x.list)[i] = concreteValue -} - -func (x *_MsgCreatePeriodicVestingAccount_4_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Period) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgCreatePeriodicVestingAccount_4_list) AppendMutable() protoreflect.Value { - v := new(Period) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgCreatePeriodicVestingAccount_4_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MsgCreatePeriodicVestingAccount_4_list) NewElement() protoreflect.Value { - v := new(Period) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgCreatePeriodicVestingAccount_4_list) IsValid() bool { - return x.list != nil -} - var ( - md_MsgCreatePeriodicVestingAccount protoreflect.MessageDescriptor - fd_MsgCreatePeriodicVestingAccount_from_address protoreflect.FieldDescriptor - fd_MsgCreatePeriodicVestingAccount_to_address protoreflect.FieldDescriptor - fd_MsgCreatePeriodicVestingAccount_start_time protoreflect.FieldDescriptor - fd_MsgCreatePeriodicVestingAccount_vesting_periods protoreflect.FieldDescriptor + md_MsgReturnGrants protoreflect.MessageDescriptor + fd_MsgReturnGrants_from_address protoreflect.FieldDescriptor + fd_MsgReturnGrants_address protoreflect.FieldDescriptor ) func init() { file_cosmos_vesting_v1beta1_tx_proto_init() - md_MsgCreatePeriodicVestingAccount = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgCreatePeriodicVestingAccount") - fd_MsgCreatePeriodicVestingAccount_from_address = md_MsgCreatePeriodicVestingAccount.Fields().ByName("from_address") - fd_MsgCreatePeriodicVestingAccount_to_address = md_MsgCreatePeriodicVestingAccount.Fields().ByName("to_address") - fd_MsgCreatePeriodicVestingAccount_start_time = md_MsgCreatePeriodicVestingAccount.Fields().ByName("start_time") - fd_MsgCreatePeriodicVestingAccount_vesting_periods = md_MsgCreatePeriodicVestingAccount.Fields().ByName("vesting_periods") + md_MsgReturnGrants = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgReturnGrants") + fd_MsgReturnGrants_from_address = md_MsgReturnGrants.Fields().ByName("from_address") + fd_MsgReturnGrants_address = md_MsgReturnGrants.Fields().ByName("address") } -var _ protoreflect.Message = (*fastReflection_MsgCreatePeriodicVestingAccount)(nil) +var _ protoreflect.Message = (*fastReflection_MsgReturnGrants)(nil) -type fastReflection_MsgCreatePeriodicVestingAccount MsgCreatePeriodicVestingAccount +type fastReflection_MsgReturnGrants MsgReturnGrants -func (x *MsgCreatePeriodicVestingAccount) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgCreatePeriodicVestingAccount)(x) +func (x *MsgReturnGrants) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgReturnGrants)(x) } -func (x *MsgCreatePeriodicVestingAccount) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[4] +func (x *MsgReturnGrants) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2163,43 +5428,43 @@ func (x *MsgCreatePeriodicVestingAccount) slowProtoReflect() protoreflect.Messag return mi.MessageOf(x) } -var _fastReflection_MsgCreatePeriodicVestingAccount_messageType fastReflection_MsgCreatePeriodicVestingAccount_messageType -var _ protoreflect.MessageType = fastReflection_MsgCreatePeriodicVestingAccount_messageType{} +var _fastReflection_MsgReturnGrants_messageType fastReflection_MsgReturnGrants_messageType +var _ protoreflect.MessageType = fastReflection_MsgReturnGrants_messageType{} -type fastReflection_MsgCreatePeriodicVestingAccount_messageType struct{} +type fastReflection_MsgReturnGrants_messageType struct{} -func (x fastReflection_MsgCreatePeriodicVestingAccount_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgCreatePeriodicVestingAccount)(nil) +func (x fastReflection_MsgReturnGrants_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgReturnGrants)(nil) } -func (x fastReflection_MsgCreatePeriodicVestingAccount_messageType) New() protoreflect.Message { - return new(fastReflection_MsgCreatePeriodicVestingAccount) +func (x fastReflection_MsgReturnGrants_messageType) New() protoreflect.Message { + return new(fastReflection_MsgReturnGrants) } -func (x fastReflection_MsgCreatePeriodicVestingAccount_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreatePeriodicVestingAccount +func (x fastReflection_MsgReturnGrants_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgReturnGrants } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreatePeriodicVestingAccount +func (x *fastReflection_MsgReturnGrants) Descriptor() protoreflect.MessageDescriptor { + return md_MsgReturnGrants } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) Type() protoreflect.MessageType { - return _fastReflection_MsgCreatePeriodicVestingAccount_messageType +func (x *fastReflection_MsgReturnGrants) Type() protoreflect.MessageType { + return _fastReflection_MsgReturnGrants_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) New() protoreflect.Message { - return new(fastReflection_MsgCreatePeriodicVestingAccount) +func (x *fastReflection_MsgReturnGrants) New() protoreflect.Message { + return new(fastReflection_MsgReturnGrants) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) Interface() protoreflect.ProtoMessage { - return (*MsgCreatePeriodicVestingAccount)(x) +func (x *fastReflection_MsgReturnGrants) Interface() protoreflect.ProtoMessage { + return (*MsgReturnGrants)(x) } // Range iterates over every populated field in an undefined order, @@ -2207,28 +5472,16 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) Interface() protoreflec // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_MsgReturnGrants) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.FromAddress != "" { value := protoreflect.ValueOfString(x.FromAddress) - if !f(fd_MsgCreatePeriodicVestingAccount_from_address, value) { - return - } - } - if x.ToAddress != "" { - value := protoreflect.ValueOfString(x.ToAddress) - if !f(fd_MsgCreatePeriodicVestingAccount_to_address, value) { - return - } - } - if x.StartTime != int64(0) { - value := protoreflect.ValueOfInt64(x.StartTime) - if !f(fd_MsgCreatePeriodicVestingAccount_start_time, value) { + if !f(fd_MsgReturnGrants_from_address, value) { return } } - if len(x.VestingPeriods) != 0 { - value := protoreflect.ValueOfList(&_MsgCreatePeriodicVestingAccount_4_list{list: &x.VestingPeriods}) - if !f(fd_MsgCreatePeriodicVestingAccount_vesting_periods, value) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgReturnGrants_address, value) { return } } @@ -2245,21 +5498,17 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) Range(f func(protorefle // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgReturnGrants) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.from_address": + case "cosmos.vesting.v1beta1.MsgReturnGrants.from_address": return x.FromAddress != "" - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.to_address": - return x.ToAddress != "" - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.start_time": - return x.StartTime != int64(0) - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods": - return len(x.VestingPeriods) != 0 + case "cosmos.vesting.v1beta1.MsgReturnGrants.address": + return x.Address != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgReturnGrants")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgReturnGrants does not contain field %s", fd.FullName())) } } @@ -2269,21 +5518,17 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) Has(fd protoreflect.Fie // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgReturnGrants) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.from_address": + case "cosmos.vesting.v1beta1.MsgReturnGrants.from_address": x.FromAddress = "" - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.to_address": - x.ToAddress = "" - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.start_time": - x.StartTime = int64(0) - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods": - x.VestingPeriods = nil + case "cosmos.vesting.v1beta1.MsgReturnGrants.address": + x.Address = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgReturnGrants")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgReturnGrants does not contain field %s", fd.FullName())) } } @@ -2293,28 +5538,19 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) Clear(fd protoreflect.F // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgReturnGrants) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.from_address": + case "cosmos.vesting.v1beta1.MsgReturnGrants.from_address": value := x.FromAddress return protoreflect.ValueOfString(value) - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.to_address": - value := x.ToAddress + case "cosmos.vesting.v1beta1.MsgReturnGrants.address": + value := x.Address return protoreflect.ValueOfString(value) - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.start_time": - value := x.StartTime - return protoreflect.ValueOfInt64(value) - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods": - if len(x.VestingPeriods) == 0 { - return protoreflect.ValueOfList(&_MsgCreatePeriodicVestingAccount_4_list{}) - } - listValue := &_MsgCreatePeriodicVestingAccount_4_list{list: &x.VestingPeriods} - return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgReturnGrants")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgReturnGrants does not contain field %s", descriptor.FullName())) } } @@ -2328,23 +5564,17 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) Get(descriptor protoref // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgReturnGrants) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.from_address": - x.FromAddress = value.Interface().(string) - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.to_address": - x.ToAddress = value.Interface().(string) - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.start_time": - x.StartTime = value.Int() - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods": - lv := value.List() - clv := lv.(*_MsgCreatePeriodicVestingAccount_4_list) - x.VestingPeriods = *clv.list + case "cosmos.vesting.v1beta1.MsgReturnGrants.from_address": + x.FromAddress = value.Interface().(string) + case "cosmos.vesting.v1beta1.MsgReturnGrants.address": + x.Address = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgReturnGrants")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgReturnGrants does not contain field %s", fd.FullName())) } } @@ -2358,57 +5588,44 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) Set(fd protoreflect.Fie // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgReturnGrants) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods": - if x.VestingPeriods == nil { - x.VestingPeriods = []*Period{} - } - value := &_MsgCreatePeriodicVestingAccount_4_list{list: &x.VestingPeriods} - return protoreflect.ValueOfList(value) - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.from_address": - panic(fmt.Errorf("field from_address of message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount is not mutable")) - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.to_address": - panic(fmt.Errorf("field to_address of message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount is not mutable")) - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.start_time": - panic(fmt.Errorf("field start_time of message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount is not mutable")) + case "cosmos.vesting.v1beta1.MsgReturnGrants.from_address": + panic(fmt.Errorf("field from_address of message cosmos.vesting.v1beta1.MsgReturnGrants is not mutable")) + case "cosmos.vesting.v1beta1.MsgReturnGrants.address": + panic(fmt.Errorf("field address of message cosmos.vesting.v1beta1.MsgReturnGrants is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgReturnGrants")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgReturnGrants does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgReturnGrants) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.from_address": + case "cosmos.vesting.v1beta1.MsgReturnGrants.from_address": return protoreflect.ValueOfString("") - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.to_address": + case "cosmos.vesting.v1beta1.MsgReturnGrants.address": return protoreflect.ValueOfString("") - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.start_time": - return protoreflect.ValueOfInt64(int64(0)) - case "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods": - list := []*Period{} - return protoreflect.ValueOfList(&_MsgCreatePeriodicVestingAccount_4_list{list: &list}) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgReturnGrants")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgReturnGrants does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgReturnGrants) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgReturnGrants", d.FullName())) } panic("unreachable") } @@ -2416,7 +5633,7 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) WhichOneof(d protorefle // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgReturnGrants) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2427,7 +5644,7 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) GetUnknown() protorefle // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgReturnGrants) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2439,7 +5656,7 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) SetUnknown(fields proto // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) IsValid() bool { +func (x *fastReflection_MsgReturnGrants) IsValid() bool { return x != nil } @@ -2449,9 +5666,9 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgCreatePeriodicVestingAccount) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgReturnGrants) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgCreatePeriodicVestingAccount) + x := input.Message.Interface().(*MsgReturnGrants) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2467,19 +5684,10 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) ProtoMethods() *protoif if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.ToAddress) + l = len(x.Address) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if x.StartTime != 0 { - n += 1 + runtime.Sov(uint64(x.StartTime)) - } - if len(x.VestingPeriods) > 0 { - for _, e := range x.VestingPeriods { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -2490,7 +5698,7 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) ProtoMethods() *protoif } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgCreatePeriodicVestingAccount) + x := input.Message.Interface().(*MsgReturnGrants) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2509,31 +5717,10 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) ProtoMethods() *protoif i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.VestingPeriods) > 0 { - for iNdEx := len(x.VestingPeriods) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.VestingPeriods[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x22 - } - } - if x.StartTime != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.StartTime)) - i-- - dAtA[i] = 0x18 - } - if len(x.ToAddress) > 0 { - i -= len(x.ToAddress) - copy(dAtA[i:], x.ToAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ToAddress))) + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) i-- dAtA[i] = 0x12 } @@ -2555,7 +5742,7 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) ProtoMethods() *protoif }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgCreatePeriodicVestingAccount) + x := input.Message.Interface().(*MsgReturnGrants) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2587,10 +5774,10 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) ProtoMethods() *protoif fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePeriodicVestingAccount: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgReturnGrants: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePeriodicVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgReturnGrants: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2627,7 +5814,7 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) ProtoMethods() *protoif iNdEx = postIndex case 2: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2655,60 +5842,7 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) ProtoMethods() *protoif if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.ToAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) - } - x.StartTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.StartTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field VestingPeriods", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.VestingPeriods = append(x.VestingPeriods, &Period{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.VestingPeriods[len(x.VestingPeriods)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } + x.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2746,24 +5880,24 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccount) ProtoMethods() *protoif } var ( - md_MsgCreatePeriodicVestingAccountResponse protoreflect.MessageDescriptor + md_MsgReturnGrantsResponse protoreflect.MessageDescriptor ) func init() { file_cosmos_vesting_v1beta1_tx_proto_init() - md_MsgCreatePeriodicVestingAccountResponse = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgCreatePeriodicVestingAccountResponse") + md_MsgReturnGrantsResponse = File_cosmos_vesting_v1beta1_tx_proto.Messages().ByName("MsgReturnGrantsResponse") } -var _ protoreflect.Message = (*fastReflection_MsgCreatePeriodicVestingAccountResponse)(nil) +var _ protoreflect.Message = (*fastReflection_MsgReturnGrantsResponse)(nil) -type fastReflection_MsgCreatePeriodicVestingAccountResponse MsgCreatePeriodicVestingAccountResponse +type fastReflection_MsgReturnGrantsResponse MsgReturnGrantsResponse -func (x *MsgCreatePeriodicVestingAccountResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgCreatePeriodicVestingAccountResponse)(x) +func (x *MsgReturnGrantsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgReturnGrantsResponse)(x) } -func (x *MsgCreatePeriodicVestingAccountResponse) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[5] +func (x *MsgReturnGrantsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2774,43 +5908,43 @@ func (x *MsgCreatePeriodicVestingAccountResponse) slowProtoReflect() protoreflec return mi.MessageOf(x) } -var _fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType{} +var _fastReflection_MsgReturnGrantsResponse_messageType fastReflection_MsgReturnGrantsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgReturnGrantsResponse_messageType{} -type fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType struct{} +type fastReflection_MsgReturnGrantsResponse_messageType struct{} -func (x fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgCreatePeriodicVestingAccountResponse)(nil) +func (x fastReflection_MsgReturnGrantsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgReturnGrantsResponse)(nil) } -func (x fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgCreatePeriodicVestingAccountResponse) +func (x fastReflection_MsgReturnGrantsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgReturnGrantsResponse) } -func (x fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreatePeriodicVestingAccountResponse +func (x fastReflection_MsgReturnGrantsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgReturnGrantsResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreatePeriodicVestingAccountResponse +func (x *fastReflection_MsgReturnGrantsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgReturnGrantsResponse } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgCreatePeriodicVestingAccountResponse_messageType +func (x *fastReflection_MsgReturnGrantsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgReturnGrantsResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) New() protoreflect.Message { - return new(fastReflection_MsgCreatePeriodicVestingAccountResponse) +func (x *fastReflection_MsgReturnGrantsResponse) New() protoreflect.Message { + return new(fastReflection_MsgReturnGrantsResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Interface() protoreflect.ProtoMessage { - return (*MsgCreatePeriodicVestingAccountResponse)(x) +func (x *fastReflection_MsgReturnGrantsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgReturnGrantsResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -2818,7 +5952,7 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Interface() pro // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_MsgReturnGrantsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { } // Has reports whether a field is populated. @@ -2832,13 +5966,13 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Range(f func(pr // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgReturnGrantsResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgReturnGrantsResponse")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgReturnGrantsResponse does not contain field %s", fd.FullName())) } } @@ -2848,13 +5982,13 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Has(fd protoref // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgReturnGrantsResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgReturnGrantsResponse")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgReturnGrantsResponse does not contain field %s", fd.FullName())) } } @@ -2864,13 +5998,13 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Clear(fd protor // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgReturnGrantsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgReturnGrantsResponse")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgReturnGrantsResponse does not contain field %s", descriptor.FullName())) } } @@ -2884,13 +6018,13 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Get(descriptor // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgReturnGrantsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgReturnGrantsResponse")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgReturnGrantsResponse does not contain field %s", fd.FullName())) } } @@ -2904,36 +6038,36 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Set(fd protoref // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgReturnGrantsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgReturnGrantsResponse")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgReturnGrantsResponse does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgReturnGrantsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.MsgReturnGrantsResponse")) } - panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message cosmos.vesting.v1beta1.MsgReturnGrantsResponse does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgReturnGrantsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.MsgReturnGrantsResponse", d.FullName())) } panic("unreachable") } @@ -2941,7 +6075,7 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) WhichOneof(d pr // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgReturnGrantsResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2952,7 +6086,7 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) GetUnknown() pr // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgReturnGrantsResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2964,7 +6098,7 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) SetUnknown(fiel // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) IsValid() bool { +func (x *fastReflection_MsgReturnGrantsResponse) IsValid() bool { return x != nil } @@ -2974,9 +6108,9 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) IsValid() bool // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgReturnGrantsResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgCreatePeriodicVestingAccountResponse) + x := input.Message.Interface().(*MsgReturnGrantsResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2998,7 +6132,7 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) ProtoMethods() } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgCreatePeriodicVestingAccountResponse) + x := input.Message.Interface().(*MsgReturnGrantsResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -3028,7 +6162,7 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) ProtoMethods() }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgCreatePeriodicVestingAccountResponse) + x := input.Message.Interface().(*MsgReturnGrantsResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -3060,10 +6194,10 @@ func (x *fastReflection_MsgCreatePeriodicVestingAccountResponse) ProtoMethods() fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePeriodicVestingAccountResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgReturnGrantsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePeriodicVestingAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgReturnGrantsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3121,65 +6255,157 @@ type MsgCreateVestingAccount struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty"` - Amount []*v1beta1.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount,omitempty"` - // end of vesting as unix time (in seconds). - EndTime int64 `protobuf:"varint,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` - Delayed bool `protobuf:"varint,5,opt,name=delayed,proto3" json:"delayed,omitempty"` -} - -func (x *MsgCreateVestingAccount) Reset() { - *x = MsgCreateVestingAccount{} + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty"` + Amount []*v1beta1.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount,omitempty"` + // end of vesting as unix time (in seconds). + EndTime int64 `protobuf:"varint,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` + Delayed bool `protobuf:"varint,5,opt,name=delayed,proto3" json:"delayed,omitempty"` + Merge bool `protobuf:"varint,6,opt,name=merge,proto3" json:"merge,omitempty"` +} + +func (x *MsgCreateVestingAccount) Reset() { + *x = MsgCreateVestingAccount{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCreateVestingAccount) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCreateVestingAccount) ProtoMessage() {} + +// Deprecated: Use MsgCreateVestingAccount.ProtoReflect.Descriptor instead. +func (*MsgCreateVestingAccount) Descriptor() ([]byte, []int) { + return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgCreateVestingAccount) GetFromAddress() string { + if x != nil { + return x.FromAddress + } + return "" +} + +func (x *MsgCreateVestingAccount) GetToAddress() string { + if x != nil { + return x.ToAddress + } + return "" +} + +func (x *MsgCreateVestingAccount) GetAmount() []*v1beta1.Coin { + if x != nil { + return x.Amount + } + return nil +} + +func (x *MsgCreateVestingAccount) GetEndTime() int64 { + if x != nil { + return x.EndTime + } + return 0 +} + +func (x *MsgCreateVestingAccount) GetDelayed() bool { + if x != nil { + return x.Delayed + } + return false +} + +func (x *MsgCreateVestingAccount) GetMerge() bool { + if x != nil { + return x.Merge + } + return false +} + +// MsgCreateClawbackVestingAccount defines a message that enables creating a ClawbackVestingAccount. +type MsgCreateClawbackVestingAccount struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Address of the account providing the funds, which must also sign the request. + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // Address of the account to receive the funds. + ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty"` + // Start time of the vesting. Periods start relative to this time. + StartTime int64 `protobuf:"varint,3,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + // Unlocking events as a sequence of durations and amounts, starting relative to start_time. + LockupPeriods []*Period `protobuf:"bytes,4,rep,name=lockup_periods,json=lockupPeriods,proto3" json:"lockup_periods,omitempty"` + // Vesting events as a sequence of durations and amounts, starting relative to start_time. + VestingPeriods []*Period `protobuf:"bytes,5,rep,name=vesting_periods,json=vestingPeriods,proto3" json:"vesting_periods,omitempty"` + // If true, merge this new grant into an existing ClawbackVestingAccount, + // or create it if it does not exist. If false, creates a new account. + // New grants to an existing account must be from the same from_address. + Merge bool `protobuf:"varint,6,opt,name=merge,proto3" json:"merge,omitempty"` +} + +func (x *MsgCreateClawbackVestingAccount) Reset() { + *x = MsgCreateClawbackVestingAccount{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[0] + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgCreateVestingAccount) String() string { +func (x *MsgCreateClawbackVestingAccount) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgCreateVestingAccount) ProtoMessage() {} +func (*MsgCreateClawbackVestingAccount) ProtoMessage() {} -// Deprecated: Use MsgCreateVestingAccount.ProtoReflect.Descriptor instead. -func (*MsgCreateVestingAccount) Descriptor() ([]byte, []int) { - return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{0} +// Deprecated: Use MsgCreateClawbackVestingAccount.ProtoReflect.Descriptor instead. +func (*MsgCreateClawbackVestingAccount) Descriptor() ([]byte, []int) { + return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{1} } -func (x *MsgCreateVestingAccount) GetFromAddress() string { +func (x *MsgCreateClawbackVestingAccount) GetFromAddress() string { if x != nil { return x.FromAddress } return "" } -func (x *MsgCreateVestingAccount) GetToAddress() string { +func (x *MsgCreateClawbackVestingAccount) GetToAddress() string { if x != nil { return x.ToAddress } return "" } -func (x *MsgCreateVestingAccount) GetAmount() []*v1beta1.Coin { +func (x *MsgCreateClawbackVestingAccount) GetStartTime() int64 { if x != nil { - return x.Amount + return x.StartTime + } + return 0 +} + +func (x *MsgCreateClawbackVestingAccount) GetLockupPeriods() []*Period { + if x != nil { + return x.LockupPeriods } return nil } -func (x *MsgCreateVestingAccount) GetEndTime() int64 { +func (x *MsgCreateClawbackVestingAccount) GetVestingPeriods() []*Period { if x != nil { - return x.EndTime + return x.VestingPeriods } - return 0 + return nil } -func (x *MsgCreateVestingAccount) GetDelayed() bool { +func (x *MsgCreateClawbackVestingAccount) GetMerge() bool { if x != nil { - return x.Delayed + return x.Merge } return false } @@ -3194,7 +6420,7 @@ type MsgCreateVestingAccountResponse struct { func (x *MsgCreateVestingAccountResponse) Reset() { *x = MsgCreateVestingAccountResponse{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[1] + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3208,7 +6434,7 @@ func (*MsgCreateVestingAccountResponse) ProtoMessage() {} // Deprecated: Use MsgCreateVestingAccountResponse.ProtoReflect.Descriptor instead. func (*MsgCreateVestingAccountResponse) Descriptor() ([]byte, []int) { - return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{1} + return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{2} } // MsgCreatePermanentLockedAccount defines a message that enables creating a permanent @@ -3228,7 +6454,7 @@ type MsgCreatePermanentLockedAccount struct { func (x *MsgCreatePermanentLockedAccount) Reset() { *x = MsgCreatePermanentLockedAccount{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[2] + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3242,7 +6468,7 @@ func (*MsgCreatePermanentLockedAccount) ProtoMessage() {} // Deprecated: Use MsgCreatePermanentLockedAccount.ProtoReflect.Descriptor instead. func (*MsgCreatePermanentLockedAccount) Descriptor() ([]byte, []int) { - return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{2} + return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{3} } func (x *MsgCreatePermanentLockedAccount) GetFromAddress() string { @@ -3278,7 +6504,7 @@ type MsgCreatePermanentLockedAccountResponse struct { func (x *MsgCreatePermanentLockedAccountResponse) Reset() { *x = MsgCreatePermanentLockedAccountResponse{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[3] + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3292,7 +6518,7 @@ func (*MsgCreatePermanentLockedAccountResponse) ProtoMessage() {} // Deprecated: Use MsgCreatePermanentLockedAccountResponse.ProtoReflect.Descriptor instead. func (*MsgCreatePermanentLockedAccountResponse) Descriptor() ([]byte, []int) { - return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{3} + return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{4} } // MsgCreateVestingAccount defines a message that enables creating a vesting @@ -3309,12 +6535,13 @@ type MsgCreatePeriodicVestingAccount struct { // start of vesting as unix time (in seconds). StartTime int64 `protobuf:"varint,3,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` VestingPeriods []*Period `protobuf:"bytes,4,rep,name=vesting_periods,json=vestingPeriods,proto3" json:"vesting_periods,omitempty"` + Merge bool `protobuf:"varint,5,opt,name=merge,proto3" json:"merge,omitempty"` } func (x *MsgCreatePeriodicVestingAccount) Reset() { *x = MsgCreatePeriodicVestingAccount{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[4] + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3328,7 +6555,7 @@ func (*MsgCreatePeriodicVestingAccount) ProtoMessage() {} // Deprecated: Use MsgCreatePeriodicVestingAccount.ProtoReflect.Descriptor instead. func (*MsgCreatePeriodicVestingAccount) Descriptor() ([]byte, []int) { - return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{4} + return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{5} } func (x *MsgCreatePeriodicVestingAccount) GetFromAddress() string { @@ -3359,6 +6586,13 @@ func (x *MsgCreatePeriodicVestingAccount) GetVestingPeriods() []*Period { return nil } +func (x *MsgCreatePeriodicVestingAccount) GetMerge() bool { + if x != nil { + return x.Merge + } + return false +} + // MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount // response type. // @@ -3372,7 +6606,7 @@ type MsgCreatePeriodicVestingAccountResponse struct { func (x *MsgCreatePeriodicVestingAccountResponse) Reset() { *x = MsgCreatePeriodicVestingAccountResponse{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[5] + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3386,7 +6620,200 @@ func (*MsgCreatePeriodicVestingAccountResponse) ProtoMessage() {} // Deprecated: Use MsgCreatePeriodicVestingAccountResponse.ProtoReflect.Descriptor instead. func (*MsgCreatePeriodicVestingAccountResponse) Descriptor() ([]byte, []int) { - return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{5} + return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{6} +} + +// MsgCreateClawbackVestingAccountResponse defines the MsgCreateClawbackVestingAccount response type. +type MsgCreateClawbackVestingAccountResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgCreateClawbackVestingAccountResponse) Reset() { + *x = MsgCreateClawbackVestingAccountResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCreateClawbackVestingAccountResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCreateClawbackVestingAccountResponse) ProtoMessage() {} + +// Deprecated: Use MsgCreateClawbackVestingAccountResponse.ProtoReflect.Descriptor instead. +func (*MsgCreateClawbackVestingAccountResponse) Descriptor() ([]byte, []int) { + return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{7} +} + +// MsgClawback defines a message that removes unvested tokens from a ClawbackVestingAccount. +type MsgClawback struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // funder_address is the address which funded the account + FunderAddress string `protobuf:"bytes,2,opt,name=funder_address,json=funderAddress,proto3" json:"funder_address,omitempty"` + // address is the address of the ClawbackVestingAccount to claw back from. + Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + // dest_address specifies where the clawed-back tokens should be transferred. + // If empty, the tokens will be transferred back to the original funder of the account. + DestAddress string `protobuf:"bytes,4,opt,name=dest_address,json=destAddress,proto3" json:"dest_address,omitempty"` +} + +func (x *MsgClawback) Reset() { + *x = MsgClawback{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgClawback) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgClawback) ProtoMessage() {} + +// Deprecated: Use MsgClawback.ProtoReflect.Descriptor instead. +func (*MsgClawback) Descriptor() ([]byte, []int) { + return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{8} +} + +func (x *MsgClawback) GetFromAddress() string { + if x != nil { + return x.FromAddress + } + return "" +} + +func (x *MsgClawback) GetFunderAddress() string { + if x != nil { + return x.FunderAddress + } + return "" +} + +func (x *MsgClawback) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *MsgClawback) GetDestAddress() string { + if x != nil { + return x.DestAddress + } + return "" +} + +// MsgClawbackResponse defines the MsgClawback response type. +type MsgClawbackResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgClawbackResponse) Reset() { + *x = MsgClawbackResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgClawbackResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgClawbackResponse) ProtoMessage() {} + +// Deprecated: Use MsgClawbackResponse.ProtoReflect.Descriptor instead. +func (*MsgClawbackResponse) Descriptor() ([]byte, []int) { + return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{9} +} + +// MsgReturnGrants defines a message for a grantee to return all granted assets, +// including delegated, undelegated and unbonding, vested and unvested, +// are transferred to the original funder of the account. Might not be complete if +// some vested assets have been transferred out of the account. Currently only applies to +// ClawbackVesting accounts. +type MsgReturnGrants struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *MsgReturnGrants) Reset() { + *x = MsgReturnGrants{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgReturnGrants) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgReturnGrants) ProtoMessage() {} + +// Deprecated: Use MsgReturnGrants.ProtoReflect.Descriptor instead. +func (*MsgReturnGrants) Descriptor() ([]byte, []int) { + return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{10} +} + +func (x *MsgReturnGrants) GetFromAddress() string { + if x != nil { + return x.FromAddress + } + return "" +} + +func (x *MsgReturnGrants) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +// MsgReturnGrantsResponse defines the ReturnGrants response type. +type MsgReturnGrantsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgReturnGrantsResponse) Reset() { + *x = MsgReturnGrantsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_vesting_v1beta1_tx_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgReturnGrantsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgReturnGrantsResponse) ProtoMessage() {} + +// Deprecated: Use MsgReturnGrantsResponse.ProtoReflect.Descriptor instead. +func (*MsgReturnGrantsResponse) Descriptor() ([]byte, []int) { + return file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP(), []int{11} } var File_cosmos_vesting_v1beta1_tx_proto protoreflect.FileDescriptor @@ -3405,7 +6832,7 @@ var file_cosmos_vesting_v1beta1_tx_proto_rawDesc = []byte{ 0x61, 0x31, 0x2f, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, - 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfd, 0x02, 0x0a, + 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x93, 0x03, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3b, 0x0a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, @@ -3425,100 +6852,183 @@ var file_cosmos_vesting_v1beta1_tx_proto_rawDesc = []byte{ 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x3a, 0x3c, - 0xe8, 0xa0, 0x1f, 0x01, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, 0x2a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, - 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x21, 0x0a, 0x1f, - 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0xcf, 0x02, 0x0a, 0x1f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, - 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x17, 0xf2, 0xde, 0x1f, 0x13, 0x79, - 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x22, 0x52, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, - 0x34, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x15, 0xf2, 0xde, 0x1f, 0x11, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x74, - 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x52, 0x09, 0x74, 0x6f, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x79, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, - 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, - 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, - 0x6e, 0x73, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, - 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x3a, 0x3f, 0xe8, 0xa0, 0x1f, 0x01, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, 0x2a, 0x25, 0x63, 0x6f, 0x73, 0x6d, + 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6d, + 0x65, 0x72, 0x67, 0x65, 0x3a, 0x3c, 0xe8, 0xa0, 0x1f, 0x01, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, + 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, 0x2a, 0x22, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0xc1, 0x03, 0x0a, 0x1f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x43, 0x6c, 0x61, 0x77, 0x62, 0x61, 0x63, 0x6b, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3a, 0x0a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x17, 0xf2, 0xde, + 0x1f, 0x13, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x22, 0x52, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x34, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x15, 0xf2, 0xde, 0x1f, 0x11, 0x79, 0x61, 0x6d, 0x6c, + 0x3a, 0x22, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x52, 0x09, 0x74, + 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x34, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x15, 0xf2, 0xde, + 0x1f, 0x11, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x22, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x4b, + 0x0a, 0x0e, 0x6c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0d, 0x6c, 0x6f, + 0x63, 0x6b, 0x75, 0x70, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x12, 0x4d, 0x0a, 0x0f, 0x76, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x18, 0x05, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x65, + 0x72, 0x69, 0x6f, 0x64, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0e, 0x76, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x65, + 0x72, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6d, 0x65, 0x72, 0x67, 0x65, + 0x3a, 0x44, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, 0x2a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x50, 0x65, 0x72, 0x6d, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x29, 0x0a, 0x27, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, - 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x97, 0x02, 0x0a, - 0x1f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, - 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, - 0x65, 0x12, 0x52, 0x0a, 0x0f, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x72, - 0x69, 0x6f, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, - 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, - 0x72, 0x69, 0x6f, 0x64, 0x73, 0x3a, 0x3f, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, + 0x43, 0x6c, 0x61, 0x77, 0x62, 0x61, 0x63, 0x6b, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x21, 0x0a, 0x1f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xcf, 0x02, 0x0a, 0x1f, 0x4d, 0x73, + 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, + 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3a, 0x0a, + 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x17, 0xf2, 0xde, 0x1f, 0x13, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x66, + 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x52, 0x0b, 0x66, 0x72, + 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x34, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x15, 0xf2, + 0xde, 0x1f, 0x11, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x22, 0x52, 0x09, 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x79, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, + 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, 0x2a, + 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, + 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x3f, 0xe8, 0xa0, 0x1f, 0x01, + 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x8a, 0xe7, 0xb0, 0x2a, 0x25, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x4c, 0x6f, + 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x29, 0x0a, 0x27, 0x4d, + 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, + 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xad, 0x02, 0x0a, 0x1f, 0x4d, 0x73, 0x67, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x72, + 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, + 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x52, 0x0a, 0x0f, 0x76, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x65, + 0x72, 0x69, 0x6f, 0x64, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x0e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x12, + 0x14, 0x0a, 0x05, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, + 0x6d, 0x65, 0x72, 0x67, 0x65, 0x3a, 0x3f, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, 0x2a, 0x25, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x56, 0x65, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x29, 0x0a, 0x27, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x32, 0xc5, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x80, 0x01, 0x0a, 0x14, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x2f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, + 0x65, 0x22, 0x29, 0x0a, 0x27, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, + 0x61, 0x77, 0x62, 0x61, 0x63, 0x6b, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xdf, 0x01, 0x0a, + 0x0b, 0x4d, 0x73, 0x67, 0x43, 0x6c, 0x61, 0x77, 0x62, 0x61, 0x63, 0x6b, 0x12, 0x3b, 0x0a, 0x0c, + 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x66, 0x72, + 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x66, 0x75, 0x6e, + 0x64, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x66, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x65, + 0x73, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x2f, 0x82, + 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x8a, 0xe7, 0xb0, 0x2a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, + 0x4d, 0x73, 0x67, 0x4d, 0x73, 0x67, 0x43, 0x6c, 0x61, 0x77, 0x62, 0x61, 0x63, 0x6b, 0x22, 0x15, + 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x43, 0x6c, 0x61, 0x77, 0x62, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, + 0x75, 0x72, 0x6e, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x3b, 0x0a, 0x0c, 0x66, 0x72, 0x6f, + 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x3a, 0x30, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, 0x2a, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, + 0x64, 0x6b, 0x2f, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x47, 0x72, 0x61, 0x6e, + 0x74, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x47, + 0x72, 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xa8, 0x06, + 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x80, 0x01, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2f, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, + 0x37, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, + 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x37, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, + 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x1a, 0x3f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x1a, 0x37, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, - 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x98, 0x01, 0x0a, - 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, - 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x37, 0x2e, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x6f, + 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, + 0x72, 0x69, 0x6f, 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x37, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, + 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x69, 0x63, 0x56, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x3f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x3f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, - 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, - 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x37, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x98, + 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x77, 0x62, 0x61, 0x63, + 0x6b, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, + 0x37, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x43, 0x6c, 0x61, 0x77, 0x62, 0x61, 0x63, 0x6b, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x3f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, - 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x1a, 0x3f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, - 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x69, 0x63, 0x56, 0x65, 0x73, 0x74, - 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xd7, 0x01, 0x0a, 0x1a, 0x63, 0x6f, - 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, - 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x73, - 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x76, 0x65, 0x73, - 0x74, 0x69, 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x56, - 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x65, 0x73, 0x74, 0x69, - 0x6e, 0x67, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x5c, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x56, 0x65, 0x73, - 0x74, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x3a, 0x3a, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x77, 0x62, + 0x61, 0x63, 0x6b, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x08, 0x43, 0x6c, 0x61, + 0x77, 0x62, 0x61, 0x63, 0x6b, 0x12, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x43, 0x6c, 0x61, 0x77, 0x62, 0x61, 0x63, 0x6b, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x6c, 0x61, 0x77, 0x62, 0x61, 0x63, 0x6b, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x0c, 0x52, 0x65, 0x74, 0x75, 0x72, + 0x6e, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, + 0x1a, 0x2f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, + 0x75, 0x72, 0x6e, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xd7, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x36, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x76, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x56, 0x58, + 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5c, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x56, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x3a, 0x3a, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3533,32 +7043,46 @@ func file_cosmos_vesting_v1beta1_tx_proto_rawDescGZIP() []byte { return file_cosmos_vesting_v1beta1_tx_proto_rawDescData } -var file_cosmos_vesting_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_cosmos_vesting_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_cosmos_vesting_v1beta1_tx_proto_goTypes = []interface{}{ (*MsgCreateVestingAccount)(nil), // 0: cosmos.vesting.v1beta1.MsgCreateVestingAccount - (*MsgCreateVestingAccountResponse)(nil), // 1: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse - (*MsgCreatePermanentLockedAccount)(nil), // 2: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount - (*MsgCreatePermanentLockedAccountResponse)(nil), // 3: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse - (*MsgCreatePeriodicVestingAccount)(nil), // 4: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount - (*MsgCreatePeriodicVestingAccountResponse)(nil), // 5: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse - (*v1beta1.Coin)(nil), // 6: cosmos.base.v1beta1.Coin - (*Period)(nil), // 7: cosmos.vesting.v1beta1.Period + (*MsgCreateClawbackVestingAccount)(nil), // 1: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount + (*MsgCreateVestingAccountResponse)(nil), // 2: cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse + (*MsgCreatePermanentLockedAccount)(nil), // 3: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount + (*MsgCreatePermanentLockedAccountResponse)(nil), // 4: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse + (*MsgCreatePeriodicVestingAccount)(nil), // 5: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount + (*MsgCreatePeriodicVestingAccountResponse)(nil), // 6: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse + (*MsgCreateClawbackVestingAccountResponse)(nil), // 7: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse + (*MsgClawback)(nil), // 8: cosmos.vesting.v1beta1.MsgClawback + (*MsgClawbackResponse)(nil), // 9: cosmos.vesting.v1beta1.MsgClawbackResponse + (*MsgReturnGrants)(nil), // 10: cosmos.vesting.v1beta1.MsgReturnGrants + (*MsgReturnGrantsResponse)(nil), // 11: cosmos.vesting.v1beta1.MsgReturnGrantsResponse + (*v1beta1.Coin)(nil), // 12: cosmos.base.v1beta1.Coin + (*Period)(nil), // 13: cosmos.vesting.v1beta1.Period } var file_cosmos_vesting_v1beta1_tx_proto_depIdxs = []int32{ - 6, // 0: cosmos.vesting.v1beta1.MsgCreateVestingAccount.amount:type_name -> cosmos.base.v1beta1.Coin - 6, // 1: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount:type_name -> cosmos.base.v1beta1.Coin - 7, // 2: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods:type_name -> cosmos.vesting.v1beta1.Period - 0, // 3: cosmos.vesting.v1beta1.Msg.CreateVestingAccount:input_type -> cosmos.vesting.v1beta1.MsgCreateVestingAccount - 2, // 4: cosmos.vesting.v1beta1.Msg.CreatePermanentLockedAccount:input_type -> cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount - 4, // 5: cosmos.vesting.v1beta1.Msg.CreatePeriodicVestingAccount:input_type -> cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount - 1, // 6: cosmos.vesting.v1beta1.Msg.CreateVestingAccount:output_type -> cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse - 3, // 7: cosmos.vesting.v1beta1.Msg.CreatePermanentLockedAccount:output_type -> cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse - 5, // 8: cosmos.vesting.v1beta1.Msg.CreatePeriodicVestingAccount:output_type -> cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse - 6, // [6:9] is the sub-list for method output_type - 3, // [3:6] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 12, // 0: cosmos.vesting.v1beta1.MsgCreateVestingAccount.amount:type_name -> cosmos.base.v1beta1.Coin + 13, // 1: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.lockup_periods:type_name -> cosmos.vesting.v1beta1.Period + 13, // 2: cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount.vesting_periods:type_name -> cosmos.vesting.v1beta1.Period + 12, // 3: cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount.amount:type_name -> cosmos.base.v1beta1.Coin + 13, // 4: cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount.vesting_periods:type_name -> cosmos.vesting.v1beta1.Period + 0, // 5: cosmos.vesting.v1beta1.Msg.CreateVestingAccount:input_type -> cosmos.vesting.v1beta1.MsgCreateVestingAccount + 3, // 6: cosmos.vesting.v1beta1.Msg.CreatePermanentLockedAccount:input_type -> cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount + 5, // 7: cosmos.vesting.v1beta1.Msg.CreatePeriodicVestingAccount:input_type -> cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount + 1, // 8: cosmos.vesting.v1beta1.Msg.CreateClawbackVestingAccount:input_type -> cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount + 8, // 9: cosmos.vesting.v1beta1.Msg.Clawback:input_type -> cosmos.vesting.v1beta1.MsgClawback + 10, // 10: cosmos.vesting.v1beta1.Msg.ReturnGrants:input_type -> cosmos.vesting.v1beta1.MsgReturnGrants + 2, // 11: cosmos.vesting.v1beta1.Msg.CreateVestingAccount:output_type -> cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse + 4, // 12: cosmos.vesting.v1beta1.Msg.CreatePermanentLockedAccount:output_type -> cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse + 6, // 13: cosmos.vesting.v1beta1.Msg.CreatePeriodicVestingAccount:output_type -> cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse + 7, // 14: cosmos.vesting.v1beta1.Msg.CreateClawbackVestingAccount:output_type -> cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse + 9, // 15: cosmos.vesting.v1beta1.Msg.Clawback:output_type -> cosmos.vesting.v1beta1.MsgClawbackResponse + 11, // 16: cosmos.vesting.v1beta1.Msg.ReturnGrants:output_type -> cosmos.vesting.v1beta1.MsgReturnGrantsResponse + 11, // [11:17] is the sub-list for method output_type + 5, // [5:11] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_cosmos_vesting_v1beta1_tx_proto_init() } @@ -3581,7 +7105,7 @@ func file_cosmos_vesting_v1beta1_tx_proto_init() { } } file_cosmos_vesting_v1beta1_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgCreateVestingAccountResponse); i { + switch v := v.(*MsgCreateClawbackVestingAccount); i { case 0: return &v.state case 1: @@ -3593,7 +7117,7 @@ func file_cosmos_vesting_v1beta1_tx_proto_init() { } } file_cosmos_vesting_v1beta1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgCreatePermanentLockedAccount); i { + switch v := v.(*MsgCreateVestingAccountResponse); i { case 0: return &v.state case 1: @@ -3605,7 +7129,7 @@ func file_cosmos_vesting_v1beta1_tx_proto_init() { } } file_cosmos_vesting_v1beta1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgCreatePermanentLockedAccountResponse); i { + switch v := v.(*MsgCreatePermanentLockedAccount); i { case 0: return &v.state case 1: @@ -3617,7 +7141,7 @@ func file_cosmos_vesting_v1beta1_tx_proto_init() { } } file_cosmos_vesting_v1beta1_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgCreatePeriodicVestingAccount); i { + switch v := v.(*MsgCreatePermanentLockedAccountResponse); i { case 0: return &v.state case 1: @@ -3629,6 +7153,18 @@ func file_cosmos_vesting_v1beta1_tx_proto_init() { } } file_cosmos_vesting_v1beta1_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCreatePeriodicVestingAccount); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_vesting_v1beta1_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgCreatePeriodicVestingAccountResponse); i { case 0: return &v.state @@ -3640,6 +7176,66 @@ func file_cosmos_vesting_v1beta1_tx_proto_init() { return nil } } + file_cosmos_vesting_v1beta1_tx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCreateClawbackVestingAccountResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_vesting_v1beta1_tx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgClawback); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_vesting_v1beta1_tx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgClawbackResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_vesting_v1beta1_tx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgReturnGrants); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_vesting_v1beta1_tx_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgReturnGrantsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -3647,7 +7243,7 @@ func file_cosmos_vesting_v1beta1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_vesting_v1beta1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/vesting/v1beta1/tx_grpc.pb.go b/api/cosmos/vesting/v1beta1/tx_grpc.pb.go index 13b9a67c5d37..261331567304 100644 --- a/api/cosmos/vesting/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/vesting/v1beta1/tx_grpc.pb.go @@ -22,6 +22,9 @@ const ( Msg_CreateVestingAccount_FullMethodName = "/cosmos.vesting.v1beta1.Msg/CreateVestingAccount" Msg_CreatePermanentLockedAccount_FullMethodName = "/cosmos.vesting.v1beta1.Msg/CreatePermanentLockedAccount" Msg_CreatePeriodicVestingAccount_FullMethodName = "/cosmos.vesting.v1beta1.Msg/CreatePeriodicVestingAccount" + Msg_CreateClawbackVestingAccount_FullMethodName = "/cosmos.vesting.v1beta1.Msg/CreateClawbackVestingAccount" + Msg_Clawback_FullMethodName = "/cosmos.vesting.v1beta1.Msg/Clawback" + Msg_ReturnGrants_FullMethodName = "/cosmos.vesting.v1beta1.Msg/ReturnGrants" ) // MsgClient is the client API for Msg service. @@ -41,6 +44,13 @@ type MsgClient interface { // // Since: cosmos-sdk 0.46 CreatePeriodicVestingAccount(ctx context.Context, in *MsgCreatePeriodicVestingAccount, opts ...grpc.CallOption) (*MsgCreatePeriodicVestingAccountResponse, error) + // CreateClawbackVestingAccount defines a method that enables creating a + // vesting account that is subject to clawback. + CreateClawbackVestingAccount(ctx context.Context, in *MsgCreateClawbackVestingAccount, opts ...grpc.CallOption) (*MsgCreateClawbackVestingAccountResponse, error) + // Clawback removes the unvested tokens from a ClawbackVestingAccount. + Clawback(ctx context.Context, in *MsgClawback, opts ...grpc.CallOption) (*MsgClawbackResponse, error) + // ReturnGrants returns vesting grants to the funder. + ReturnGrants(ctx context.Context, in *MsgReturnGrants, opts ...grpc.CallOption) (*MsgReturnGrantsResponse, error) } type msgClient struct { @@ -78,6 +88,33 @@ func (c *msgClient) CreatePeriodicVestingAccount(ctx context.Context, in *MsgCre return out, nil } +func (c *msgClient) CreateClawbackVestingAccount(ctx context.Context, in *MsgCreateClawbackVestingAccount, opts ...grpc.CallOption) (*MsgCreateClawbackVestingAccountResponse, error) { + out := new(MsgCreateClawbackVestingAccountResponse) + err := c.cc.Invoke(ctx, Msg_CreateClawbackVestingAccount_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Clawback(ctx context.Context, in *MsgClawback, opts ...grpc.CallOption) (*MsgClawbackResponse, error) { + out := new(MsgClawbackResponse) + err := c.cc.Invoke(ctx, Msg_Clawback_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ReturnGrants(ctx context.Context, in *MsgReturnGrants, opts ...grpc.CallOption) (*MsgReturnGrantsResponse, error) { + out := new(MsgReturnGrantsResponse) + err := c.cc.Invoke(ctx, Msg_ReturnGrants_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility @@ -95,6 +132,13 @@ type MsgServer interface { // // Since: cosmos-sdk 0.46 CreatePeriodicVestingAccount(context.Context, *MsgCreatePeriodicVestingAccount) (*MsgCreatePeriodicVestingAccountResponse, error) + // CreateClawbackVestingAccount defines a method that enables creating a + // vesting account that is subject to clawback. + CreateClawbackVestingAccount(context.Context, *MsgCreateClawbackVestingAccount) (*MsgCreateClawbackVestingAccountResponse, error) + // Clawback removes the unvested tokens from a ClawbackVestingAccount. + Clawback(context.Context, *MsgClawback) (*MsgClawbackResponse, error) + // ReturnGrants returns vesting grants to the funder. + ReturnGrants(context.Context, *MsgReturnGrants) (*MsgReturnGrantsResponse, error) mustEmbedUnimplementedMsgServer() } @@ -111,6 +155,15 @@ func (UnimplementedMsgServer) CreatePermanentLockedAccount(context.Context, *Msg func (UnimplementedMsgServer) CreatePeriodicVestingAccount(context.Context, *MsgCreatePeriodicVestingAccount) (*MsgCreatePeriodicVestingAccountResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreatePeriodicVestingAccount not implemented") } +func (UnimplementedMsgServer) CreateClawbackVestingAccount(context.Context, *MsgCreateClawbackVestingAccount) (*MsgCreateClawbackVestingAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateClawbackVestingAccount not implemented") +} +func (UnimplementedMsgServer) Clawback(context.Context, *MsgClawback) (*MsgClawbackResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Clawback not implemented") +} +func (UnimplementedMsgServer) ReturnGrants(context.Context, *MsgReturnGrants) (*MsgReturnGrantsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReturnGrants not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -178,6 +231,60 @@ func _Msg_CreatePeriodicVestingAccount_Handler(srv interface{}, ctx context.Cont return interceptor(ctx, in, info, handler) } +func _Msg_CreateClawbackVestingAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateClawbackVestingAccount) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateClawbackVestingAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_CreateClawbackVestingAccount_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateClawbackVestingAccount(ctx, req.(*MsgCreateClawbackVestingAccount)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Clawback_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgClawback) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Clawback(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_Clawback_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Clawback(ctx, req.(*MsgClawback)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ReturnGrants_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgReturnGrants) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ReturnGrants(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_ReturnGrants_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ReturnGrants(ctx, req.(*MsgReturnGrants)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -197,6 +304,18 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "CreatePeriodicVestingAccount", Handler: _Msg_CreatePeriodicVestingAccount_Handler, }, + { + MethodName: "CreateClawbackVestingAccount", + Handler: _Msg_CreateClawbackVestingAccount_Handler, + }, + { + MethodName: "Clawback", + Handler: _Msg_Clawback_Handler, + }, + { + MethodName: "ReturnGrants", + Handler: _Msg_ReturnGrants_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/vesting/v1beta1/tx.proto", diff --git a/api/cosmos/vesting/v1beta1/vesting.pulsar.go b/api/cosmos/vesting/v1beta1/vesting.pulsar.go index 27e5e3db8e37..6608978420ed 100644 --- a/api/cosmos/vesting/v1beta1/vesting.pulsar.go +++ b/api/cosmos/vesting/v1beta1/vesting.pulsar.go @@ -3429,6 +3429,829 @@ func (x *fastReflection_PermanentLockedAccount) ProtoMethods() *protoiface.Metho } } +var _ protoreflect.List = (*_ClawbackVestingAccount_4_list)(nil) + +type _ClawbackVestingAccount_4_list struct { + list *[]*Period +} + +func (x *_ClawbackVestingAccount_4_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_ClawbackVestingAccount_4_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_ClawbackVestingAccount_4_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Period) + (*x.list)[i] = concreteValue +} + +func (x *_ClawbackVestingAccount_4_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Period) + *x.list = append(*x.list, concreteValue) +} + +func (x *_ClawbackVestingAccount_4_list) AppendMutable() protoreflect.Value { + v := new(Period) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_ClawbackVestingAccount_4_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_ClawbackVestingAccount_4_list) NewElement() protoreflect.Value { + v := new(Period) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_ClawbackVestingAccount_4_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_ClawbackVestingAccount_5_list)(nil) + +type _ClawbackVestingAccount_5_list struct { + list *[]*Period +} + +func (x *_ClawbackVestingAccount_5_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_ClawbackVestingAccount_5_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_ClawbackVestingAccount_5_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Period) + (*x.list)[i] = concreteValue +} + +func (x *_ClawbackVestingAccount_5_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Period) + *x.list = append(*x.list, concreteValue) +} + +func (x *_ClawbackVestingAccount_5_list) AppendMutable() protoreflect.Value { + v := new(Period) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_ClawbackVestingAccount_5_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_ClawbackVestingAccount_5_list) NewElement() protoreflect.Value { + v := new(Period) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_ClawbackVestingAccount_5_list) IsValid() bool { + return x.list != nil +} + +var ( + md_ClawbackVestingAccount protoreflect.MessageDescriptor + fd_ClawbackVestingAccount_base_vesting_account protoreflect.FieldDescriptor + fd_ClawbackVestingAccount_funder_address protoreflect.FieldDescriptor + fd_ClawbackVestingAccount_start_time protoreflect.FieldDescriptor + fd_ClawbackVestingAccount_lockup_periods protoreflect.FieldDescriptor + fd_ClawbackVestingAccount_vesting_periods protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_vesting_v1beta1_vesting_proto_init() + md_ClawbackVestingAccount = File_cosmos_vesting_v1beta1_vesting_proto.Messages().ByName("ClawbackVestingAccount") + fd_ClawbackVestingAccount_base_vesting_account = md_ClawbackVestingAccount.Fields().ByName("base_vesting_account") + fd_ClawbackVestingAccount_funder_address = md_ClawbackVestingAccount.Fields().ByName("funder_address") + fd_ClawbackVestingAccount_start_time = md_ClawbackVestingAccount.Fields().ByName("start_time") + fd_ClawbackVestingAccount_lockup_periods = md_ClawbackVestingAccount.Fields().ByName("lockup_periods") + fd_ClawbackVestingAccount_vesting_periods = md_ClawbackVestingAccount.Fields().ByName("vesting_periods") +} + +var _ protoreflect.Message = (*fastReflection_ClawbackVestingAccount)(nil) + +type fastReflection_ClawbackVestingAccount ClawbackVestingAccount + +func (x *ClawbackVestingAccount) ProtoReflect() protoreflect.Message { + return (*fastReflection_ClawbackVestingAccount)(x) +} + +func (x *ClawbackVestingAccount) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_vesting_v1beta1_vesting_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_ClawbackVestingAccount_messageType fastReflection_ClawbackVestingAccount_messageType +var _ protoreflect.MessageType = fastReflection_ClawbackVestingAccount_messageType{} + +type fastReflection_ClawbackVestingAccount_messageType struct{} + +func (x fastReflection_ClawbackVestingAccount_messageType) Zero() protoreflect.Message { + return (*fastReflection_ClawbackVestingAccount)(nil) +} +func (x fastReflection_ClawbackVestingAccount_messageType) New() protoreflect.Message { + return new(fastReflection_ClawbackVestingAccount) +} +func (x fastReflection_ClawbackVestingAccount_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_ClawbackVestingAccount +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_ClawbackVestingAccount) Descriptor() protoreflect.MessageDescriptor { + return md_ClawbackVestingAccount +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_ClawbackVestingAccount) Type() protoreflect.MessageType { + return _fastReflection_ClawbackVestingAccount_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_ClawbackVestingAccount) New() protoreflect.Message { + return new(fastReflection_ClawbackVestingAccount) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_ClawbackVestingAccount) Interface() protoreflect.ProtoMessage { + return (*ClawbackVestingAccount)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_ClawbackVestingAccount) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.BaseVestingAccount != nil { + value := protoreflect.ValueOfMessage(x.BaseVestingAccount.ProtoReflect()) + if !f(fd_ClawbackVestingAccount_base_vesting_account, value) { + return + } + } + if x.FunderAddress != "" { + value := protoreflect.ValueOfString(x.FunderAddress) + if !f(fd_ClawbackVestingAccount_funder_address, value) { + return + } + } + if x.StartTime != int64(0) { + value := protoreflect.ValueOfInt64(x.StartTime) + if !f(fd_ClawbackVestingAccount_start_time, value) { + return + } + } + if len(x.LockupPeriods) != 0 { + value := protoreflect.ValueOfList(&_ClawbackVestingAccount_4_list{list: &x.LockupPeriods}) + if !f(fd_ClawbackVestingAccount_lockup_periods, value) { + return + } + } + if len(x.VestingPeriods) != 0 { + value := protoreflect.ValueOfList(&_ClawbackVestingAccount_5_list{list: &x.VestingPeriods}) + if !f(fd_ClawbackVestingAccount_vesting_periods, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_ClawbackVestingAccount) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.base_vesting_account": + return x.BaseVestingAccount != nil + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.funder_address": + return x.FunderAddress != "" + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.start_time": + return x.StartTime != int64(0) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.lockup_periods": + return len(x.LockupPeriods) != 0 + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.vesting_periods": + return len(x.VestingPeriods) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.ClawbackVestingAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.ClawbackVestingAccount does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_ClawbackVestingAccount) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.base_vesting_account": + x.BaseVestingAccount = nil + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.funder_address": + x.FunderAddress = "" + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.start_time": + x.StartTime = int64(0) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.lockup_periods": + x.LockupPeriods = nil + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.vesting_periods": + x.VestingPeriods = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.ClawbackVestingAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.ClawbackVestingAccount does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_ClawbackVestingAccount) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.base_vesting_account": + value := x.BaseVestingAccount + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.funder_address": + value := x.FunderAddress + return protoreflect.ValueOfString(value) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.start_time": + value := x.StartTime + return protoreflect.ValueOfInt64(value) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.lockup_periods": + if len(x.LockupPeriods) == 0 { + return protoreflect.ValueOfList(&_ClawbackVestingAccount_4_list{}) + } + listValue := &_ClawbackVestingAccount_4_list{list: &x.LockupPeriods} + return protoreflect.ValueOfList(listValue) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.vesting_periods": + if len(x.VestingPeriods) == 0 { + return protoreflect.ValueOfList(&_ClawbackVestingAccount_5_list{}) + } + listValue := &_ClawbackVestingAccount_5_list{list: &x.VestingPeriods} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.ClawbackVestingAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.ClawbackVestingAccount does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_ClawbackVestingAccount) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.base_vesting_account": + x.BaseVestingAccount = value.Message().Interface().(*BaseVestingAccount) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.funder_address": + x.FunderAddress = value.Interface().(string) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.start_time": + x.StartTime = value.Int() + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.lockup_periods": + lv := value.List() + clv := lv.(*_ClawbackVestingAccount_4_list) + x.LockupPeriods = *clv.list + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.vesting_periods": + lv := value.List() + clv := lv.(*_ClawbackVestingAccount_5_list) + x.VestingPeriods = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.ClawbackVestingAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.ClawbackVestingAccount does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_ClawbackVestingAccount) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.base_vesting_account": + if x.BaseVestingAccount == nil { + x.BaseVestingAccount = new(BaseVestingAccount) + } + return protoreflect.ValueOfMessage(x.BaseVestingAccount.ProtoReflect()) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.lockup_periods": + if x.LockupPeriods == nil { + x.LockupPeriods = []*Period{} + } + value := &_ClawbackVestingAccount_4_list{list: &x.LockupPeriods} + return protoreflect.ValueOfList(value) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.vesting_periods": + if x.VestingPeriods == nil { + x.VestingPeriods = []*Period{} + } + value := &_ClawbackVestingAccount_5_list{list: &x.VestingPeriods} + return protoreflect.ValueOfList(value) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.funder_address": + panic(fmt.Errorf("field funder_address of message cosmos.vesting.v1beta1.ClawbackVestingAccount is not mutable")) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.start_time": + panic(fmt.Errorf("field start_time of message cosmos.vesting.v1beta1.ClawbackVestingAccount is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.ClawbackVestingAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.ClawbackVestingAccount does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_ClawbackVestingAccount) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.base_vesting_account": + m := new(BaseVestingAccount) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.funder_address": + return protoreflect.ValueOfString("") + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.start_time": + return protoreflect.ValueOfInt64(int64(0)) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.lockup_periods": + list := []*Period{} + return protoreflect.ValueOfList(&_ClawbackVestingAccount_4_list{list: &list}) + case "cosmos.vesting.v1beta1.ClawbackVestingAccount.vesting_periods": + list := []*Period{} + return protoreflect.ValueOfList(&_ClawbackVestingAccount_5_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.vesting.v1beta1.ClawbackVestingAccount")) + } + panic(fmt.Errorf("message cosmos.vesting.v1beta1.ClawbackVestingAccount does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_ClawbackVestingAccount) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.vesting.v1beta1.ClawbackVestingAccount", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_ClawbackVestingAccount) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_ClawbackVestingAccount) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_ClawbackVestingAccount) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_ClawbackVestingAccount) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*ClawbackVestingAccount) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.BaseVestingAccount != nil { + l = options.Size(x.BaseVestingAccount) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.FunderAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.StartTime != 0 { + n += 1 + runtime.Sov(uint64(x.StartTime)) + } + if len(x.LockupPeriods) > 0 { + for _, e := range x.LockupPeriods { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if len(x.VestingPeriods) > 0 { + for _, e := range x.VestingPeriods { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*ClawbackVestingAccount) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.VestingPeriods) > 0 { + for iNdEx := len(x.VestingPeriods) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.VestingPeriods[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x2a + } + } + if len(x.LockupPeriods) > 0 { + for iNdEx := len(x.LockupPeriods) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.LockupPeriods[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x22 + } + } + if x.StartTime != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.StartTime)) + i-- + dAtA[i] = 0x18 + } + if len(x.FunderAddress) > 0 { + i -= len(x.FunderAddress) + copy(dAtA[i:], x.FunderAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.FunderAddress))) + i-- + dAtA[i] = 0x12 + } + if x.BaseVestingAccount != nil { + encoded, err := options.Marshal(x.BaseVestingAccount) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*ClawbackVestingAccount) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ClawbackVestingAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ClawbackVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BaseVestingAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.BaseVestingAccount == nil { + x.BaseVestingAccount = &BaseVestingAccount{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.BaseVestingAccount); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field FunderAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.FunderAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + x.StartTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.StartTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LockupPeriods", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.LockupPeriods = append(x.LockupPeriods, &Period{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.LockupPeriods[len(x.LockupPeriods)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field VestingPeriods", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.VestingPeriods = append(x.VestingPeriods, &Period{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.VestingPeriods[len(x.VestingPeriods)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -3734,6 +4557,80 @@ func (x *PermanentLockedAccount) GetBaseVestingAccount() *BaseVestingAccount { return nil } +// ClawbackVestingAccount implements the VestingAccount interface. It provides +// an account that can hold contributions subject to "lockup" (like a +// PeriodicVestingAccount), or vesting which is subject to clawback +// of unvested tokens, or a combination (tokens vest, but are still locked). +type ClawbackVestingAccount struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BaseVestingAccount *BaseVestingAccount `protobuf:"bytes,1,opt,name=base_vesting_account,json=baseVestingAccount,proto3" json:"base_vesting_account,omitempty"` + // funder_address specifies the account which can perform clawback. + FunderAddress string `protobuf:"bytes,2,opt,name=funder_address,json=funderAddress,proto3" json:"funder_address,omitempty"` + StartTime int64 `protobuf:"varint,3,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + // unlocking schedule relative to the BaseVestingAccount start_time. + LockupPeriods []*Period `protobuf:"bytes,4,rep,name=lockup_periods,json=lockupPeriods,proto3" json:"lockup_periods,omitempty"` + // vesting (i.e. immunity from clawback) schedule relative to the BaseVestingAccount start_time. + VestingPeriods []*Period `protobuf:"bytes,5,rep,name=vesting_periods,json=vestingPeriods,proto3" json:"vesting_periods,omitempty"` +} + +func (x *ClawbackVestingAccount) Reset() { + *x = ClawbackVestingAccount{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_vesting_v1beta1_vesting_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClawbackVestingAccount) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClawbackVestingAccount) ProtoMessage() {} + +// Deprecated: Use ClawbackVestingAccount.ProtoReflect.Descriptor instead. +func (*ClawbackVestingAccount) Descriptor() ([]byte, []int) { + return file_cosmos_vesting_v1beta1_vesting_proto_rawDescGZIP(), []int{6} +} + +func (x *ClawbackVestingAccount) GetBaseVestingAccount() *BaseVestingAccount { + if x != nil { + return x.BaseVestingAccount + } + return nil +} + +func (x *ClawbackVestingAccount) GetFunderAddress() string { + if x != nil { + return x.FunderAddress + } + return "" +} + +func (x *ClawbackVestingAccount) GetStartTime() int64 { + if x != nil { + return x.StartTime + } + return 0 +} + +func (x *ClawbackVestingAccount) GetLockupPeriods() []*Period { + if x != nil { + return x.LockupPeriods + } + return nil +} + +func (x *ClawbackVestingAccount) GetVestingPeriods() []*Period { + if x != nil { + return x.VestingPeriods + } + return nil +} + var File_cosmos_vesting_v1beta1_vesting_proto protoreflect.FileDescriptor var file_cosmos_vesting_v1beta1_vesting_proto_rawDesc = []byte{ @@ -3846,21 +4743,52 @@ var file_cosmos_vesting_v1beta1_vesting_proto_rawDesc = []byte{ 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x2a, 0x88, 0xa0, 0x1f, 0x00, 0x8a, 0xe7, 0xb0, 0x2a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0xdc, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xef, 0x03, 0x0a, 0x16, 0x43, 0x6c, 0x61, 0x77, 0x62, 0x61, + 0x63, 0x6b, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x12, 0x62, 0x0a, 0x14, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, + 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x56, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x04, 0xd0, 0xde, 0x1f, 0x01, + 0x52, 0x12, 0x62, 0x61, 0x73, 0x65, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x0e, 0x66, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x19, 0xf2, 0xde, + 0x1f, 0x15, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x66, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x52, 0x0d, 0x66, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x34, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x15, 0xf2, 0xde, 0x1f, 0x11, + 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x22, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x64, 0x0a, 0x0e, + 0x6c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x65, + 0x72, 0x69, 0x6f, 0x64, 0x42, 0x1d, 0xc8, 0xde, 0x1f, 0x00, 0xf2, 0xde, 0x1f, 0x15, 0x79, 0x61, + 0x6d, 0x6c, 0x3a, 0x22, 0x6c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, + 0x64, 0x73, 0x22, 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x65, 0x72, 0x69, 0x6f, + 0x64, 0x73, 0x12, 0x67, 0x0a, 0x0f, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, + 0x72, 0x69, 0x6f, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x42, 0x0c, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, - 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x76, 0x65, - 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x76, 0x65, - 0x73, 0x74, 0x69, 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, - 0x56, 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x65, 0x73, 0x74, - 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x56, 0x65, - 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x3a, 0x3a, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x42, 0x1e, 0xc8, 0xde, 0x1f, + 0x00, 0xf2, 0xde, 0x1f, 0x16, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x76, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x22, 0x52, 0x0e, 0x76, 0x65, 0x73, + 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x3a, 0x2a, 0x88, 0xa0, 0x1f, + 0x00, 0x8a, 0xe7, 0xb0, 0x2a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2f, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0xdc, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0c, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, + 0x76, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, + 0x03, 0x43, 0x56, 0x58, 0xaa, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x16, + 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5c, 0x56, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, + 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x18, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x56, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3875,7 +4803,7 @@ func file_cosmos_vesting_v1beta1_vesting_proto_rawDescGZIP() []byte { return file_cosmos_vesting_v1beta1_vesting_proto_rawDescData } -var file_cosmos_vesting_v1beta1_vesting_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_cosmos_vesting_v1beta1_vesting_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_cosmos_vesting_v1beta1_vesting_proto_goTypes = []interface{}{ (*BaseVestingAccount)(nil), // 0: cosmos.vesting.v1beta1.BaseVestingAccount (*ContinuousVestingAccount)(nil), // 1: cosmos.vesting.v1beta1.ContinuousVestingAccount @@ -3883,25 +4811,29 @@ var file_cosmos_vesting_v1beta1_vesting_proto_goTypes = []interface{}{ (*Period)(nil), // 3: cosmos.vesting.v1beta1.Period (*PeriodicVestingAccount)(nil), // 4: cosmos.vesting.v1beta1.PeriodicVestingAccount (*PermanentLockedAccount)(nil), // 5: cosmos.vesting.v1beta1.PermanentLockedAccount - (*v1beta11.BaseAccount)(nil), // 6: cosmos.auth.v1beta1.BaseAccount - (*v1beta1.Coin)(nil), // 7: cosmos.base.v1beta1.Coin + (*ClawbackVestingAccount)(nil), // 6: cosmos.vesting.v1beta1.ClawbackVestingAccount + (*v1beta11.BaseAccount)(nil), // 7: cosmos.auth.v1beta1.BaseAccount + (*v1beta1.Coin)(nil), // 8: cosmos.base.v1beta1.Coin } var file_cosmos_vesting_v1beta1_vesting_proto_depIdxs = []int32{ - 6, // 0: cosmos.vesting.v1beta1.BaseVestingAccount.base_account:type_name -> cosmos.auth.v1beta1.BaseAccount - 7, // 1: cosmos.vesting.v1beta1.BaseVestingAccount.original_vesting:type_name -> cosmos.base.v1beta1.Coin - 7, // 2: cosmos.vesting.v1beta1.BaseVestingAccount.delegated_free:type_name -> cosmos.base.v1beta1.Coin - 7, // 3: cosmos.vesting.v1beta1.BaseVestingAccount.delegated_vesting:type_name -> cosmos.base.v1beta1.Coin + 7, // 0: cosmos.vesting.v1beta1.BaseVestingAccount.base_account:type_name -> cosmos.auth.v1beta1.BaseAccount + 8, // 1: cosmos.vesting.v1beta1.BaseVestingAccount.original_vesting:type_name -> cosmos.base.v1beta1.Coin + 8, // 2: cosmos.vesting.v1beta1.BaseVestingAccount.delegated_free:type_name -> cosmos.base.v1beta1.Coin + 8, // 3: cosmos.vesting.v1beta1.BaseVestingAccount.delegated_vesting:type_name -> cosmos.base.v1beta1.Coin 0, // 4: cosmos.vesting.v1beta1.ContinuousVestingAccount.base_vesting_account:type_name -> cosmos.vesting.v1beta1.BaseVestingAccount 0, // 5: cosmos.vesting.v1beta1.DelayedVestingAccount.base_vesting_account:type_name -> cosmos.vesting.v1beta1.BaseVestingAccount - 7, // 6: cosmos.vesting.v1beta1.Period.amount:type_name -> cosmos.base.v1beta1.Coin + 8, // 6: cosmos.vesting.v1beta1.Period.amount:type_name -> cosmos.base.v1beta1.Coin 0, // 7: cosmos.vesting.v1beta1.PeriodicVestingAccount.base_vesting_account:type_name -> cosmos.vesting.v1beta1.BaseVestingAccount 3, // 8: cosmos.vesting.v1beta1.PeriodicVestingAccount.vesting_periods:type_name -> cosmos.vesting.v1beta1.Period 0, // 9: cosmos.vesting.v1beta1.PermanentLockedAccount.base_vesting_account:type_name -> cosmos.vesting.v1beta1.BaseVestingAccount - 10, // [10:10] is the sub-list for method output_type - 10, // [10:10] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name + 0, // 10: cosmos.vesting.v1beta1.ClawbackVestingAccount.base_vesting_account:type_name -> cosmos.vesting.v1beta1.BaseVestingAccount + 3, // 11: cosmos.vesting.v1beta1.ClawbackVestingAccount.lockup_periods:type_name -> cosmos.vesting.v1beta1.Period + 3, // 12: cosmos.vesting.v1beta1.ClawbackVestingAccount.vesting_periods:type_name -> cosmos.vesting.v1beta1.Period + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_cosmos_vesting_v1beta1_vesting_proto_init() } @@ -3982,6 +4914,18 @@ func file_cosmos_vesting_v1beta1_vesting_proto_init() { return nil } } + file_cosmos_vesting_v1beta1_vesting_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClawbackVestingAccount); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -3989,7 +4933,7 @@ func file_cosmos_vesting_v1beta1_vesting_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_vesting_v1beta1_vesting_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 0, }, diff --git a/baseapp/abci.go b/baseapp/abci.go index cb924e271e9b..6559eab29734 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -3,8 +3,10 @@ package baseapp import ( "context" "fmt" + "os" "sort" "strings" + "syscall" "time" "github.com/cockroachdb/errors" @@ -159,8 +161,17 @@ func (app *BaseApp) Query(_ context.Context, req *abci.RequestQuery) (resp *abci }() // when a client did not provide a query height, manually inject the latest + //[AGORIC] sanity check required for parallel Query https://github.com/agoric-labs/cosmos-sdk/pull/111 + lastHeight := app.LastBlockHeight() if req.Height == 0 { - req.Height = app.LastBlockHeight() + req.Height = lastHeight + } + if req.Height > lastHeight { + return sdkerrors.QueryResult( + errorsmod.Wrapf(sdkerrors.ErrInvalidHeight, + "given height %d is greater than latest height %d", req.Height, lastHeight), + app.trace, + ), nil } telemetry.IncrCounter(1, "query", "count") @@ -835,6 +846,9 @@ func (app *BaseApp) internalFinalizeBlock(ctx context.Context, req *abci.Request events = append(events, endBlock.Events...) cp := app.GetConsensusParams(app.finalizeBlockState.Context()) + // [AGORIC] Clear the event history after each block. + app.finalizeBlockState.eventHistory = sdk.Events{} + return &abci.ResponseFinalizeBlock{ Events: events, TxResults: txResults, @@ -903,11 +917,20 @@ func (app *BaseApp) checkHalt(height int64, time time.Time) error { halt = true } - if halt { - return fmt.Errorf("halt per configuration height %d time %d", app.haltHeight, app.haltTime) + if !halt { + return nil } - - return nil + // [AGORIC] Make a best-effort attempt to kill our process. + p, err := os.FindProcess(os.Getpid()) + if err == nil { + // attempt cascading signals in case SIGINT fails (os dependent) + _ = p.Signal(syscall.SIGINT) + _ = p.Signal(syscall.SIGTERM) + // Errors in these signal calls are not meaningful to us. We tried our + // best, but we don't care (and can't tell) if or how the signal handler + // responds. + } + return fmt.Errorf("halt per configuration height %d time %d", app.haltHeight, app.haltTime) } // Commit implements the ABCI interface. It will commit all state that exists in diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 5fb0b0fca479..68077196e1b9 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -489,6 +489,7 @@ func (app *BaseApp) setState(mode execMode, h cmtproto.Header) { ctx: sdk.NewContext(ms, h, false, app.logger). WithStreamingManager(app.streamingManager). WithHeaderInfo(headerInfo), + eventHistory: sdk.Events{}, } switch mode { @@ -778,12 +779,20 @@ func (app *BaseApp) deliverTx(tx []byte) *abci.ExecTxResult { return resp } + // [AGORIC] When successful, remember event history. Append the events to the event history. + events := sdk.MarkEventsToIndex(result.Events, app.indexEvents) + sdkEvents := make(sdk.Events, len(events)) + for _, event := range result.Events { + sdkEvents = sdkEvents.AppendEvent(sdk.Event(event)) + } + app.finalizeBlockState.eventHistory = app.finalizeBlockState.eventHistory.AppendEvents(sdkEvents) + resp = &abci.ExecTxResult{ GasWanted: int64(gInfo.GasWanted), GasUsed: int64(gInfo.GasUsed), Log: result.Log, Data: result.Data, - Events: sdk.MarkEventsToIndex(result.Events, app.indexEvents), + Events: events, } return resp @@ -795,7 +804,11 @@ func (app *BaseApp) endBlock(_ context.Context) (sdk.EndBlock, error) { var endblock sdk.EndBlock if app.endBlocker != nil { - eb, err := app.endBlocker(app.finalizeBlockState.Context()) + // [AGORIC] Propagate the event history. + eventManagerWithHistory := sdk.NewEventManagerWithHistory(app.finalizeBlockState.eventHistory) + ctxWithHistory := app.finalizeBlockState.Context().WithEventManager(eventManagerWithHistory) + + eb, err := app.endBlocker(ctxWithHistory) if err != nil { return endblock, err } diff --git a/baseapp/state.go b/baseapp/state.go index 19ee4e7eaa40..7cc9fc750828 100644 --- a/baseapp/state.go +++ b/baseapp/state.go @@ -13,6 +13,12 @@ type state struct { mtx sync.RWMutex ctx sdk.Context + + // eventHistory accumulates events returned by DeliverTx throughout a block. + // [AGORIC] The accumulated events are passed to the EndBlocker in its context's + // EventManager ABCI event history, and the state's eventHistory is then cleared. + // Not used for modes or states other than delivery. + eventHistory sdk.Events } // CacheMultiStore calls and returns a CacheMultiStore on the state's underling diff --git a/go.mod b/go.mod index 876bf10c3454..59df0e6d945f 100644 --- a/go.mod +++ b/go.mod @@ -181,6 +181,9 @@ replace ( github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 // replace broken goleveldb github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 +// use cometbft +//github.com/cometbft/cometbft => github.com/agoric-labs/cometbft v0.34.30-alpha.agoric.1 + ) retract ( diff --git a/proto/cosmos/vesting/v1beta1/tx.proto b/proto/cosmos/vesting/v1beta1/tx.proto index 67008724c4d1..affd77446b96 100644 --- a/proto/cosmos/vesting/v1beta1/tx.proto +++ b/proto/cosmos/vesting/v1beta1/tx.proto @@ -27,6 +27,16 @@ service Msg { // // Since: cosmos-sdk 0.46 rpc CreatePeriodicVestingAccount(MsgCreatePeriodicVestingAccount) returns (MsgCreatePeriodicVestingAccountResponse); + + // CreateClawbackVestingAccount defines a method that enables creating a + // vesting account that is subject to clawback. + rpc CreateClawbackVestingAccount(MsgCreateClawbackVestingAccount) returns (MsgCreateClawbackVestingAccountResponse); + + // Clawback removes the unvested tokens from a ClawbackVestingAccount. + rpc Clawback(MsgClawback) returns (MsgClawbackResponse); + + // ReturnGrants returns vesting grants to the funder. + rpc ReturnGrants(MsgReturnGrants) returns (MsgReturnGrantsResponse); } // MsgCreateVestingAccount defines a message that enables creating a vesting @@ -49,6 +59,28 @@ message MsgCreateVestingAccount { // end of vesting as unix time (in seconds). int64 end_time = 4; bool delayed = 5; + bool merge = 6; +} +// MsgCreateClawbackVestingAccount defines a message that enables creating a ClawbackVestingAccount. +message MsgCreateClawbackVestingAccount { + option (cosmos.msg.v1.signer) = "from_address"; + option (amino.name) = "cosmos-sdk/MsgCreateClawbackVestingAccount"; + option (gogoproto.equal) = false; + + // Address of the account providing the funds, which must also sign the request. + string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""]; + // Address of the account to receive the funds. + string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""]; + // Start time of the vesting. Periods start relative to this time. + int64 start_time = 3 [(gogoproto.moretags) = "yaml:\"start_time\""]; + // Unlocking events as a sequence of durations and amounts, starting relative to start_time. + repeated Period lockup_periods = 4 [(gogoproto.nullable) = false]; + // Vesting events as a sequence of durations and amounts, starting relative to start_time. + repeated Period vesting_periods = 5 [(gogoproto.nullable) = false]; + // If true, merge this new grant into an existing ClawbackVestingAccount, + // or create it if it does not exist. If false, creates a new account. + // New grants to an existing account must be from the same from_address. + bool merge = 6; } // MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. @@ -93,6 +125,7 @@ message MsgCreatePeriodicVestingAccount { // start of vesting as unix time (in seconds). int64 start_time = 3; repeated Period vesting_periods = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + bool merge = 5; } // MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount @@ -100,3 +133,41 @@ message MsgCreatePeriodicVestingAccount { // // Since: cosmos-sdk 0.46 message MsgCreatePeriodicVestingAccountResponse {} + +// MsgCreateClawbackVestingAccountResponse defines the MsgCreateClawbackVestingAccount response type. +message MsgCreateClawbackVestingAccountResponse {} + +// MsgClawback defines a message that removes unvested tokens from a ClawbackVestingAccount. +message MsgClawback { + option (cosmos.msg.v1.signer) = "from_address"; + option (amino.name) = "cosmos-sdk/MsgMsgClawback"; + + string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // funder_address is the address which funded the account + string funder_address = 2; + // address is the address of the ClawbackVestingAccount to claw back from. + string address = 3; + // dest_address specifies where the clawed-back tokens should be transferred. + // If empty, the tokens will be transferred back to the original funder of the account. + string dest_address = 4; +} + +// MsgClawbackResponse defines the MsgClawback response type. +message MsgClawbackResponse {} + +// MsgReturnGrants defines a message for a grantee to return all granted assets, +// including delegated, undelegated and unbonding, vested and unvested, +// are transferred to the original funder of the account. Might not be complete if +// some vested assets have been transferred out of the account. Currently only applies to +// ClawbackVesting accounts. +message MsgReturnGrants { + option (cosmos.msg.v1.signer) = "from_address"; + option (amino.name) = "cosmos-sdk/MsgReturnGrants"; + // address is the address of the grantee account returning the grant. + + string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string address = 2; +} + +// MsgReturnGrantsResponse defines the ReturnGrants response type. +message MsgReturnGrantsResponse {} diff --git a/proto/cosmos/vesting/v1beta1/vesting.proto b/proto/cosmos/vesting/v1beta1/vesting.proto index 12e9cdd2e092..15aaafd84650 100644 --- a/proto/cosmos/vesting/v1beta1/vesting.proto +++ b/proto/cosmos/vesting/v1beta1/vesting.proto @@ -92,3 +92,22 @@ message PermanentLockedAccount { BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; } + +// ClawbackVestingAccount implements the VestingAccount interface. It provides +// an account that can hold contributions subject to "lockup" (like a +// PeriodicVestingAccount), or vesting which is subject to clawback +// of unvested tokens, or a combination (tokens vest, but are still locked). +message ClawbackVestingAccount { + option (amino.name) = "cosmos-sdk/PermanentLockedAccount"; + option (gogoproto.goproto_getters) = false; + + BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; + + // funder_address specifies the account which can perform clawback. + string funder_address = 2 [(gogoproto.moretags) = "yaml:\"funder_address\""]; + int64 start_time = 3 [(gogoproto.moretags) = "yaml:\"start_time\""]; + // unlocking schedule relative to the BaseVestingAccount start_time. + repeated Period lockup_periods = 4 [(gogoproto.moretags) = "yaml:\"lockup_periods\"", (gogoproto.nullable) = false]; + // vesting (i.e. immunity from clawback) schedule relative to the BaseVestingAccount start_time. + repeated Period vesting_periods = 5 [(gogoproto.moretags) = "yaml:\"vesting_periods\"", (gogoproto.nullable) = false]; +} diff --git a/scripts/store/mock/cosmos_cosmos_db_DB.go b/scripts/store/mock/cosmos_cosmos_db_DB.go new file mode 100644 index 000000000000..4a79ee7956d4 --- /dev/null +++ b/scripts/store/mock/cosmos_cosmos_db_DB.go @@ -0,0 +1,221 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/cosmos/cosmos-db (interfaces: DB) + +// Package mock is a generated GoMock package. +package mock + +import ( + reflect "reflect" + + db "github.com/cosmos/cosmos-db" + gomock "github.com/golang/mock/gomock" +) + +// MockDB is a mock of DB interface. +type MockDB struct { + ctrl *gomock.Controller + recorder *MockDBMockRecorder +} + +// MockDBMockRecorder is the mock recorder for MockDB. +type MockDBMockRecorder struct { + mock *MockDB +} + +// NewMockDB creates a new mock instance. +func NewMockDB(ctrl *gomock.Controller) *MockDB { + mock := &MockDB{ctrl: ctrl} + mock.recorder = &MockDBMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockDB) EXPECT() *MockDBMockRecorder { + return m.recorder +} + +// Close mocks base method. +func (m *MockDB) Close() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Close") + ret0, _ := ret[0].(error) + return ret0 +} + +// Close indicates an expected call of Close. +func (mr *MockDBMockRecorder) Close() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockDB)(nil).Close)) +} + +// Delete mocks base method. +func (m *MockDB) Delete(arg0 []byte) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockDBMockRecorder) Delete(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockDB)(nil).Delete), arg0) +} + +// DeleteSync mocks base method. +func (m *MockDB) DeleteSync(arg0 []byte) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteSync", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteSync indicates an expected call of DeleteSync. +func (mr *MockDBMockRecorder) DeleteSync(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSync", reflect.TypeOf((*MockDB)(nil).DeleteSync), arg0) +} + +// Get mocks base method. +func (m *MockDB) Get(arg0 []byte) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", arg0) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockDBMockRecorder) Get(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockDB)(nil).Get), arg0) +} + +// Has mocks base method. +func (m *MockDB) Has(arg0 []byte) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Has", arg0) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Has indicates an expected call of Has. +func (mr *MockDBMockRecorder) Has(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Has", reflect.TypeOf((*MockDB)(nil).Has), arg0) +} + +// Iterator mocks base method. +func (m *MockDB) Iterator(arg0, arg1 []byte) (db.Iterator, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Iterator", arg0, arg1) + ret0, _ := ret[0].(db.Iterator) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Iterator indicates an expected call of Iterator. +func (mr *MockDBMockRecorder) Iterator(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Iterator", reflect.TypeOf((*MockDB)(nil).Iterator), arg0, arg1) +} + +// NewBatch mocks base method. +func (m *MockDB) NewBatch() db.Batch { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewBatch") + ret0, _ := ret[0].(db.Batch) + return ret0 +} + +// NewBatch indicates an expected call of NewBatch. +func (mr *MockDBMockRecorder) NewBatch() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewBatch", reflect.TypeOf((*MockDB)(nil).NewBatch)) +} + +// NewBatchWithSize mocks base method. +func (m *MockDB) NewBatchWithSize(arg0 int) db.Batch { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewBatchWithSize", arg0) + ret0, _ := ret[0].(db.Batch) + return ret0 +} + +// NewBatchWithSize indicates an expected call of NewBatchWithSize. +func (mr *MockDBMockRecorder) NewBatchWithSize(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewBatchWithSize", reflect.TypeOf((*MockDB)(nil).NewBatchWithSize), arg0) +} + +// Print mocks base method. +func (m *MockDB) Print() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Print") + ret0, _ := ret[0].(error) + return ret0 +} + +// Print indicates an expected call of Print. +func (mr *MockDBMockRecorder) Print() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Print", reflect.TypeOf((*MockDB)(nil).Print)) +} + +// ReverseIterator mocks base method. +func (m *MockDB) ReverseIterator(arg0, arg1 []byte) (db.Iterator, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReverseIterator", arg0, arg1) + ret0, _ := ret[0].(db.Iterator) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReverseIterator indicates an expected call of ReverseIterator. +func (mr *MockDBMockRecorder) ReverseIterator(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReverseIterator", reflect.TypeOf((*MockDB)(nil).ReverseIterator), arg0, arg1) +} + +// Set mocks base method. +func (m *MockDB) Set(arg0, arg1 []byte) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Set", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// Set indicates an expected call of Set. +func (mr *MockDBMockRecorder) Set(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Set", reflect.TypeOf((*MockDB)(nil).Set), arg0, arg1) +} + +// SetSync mocks base method. +func (m *MockDB) SetSync(arg0, arg1 []byte) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetSync", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetSync indicates an expected call of SetSync. +func (mr *MockDBMockRecorder) SetSync(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSync", reflect.TypeOf((*MockDB)(nil).SetSync), arg0, arg1) +} + +// Stats mocks base method. +func (m *MockDB) Stats() map[string]string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Stats") + ret0, _ := ret[0].(map[string]string) + return ret0 +} + +// Stats indicates an expected call of Stats. +func (mr *MockDBMockRecorder) Stats() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stats", reflect.TypeOf((*MockDB)(nil).Stats)) +} diff --git a/scripts/testutil/mock/grpc_server.go b/scripts/testutil/mock/grpc_server.go new file mode 100644 index 000000000000..7959051080d4 --- /dev/null +++ b/scripts/testutil/mock/grpc_server.go @@ -0,0 +1,47 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/cosmos/gogoproto/grpc (interfaces: Server) + +// Package mock is a generated GoMock package. +package mock + +import ( + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + grpc "google.golang.org/grpc" +) + +// MockServer is a mock of Server interface. +type MockServer struct { + ctrl *gomock.Controller + recorder *MockServerMockRecorder +} + +// MockServerMockRecorder is the mock recorder for MockServer. +type MockServerMockRecorder struct { + mock *MockServer +} + +// NewMockServer creates a new mock instance. +func NewMockServer(ctrl *gomock.Controller) *MockServer { + mock := &MockServer{ctrl: ctrl} + mock.recorder = &MockServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockServer) EXPECT() *MockServerMockRecorder { + return m.recorder +} + +// RegisterService mocks base method. +func (m *MockServer) RegisterService(arg0 *grpc.ServiceDesc, arg1 interface{}) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "RegisterService", arg0, arg1) +} + +// RegisterService indicates an expected call of RegisterService. +func (mr *MockServerMockRecorder) RegisterService(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterService", reflect.TypeOf((*MockServer)(nil).RegisterService), arg0, arg1) +} diff --git a/scripts/testutil/mock/logger.go b/scripts/testutil/mock/logger.go new file mode 100644 index 000000000000..800210aa241e --- /dev/null +++ b/scripts/testutil/mock/logger.go @@ -0,0 +1,135 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: cosmossdk.io/log (interfaces: Logger) + +// Package mock is a generated GoMock package. +package mock + +import ( + reflect "reflect" + + log "cosmossdk.io/log" + gomock "github.com/golang/mock/gomock" +) + +// MockLogger is a mock of Logger interface. +type MockLogger struct { + ctrl *gomock.Controller + recorder *MockLoggerMockRecorder +} + +// MockLoggerMockRecorder is the mock recorder for MockLogger. +type MockLoggerMockRecorder struct { + mock *MockLogger +} + +// NewMockLogger creates a new mock instance. +func NewMockLogger(ctrl *gomock.Controller) *MockLogger { + mock := &MockLogger{ctrl: ctrl} + mock.recorder = &MockLoggerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockLogger) EXPECT() *MockLoggerMockRecorder { + return m.recorder +} + +// Debug mocks base method. +func (m *MockLogger) Debug(arg0 string, arg1 ...interface{}) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0} + for _, a := range arg1 { + varargs = append(varargs, a) + } + m.ctrl.Call(m, "Debug", varargs...) +} + +// Debug indicates an expected call of Debug. +func (mr *MockLoggerMockRecorder) Debug(arg0 interface{}, arg1 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0}, arg1...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Debug", reflect.TypeOf((*MockLogger)(nil).Debug), varargs...) +} + +// Error mocks base method. +func (m *MockLogger) Error(arg0 string, arg1 ...interface{}) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0} + for _, a := range arg1 { + varargs = append(varargs, a) + } + m.ctrl.Call(m, "Error", varargs...) +} + +// Error indicates an expected call of Error. +func (mr *MockLoggerMockRecorder) Error(arg0 interface{}, arg1 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0}, arg1...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Error", reflect.TypeOf((*MockLogger)(nil).Error), varargs...) +} + +// Impl mocks base method. +func (m *MockLogger) Impl() interface{} { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Impl") + ret0, _ := ret[0].(interface{}) + return ret0 +} + +// Impl indicates an expected call of Impl. +func (mr *MockLoggerMockRecorder) Impl() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Impl", reflect.TypeOf((*MockLogger)(nil).Impl)) +} + +// Info mocks base method. +func (m *MockLogger) Info(arg0 string, arg1 ...interface{}) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0} + for _, a := range arg1 { + varargs = append(varargs, a) + } + m.ctrl.Call(m, "Info", varargs...) +} + +// Info indicates an expected call of Info. +func (mr *MockLoggerMockRecorder) Info(arg0 interface{}, arg1 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0}, arg1...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Info", reflect.TypeOf((*MockLogger)(nil).Info), varargs...) +} + +// Warn mocks base method. +func (m *MockLogger) Warn(arg0 string, arg1 ...interface{}) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0} + for _, a := range arg1 { + varargs = append(varargs, a) + } + m.ctrl.Call(m, "Warn", varargs...) +} + +// Warn indicates an expected call of Warn. +func (mr *MockLoggerMockRecorder) Warn(arg0 interface{}, arg1 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0}, arg1...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Warn", reflect.TypeOf((*MockLogger)(nil).Warn), varargs...) +} + +// With mocks base method. +func (m *MockLogger) With(arg0 ...interface{}) log.Logger { + m.ctrl.T.Helper() + varargs := []interface{}{} + for _, a := range arg0 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "With", varargs...) + ret0, _ := ret[0].(log.Logger) + return ret0 +} + +// With indicates an expected call of With. +func (mr *MockLoggerMockRecorder) With(arg0 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "With", reflect.TypeOf((*MockLogger)(nil).With), arg0...) +} diff --git a/server/config/config.go b/server/config/config.go index d97dedc5f54e..fdac0ed9dac5 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -13,6 +13,12 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) +// [AGORIC] Valid values for FlagAbciClientType +const ( + AbciClientTypeCommitting = "committing" + AbciClientTypeLocal = "local" +) + const ( defaultMinGasPrices = "" @@ -29,6 +35,9 @@ const ( // DefaultGRPCMaxSendMsgSize defines the default gRPC max message size in // bytes the server can send. DefaultGRPCMaxSendMsgSize = math.MaxInt32 + + // DefaultABCIClientType defines the default ABCI client type to use with cometbft. + DefaultABCIClientType = AbciClientTypeCommitting // [AGORIC] ) // BaseConfig defines the server's basic configuration @@ -91,6 +100,12 @@ type BaseConfig struct { // AppDBBackend defines the type of Database to use for the application and snapshots databases. // An empty string indicates that the CometBFT config's DBBackend value should be used. AppDBBackend string `mapstructure:"app-db-backend"` + + // ABCIClientType selects the type of ABCI client. + // Valid settings are "committing" (default) or "local". + // The committing client allows greater query parallelism, + // but the local client is more defensive. + ABCIClientType string `mapstructure:"abci-client-type"` // [AGORIC] } // APIConfig defines the API listener configuration. @@ -230,6 +245,7 @@ func DefaultConfig() *Config { IAVLCacheSize: 781250, IAVLDisableFastNode: false, AppDBBackend: "", + ABCIClientType: DefaultABCIClientType, // [AGORIC] }, Telemetry: telemetry.Config{ Enabled: false, diff --git a/server/start.go b/server/start.go index 80e29b9c1299..86b33bc8d14d 100644 --- a/server/start.go +++ b/server/start.go @@ -12,6 +12,7 @@ import ( "time" "github.com/cometbft/cometbft/abci/server" + cmtabcitypes "github.com/cometbft/cometbft/abci/types" cmtcmd "github.com/cometbft/cometbft/cmd/cometbft/commands" cmtcfg "github.com/cometbft/cometbft/config" cmtjson "github.com/cometbft/cometbft/libs/json" @@ -74,6 +75,7 @@ const ( FlagIAVLCacheSize = "iavl-cache-size" FlagDisableIAVLFastNode = "iavl-disable-fastnode" FlagShutdownGrace = "shutdown-grace" + FlagAbciClientType = "abci-client-type" // [AGORIC] // state sync-related flags FlagStateSyncSnapshotInterval = "state-sync.snapshot-interval" @@ -374,6 +376,11 @@ func startCmtNode( } cmtApp := NewCometABCIWrapper(app) + // TODO fix ABCI client type + //abciClient, err := proxy.NewLocalClientCreator(cmtApp).NewABCIClient() + //if err != nil { + // return nil, cleanupFn, err + //} tmNode, err = node.NewNodeWithContext( ctx, cfg, @@ -949,6 +956,22 @@ func testnetify(ctx *Context, testnetAppCreator types.AppCreator, db dbm.DB, tra return testnetApp, err } +type abciClientCreator func(cmtabcitypes.Application) proxy.ClientCreator + +// getABCIClientCreator dispatches the client type to the right cometBFT constructor. +// [AGORIC] Allows us to disable committingClient. +func getABCIClientCreator(abciClientType string) (abciClientCreator, error) { + switch abciClientType { + // case serverconfig.AbciClientTypeCommitting: + // return proxy.NewCommittingClientCreator, nil + case serverconfig.AbciClientTypeLocal: + return func(app cmtabcitypes.Application) proxy.ClientCreator { + return proxy.NewLocalClientCreator(app) + }, nil + } + return nil, fmt.Errorf(`unknown ABCI client type "%s"`, abciClientType) +} + // addStartNodeFlags should be added to any CLI commands that start the network. func addStartNodeFlags(cmd *cobra.Command, opts StartCmdOptions) { cmd.Flags().Bool(flagWithComet, true, "Run abci app embedded in-process with CometBFT") @@ -983,6 +1006,7 @@ func addStartNodeFlags(cmd *cobra.Command, opts StartCmdOptions) { cmd.Flags().Uint64(FlagStateSyncSnapshotInterval, 0, "State sync snapshot interval") cmd.Flags().Uint32(FlagStateSyncSnapshotKeepRecent, 2, "State sync snapshot to keep") cmd.Flags().Bool(FlagDisableIAVLFastNode, false, "Disable fast node for IAVL tree") + cmd.Flags().String(FlagAbciClientType, serverconfig.DefaultABCIClientType, fmt.Sprintf(`Type of ABCI client ("%s" or "%s")`, serverconfig.AbciClientTypeCommitting, serverconfig.AbciClientTypeLocal)) // [AGORIC] cmd.Flags().Int(FlagMempoolMaxTxs, mempool.DefaultMaxTx, "Sets MaxTx value for the app-side mempool") cmd.Flags().Duration(FlagShutdownGrace, 0*time.Second, "On Shutdown, duration to wait for resource clean up") diff --git a/simapp/app.go b/simapp/app.go index 35ce2e5bac23..4d1919030fc6 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -217,7 +217,7 @@ func NewSimApp( std.RegisterInterfaces(interfaceRegistry) // Below we could construct and set an application specific mempool and - // ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are + // ABCI 1.0 Preparefroposal and ProcessProposal handlers. These defaults are // already set in the SDK's BaseApp, this shows an example of how to override // them. // diff --git a/tests/integration/vesting/keeper/vesting_account_test.go b/tests/integration/vesting/keeper/vesting_account_test.go new file mode 100644 index 000000000000..abcb817cad66 --- /dev/null +++ b/tests/integration/vesting/keeper/vesting_account_test.go @@ -0,0 +1,324 @@ +package keeper + +import ( + "math/big" + "testing" + stdtime "time" + + "cosmossdk.io/core/appmodule" + "cosmossdk.io/log" + "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + cmtprototypes "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cometbft/cometbft/types/time" + "github.com/cosmos/cosmos-sdk/codec" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/testutil/integration" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + "github.com/cosmos/cosmos-sdk/x/bank" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/cosmos/cosmos-sdk/x/staking" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/stretchr/testify/require" + "gotest.tools/v3/assert" +) + +var ( + PKs = simtestutil.CreateTestPubKeys(500) + stakeDenom = "stake" + feeDenom = "fee" + emptyCoin = sdk.Coins{} +) + +type fixture struct { + app *integration.App + + sdkCtx sdk.Context + cdc codec.Codec + keys map[string]*storetypes.KVStoreKey + + accountKeeper authkeeper.AccountKeeper + bankKeeper bankkeeper.Keeper + stakingKeeper stakingkeeper.Keeper +} + +func init() { + sdk.DefaultPowerReduction = math.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)) +} + +func initBaseAccount() (*authtypes.BaseAccount, sdk.Coins) { + _, _, addr := testdata.KeyTestPubAddr() + origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} + bacc := authtypes.NewBaseAccountWithAddress(addr) + + return bacc, origCoins +} + +func initFixtures(t *testing.T) *fixture { + keys := storetypes.NewKVStoreKeys(authtypes.StoreKey, stakingtypes.StoreKey, banktypes.StoreKey, minttypes.StoreKey) + cdc := moduletestutil.MakeTestEncodingConfig(auth.AppModuleBasic{}, vesting.AppModuleBasic{}).Codec + + logger := log.NewTestLogger(t) + cms := integration.CreateMultiStore(keys, logger) + + newCtx := sdk.NewContext(cms, cmtprototypes.Header{}, true, logger) + + authority := authtypes.NewModuleAddress("gov") + + maccPerms := map[string][]string{ + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + } + + accountKeeper := authkeeper.NewAccountKeeper( + cdc, + runtime.NewKVStoreService(keys[authtypes.StoreKey]), + authtypes.ProtoBaseAccount, + maccPerms, + addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), + sdk.Bech32MainPrefix, + authority.String(), + ) + + blockedAddresses := map[string]bool{ + accountKeeper.GetAuthority(): false, + } + bankKeeper := bankkeeper.NewBaseKeeper( + cdc, + runtime.NewKVStoreService(keys[banktypes.StoreKey]), + accountKeeper, + blockedAddresses, + authority.String(), + log.NewNopLogger(), + ) + + stakingKeeper := stakingkeeper.NewKeeper( + cdc, + runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), + accountKeeper, + bankKeeper, + authority.String(), + addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr), + addresscodec.NewBech32Codec(sdk.Bech32PrefixConsAddr), + ) + + authModule := auth.NewAppModule(cdc, accountKeeper, authsims.RandomGenesisAccounts, nil) + bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper, nil) + stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper, nil) + //mintModule := mint.NewAppModule(cdc, mintKeeper, accountKeeper, nil, nil) + + integrationApp := integration.NewIntegrationApp(newCtx, logger, keys, cdc, map[string]appmodule.AppModule{ + authtypes.ModuleName: authModule, + banktypes.ModuleName: bankModule, + stakingtypes.ModuleName: stakingModule, + //minttypes.ModuleName: mintModule, + }) + + sdkCtx := sdk.UnwrapSDKContext(integrationApp.Context()) + // Register MsgServer and QueryServer + stakingtypes.RegisterMsgServer(integrationApp.MsgServiceRouter(), stakingkeeper.NewMsgServerImpl(stakingKeeper)) + stakingtypes.RegisterQueryServer(integrationApp.QueryHelper(), stakingkeeper.NewQuerier(stakingKeeper)) + + // set default staking params + assert.NilError(t, stakingKeeper.SetParams(sdkCtx, stakingtypes.DefaultParams())) + + f := &fixture{ + app: integrationApp, + sdkCtx: sdkCtx, + cdc: cdc, + keys: keys, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + stakingKeeper: *stakingKeeper, + } + return f +} + +func TestCreatePeriodicVestingAccBricked(t *testing.T) { + t.Parallel() + _ = initFixtures(t) + + now := time.Now() + c := sdk.NewCoins + fee := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(feeDenom, amt) } + stake := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, amt) } + + badPeriods := vestingtypes.Periods{ + {Length: 1, Amount: c(fee(10000), stake(100))}, + {Length: 1000, Amount: []sdk.Coin{{Denom: feeDenom, Amount: math.NewInt(-9000)}}}, + } + bacc, origCoins := initBaseAccount() + _, err := vestingtypes.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), badPeriods) + assert.Error(t, err, "period #1 has invalid coins: -9000fee") + +} + +func TestAddGrantPeroidicVestingAcc(t *testing.T) { + t.Parallel() + f := initFixtures(t) + ctx := f.sdkCtx + now := time.Now() + c := sdk.NewCoins + fee := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(feeDenom, amt) } + stake := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, amt) } + + periods := vestingtypes.Periods{ + {Length: 100, Amount: c(fee(250), stake(25))}, + {Length: 100, Amount: c(fee(250), stake(25))}, + {Length: 100, Amount: c(fee(250), stake(25))}, + {Length: 100, Amount: c(fee(250), stake(25))}, + } + bacc, origCoins := initBaseAccount() + pva, err := vestingtypes.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) + assert.NilError(t, err) + + // simulate 60stake (unvested) lost to slashing + pva.DelegatedVesting = c(stake(60)) + ctx = ctx.WithBlockTime(now.Add(150 * stdtime.Second)) + assert.Equal(t, int64(75), pva.GetVestingCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) + assert.Equal(t, int64(15), pva.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) + + // Add a new grant while all slashing is covered by unvested tokens + pva.AddGrant(ctx, f.stakingKeeper, ctx.BlockTime().Unix(), periods, origCoins) + + // After new grant, 115stake locked at now+150 due to slashing, + // delegation bookkeeping unchanged + assert.Equal(t, int64(115), pva.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) + assert.Equal(t, int64(60), pva.DelegatedVesting.AmountOf(stakeDenom).Int64()) + assert.Equal(t, int64(0), pva.DelegatedFree.AmountOf(stakeDenom).Int64()) + + ctx = ctx.WithBlockTime(now.Add(425 * stdtime.Second)) + require.Equal(t, int64(50), pva.GetVestingCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) + require.Equal(t, int64(0), pva.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) + + // Add a new grant, while slashed amount is 50 unvested, 10 vested + pva.AddGrant(ctx, f.stakingKeeper, ctx.BlockTime().Unix(), periods, origCoins) + assert.Equal(t, int64(100), pva.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) + assert.Equal(t, int64(50), pva.DelegatedVesting.AmountOf(stakeDenom).Int64()) + assert.Equal(t, int64(0), pva.DelegatedFree.AmountOf(stakeDenom).Int64()) + + ctx = ctx.WithBlockTime(now.Add(1000 * stdtime.Second)) + require.Equal(t, int64(0), pva.GetVestingCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) + require.Equal(t, int64(0), pva.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) + + // Add a new grant with residual slashed amount, but no unvested + pva.AddGrant(ctx, f.stakingKeeper, ctx.BlockTime().Unix(), periods, origCoins) + + // After new grant, all 100 locked, no residual delegation bookkeeping + require.Equal(t, int64(100), pva.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) + require.Equal(t, int64(0), pva.DelegatedVesting.AmountOf(stakeDenom).Int64()) + require.Equal(t, int64(0), pva.DelegatedFree.AmountOf(stakeDenom).Int64()) + + //f.accountKeeper.SetAccount(ctx, pva) + // fund the vesting account with new grant (old has vested and transferred out) + err = banktestutil.FundAccount(ctx, f.bankKeeper, pva.GetAddress(), origCoins) + require.NoError(t, err) + require.Equal(t, int64(100), f.bankKeeper.GetBalance(ctx, pva.GetAddress(), stakeDenom).Amount.Int64()) + + // we should not be able to transfer the latest grant out until it has vested + _, _, dest := testdata.KeyTestPubAddr() + tadr := pva.GetAddress() + co := c(stake(1)) + err = f.bankKeeper.SendCoins(ctx, tadr, dest, co) + //require.Error(t, err) + ctx = ctx.WithBlockTime(now.Add(1500 * stdtime.Second)) + //err = f.bankKeeper.SendCoins(ctx, pva.GetAddress(), dest, origCoins) + require.NoError(t, err) +} + +func TestAddGrantPeriodicVestincAcc_FullSlash(t *testing.T) { + t.Parallel() + f := initFixtures(t) + ctx := f.sdkCtx + now := time.Now() + c := sdk.NewCoins + + stake := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, amt) } + // create an account with an initial grant + periods := vestingtypes.Periods{ + {Length: 100, Amount: c(stake(40))}, + {Length: 100, Amount: c(stake(60))}, + } + bacc, _ := initBaseAccount() + origCoins := c(stake(100)) + pva, err := vestingtypes.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) + assert.NilError(t, err) + + // simulate all 100stake lost to slashing + pva.DelegatedVesting = c(stake(100)) + + // Nothing locked at now+150 since all unvested lost to slashing + require.Equal(t, int64(0), pva.LockedCoins(now.Add(150*stdtime.Second)).AmountOf(stakeDenom).Int64()) + + // Nothing locked at now+150 since all unvested lost to slashing + newGrant := c(stake(50)) + pva.AddGrant( + ctx, + f.stakingKeeper, + ctx.BlockTime().Unix(), + []vestingtypes.Period{{Length: 50, Amount: newGrant}}, + newGrant, + ) + f.accountKeeper.SetAccount(ctx, pva) + + // Only 10 of the new grant locked, since 40 fell into the "hole" of slashed-vested + require.Equal(t, int64(0), pva.LockedCoins(now.Add(150*stdtime.Second)).AmountOf(stakeDenom).Int64()) +} + +func TestAddGrantPeriodicVestingAcc_negAmount(t *testing.T) { + t.Parallel() + f := initFixtures(t) + ctx := f.sdkCtx + now := time.Now() + c := sdk.NewCoins + + fee := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(feeDenom, amt) } + stake := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, amt) } + + periods := vestingtypes.Periods{ + {Length: 100, Amount: c(fee(250), stake(25))}, + {Length: 100, Amount: c(fee(250), stake(25))}, + {Length: 100, Amount: c(fee(250), stake(25))}, + {Length: 100, Amount: c(fee(250), stake(25))}, + } + bacc, origCoins := initBaseAccount() + pva, err := vestingtypes.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) + assert.NilError(t, err) + + addr := pva.GetAddress() + + // At now+150 add a new grant wich attempts to prematurly vest the grant + bogusPeriods := vestingtypes.Periods{ + {Length: 1, Amount: c(fee(750))}, + {Length: 1000, Amount: []sdk.Coin{{Denom: feeDenom, Amount: math.NewInt(-749)}}}, + } + ctx = ctx.WithBlockTime(now.Add(150 * stdtime.Second)) + pva.AddGrant(ctx, f.stakingKeeper, ctx.BlockTime().Unix(), bogusPeriods, c(fee(1))) + + // fund the vesting account with new grant (old has vested and transferred out) + err = banktestutil.FundAccount(ctx, f.bankKeeper, addr, origCoins) + assert.NilError(t, err) + assert.Equal(t, int64(100), f.bankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) + + // try to transfer the orginal grant before its time + ctx = ctx.WithBlockTime(now.Add(160 * stdtime.Second)) + _, _, dest := testdata.KeyTestPubAddr() + err = f.bankKeeper.SendCoins(ctx, addr, dest, c(fee(750))) + assert.NilError(t, err) +} diff --git a/types/events.go b/types/events.go index 8d1f9d6cb44c..93063355c771 100644 --- a/types/events.go +++ b/types/events.go @@ -22,6 +22,8 @@ type EventManagerI interface { EmitTypedEvents(tevs ...proto.Message) error EmitEvent(event Event) EmitEvents(events Events) + // ABCIEventsHistory [Agoric] history holds the events from all transactions delivered in a block + ABCIEventsHistory() []abci.Event } // ---------------------------------------------------------------------------- @@ -33,11 +35,22 @@ var _ EventManagerI = (*EventManager)(nil) // EventManager implements a simple wrapper around a slice of Event objects that // can be emitted from. type EventManager struct { - events Events + events Events + history Events +} + +// NewEventManagerWithHistory returns a new event manager with empty events, +// but seeded with the provided history of earlier events in the block. +// [AGORIC] This should be used to create the EventManager for use in EndBlockers. +func NewEventManagerWithHistory(history Events) *EventManager { + return &EventManager{ + events: EmptyEvents(), + history: history, + } } func NewEventManager() *EventManager { - return &EventManager{EmptyEvents()} + return &EventManager{EmptyEvents(), EmptyEvents()} } func (em *EventManager) Events() Events { return em.events } @@ -59,6 +72,11 @@ func (em EventManager) ABCIEvents() []abci.Event { return em.events.ToABCIEvents() } +// ABCIEventsHistory [AGORIC] returns the historical slice of emitted events as a slice of abci.Event objects. +func (em EventManager) ABCIEventsHistory() []abci.Event { + return em.history.ToABCIEvents() +} + // EmitTypedEvent takes typed event and emits converting it into Event func (em *EventManager) EmitTypedEvent(tev proto.Message) error { event, err := TypedEventToEvent(tev) diff --git a/types/module/module.go b/types/module/module.go index 7eacde76d097..59212b4ecc1b 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -790,7 +790,18 @@ func (m *Manager) BeginBlock(ctx sdk.Context) (sdk.BeginBlock, error) { // child context with an event manager to aggregate events emitted from all // modules. func (m *Manager) EndBlock(ctx sdk.Context) (sdk.EndBlock, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) + // [AGORIC] Reset the EventManager, preserving any existing event history. + eventHistory := []sdk.Event{} + if oldEm := ctx.EventManager(); oldEm != nil { + abciEvents := oldEm.ABCIEventsHistory() + eventHistory = make(sdk.Events, len(abciEvents)) + for i, event := range abciEvents { + eventHistory[i] = sdk.Event(event) + } + } + em := sdk.NewEventManagerWithHistory(eventHistory) + + ctx = ctx.WithEventManager(em) validatorUpdates := []abci.ValidatorUpdate{} for _, moduleName := range m.OrderEndBlockers { diff --git a/types/router.go b/types/router.go index ef644994629c..c1b1c69d6459 100644 --- a/types/router.go +++ b/types/router.go @@ -1,9 +1,13 @@ package types -import ( - "regexp" -) +import "regexp" + +var ( + // IsAlphaNumeric defines a regular expression for matching against alpha-numeric + // values. + IsAlphaNumeric = regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString -// IsAlphaNumeric defines a regular expression for matching against alpha-numeric -// values. -var IsAlphaNumeric = regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString + // IsAlphaNumericOrUnderscore [AGORIC] is a regular expression that matches all typical + // JSON property names. + IsAlphaNumericOrUnderscore = regexp.MustCompile(`^[a-zA-Z0-9_]+$`).MatchString +) diff --git a/x/auth/vesting/cmd/vestcalc/vestcalc.go b/x/auth/vesting/cmd/vestcalc/vestcalc.go new file mode 100644 index 000000000000..35d6367e06e3 --- /dev/null +++ b/x/auth/vesting/cmd/vestcalc/vestcalc.go @@ -0,0 +1,576 @@ +package main + +import ( + "encoding/json" + "flag" + "fmt" + "io" + "os" + "strings" + "time" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/vesting/client/cli" +) + +// vestcalc is a utility for creating or reading schedule files +// for use in some vesting account types. See README.md for usage. + +// divide returns the division of total as evenly as possible. +// Divisor must be 1 or greater and total must be nonnegative. +func divide(total sdkmath.Int, divisor int) ([]sdkmath.Int, error) { + if divisor < 1 { + return nil, fmt.Errorf("divisions must be 1 or greater") + } + div64 := int64(divisor) + if total.IsNegative() { + return nil, fmt.Errorf("total must be nonnegative") + } + divisions := make([]sdkmath.Int, divisor) + + // Ideally we could compute total of the first i divisions as + // cumulative(i) = floor((total * i) / divisor) + // and so + // divisions[i] = cumulative(i + 1) - cumulative(i) + // but this could lead to numeric overflow for large values of total. + // Instead, we'll compute + // truncated = floor(total / divisor) + // so that + // total = truncated * divisor + remainder + // where remainder < divisor, then divide the remainder via the + // above algorithm - which now won't overflow - and sum the + // truncated and slices of the remainder to form the divisions. + truncated := total.QuoRaw(div64) + remainder := total.ModRaw(div64) + cumulative := sdkmath.NewInt(0) // portion of remainder which has been doled out + for i := int64(0); i < div64; i++ { + // multiply will not overflow since remainder and div64 are < 2^63 + nextCumulative := remainder.MulRaw(i + 1).QuoRaw(div64) + divisions[i] = truncated.Add(nextCumulative.Sub(cumulative)) + cumulative = nextCumulative + } + + // Integrity check + sum := sdkmath.NewInt(0) + for _, x := range divisions { + sum = sum.Add(x) + } + if !sum.Equal(total) { + return nil, fmt.Errorf("failed integrity check: divisions of %v sum to %d, should be %d", divisions, sum, total) + } + return divisions, nil +} + +// divideCoins divides the coins into divisor separate parts as evenly as possible. +// Divisor must be positive. Returns an array holding the division. +func divideCoins(coins sdk.Coins, divisor int) ([]sdk.Coins, error) { + if divisor < 1 { + return nil, fmt.Errorf("divisor must be 1 or greater") + } + divisions := make([]sdk.Coins, divisor) + divisionsByDenom := make(map[string][]sdkmath.Int) + for _, coin := range coins { + dividedCoin, err := divide(coin.Amount, divisor) + if err != nil { + return nil, fmt.Errorf("cannot divide %s: %v", coin.Denom, err) + } + divisionsByDenom[coin.Denom] = dividedCoin + } + for i := 0; i < divisor; i++ { + newCoins := sdk.NewCoins() + for _, coin := range coins { + c := sdk.NewCoin(coin.Denom, divisionsByDenom[coin.Denom][i]) + newCoins = newCoins.Add(c) + } + divisions[i] = newCoins + } + // Integrity check + sum := sdk.NewCoins() + for _, c := range divisions { + sum = sum.Add(c...) + } + if !sum.Equal(coins) { + return nil, fmt.Errorf("failed integrity check: divisions of %v sum to %s, should be %s", divisions, sum, coins) + } + return divisions, nil +} + +// monthlyVestTimes generates timestamps for successive months after startTime. +// The monthly events occur at the given time of day. If the month is not +// long enough for the desired date, the last day of the month is used. +// The number of months must be positive. +func monthlyVestTimes(startTime time.Time, months int, timeOfDay time.Time) ([]time.Time, error) { + if months < 1 { + return nil, fmt.Errorf("must have at least one vesting period") + } + location := startTime.Location() + hour := timeOfDay.Hour() + minute := timeOfDay.Minute() + second := timeOfDay.Second() + times := make([]time.Time, months) + for i := 1; i <= months; i++ { + tm := startTime.AddDate(0, i, 0) + if tm.Day() != startTime.Day() { + // The starting day-of-month cannot fit in this month, + // and we've wrapped to the next month. Back up to the + // end of the previous month. + tm = tm.AddDate(0, 0, -tm.Day()) + } + times[i-1] = time.Date(tm.Year(), tm.Month(), tm.Day(), hour, minute, second, 0, location) + } + // Integrity check: dates must be sequential and 26-33 days apart. + // (Jan 31 to Feb 28 or Feb 28 to Mar 31, plus slop for DST.) + lastTime := startTime + for _, tm := range times { + duration := tm.Sub(lastTime) + if duration < 26*24*time.Hour { + return nil, fmt.Errorf("vesting dates too close: %v and %v", lastTime, tm) + } + if duration > 33*24*time.Hour { + return nil, fmt.Errorf("vesting dates too distant: %v and %v", lastTime, tm) + } + lastTime = tm + } + return times, nil +} + +// marshalVestingData writes the vesting data as JSON. +func marshalVestingData(data cli.VestingData) ([]byte, error) { + return json.MarshalIndent(data, "", " ") +} + +// unmarshalVestingData parses the vesting data from JSON. +func unmarshalVestingData(bz []byte) (cli.VestingData, error) { + data := cli.VestingData{} + err := json.Unmarshal(bz, &data) + return data, err +} + +// event represents a single vesting event with an absolute time. +type event struct { + Time time.Time + Coins sdk.Coins +} + +// zipEvents generates events by zipping corresponding amounts and times +// from equal-sized arrays, returning an event array of the same size. +func zipEvents(divisions []sdk.Coins, times []time.Time) ([]event, error) { + n := len(divisions) + if len(times) != n { + return nil, fmt.Errorf("amount and time arrays are unequal") + } + events := make([]event, n) + for i := 0; i < n; i++ { + events[i] = event{Time: times[i], Coins: divisions[i]} + } + return events, nil +} + +// marshalEvents returns a printed representation of events. +// nolint:unparam +func marshalEvents(events []event) ([]byte, error) { + var b strings.Builder + b.WriteString("[\n") + for _, e := range events { + b.WriteString(" ") + b.WriteString(formatIso(e.Time)) + b.WriteString(": ") + b.WriteString(e.Coins.String()) + b.WriteString("\n") + } + b.WriteString("]") + return []byte(b.String()), nil +} + +// applyCliff accumulates vesting events before or at the cliff time +// into a single event, leaving subsequent events unchanged. +func applyCliff(events []event, cliff time.Time) ([]event, error) { + newEvents := []event{} + preCliffAmount := sdk.NewCoins() + i := 0 + for ; i < len(events) && !events[i].Time.After(cliff); i++ { + preCliffAmount = preCliffAmount.Add(events[i].Coins...) + } + if !preCliffAmount.IsZero() { + cliffEvent := event{Time: cliff, Coins: preCliffAmount} + newEvents = append(newEvents, cliffEvent) + } + for ; i < len(events); i++ { + newEvents = append(newEvents, events[i]) + } + + // integrity check + oldTotal := sdk.NewCoins() + for _, e := range events { + oldTotal = oldTotal.Add(e.Coins...) + } + newTotal := sdk.NewCoins() + for _, e := range newEvents { + newTotal = newTotal.Add(e.Coins...) + } + if !oldTotal.Equal(newTotal) { + return nil, fmt.Errorf("applying vesting cliff changed total from %s to %s", oldTotal, newTotal) + } + + return newEvents, nil +} + +// eventsToVestingData converts the events to VestingData with the given start time. +func eventsToVestingData(startTime time.Time, events []event) cli.VestingData { + periods := []cli.InputPeriod{} + lastTime := startTime + for _, e := range events { + dur := e.Time.Sub(lastTime) + p := cli.InputPeriod{ + Coins: e.Coins.String(), + Length: int64(dur.Seconds()), + } + periods = append(periods, p) + lastTime = e.Time + } + return cli.VestingData{ + StartTime: startTime.Unix(), + Periods: periods, + } +} + +// vestingDataToEvents converts the vesting data to absolute-timestamped events. +func vestingDataToEvents(data cli.VestingData) ([]event, error) { + startTime := time.Unix(data.StartTime, 0) + events := []event{} + lastTime := startTime + for _, p := range data.Periods { + coins, err := sdk.ParseCoinsNormalized(p.Coins) + if err != nil { + return nil, err + } + newTime := lastTime.Add(time.Duration(p.Length) * time.Second) + e := event{ + Time: newTime, + Coins: coins, + } + events = append(events, e) + lastTime = newTime + } + return events, nil +} + +// Time utilities + +// nolint:unused +const day = 24 * time.Hour + +// formatDuration returns a duration in a string like "3d4h3m0.5s". +// It follows time.Duration.String() except that it includes 24-hour days. +// NOTE: Does not reflect daylight savings changes. +// nolint:deadcode,unused +func formatDuration(d time.Duration) string { + s := "" + if d < 0 { + d = -d + s = "-" + } + if d < day { + // handle several special cases + return s + d.String() + } + // Now we know days are the most significant unit, + // so all other units should be present + r := d + days := int64(r / day) + r %= day // remainder + s += fmt.Sprint(days) + "d" + hours := int64(r / time.Hour) + r %= time.Hour + s += fmt.Sprint(hours) + "h" + minutes := int64(r / time.Minute) + r %= time.Minute + s += fmt.Sprint(minutes) + "m" + seconds := int64(r / time.Second) + r %= time.Second + s += fmt.Sprint(seconds) // no suffix yet + if r != 0 { + // Follow normal Duration formatting, but need to avoid + // the special handling of fractional seconds. + r += time.Second + frac := r.String() + // append skipping the leading "1" + return s + frac[1:] // adds the suffix + } + return s + "s" // now the suffix +} + +// maxTime gives the maximum of a set of times, or the zero time if empty. +func maxTime(cliffs []time.Time) time.Time { + tm := time.Time{} + for _, c := range cliffs { + if c.After(tm) { + tm = c + } + } + return tm +} + +// shortIsoFmt specifies ISO 8601 without seconds or timezone. +// Note: when parsing, timezone is UTC unless overridden. +const shortIsoFmt = "2006-01-02T15:04" + +// Common ISO-8601 formats for local day/time. +var localIsoFormats = []string{ + "2006-01-02", + "2006-01-02T15:04", + "2006-01-02T15:04:05", +} + +// parseIso tries to parse the given string as some common prefix of ISO-8601. +// "Common" means the least significant unit is day, minute, or second. +// The time will be in local time unless a timezone specifier is given. +func parseIso(s string) (time.Time, error) { + // Try local (no explicit timezone) formats first. + for _, fmt := range localIsoFormats { + tm, err := time.ParseInLocation(fmt, s, time.Local) + if err == nil { + return tm, nil + } + } + // Now try the full format. + return time.Parse(time.RFC3339, s) +} + +// formatIso formats the time in shortIso format in local time. +func formatIso(tm time.Time) string { + return tm.Format(shortIsoFmt) +} + +// hhmmFmt specifies an HH:MM time format to generate time.Time values +// where only hours, minutes, seconds are used. +const hhmmFmt = "15:04" + +// Custom flag types + +// isoDate is time.Time as a flag.Value in shortIsoFmt. +type isoDate struct{ time.Time } + +var _ flag.Value = &isoDate{} + +// Set implements flag.Value.Set(). +func (id *isoDate) Set(s string) error { + t, err := parseIso(s) + if err != nil { + return err + } + id.Time = t + return nil +} + +// String implements flag.Value.String(). +func (id *isoDate) String() string { + return formatIso(id.Time) +} + +// isoDateFlag makes a new isoDate flag, accessed as a time.Time. +func isoDateFlag(name string, usage string) *time.Time { + id := isoDate{time.Time{}} + flag.CommandLine.Var(&id, name, usage) + return &id.Time +} + +// isoDateList is []time.Time as a flag.Value in repeated or comma-separated shortIsoFmt. +type isoDateList []time.Time + +var _ flag.Value = &isoDateList{} + +// Set implements flag.Value.Set(). +func (dates *isoDateList) Set(s string) error { + for _, ds := range strings.Split(s, ",") { + d, err := parseIso(ds) + if err != nil { + return err + } + *dates = append(*dates, d) // accumulates repeated flag arguments + } + return nil +} + +// String implements flag.Value.String(). +func (dates *isoDateList) String() string { + s := "" + for _, t := range *dates { + if s == "" { + s = formatIso(t) + } else { + s = s + "," + formatIso(t) + } + } + return s +} + +// isoDateListFlag makes a new isoDateList flag. +func isoDateListFlag(name string, usage string) *isoDateList { + dates := isoDateList([]time.Time{}) + flag.Var(&dates, name, usage) + return &dates +} + +// isoTime is time.Time as a flagValue in HH:MM format. +type isoTime struct{ time.Time } + +var _ flag.Value = &isoTime{} + +// Set implements flag.Value.Set(). +func (it *isoTime) Set(s string) error { + t, err := time.Parse(hhmmFmt, s) + if err != nil { + return err + } + it.Time = t + return nil +} + +// String implements flag.Value.String(). +func (it *isoTime) String() string { + return it.Format(hhmmFmt) +} + +// isoTimeFlag makes a new isoTime flag, accessed as a time.Time. +func isoTimeFlag(name string, value string, usage string) *time.Time { + t, err := time.Parse(hhmmFmt, value) + if err != nil { + t = time.Time{} + } + it := isoTime{t} + flag.CommandLine.Var(&it, name, usage) + return &it.Time +} + +var ( + flagStart = isoDateFlag("start", "Start date for the vesting in format 2006-01-02T15:04 (local time).") + flagMonths = flag.Int("months", 1, "Number of months to vest over.") + flagCoins = flag.String("coins", "", "Total coins to vest.") + flagTime = isoTimeFlag("time", "00:00", "Time of day for vesting, e.g. 15:04.") + flagCliffs = isoDateListFlag("cliffs", "Vesting cliffs in format 2006-01-02T15:04 (local time).") + flagRead = flag.Bool("read", false, "Read periods file from stdin and print dates relative to start.") + flagWrite = flag.Bool("write", false, "Write periods file to stdout.") +) + +// readCmd reads a schedule file from stdin and writes a sequence of vesting +// events in local time to stdout. See README.md for the format. +func readCmd() { + bzIn, err := io.ReadAll(os.Stdin) + if err != nil { + fmt.Fprintf(os.Stderr, "cannot read stdin: %v", err) + return + } + vestingData, err := unmarshalVestingData(bzIn) + if err != nil { + fmt.Fprintf(os.Stderr, "cannot decode vesting data: %v", err) + return + } + events, err := vestingDataToEvents(vestingData) + if err != nil { + fmt.Fprintf(os.Stderr, "cannot convert vesting data: %v", err) + } + bzOut, err := marshalEvents(events) + if err != nil { + fmt.Fprintf(os.Stderr, "cannot encode events: %v", err) + return + } + fmt.Println(string(bzOut)) +} + +// writeConfig bundles data needed for the write operation. +type writeConfig struct { + // Coins is the total amount to be vested. + Coins sdk.Coins + // Months is the number of months to vest over. Must be positive. + Months int + TimeOfDay time.Time + Start time.Time + Cliffs []time.Time +} + +// genWriteConfig generates a writeConfig from flag settings and validates it. +func genWriteConfig() (writeConfig, error) { + wc := writeConfig{} + coins, err := sdk.ParseCoinsNormalized(*flagCoins) + if err != nil { + return wc, fmt.Errorf("cannot parse --coins: %v", err) + } + wc.Coins = coins + if *flagMonths < 1 { + return wc, fmt.Errorf("must use a positive number of months") + } + wc.Months = *flagMonths + wc.TimeOfDay = *flagTime + wc.Start = *flagStart + wc.Cliffs = *flagCliffs + return wc, nil +} + +// generateEvents generates vesting events from the writeConfig. +func (wc writeConfig) generateEvents() ([]event, error) { + divisions, err := divideCoins(wc.Coins, wc.Months) + if err != nil { + return nil, fmt.Errorf("vesting amount division failed: %v", err) + } + times, err := monthlyVestTimes(wc.Start, wc.Months, wc.TimeOfDay) + if err != nil { + return nil, fmt.Errorf("vesting time calcuation failed: %v", err) + } + events, err := zipEvents(divisions, times) + if err != nil { + return nil, fmt.Errorf("vesting event generation failed: %v", err) + } + if len(wc.Cliffs) > 0 { + last := maxTime(wc.Cliffs) + events, err = applyCliff(events, last) + if err != nil { + return nil, fmt.Errorf("vesting cliff failed: %v", err) + } + } + return events, nil +} + +// convertRelative converts absolute-time events to VestingData relative to the Start time. +func (wc writeConfig) convertRelative(events []event) cli.VestingData { + return eventsToVestingData(wc.Start, events) +} + +// writeCmd generates a set of vesting events based on parsed flags +// and writes a schedule file to stdout. +func writeCmd() { + wc, err := genWriteConfig() + if err != nil { + fmt.Fprintf(os.Stderr, "bad write configuration: %v", err) + return + } + events, err := wc.generateEvents() + if err != nil { + fmt.Fprintf(os.Stderr, "cannot generate events: %v", err) + return + } + vestingData := wc.convertRelative(events) + bz, err := marshalVestingData(vestingData) + if err != nil { + fmt.Fprintf(os.Stderr, "cannot marshal vesting data: %v", err) + return + } + fmt.Println(string(bz)) +} + +// main parses the flags and executes a subcommand based on flags. +// See README.md for flags and subcommands. +func main() { + flag.Parse() + switch { + case *flagRead && !*flagWrite: + readCmd() + case *flagWrite && !*flagRead: + writeCmd() + default: + fmt.Fprintln(os.Stderr, "Must specify one of --read or --write") + flag.Usage() + os.Exit(1) + } +} diff --git a/x/auth/vesting/module.go b/x/auth/vesting/module.go index 139efb1af0de..5d60b3a4b0d9 100644 --- a/x/auth/vesting/module.go +++ b/x/auth/vesting/module.go @@ -79,6 +79,7 @@ type AppModule struct { accountKeeper keeper.AccountKeeper bankKeeper types.BankKeeper + stakingKeeper types.StakingKeeper } func NewAppModule(ak keeper.AccountKeeper, bk types.BankKeeper) AppModule { @@ -97,7 +98,7 @@ func (am AppModule) IsAppModule() {} // RegisterServices registers module services. func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error { - types.RegisterMsgServer(registrar, NewMsgServerImpl(am.accountKeeper, am.bankKeeper)) + types.RegisterMsgServer(registrar, NewMsgServerImpl(am.accountKeeper, am.bankKeeper, am.stakingKeeper)) return nil } @@ -129,6 +130,7 @@ type ModuleInputs struct { AccountKeeper keeper.AccountKeeper BankKeeper types.BankKeeper + StakingKeeper types.StakingKeeper } type ModuleOutputs struct { diff --git a/x/auth/vesting/msg_server.go b/x/auth/vesting/msg_server.go index 222fc262a291..ab07adedf4e6 100644 --- a/x/auth/vesting/msg_server.go +++ b/x/auth/vesting/msg_server.go @@ -18,53 +18,48 @@ import ( type msgServer struct { keeper.AccountKeeper types.BankKeeper + types.StakingKeeper } // NewMsgServerImpl returns an implementation of the vesting MsgServer interface, // wrapping the corresponding AccountKeeper and BankKeeper. -func NewMsgServerImpl(k keeper.AccountKeeper, bk types.BankKeeper) types.MsgServer { - return &msgServer{AccountKeeper: k, BankKeeper: bk} +func NewMsgServerImpl(k keeper.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper) types.MsgServer { + return &msgServer{AccountKeeper: k, BankKeeper: bk, StakingKeeper: sk} } var _ types.MsgServer = msgServer{} func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCreateVestingAccount) (*types.MsgCreateVestingAccountResponse, error) { - from, err := s.AccountKeeper.AddressCodec().StringToBytes(msg.FromAddress) - if err != nil { - return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid 'from' address: %s", err) - } - - to, err := s.AccountKeeper.AddressCodec().StringToBytes(msg.ToAddress) - if err != nil { - return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid 'to' address: %s", err) - } + ctx := sdk.UnwrapSDKContext(goCtx) + ak := s.AccountKeeper + bk := s.BankKeeper - if err := validateAmount(msg.Amount); err != nil { + if err := bk.IsSendEnabledCoins(ctx, msg.Amount...); err != nil { return nil, err } - if msg.EndTime <= 0 { - return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid end time") + from, err := sdk.AccAddressFromBech32(msg.FromAddress) + if err != nil { + return nil, err } - - ctx := sdk.UnwrapSDKContext(goCtx) - if err := s.BankKeeper.IsSendEnabledCoins(ctx, msg.Amount...); err != nil { + to, err := sdk.AccAddressFromBech32(msg.ToAddress) + if err != nil { return nil, err } - if s.BankKeeper.BlockedAddr(to) { + if bk.BlockedAddr(to) { return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress) } - if acc := s.AccountKeeper.GetAccount(ctx, to); acc != nil { + if acc := ak.GetAccount(ctx, to); acc != nil { return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress) } baseAccount := authtypes.NewBaseAccountWithAddress(to) - baseAccount = s.AccountKeeper.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount) + baseAccount = ak.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount) baseVestingAccount, err := types.NewBaseVestingAccount(baseAccount, msg.Amount.Sort(), msg.EndTime) if err != nil { - return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) + return nil, err } var vestingAccount sdk.AccountI @@ -74,7 +69,7 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCre vestingAccount = types.NewContinuousVestingAccountRaw(baseVestingAccount, ctx.BlockTime().Unix()) } - s.AccountKeeper.SetAccount(ctx, vestingAccount) + ak.SetAccount(ctx, vestingAccount) defer func() { telemetry.IncrCounter(1, "new", "account") @@ -90,7 +85,7 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCre } }() - if err = s.BankKeeper.SendCoins(ctx, from, to, msg.Amount); err != nil { + if err = bk.SendCoins(ctx, from, to, msg.Amount); err != nil { return nil, err } @@ -98,41 +93,39 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCre } func (s msgServer) CreatePermanentLockedAccount(goCtx context.Context, msg *types.MsgCreatePermanentLockedAccount) (*types.MsgCreatePermanentLockedAccountResponse, error) { - from, err := s.AccountKeeper.AddressCodec().StringToBytes(msg.FromAddress) - if err != nil { - return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid 'from' address: %s", err) - } + ctx := sdk.UnwrapSDKContext(goCtx) + ak := s.AccountKeeper + bk := s.BankKeeper - to, err := s.AccountKeeper.AddressCodec().StringToBytes(msg.ToAddress) - if err != nil { - return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid 'to' address: %s", err) + if err := bk.IsSendEnabledCoins(ctx, msg.Amount...); err != nil { + return nil, err } - if err := validateAmount(msg.Amount); err != nil { + from, err := sdk.AccAddressFromBech32(msg.FromAddress) + if err != nil { return nil, err } - - ctx := sdk.UnwrapSDKContext(goCtx) - if err := s.BankKeeper.IsSendEnabledCoins(ctx, msg.Amount...); err != nil { + to, err := sdk.AccAddressFromBech32(msg.ToAddress) + if err != nil { return nil, err } - if s.BankKeeper.BlockedAddr(to) { + if bk.BlockedAddr(to) { return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress) } - if acc := s.AccountKeeper.GetAccount(ctx, to); acc != nil { + if acc := ak.GetAccount(ctx, to); acc != nil { return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress) } baseAccount := authtypes.NewBaseAccountWithAddress(to) - baseAccount = s.AccountKeeper.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount) + baseAccount = ak.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount) vestingAccount, err := types.NewPermanentLockedAccount(baseAccount, msg.Amount) if err != nil { - return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) + return nil, err } - s.AccountKeeper.SetAccount(ctx, vestingAccount) + ak.SetAccount(ctx, vestingAccount) defer func() { telemetry.IncrCounter(1, "new", "account") @@ -148,92 +141,258 @@ func (s msgServer) CreatePermanentLockedAccount(goCtx context.Context, msg *type } }() - if err = s.BankKeeper.SendCoins(ctx, from, to, msg.Amount); err != nil { + if err = bk.SendCoins(ctx, from, to, msg.Amount); err != nil { return nil, err } return &types.MsgCreatePermanentLockedAccountResponse{}, nil } -func (s msgServer) CreatePeriodicVestingAccount(goCtx context.Context, msg *types.MsgCreatePeriodicVestingAccount) (*types.MsgCreatePeriodicVestingAccountResponse, error) { - from, err := s.AccountKeeper.AddressCodec().StringToBytes(msg.FromAddress) +// CreateClawbackVestingAccount creates a new ClawbackVestingAccount, or merges a grant into an existing one. +func (s msgServer) CreateClawbackVestingAccount(goCtx context.Context, msg *types.MsgCreateClawbackVestingAccount) (*types.MsgCreateClawbackVestingAccountResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + ak := s.AccountKeeper + bk := s.BankKeeper + + from, err := sdk.AccAddressFromBech32(msg.FromAddress) if err != nil { - return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid 'from' address: %s", err) + return nil, err } - - to, err := s.AccountKeeper.AddressCodec().StringToBytes(msg.ToAddress) + to, err := sdk.AccAddressFromBech32(msg.ToAddress) if err != nil { - return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid 'to' address: %s", err) + return nil, err } - if msg.StartTime < 1 { - return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid start time of %d, length must be greater than 0", msg.StartTime) + if bk.BlockedAddr(to) { + return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress) } - var totalCoins sdk.Coins - for i, period := range msg.VestingPeriods { - if period.Length < 1 { - return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid period length of %d in period %d, length must be greater than 0", period.Length, i) + vestingCoins := sdk.NewCoins() + for _, period := range msg.VestingPeriods { + vestingCoins = vestingCoins.Add(period.Amount...) + } + + lockupCoins := sdk.NewCoins() + for _, period := range msg.LockupPeriods { + lockupCoins = lockupCoins.Add(period.Amount...) + } + + if !vestingCoins.IsZero() && len(msg.LockupPeriods) == 0 { + // If lockup absent, default to an instant unlock schedule + msg.LockupPeriods = []types.Period{ + {Length: 0, Amount: vestingCoins}, } + lockupCoins = vestingCoins + } + + if !lockupCoins.IsZero() && len(msg.VestingPeriods) == 0 { + // If vesting absent, default to an instant vesting schedule + msg.VestingPeriods = []types.Period{ + {Length: 0, Amount: lockupCoins}, + } + vestingCoins = lockupCoins + } - if err := validateAmount(period.Amount); err != nil { + // The vesting and lockup schedules must describe the same total amount. + // IsEqual can panic, so use (a == b) <=> (a <= b && b <= a). + if !(vestingCoins.IsAllLTE(lockupCoins) && lockupCoins.IsAllLTE(vestingCoins)) { + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "lockup and vesting amounts must be equal") + } + + madeNewAcc := false + acc := ak.GetAccount(ctx, to) + var va *types.ClawbackVestingAccount + + if acc != nil { + var isClawback bool + va, isClawback = acc.(*types.ClawbackVestingAccount) + switch { + case !msg.Merge && isClawback: + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists; consider using --merge", msg.ToAddress) + case !msg.Merge && !isClawback: + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress) + case msg.Merge && !isClawback: + return nil, errorsmod.Wrapf(sdkerrors.ErrNotSupported, "account %s must be a clawback vesting account", msg.ToAddress) + } + err := va.AddGrant(ctx, msg.FromAddress, s.StakingKeeper, msg.GetStartTime(), msg.GetLockupPeriods(), msg.GetVestingPeriods(), vestingCoins) + if err != nil { return nil, err } + } else { + baseAccount := ak.NewAccountWithAddress(ctx, to) + va = types.NewClawbackVestingAccount(baseAccount.(*authtypes.BaseAccount), from, vestingCoins, msg.StartTime, msg.LockupPeriods, msg.VestingPeriods) + madeNewAcc = true + } - totalCoins = totalCoins.Add(period.Amount...) + ak.SetAccount(ctx, va) + + if madeNewAcc { + defer func() { + telemetry.IncrCounter(1, "new", "account") + + for _, a := range vestingCoins { + if a.Amount.IsInt64() { + telemetry.SetGaugeWithLabels( + []string{"tx", "msg", "create_clawback_vesting_account"}, + float32(a.Amount.Int64()), + []metrics.Label{telemetry.NewLabel("denom", a.Denom)}, + ) + } + } + }() } - if s.BankKeeper.BlockedAddr(to) { - return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress) + err = bk.SendCoins(ctx, from, to, vestingCoins) + if err != nil { + return nil, err } + return &types.MsgCreateClawbackVestingAccountResponse{}, nil +} + +// Clawback removes the unvested amount from a ClawbackVestingAccount. +// The destination defaults to the funder address, but can be overridden. +func (s msgServer) Clawback(goCtx context.Context, msg *types.MsgClawback) (*types.MsgClawbackResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - if acc := s.AccountKeeper.GetAccount(ctx, to); acc != nil { - return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress) - } - if err := s.BankKeeper.IsSendEnabledCoins(ctx, totalCoins...); err != nil { + ak := s.AccountKeeper + bk := s.BankKeeper + + funder, err := sdk.AccAddressFromBech32(msg.GetFunderAddress()) + if err != nil { return nil, err } + addr, err := sdk.AccAddressFromBech32(msg.GetAddress()) + if err != nil { + return nil, err + } + dest := funder + if msg.GetDestAddress() != "" { + dest, err = sdk.AccAddressFromBech32(msg.GetDestAddress()) + if err != nil { + return nil, err + } + } - baseAccount := authtypes.NewBaseAccountWithAddress(to) - baseAccount = s.AccountKeeper.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount) - vestingAccount, err := types.NewPeriodicVestingAccount(baseAccount, totalCoins.Sort(), msg.StartTime, msg.VestingPeriods) + if bk.BlockedAddr(dest) { + return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.DestAddress) + } + + acc := ak.GetAccount(ctx, addr) + if acc == nil { + return nil, errorsmod.Wrapf(sdkerrors.ErrNotFound, "account %s does not exist", msg.Address) + + } + va, ok := acc.(*types.ClawbackVestingAccount) + if !ok { + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account not subject to clawback: %s", msg.Address) + + } + + err = va.Clawback(ctx, funder, dest, ak, bk, s.StakingKeeper) if err != nil { - return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) + return nil, err } - s.AccountKeeper.SetAccount(ctx, vestingAccount) + return &types.MsgClawbackResponse{}, nil +} - defer func() { - telemetry.IncrCounter(1, "new", "account") +// ReturnGrants removes the unvested amount from a vesting account, +// returning it to the funder. Currently only supported for ClawbackVestingAccount. +func (s msgServer) ReturnGrants(goCtx context.Context, msg *types.MsgReturnGrants) (*types.MsgReturnGrantsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) - for _, a := range totalCoins { - if a.Amount.IsInt64() { - telemetry.SetGaugeWithLabels( - []string{"tx", "msg", "create_periodic_vesting_account"}, - float32(a.Amount.Int64()), - []metrics.Label{telemetry.NewLabel("denom", a.Denom)}, - ) - } - } - }() + ak := s.AccountKeeper - if err = s.BankKeeper.SendCoins(ctx, from, to, totalCoins); err != nil { + addr, err := sdk.AccAddressFromBech32(msg.GetAddress()) + if err != nil { return nil, err } - return &types.MsgCreatePeriodicVestingAccountResponse{}, nil + acc := ak.GetAccount(ctx, addr) + if acc == nil { + return nil, errorsmod.Wrapf(sdkerrors.ErrNotFound, "account %s does not exist", msg.Address) + + } + va, ok := acc.(*types.ClawbackVestingAccount) + if !ok { + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account does not support return-grants: %s", msg.Address) + + } + + va.ReturnGrants(ctx, ak, s.BankKeeper, s.StakingKeeper) + + return &types.MsgReturnGrantsResponse{}, nil } -func validateAmount(amount sdk.Coins) error { - if !amount.IsValid() { - return sdkerrors.ErrInvalidCoins.Wrap(amount.String()) +func (s msgServer) CreatePeriodicVestingAccount(goCtx context.Context, msg *types.MsgCreatePeriodicVestingAccount) (*types.MsgCreatePeriodicVestingAccountResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + ak := s.AccountKeeper + bk := s.BankKeeper + + from, err := sdk.AccAddressFromBech32(msg.FromAddress) + if err != nil { + return nil, err + } + to, err := sdk.AccAddressFromBech32(msg.ToAddress) + if err != nil { + return nil, err } - if !amount.IsAllPositive() { - return sdkerrors.ErrInvalidCoins.Wrap(amount.String()) + if bk.BlockedAddr(to) { + return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress) + } + + var totalCoins sdk.Coins + for _, period := range msg.VestingPeriods { + totalCoins = totalCoins.Add(period.Amount...) } - return nil + madeNewAcc := false + acc := ak.GetAccount(ctx, to) + + if acc != nil { + pva, isPeriodic := acc.(*types.PeriodicVestingAccount) + switch { + case !msg.Merge && isPeriodic: + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists; consider using --merge", msg.ToAddress) + case !msg.Merge && !isPeriodic: + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress) + case msg.Merge && !isPeriodic: + return nil, errorsmod.Wrapf(sdkerrors.ErrNotSupported, "account %s must be a periodic vesting account", msg.ToAddress) + } + pva.AddGrant(ctx, s.StakingKeeper, msg.GetStartTime(), msg.GetVestingPeriods(), totalCoins) + } else { + baseAccount := authtypes.NewBaseAccountWithAddress(to) + baseAccount = ak.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount) + acc, err = types.NewPeriodicVestingAccount(baseAccount, totalCoins.Sort(), msg.StartTime, msg.VestingPeriods) + if err != nil { + return nil, err + } + madeNewAcc = true + } + + ak.SetAccount(ctx, acc) + + if madeNewAcc { + defer func() { + telemetry.IncrCounter(1, "new", "account") + + for _, a := range totalCoins { + if a.Amount.IsInt64() { + telemetry.SetGaugeWithLabels( + []string{"tx", "msg", "create_periodic_vesting_account"}, + float32(a.Amount.Int64()), + []metrics.Label{telemetry.NewLabel("denom", a.Denom)}, + ) + } + } + }() + } + if err = bk.SendCoins(ctx, from, to, totalCoins); err != nil { + return nil, err + } + + return &types.MsgCreatePeriodicVestingAccountResponse{}, nil } diff --git a/x/auth/vesting/msg_server_test.go b/x/auth/vesting/msg_server_test.go index 45f7502f989b..577a9934ab2d 100644 --- a/x/auth/vesting/msg_server_test.go +++ b/x/auth/vesting/msg_server_test.go @@ -40,6 +40,7 @@ type VestingTestSuite struct { accountKeeper authkeeper.AccountKeeper bankKeeper *vestingtestutil.MockBankKeeper msgServer vestingtypes.MsgServer + stakingKeeper *vestingtestutil.MockStakingKeeper } func (s *VestingTestSuite) SetupTest() { @@ -53,6 +54,7 @@ func (s *VestingTestSuite) SetupTest() { ctrl := gomock.NewController(s.T()) s.bankKeeper = vestingtestutil.NewMockBankKeeper(ctrl) + s.stakingKeeper = vestingtestutil.NewMockStakingKeeper(ctrl) s.accountKeeper = authkeeper.NewAccountKeeper( encCfg.Codec, storeService, @@ -65,7 +67,7 @@ func (s *VestingTestSuite) SetupTest() { vestingtypes.RegisterInterfaces(encCfg.InterfaceRegistry) authtypes.RegisterInterfaces(encCfg.InterfaceRegistry) - s.msgServer = vesting.NewMsgServerImpl(s.accountKeeper, s.bankKeeper) + s.msgServer = vesting.NewMsgServerImpl(s.accountKeeper, s.bankKeeper, s.stakingKeeper) } func (s *VestingTestSuite) TestCreateVestingAccount() { diff --git a/x/auth/vesting/testutil/expected_keepers_mocks.go b/x/auth/vesting/testutil/expected_keepers_mocks.go index 1df8f8ebbf2b..e9028e58808e 100644 --- a/x/auth/vesting/testutil/expected_keepers_mocks.go +++ b/x/auth/vesting/testutil/expected_keepers_mocks.go @@ -8,7 +8,9 @@ import ( context "context" reflect "reflect" + math "cosmossdk.io/math" types "github.com/cosmos/cosmos-sdk/types" + types0 "github.com/cosmos/cosmos-sdk/x/staking/types" gomock "github.com/golang/mock/gomock" ) @@ -49,6 +51,20 @@ func (mr *MockBankKeeperMockRecorder) BlockedAddr(addr interface{}) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockedAddr", reflect.TypeOf((*MockBankKeeper)(nil).BlockedAddr), addr) } +// GetAllBalances mocks base method. +func (m *MockBankKeeper) GetAllBalances(ctx context.Context, addr types.AccAddress) types.Coins { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAllBalances", ctx, addr) + ret0, _ := ret[0].(types.Coins) + return ret0 +} + +// GetAllBalances indicates an expected call of GetAllBalances. +func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr) +} + // IsSendEnabledCoins mocks base method. func (m *MockBankKeeper) IsSendEnabledCoins(ctx context.Context, coins ...types.Coin) error { m.ctrl.T.Helper() @@ -81,3 +97,258 @@ func (mr *MockBankKeeperMockRecorder) SendCoins(ctx, fromAddr, toAddr, amt inter mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoins", reflect.TypeOf((*MockBankKeeper)(nil).SendCoins), ctx, fromAddr, toAddr, amt) } + +// SpendableCoins mocks base method. +func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types.AccAddress) types.Coins { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpendableCoins", ctx, addr) + ret0, _ := ret[0].(types.Coins) + return ret0 +} + +// SpendableCoins indicates an expected call of SpendableCoins. +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) +} + +// MockAccountKeeper is a mock of AccountKeeper interface. +type MockAccountKeeper struct { + ctrl *gomock.Controller + recorder *MockAccountKeeperMockRecorder +} + +// MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. +type MockAccountKeeperMockRecorder struct { + mock *MockAccountKeeper +} + +// NewMockAccountKeeper creates a new mock instance. +func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper { + mock := &MockAccountKeeper{ctrl: ctrl} + mock.recorder = &MockAccountKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { + return m.recorder +} + +// GetAccount mocks base method. +func (m *MockAccountKeeper) GetAccount(arg0 context.Context, arg1 types.AccAddress) types.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccount", arg0, arg1) + ret0, _ := ret[0].(types.AccountI) + return ret0 +} + +// GetAccount indicates an expected call of GetAccount. +func (mr *MockAccountKeeperMockRecorder) GetAccount(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), arg0, arg1) +} + +// SetAccount mocks base method. +func (m *MockAccountKeeper) SetAccount(arg0 context.Context, arg1 types.AccountI) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetAccount", arg0, arg1) +} + +// SetAccount indicates an expected call of SetAccount. +func (mr *MockAccountKeeperMockRecorder) SetAccount(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), arg0, arg1) +} + +// MockStakingKeeper is a mock of StakingKeeper interface. +type MockStakingKeeper struct { + ctrl *gomock.Controller + recorder *MockStakingKeeperMockRecorder +} + +// MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper. +type MockStakingKeeperMockRecorder struct { + mock *MockStakingKeeper +} + +// NewMockStakingKeeper creates a new mock instance. +func NewMockStakingKeeper(ctrl *gomock.Controller) *MockStakingKeeper { + mock := &MockStakingKeeper{ctrl: ctrl} + mock.recorder = &MockStakingKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockStakingKeeper) EXPECT() *MockStakingKeeperMockRecorder { + return m.recorder +} + +// BondDenom mocks base method. +func (m *MockStakingKeeper) BondDenom(ctx context.Context) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BondDenom", ctx) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BondDenom indicates an expected call of BondDenom. +func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondDenom", reflect.TypeOf((*MockStakingKeeper)(nil).BondDenom), ctx) +} + +// GetDelegatorBonded mocks base method. +func (m *MockStakingKeeper) GetDelegatorBonded(ctx context.Context, delegator types.AccAddress) (math.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDelegatorBonded", ctx, delegator) + ret0, _ := ret[0].(math.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetDelegatorBonded indicates an expected call of GetDelegatorBonded. +func (mr *MockStakingKeeperMockRecorder) GetDelegatorBonded(ctx, delegator interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDelegatorBonded", reflect.TypeOf((*MockStakingKeeper)(nil).GetDelegatorBonded), ctx, delegator) +} + +// GetDelegatorDelegations mocks base method. +func (m *MockStakingKeeper) GetDelegatorDelegations(ctx context.Context, delegator types.AccAddress, maxRetrieve uint16) ([]types0.Delegation, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDelegatorDelegations", ctx, delegator, maxRetrieve) + ret0, _ := ret[0].([]types0.Delegation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetDelegatorDelegations indicates an expected call of GetDelegatorDelegations. +func (mr *MockStakingKeeperMockRecorder) GetDelegatorDelegations(ctx, delegator, maxRetrieve interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDelegatorDelegations", reflect.TypeOf((*MockStakingKeeper)(nil).GetDelegatorDelegations), ctx, delegator, maxRetrieve) +} + +// GetDelegatorUnbonding mocks base method. +func (m *MockStakingKeeper) GetDelegatorUnbonding(ctx context.Context, delegator types.AccAddress) (math.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDelegatorUnbonding", ctx, delegator) + ret0, _ := ret[0].(math.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetDelegatorUnbonding indicates an expected call of GetDelegatorUnbonding. +func (mr *MockStakingKeeperMockRecorder) GetDelegatorUnbonding(ctx, delegator interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDelegatorUnbonding", reflect.TypeOf((*MockStakingKeeper)(nil).GetDelegatorUnbonding), ctx, delegator) +} + +// GetUnbondingDelegations mocks base method. +func (m *MockStakingKeeper) GetUnbondingDelegations(ctx context.Context, delegator types.AccAddress, maxRetrieve uint16) ([]types0.UnbondingDelegation, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUnbondingDelegations", ctx, delegator, maxRetrieve) + ret0, _ := ret[0].([]types0.UnbondingDelegation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetUnbondingDelegations indicates an expected call of GetUnbondingDelegations. +func (mr *MockStakingKeeperMockRecorder) GetUnbondingDelegations(ctx, delegator, maxRetrieve interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUnbondingDelegations", reflect.TypeOf((*MockStakingKeeper)(nil).GetUnbondingDelegations), ctx, delegator, maxRetrieve) +} + +// GetValidator mocks base method. +func (m *MockStakingKeeper) GetValidator(ctx context.Context, valAddr types.ValAddress) (types0.Validator, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetValidator", ctx, valAddr) + ret0, _ := ret[0].(types0.Validator) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetValidator indicates an expected call of GetValidator. +func (mr *MockStakingKeeperMockRecorder) GetValidator(ctx, valAddr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidator", reflect.TypeOf((*MockStakingKeeper)(nil).GetValidator), ctx, valAddr) +} + +// TransferDelegation mocks base method. +func (m *MockStakingKeeper) TransferDelegation(ctx context.Context, fromAddr, toAddr types.AccAddress, valAddr types.ValAddress, wantShares math.LegacyDec) (math.LegacyDec, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TransferDelegation", ctx, fromAddr, toAddr, valAddr, wantShares) + ret0, _ := ret[0].(math.LegacyDec) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TransferDelegation indicates an expected call of TransferDelegation. +func (mr *MockStakingKeeperMockRecorder) TransferDelegation(ctx, fromAddr, toAddr, valAddr, wantShares interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransferDelegation", reflect.TypeOf((*MockStakingKeeper)(nil).TransferDelegation), ctx, fromAddr, toAddr, valAddr, wantShares) +} + +// TransferUnbonding mocks base method. +func (m *MockStakingKeeper) TransferUnbonding(ctx context.Context, fromAddr, toAddr types.AccAddress, valAddr types.ValAddress, wantAmt math.Int) (math.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TransferUnbonding", ctx, fromAddr, toAddr, valAddr, wantAmt) + ret0, _ := ret[0].(math.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TransferUnbonding indicates an expected call of TransferUnbonding. +func (mr *MockStakingKeeperMockRecorder) TransferUnbonding(ctx, fromAddr, toAddr, valAddr, wantAmt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransferUnbonding", reflect.TypeOf((*MockStakingKeeper)(nil).TransferUnbonding), ctx, fromAddr, toAddr, valAddr, wantAmt) +} + +// MockDistributionHooks is a mock of DistributionHooks interface. +type MockDistributionHooks struct { + ctrl *gomock.Controller + recorder *MockDistributionHooksMockRecorder +} + +// MockDistributionHooksMockRecorder is the mock recorder for MockDistributionHooks. +type MockDistributionHooksMockRecorder struct { + mock *MockDistributionHooks +} + +// NewMockDistributionHooks creates a new mock instance. +func NewMockDistributionHooks(ctrl *gomock.Controller) *MockDistributionHooks { + mock := &MockDistributionHooks{ctrl: ctrl} + mock.recorder = &MockDistributionHooksMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockDistributionHooks) EXPECT() *MockDistributionHooksMockRecorder { + return m.recorder +} + +// AfterDelegationReward mocks base method. +func (m *MockDistributionHooks) AfterDelegationReward(ctx types.Context, delAddr, withdrawAddr types.AccAddress, reward types.Coins) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AfterDelegationReward", ctx, delAddr, withdrawAddr, reward) +} + +// AfterDelegationReward indicates an expected call of AfterDelegationReward. +func (mr *MockDistributionHooksMockRecorder) AfterDelegationReward(ctx, delAddr, withdrawAddr, reward interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterDelegationReward", reflect.TypeOf((*MockDistributionHooks)(nil).AfterDelegationReward), ctx, delAddr, withdrawAddr, reward) +} + +// AllowWithdrawAddr mocks base method. +func (m *MockDistributionHooks) AllowWithdrawAddr(ctx types.Context, delAddr types.AccAddress) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AllowWithdrawAddr", ctx, delAddr) + ret0, _ := ret[0].(bool) + return ret0 +} + +// AllowWithdrawAddr indicates an expected call of AllowWithdrawAddr. +func (mr *MockDistributionHooksMockRecorder) AllowWithdrawAddr(ctx, delAddr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AllowWithdrawAddr", reflect.TypeOf((*MockDistributionHooks)(nil).AllowWithdrawAddr), ctx, delAddr) +} diff --git a/x/auth/vesting/types/expected_keepers.go b/x/auth/vesting/types/expected_keepers.go index 59172579de02..3dbf02850aa9 100644 --- a/x/auth/vesting/types/expected_keepers.go +++ b/x/auth/vesting/types/expected_keepers.go @@ -2,8 +2,9 @@ package types import ( context "context" - + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // BankKeeper defines the expected interface contract the vesting module requires @@ -12,4 +13,44 @@ type BankKeeper interface { IsSendEnabledCoins(ctx context.Context, coins ...sdk.Coin) error SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error BlockedAddr(addr sdk.AccAddress) bool + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins +} + +// AccountKeeper defines the expected interface contract the vesting module +// requires for storing accounts. +type AccountKeeper interface { + // Retrieve an account from the store. + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI + + // Set an account in the store. + SetAccount(context.Context, sdk.AccountI) +} + +// StakingKeeper defines the expected interface contract the vesting module +// requires for finding and changing the delegated tokens, used in clawback. +type StakingKeeper interface { + BondDenom(ctx context.Context) (string, error) + GetDelegatorBonded(ctx context.Context, delegator sdk.AccAddress) (math.Int, error) + GetDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress, + maxRetrieve uint16) ([]stakingtypes.Delegation, error) + GetDelegatorUnbonding(ctx context.Context, delegator sdk.AccAddress) (math.Int, error) + GetUnbondingDelegations(ctx context.Context, delegator sdk.AccAddress, + maxRetrieve uint16) ([]stakingtypes.UnbondingDelegation, error) + GetValidator(ctx context.Context, valAddr sdk.ValAddress) (stakingtypes.Validator, error) + TransferUnbonding(ctx context.Context, fromAddr, toAddr sdk.AccAddress, valAddr sdk.ValAddress, wantAmt math.Int) (math.Int, error) + TransferDelegation(ctx context.Context, fromAddr, toAddr sdk.AccAddress, valAddr sdk.ValAddress, wantShares math.LegacyDec) (math.LegacyDec, error) +} + +// DistributionHooks is the expected interface for distribution module hooks. +type DistributionHooks interface { + // AllowWithdrawAddr tells whether to honor the delegation withdraw + // address associated with the address (if any). The distribution + // keeper will call this before each reward withdrawal. + // If multiple distribution hooks are set, then any of them may + // disallow the withdraw address. + AllowWithdrawAddr(ctx sdk.Context, delAddr sdk.AccAddress) bool + + // AfterDelegationReward is called after the reward has been transferred the address. + AfterDelegationReward(ctx sdk.Context, delAddr, withdrawAddr sdk.AccAddress, reward sdk.Coins) } diff --git a/x/auth/vesting/types/hooks.go b/x/auth/vesting/types/hooks.go new file mode 100644 index 000000000000..6c62df60bf29 --- /dev/null +++ b/x/auth/vesting/types/hooks.go @@ -0,0 +1,35 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type distributionHooks struct { + accountKeeper AccountKeeper + bankKeeper BankKeeper + stakingKeeper StakingKeeper +} + +var _ DistributionHooks = distributionHooks{} + +func NewDistributionHooks(ak AccountKeeper, bk BankKeeper, sk StakingKeeper) DistributionHooks { + return distributionHooks{ + accountKeeper: ak, + bankKeeper: bk, + stakingKeeper: sk, + } +} + +func (dh distributionHooks) AllowWithdrawAddr(ctx sdk.Context, delAddr sdk.AccAddress) bool { + acc := dh.accountKeeper.GetAccount(ctx, delAddr) + _, isClawback := acc.(*ClawbackVestingAccount) + return !isClawback +} + +func (dh distributionHooks) AfterDelegationReward(ctx sdk.Context, delAddr, withdrawAddr sdk.AccAddress, reward sdk.Coins) { + acc := dh.accountKeeper.GetAccount(ctx, delAddr) + cva, isClawback := acc.(*ClawbackVestingAccount) + if isClawback { + cva.PostReward(ctx, reward, dh.accountKeeper, dh.bankKeeper, dh.stakingKeeper) + } +} diff --git a/x/auth/vesting/types/period.go b/x/auth/vesting/types/period.go index 6bf7bffcceeb..2b891ca8ee0f 100644 --- a/x/auth/vesting/types/period.go +++ b/x/auth/vesting/types/period.go @@ -50,3 +50,267 @@ func (p Periods) String() string { return strings.TrimSpace(fmt.Sprintf(`Vesting Periods: %s`, strings.Join(periodsListString, ", "))) } + +// coinsMin returns the minimum of its inputs for all denominations. +func coinsMin(a, b sdk.Coins) sdk.Coins { + min := sdk.NewCoins() + for _, coinA := range a { + denom := coinA.Denom + bAmt := b.AmountOfNoDenomValidation(denom) + minAmt := coinA.Amount + if minAmt.GT(bAmt) { + minAmt = bAmt + } + if minAmt.IsPositive() { + min = min.Add(sdk.NewCoin(denom, minAmt)) + } + } + return min +} + +// A "schedule" is an increasing step function of Coins over time. +// It's specified as an absolute start time and a sequence of relative +// periods, with each step at the end of a period. A schedule may also +// give the time and total value at the last step, which can speed +// evaluation of the step function after the last step. + +// ReadSchedule returns the value of a schedule at readTime. +func ReadSchedule(startTime, endTime int64, periods []Period, totalCoins sdk.Coins, readTime int64) sdk.Coins { + if readTime <= startTime { + return sdk.NewCoins() + } + if readTime >= endTime { + return totalCoins + } + + coins := sdk.NewCoins() // sum of amounts for events before readTime + time := startTime + + for _, period := range periods { + if readTime < time+period.Length { + // we're reading before the next event + break + } + coins = coins.Add(period.Amount...) + time += period.Length + } + + return coins +} + +// DisjunctPeriods returns the union of two vesting period schedules. +// The returned schedule is the union of the vesting events, with simultaneous +// events combined into a single event. +// Input schedules P and Q are defined by their start times and periods. +// Returns new start time, new end time, and merged vesting events, relative to +// the new start time. +func DisjunctPeriods(startP, startQ int64, periodsP, periodsQ []Period) (int64, int64, []Period) { + timeP := startP // time of last merged p event, next p event is relative to this time + timeQ := startQ // time of last merged q event, next q event is relative to this time + iP := 0 // p indexes before this have been merged + iQ := 0 // q indexes before this have been merged + lenP := len(periodsP) + lenQ := len(periodsQ) + startTime := min(startP, startQ) // we pick the earlier time + time := startTime // time of last merged event, or the start time + merged := []Period{} + + // emit adds an output period and updates the last event time + emit := func(nextTime int64, amount sdk.Coins) { + period := Period{ + Length: nextTime - time, + Amount: amount, + } + merged = append(merged, period) + time = nextTime + } + + // consumeP emits the next period from p, updating indexes + consumeP := func(nextP int64) { + emit(nextP, periodsP[iP].Amount) + timeP = nextP + iP++ + } + + // consumeQ emits the next period from q, updating indexes + consumeQ := func(nextQ int64) { + emit(nextQ, periodsQ[iQ].Amount) + timeQ = nextQ + iQ++ + } + + // consumeBoth emits a merge of the next periods from p and q, updating indexes + consumeBoth := func(nextTime int64) { + emit(nextTime, periodsP[iP].Amount.Add(periodsQ[iQ].Amount...)) + timeP = nextTime + timeQ = nextTime + iP++ + iQ++ + } + + // while there are more events in both schedules, handle the next one, merge if concurrent + for iP < lenP && iQ < lenQ { + nextP := timeP + periodsP[iP].Length // next p event in absolute time + nextQ := timeQ + periodsQ[iQ].Length // next q event in absolute time + switch { + case nextP < nextQ: + consumeP(nextP) + case nextP > nextQ: + consumeQ(nextQ) + default: // nextP == nextQ + consumeBoth(nextP) + } + } + // consume remaining events in schedule P + for iP < lenP { + nextP := timeP + periodsP[iP].Length + consumeP(nextP) + } + // consume remaining events in schedule Q + for iQ < lenQ { + nextQ := timeQ + periodsQ[iQ].Length + consumeQ(nextQ) + } + return startTime, time, merged +} + +// ConjunctPeriods returns the combination of two period schedules where the result is the minimum of the two schedules. +func ConjunctPeriods(startP, startQ int64, periodsP, periodsQ []Period) (int64, int64, []Period) { + startTime := min(startP, startQ) + time := startTime + + timeP := startP + timeQ := startQ + iP := 0 + iQ := 0 + lenP := len(periodsP) + lenQ := len(periodsQ) + merged := []Period{} + amount := sdk.NewCoins() + amountP := amount + amountQ := amount + + // emit adds an output period and updates the last event time + emit := func(nextTime int64, coins sdk.Coins) { + period := Period{ + Length: nextTime - time, + Amount: coins, + } + merged = append(merged, period) + time = nextTime + amount = amount.Add(coins...) + } + + // consumeP processes the next event in P and emits an event + // if the minimum of P and Q changes + consumeP := func(nextTime int64) { + amountP = amountP.Add(periodsP[iP].Amount...) + min := coinsMin(amountP, amountQ) + if amount.IsAllLTE(min) { + diff := min.Sub(amount...) + if !diff.IsZero() { + emit(nextTime, diff) + } + } + timeP = nextTime + iP++ + } + + // consumeQ processes the next event in Q and emits an event + // if the minimum of P and Q changes + consumeQ := func(nextTime int64) { + amountQ = amountQ.Add(periodsQ[iQ].Amount...) + min := coinsMin(amountP, amountQ) + if amount.IsAllLTE(min) { + diff := min.Sub(amount...) + if !diff.IsZero() { + emit(nextTime, diff) + } + } + timeQ = nextTime + iQ++ + } + + // consumeBoth processes simultaneous events in P and Q and emits an + // event if the minimum of P and Q changes + consumeBoth := func(nextTime int64) { + amountP = amountP.Add(periodsP[iP].Amount...) + amountQ = amountQ.Add(periodsQ[iQ].Amount...) + min := coinsMin(amountP, amountQ) + if amount.IsAllLTE(min) { + diff := min.Sub(amount...) + if !diff.IsZero() { + emit(nextTime, diff) + } + } + timeP = nextTime + timeQ = nextTime + iP++ + iQ++ + } + + // while there are events left in both schedules, process the next one + for iP < lenP && iQ < lenQ { + nextP := timeP + periodsP[iP].Length // next p event in absolute time + nextQ := timeQ + periodsQ[iQ].Length // next q event in absolute time + switch { + case nextP < nextQ: + consumeP(nextP) + case nextP > nextQ: + consumeQ(nextQ) + default: // nextP == nextQ + consumeBoth(nextP) + } + } + + // consume remaining events in schedule P + for iP < lenP { + nextP := timeP + periodsP[iP].Length + consumeP(nextP) + } + + // consume remaining events in schedule Q + for iQ < lenQ { + nextQ := timeQ + periodsQ[iQ].Length + consumeQ(nextQ) + } + + return startTime, time, merged +} + +// AlignSchedules rewrites the first period length to align the two arguments to the same start time. +func AlignSchedules(startP, startQ int64, p, q []Period) (startTime, endTime int64) { + startTime = min(startP, startQ) + + if len(p) > 0 { + p[0].Length += startP - startTime + } + if len(q) > 0 { + q[0].Length += startQ - startTime + } + + endP := startTime + for _, period := range p { + endP += period.Length + } + endQ := startTime + for _, period := range q { + endQ += period.Length + } + endTime = max64(endP, endQ) + return +} + +func max64(a, b int64) int64 { + if a > b { + return a + } + return b +} + +func min64(a, b int64) int64 { + if a < b { + return a + } + return b +} diff --git a/x/auth/vesting/types/tx.pb.go b/x/auth/vesting/types/tx.pb.go index 2d46bb32daca..f923d02944d4 100644 --- a/x/auth/vesting/types/tx.pb.go +++ b/x/auth/vesting/types/tx.pb.go @@ -42,6 +42,7 @@ type MsgCreateVestingAccount struct { // end of vesting as unix time (in seconds). EndTime int64 `protobuf:"varint,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` Delayed bool `protobuf:"varint,5,opt,name=delayed,proto3" json:"delayed,omitempty"` + Merge bool `protobuf:"varint,6,opt,name=merge,proto3" json:"merge,omitempty"` } func (m *MsgCreateVestingAccount) Reset() { *m = MsgCreateVestingAccount{} } @@ -112,6 +113,106 @@ func (m *MsgCreateVestingAccount) GetDelayed() bool { return false } +func (m *MsgCreateVestingAccount) GetMerge() bool { + if m != nil { + return m.Merge + } + return false +} + +// MsgCreateClawbackVestingAccount defines a message that enables creating a ClawbackVestingAccount. +type MsgCreateClawbackVestingAccount struct { + // Address of the account providing the funds, which must also sign the request. + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"` + // Address of the account to receive the funds. + ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty" yaml:"to_address"` + // Start time of the vesting. Periods start relative to this time. + StartTime int64 `protobuf:"varint,3,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty" yaml:"start_time"` + // Unlocking events as a sequence of durations and amounts, starting relative to start_time. + LockupPeriods []Period `protobuf:"bytes,4,rep,name=lockup_periods,json=lockupPeriods,proto3" json:"lockup_periods"` + // Vesting events as a sequence of durations and amounts, starting relative to start_time. + VestingPeriods []Period `protobuf:"bytes,5,rep,name=vesting_periods,json=vestingPeriods,proto3" json:"vesting_periods"` + // If true, merge this new grant into an existing ClawbackVestingAccount, + // or create it if it does not exist. If false, creates a new account. + // New grants to an existing account must be from the same from_address. + Merge bool `protobuf:"varint,6,opt,name=merge,proto3" json:"merge,omitempty"` +} + +func (m *MsgCreateClawbackVestingAccount) Reset() { *m = MsgCreateClawbackVestingAccount{} } +func (m *MsgCreateClawbackVestingAccount) String() string { return proto.CompactTextString(m) } +func (*MsgCreateClawbackVestingAccount) ProtoMessage() {} +func (*MsgCreateClawbackVestingAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_5338ca97811f9792, []int{1} +} +func (m *MsgCreateClawbackVestingAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateClawbackVestingAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateClawbackVestingAccount.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateClawbackVestingAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateClawbackVestingAccount.Merge(m, src) +} +func (m *MsgCreateClawbackVestingAccount) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateClawbackVestingAccount) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateClawbackVestingAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateClawbackVestingAccount proto.InternalMessageInfo + +func (m *MsgCreateClawbackVestingAccount) GetFromAddress() string { + if m != nil { + return m.FromAddress + } + return "" +} + +func (m *MsgCreateClawbackVestingAccount) GetToAddress() string { + if m != nil { + return m.ToAddress + } + return "" +} + +func (m *MsgCreateClawbackVestingAccount) GetStartTime() int64 { + if m != nil { + return m.StartTime + } + return 0 +} + +func (m *MsgCreateClawbackVestingAccount) GetLockupPeriods() []Period { + if m != nil { + return m.LockupPeriods + } + return nil +} + +func (m *MsgCreateClawbackVestingAccount) GetVestingPeriods() []Period { + if m != nil { + return m.VestingPeriods + } + return nil +} + +func (m *MsgCreateClawbackVestingAccount) GetMerge() bool { + if m != nil { + return m.Merge + } + return false +} + // MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. type MsgCreateVestingAccountResponse struct { } @@ -120,7 +221,7 @@ func (m *MsgCreateVestingAccountResponse) Reset() { *m = MsgCreateVestin func (m *MsgCreateVestingAccountResponse) String() string { return proto.CompactTextString(m) } func (*MsgCreateVestingAccountResponse) ProtoMessage() {} func (*MsgCreateVestingAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{1} + return fileDescriptor_5338ca97811f9792, []int{2} } func (m *MsgCreateVestingAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -163,7 +264,7 @@ func (m *MsgCreatePermanentLockedAccount) Reset() { *m = MsgCreatePerman func (m *MsgCreatePermanentLockedAccount) String() string { return proto.CompactTextString(m) } func (*MsgCreatePermanentLockedAccount) ProtoMessage() {} func (*MsgCreatePermanentLockedAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{2} + return fileDescriptor_5338ca97811f9792, []int{3} } func (m *MsgCreatePermanentLockedAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -225,7 +326,7 @@ func (m *MsgCreatePermanentLockedAccountResponse) Reset() { func (m *MsgCreatePermanentLockedAccountResponse) String() string { return proto.CompactTextString(m) } func (*MsgCreatePermanentLockedAccountResponse) ProtoMessage() {} func (*MsgCreatePermanentLockedAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{3} + return fileDescriptor_5338ca97811f9792, []int{4} } func (m *MsgCreatePermanentLockedAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -264,13 +365,14 @@ type MsgCreatePeriodicVestingAccount struct { // start of vesting as unix time (in seconds). StartTime int64 `protobuf:"varint,3,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` VestingPeriods []Period `protobuf:"bytes,4,rep,name=vesting_periods,json=vestingPeriods,proto3" json:"vesting_periods"` + Merge bool `protobuf:"varint,5,opt,name=merge,proto3" json:"merge,omitempty"` } func (m *MsgCreatePeriodicVestingAccount) Reset() { *m = MsgCreatePeriodicVestingAccount{} } func (m *MsgCreatePeriodicVestingAccount) String() string { return proto.CompactTextString(m) } func (*MsgCreatePeriodicVestingAccount) ProtoMessage() {} func (*MsgCreatePeriodicVestingAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{4} + return fileDescriptor_5338ca97811f9792, []int{5} } func (m *MsgCreatePeriodicVestingAccount) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -327,6 +429,13 @@ func (m *MsgCreatePeriodicVestingAccount) GetVestingPeriods() []Period { return nil } +func (m *MsgCreatePeriodicVestingAccount) GetMerge() bool { + if m != nil { + return m.Merge + } + return false +} + // MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount // response type. // @@ -340,7 +449,7 @@ func (m *MsgCreatePeriodicVestingAccountResponse) Reset() { func (m *MsgCreatePeriodicVestingAccountResponse) String() string { return proto.CompactTextString(m) } func (*MsgCreatePeriodicVestingAccountResponse) ProtoMessage() {} func (*MsgCreatePeriodicVestingAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5338ca97811f9792, []int{5} + return fileDescriptor_5338ca97811f9792, []int{6} } func (m *MsgCreatePeriodicVestingAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -369,61 +478,327 @@ func (m *MsgCreatePeriodicVestingAccountResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreatePeriodicVestingAccountResponse proto.InternalMessageInfo +// MsgCreateClawbackVestingAccountResponse defines the MsgCreateClawbackVestingAccount response type. +type MsgCreateClawbackVestingAccountResponse struct { +} + +func (m *MsgCreateClawbackVestingAccountResponse) Reset() { + *m = MsgCreateClawbackVestingAccountResponse{} +} +func (m *MsgCreateClawbackVestingAccountResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateClawbackVestingAccountResponse) ProtoMessage() {} +func (*MsgCreateClawbackVestingAccountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5338ca97811f9792, []int{7} +} +func (m *MsgCreateClawbackVestingAccountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateClawbackVestingAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateClawbackVestingAccountResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateClawbackVestingAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateClawbackVestingAccountResponse.Merge(m, src) +} +func (m *MsgCreateClawbackVestingAccountResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateClawbackVestingAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateClawbackVestingAccountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateClawbackVestingAccountResponse proto.InternalMessageInfo + +// MsgClawback defines a message that removes unvested tokens from a ClawbackVestingAccount. +type MsgClawback struct { + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // funder_address is the address which funded the account + FunderAddress string `protobuf:"bytes,2,opt,name=funder_address,json=funderAddress,proto3" json:"funder_address,omitempty"` + // address is the address of the ClawbackVestingAccount to claw back from. + Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + // dest_address specifies where the clawed-back tokens should be transferred. + // If empty, the tokens will be transferred back to the original funder of the account. + DestAddress string `protobuf:"bytes,4,opt,name=dest_address,json=destAddress,proto3" json:"dest_address,omitempty"` +} + +func (m *MsgClawback) Reset() { *m = MsgClawback{} } +func (m *MsgClawback) String() string { return proto.CompactTextString(m) } +func (*MsgClawback) ProtoMessage() {} +func (*MsgClawback) Descriptor() ([]byte, []int) { + return fileDescriptor_5338ca97811f9792, []int{8} +} +func (m *MsgClawback) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClawback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClawback.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgClawback) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClawback.Merge(m, src) +} +func (m *MsgClawback) XXX_Size() int { + return m.Size() +} +func (m *MsgClawback) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClawback.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClawback proto.InternalMessageInfo + +func (m *MsgClawback) GetFromAddress() string { + if m != nil { + return m.FromAddress + } + return "" +} + +func (m *MsgClawback) GetFunderAddress() string { + if m != nil { + return m.FunderAddress + } + return "" +} + +func (m *MsgClawback) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *MsgClawback) GetDestAddress() string { + if m != nil { + return m.DestAddress + } + return "" +} + +// MsgClawbackResponse defines the MsgClawback response type. +type MsgClawbackResponse struct { +} + +func (m *MsgClawbackResponse) Reset() { *m = MsgClawbackResponse{} } +func (m *MsgClawbackResponse) String() string { return proto.CompactTextString(m) } +func (*MsgClawbackResponse) ProtoMessage() {} +func (*MsgClawbackResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5338ca97811f9792, []int{9} +} +func (m *MsgClawbackResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClawbackResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClawbackResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgClawbackResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClawbackResponse.Merge(m, src) +} +func (m *MsgClawbackResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgClawbackResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClawbackResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClawbackResponse proto.InternalMessageInfo + +// MsgReturnGrants defines a message for a grantee to return all granted assets, +// including delegated, undelegated and unbonding, vested and unvested, +// are transferred to the original funder of the account. Might not be complete if +// some vested assets have been transferred out of the account. Currently only applies to +// ClawbackVesting accounts. +type MsgReturnGrants struct { + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *MsgReturnGrants) Reset() { *m = MsgReturnGrants{} } +func (m *MsgReturnGrants) String() string { return proto.CompactTextString(m) } +func (*MsgReturnGrants) ProtoMessage() {} +func (*MsgReturnGrants) Descriptor() ([]byte, []int) { + return fileDescriptor_5338ca97811f9792, []int{10} +} +func (m *MsgReturnGrants) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReturnGrants) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReturnGrants.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgReturnGrants) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReturnGrants.Merge(m, src) +} +func (m *MsgReturnGrants) XXX_Size() int { + return m.Size() +} +func (m *MsgReturnGrants) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReturnGrants.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReturnGrants proto.InternalMessageInfo + +func (m *MsgReturnGrants) GetFromAddress() string { + if m != nil { + return m.FromAddress + } + return "" +} + +func (m *MsgReturnGrants) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +// MsgReturnGrantsResponse defines the ReturnGrants response type. +type MsgReturnGrantsResponse struct { +} + +func (m *MsgReturnGrantsResponse) Reset() { *m = MsgReturnGrantsResponse{} } +func (m *MsgReturnGrantsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgReturnGrantsResponse) ProtoMessage() {} +func (*MsgReturnGrantsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5338ca97811f9792, []int{11} +} +func (m *MsgReturnGrantsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReturnGrantsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReturnGrantsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgReturnGrantsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReturnGrantsResponse.Merge(m, src) +} +func (m *MsgReturnGrantsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgReturnGrantsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReturnGrantsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReturnGrantsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreateVestingAccount)(nil), "cosmos.vesting.v1beta1.MsgCreateVestingAccount") + proto.RegisterType((*MsgCreateClawbackVestingAccount)(nil), "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccount") proto.RegisterType((*MsgCreateVestingAccountResponse)(nil), "cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse") proto.RegisterType((*MsgCreatePermanentLockedAccount)(nil), "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount") proto.RegisterType((*MsgCreatePermanentLockedAccountResponse)(nil), "cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse") proto.RegisterType((*MsgCreatePeriodicVestingAccount)(nil), "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount") proto.RegisterType((*MsgCreatePeriodicVestingAccountResponse)(nil), "cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse") + proto.RegisterType((*MsgCreateClawbackVestingAccountResponse)(nil), "cosmos.vesting.v1beta1.MsgCreateClawbackVestingAccountResponse") + proto.RegisterType((*MsgClawback)(nil), "cosmos.vesting.v1beta1.MsgClawback") + proto.RegisterType((*MsgClawbackResponse)(nil), "cosmos.vesting.v1beta1.MsgClawbackResponse") + proto.RegisterType((*MsgReturnGrants)(nil), "cosmos.vesting.v1beta1.MsgReturnGrants") + proto.RegisterType((*MsgReturnGrantsResponse)(nil), "cosmos.vesting.v1beta1.MsgReturnGrantsResponse") } func init() { proto.RegisterFile("cosmos/vesting/v1beta1/tx.proto", fileDescriptor_5338ca97811f9792) } var fileDescriptor_5338ca97811f9792 = []byte{ - // 670 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x95, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0xe3, 0xba, 0xbf, 0x72, 0xad, 0x40, 0x35, 0x85, 0xba, 0x11, 0xb5, 0x53, 0x0b, 0x44, - 0xa8, 0x54, 0x5b, 0x2d, 0x48, 0x95, 0x02, 0x52, 0xd5, 0x54, 0x62, 0x81, 0x4a, 0xc8, 0x20, 0x06, - 0x96, 0xe8, 0x62, 0x1f, 0xae, 0xd5, 0xda, 0x17, 0xf9, 0xae, 0x55, 0xb3, 0x55, 0x8c, 0x4c, 0x6c, - 0x20, 0x26, 0x46, 0xc4, 0xd4, 0x81, 0x7f, 0x01, 0xa9, 0x1b, 0x15, 0x13, 0x53, 0x40, 0xc9, 0x10, - 0xe6, 0xee, 0x48, 0xe8, 0x7c, 0xe7, 0x90, 0x14, 0x3b, 0x69, 0x99, 0x58, 0xe2, 0xf8, 0xde, 0xf7, - 0xfb, 0xee, 0xf9, 0xf3, 0xee, 0xd9, 0x40, 0x77, 0x30, 0x09, 0x30, 0xb1, 0xf6, 0x11, 0xa1, 0x7e, - 0xe8, 0x59, 0xfb, 0x2b, 0x35, 0x44, 0xe1, 0x8a, 0x45, 0x0f, 0xcc, 0x7a, 0x84, 0x29, 0x56, 0xae, - 0x71, 0x81, 0x29, 0x04, 0xa6, 0x10, 0x14, 0x66, 0x3d, 0xec, 0xe1, 0x58, 0x62, 0xb1, 0x7f, 0x5c, - 0x5d, 0xd0, 0x44, 0xba, 0x1a, 0x24, 0xa8, 0x9b, 0xcb, 0xc1, 0x7e, 0x28, 0xe2, 0xf3, 0x3c, 0x5e, - 0xe5, 0x46, 0x91, 0x9a, 0x87, 0x6e, 0x64, 0x54, 0x92, 0x6c, 0xcc, 0x55, 0x73, 0x42, 0x15, 0x10, - 0xa6, 0x60, 0x17, 0x11, 0x98, 0x81, 0x81, 0x1f, 0x62, 0x2b, 0xfe, 0xe5, 0x4b, 0xc6, 0xaf, 0x11, - 0x30, 0xb7, 0x45, 0xbc, 0xcd, 0x08, 0x41, 0x8a, 0x9e, 0xf1, 0x34, 0x1b, 0x8e, 0x83, 0xf7, 0x42, - 0xaa, 0xdc, 0x03, 0xd3, 0x2f, 0x22, 0x1c, 0x54, 0xa1, 0xeb, 0x46, 0x88, 0x10, 0x55, 0x2a, 0x4a, - 0xa5, 0x7c, 0x45, 0xfd, 0xfa, 0x69, 0x79, 0x56, 0x54, 0xb5, 0xc1, 0x23, 0x4f, 0x68, 0xe4, 0x87, - 0x9e, 0x3d, 0xc5, 0xd4, 0x62, 0x49, 0x59, 0x03, 0x80, 0xe2, 0xae, 0x75, 0x64, 0x88, 0x35, 0x4f, - 0x71, 0x62, 0x6c, 0x80, 0x71, 0x18, 0xb0, 0xfd, 0x55, 0xb9, 0x28, 0x97, 0xa6, 0x56, 0xe7, 0x4d, - 0xe1, 0x60, 0xbc, 0x12, 0xb4, 0xe6, 0x26, 0xf6, 0xc3, 0xca, 0x83, 0xe3, 0xa6, 0x9e, 0xfb, 0xf8, - 0x5d, 0x2f, 0x79, 0x3e, 0xdd, 0xde, 0xab, 0x99, 0x0e, 0x0e, 0x04, 0x2f, 0x71, 0x59, 0x26, 0xee, - 0x8e, 0x45, 0x1b, 0x75, 0x44, 0x62, 0x03, 0x79, 0xd7, 0x39, 0x5a, 0x9a, 0xde, 0x45, 0x1e, 0x74, - 0x1a, 0x55, 0x46, 0x9c, 0x7c, 0xe8, 0x1c, 0x2d, 0x49, 0xb6, 0xd8, 0x50, 0x99, 0x07, 0x93, 0x28, - 0x74, 0xab, 0xd4, 0x0f, 0x90, 0x3a, 0x5a, 0x94, 0x4a, 0xb2, 0x3d, 0x81, 0x42, 0xf7, 0xa9, 0x1f, - 0x20, 0x45, 0x05, 0x13, 0x2e, 0xda, 0x85, 0x0d, 0xe4, 0xaa, 0x63, 0x45, 0xa9, 0x34, 0x69, 0x27, - 0xb7, 0xe5, 0xfb, 0x3f, 0xdf, 0xeb, 0xd2, 0x4b, 0x96, 0xb8, 0x17, 0xd6, 0xab, 0xce, 0xd1, 0x92, - 0xd1, 0x53, 0x44, 0x06, 0x63, 0x63, 0x11, 0xe8, 0x19, 0x21, 0x1b, 0x91, 0x3a, 0x0e, 0x09, 0x32, - 0xbe, 0x8c, 0xf4, 0x68, 0x1e, 0xa3, 0x28, 0x80, 0x21, 0x0a, 0xe9, 0x23, 0xec, 0xec, 0x20, 0x37, - 0x69, 0x55, 0x39, 0xb5, 0x55, 0x73, 0xa7, 0x4d, 0xfd, 0x4a, 0x03, 0x06, 0xbb, 0x65, 0xa3, 0x37, - 0x6a, 0xf4, 0x77, 0xea, 0x6e, 0x4a, 0xa7, 0xae, 0x9e, 0x36, 0xf5, 0x19, 0xee, 0xfc, 0x13, 0x33, - 0xfe, 0x8f, 0x36, 0x95, 0xd7, 0x33, 0x89, 0xdf, 0x4c, 0x23, 0xce, 0x90, 0xf5, 0xd1, 0x32, 0x6e, - 0x83, 0x5b, 0x43, 0x80, 0x76, 0xe1, 0xbf, 0x39, 0x03, 0xdf, 0xc7, 0xae, 0xef, 0x9c, 0x99, 0x93, - 0xc5, 0x34, 0xf8, 0xfd, 0x8c, 0x17, 0xfe, 0x66, 0xdc, 0x0b, 0x73, 0x01, 0x00, 0x42, 0x61, 0x44, - 0xf9, 0xd1, 0x93, 0xe3, 0xa3, 0x97, 0x8f, 0x57, 0xe2, 0xc3, 0x67, 0x83, 0xcb, 0x62, 0xc2, 0xab, - 0xf5, 0xb8, 0x04, 0xa2, 0x8e, 0xc6, 0xd0, 0x35, 0x33, 0xfd, 0xcd, 0x63, 0xf2, 0x4a, 0x2b, 0x79, - 0x46, 0x9e, 0xc3, 0xbb, 0x24, 0x24, 0x3c, 0x42, 0x62, 0x88, 0xb9, 0x0b, 0x41, 0xf4, 0xb1, 0xcb, - 0x1e, 0x3c, 0x03, 0x62, 0x0a, 0x98, 0x04, 0xe2, 0xea, 0x67, 0x19, 0xc8, 0x5b, 0xc4, 0x53, 0x0e, - 0x25, 0x30, 0x9b, 0xfa, 0xa6, 0xb1, 0xb2, 0x9e, 0x23, 0x63, 0x36, 0x0a, 0x6b, 0x17, 0x34, 0x24, - 0xa5, 0x28, 0x6f, 0x25, 0x70, 0x7d, 0xe0, 0x24, 0x0d, 0xcf, 0x9c, 0x6e, 0x2c, 0xac, 0xff, 0xa3, - 0x31, 0xbd, 0xb4, 0xb4, 0x73, 0x76, 0xae, 0xd2, 0x52, 0x8c, 0xe7, 0x2b, 0x6d, 0x40, 0x03, 0x0b, - 0x63, 0x87, 0xec, 0x0c, 0x55, 0x1e, 0x1e, 0xb7, 0x34, 0xe9, 0xa4, 0xa5, 0x49, 0x3f, 0x5a, 0x9a, - 0xf4, 0xba, 0xad, 0xe5, 0x4e, 0xda, 0x5a, 0xee, 0x5b, 0x5b, 0xcb, 0x3d, 0x5f, 0x19, 0x38, 0xda, - 0x07, 0x16, 0xdc, 0xa3, 0xdb, 0xdd, 0xaf, 0x56, 0x3c, 0xe9, 0xb5, 0xf1, 0xf8, 0x03, 0x74, 0xe7, - 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x25, 0x64, 0x77, 0xbb, 0x5e, 0x07, 0x00, 0x00, + // 933 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x6f, 0xdc, 0x44, + 0x14, 0x5e, 0xc7, 0xd9, 0xfc, 0x98, 0xa4, 0xa9, 0xea, 0xa6, 0xc4, 0x6b, 0x51, 0x3b, 0x35, 0x54, + 0x5d, 0x82, 0x6a, 0x93, 0x52, 0xa9, 0xd2, 0x82, 0x14, 0x35, 0x41, 0x70, 0x28, 0x91, 0x2a, 0x83, + 0x38, 0x20, 0xa4, 0x95, 0xd7, 0x9e, 0x3a, 0x56, 0xd6, 0x9e, 0x95, 0x67, 0xb6, 0x74, 0x6f, 0x15, + 0x47, 0x4e, 0x48, 0x5c, 0x50, 0x4f, 0x3d, 0x56, 0x48, 0x48, 0x39, 0xf0, 0x0f, 0x70, 0xeb, 0x8d, + 0x8a, 0x13, 0xa7, 0x14, 0x25, 0x87, 0xf4, 0xdc, 0xbf, 0x00, 0x8d, 0x67, 0xec, 0x8e, 0x93, 0xf1, + 0xee, 0xb6, 0x3d, 0xf4, 0x92, 0xcd, 0xcc, 0xfb, 0xbe, 0x37, 0x6f, 0xbe, 0x6f, 0xde, 0x78, 0x80, + 0x15, 0x20, 0x9c, 0x20, 0xec, 0xde, 0x87, 0x98, 0xc4, 0x69, 0xe4, 0xde, 0xdf, 0xec, 0x41, 0xe2, + 0x6f, 0xba, 0xe4, 0x81, 0x33, 0xc8, 0x10, 0x41, 0xda, 0x7b, 0x0c, 0xe0, 0x70, 0x80, 0xc3, 0x01, + 0xc6, 0x6a, 0x84, 0x22, 0x94, 0x43, 0x5c, 0xfa, 0x1f, 0x43, 0x1b, 0x26, 0x4f, 0xd7, 0xf3, 0x31, + 0x2c, 0x73, 0x05, 0x28, 0x4e, 0x79, 0xbc, 0xc5, 0xe2, 0x5d, 0x46, 0xe4, 0xa9, 0x59, 0xe8, 0xc3, + 0x9a, 0x4a, 0x8a, 0x85, 0x19, 0x6a, 0x8d, 0xa3, 0x12, 0x4c, 0x11, 0xf4, 0x87, 0x07, 0x2e, 0xf8, + 0x49, 0x9c, 0x22, 0x37, 0xff, 0xcb, 0xa6, 0xec, 0x5f, 0x55, 0xb0, 0xb6, 0x8b, 0xa3, 0x9d, 0x0c, + 0xfa, 0x04, 0x7e, 0xc7, 0xd2, 0xdc, 0x0e, 0x02, 0x34, 0x4c, 0x89, 0xf6, 0x19, 0x58, 0xbe, 0x97, + 0xa1, 0xa4, 0xeb, 0x87, 0x61, 0x06, 0x31, 0xd6, 0x95, 0x75, 0xa5, 0xbd, 0xb8, 0xad, 0xff, 0xf3, + 0xe7, 0xf5, 0x55, 0x5e, 0xd5, 0x6d, 0x16, 0xf9, 0x86, 0x64, 0x71, 0x1a, 0x79, 0x4b, 0x14, 0xcd, + 0xa7, 0xb4, 0x5b, 0x00, 0x10, 0x54, 0x52, 0x67, 0x26, 0x50, 0x17, 0x09, 0x2a, 0x88, 0x23, 0x30, + 0xe7, 0x27, 0x74, 0x7d, 0x5d, 0x5d, 0x57, 0xdb, 0x4b, 0x37, 0x5a, 0x0e, 0x67, 0x50, 0xbd, 0x0a, + 0x69, 0x9d, 0x1d, 0x14, 0xa7, 0xdb, 0x5f, 0x3e, 0x3d, 0xb4, 0x1a, 0xbf, 0x3f, 0xb7, 0xda, 0x51, + 0x4c, 0xf6, 0x86, 0x3d, 0x27, 0x40, 0x09, 0xd7, 0x8b, 0xff, 0x5c, 0xc7, 0xe1, 0xbe, 0x4b, 0x46, + 0x03, 0x88, 0x73, 0x02, 0x7e, 0x74, 0x72, 0xb0, 0xb1, 0xdc, 0x87, 0x91, 0x1f, 0x8c, 0xba, 0x54, + 0x71, 0xfc, 0xe4, 0xe4, 0x60, 0x43, 0xf1, 0xf8, 0x82, 0x5a, 0x0b, 0x2c, 0xc0, 0x34, 0xec, 0x92, + 0x38, 0x81, 0xfa, 0xec, 0xba, 0xd2, 0x56, 0xbd, 0x79, 0x98, 0x86, 0xdf, 0xc6, 0x09, 0xd4, 0x74, + 0x30, 0x1f, 0xc2, 0xbe, 0x3f, 0x82, 0xa1, 0xde, 0x5c, 0x57, 0xda, 0x0b, 0x5e, 0x31, 0xd4, 0x56, + 0x41, 0x33, 0x81, 0x59, 0x04, 0xf5, 0xb9, 0x7c, 0x9e, 0x0d, 0x3a, 0x9f, 0xbf, 0x78, 0x6c, 0x29, + 0x3f, 0xd1, 0xe5, 0x44, 0x09, 0x7f, 0x3e, 0x39, 0xd8, 0xb0, 0x85, 0xd2, 0x6a, 0x94, 0xb7, 0xff, + 0x52, 0x81, 0x55, 0xc6, 0x76, 0xfa, 0xfe, 0x8f, 0x3d, 0x3f, 0xd8, 0x3f, 0xe5, 0x4e, 0x47, 0xea, + 0xce, 0xda, 0xcb, 0x43, 0xeb, 0xe2, 0xc8, 0x4f, 0xfa, 0x1d, 0x5b, 0x8c, 0xda, 0x55, 0x73, 0x6e, + 0x4a, 0xcc, 0xb9, 0xf4, 0xf2, 0xd0, 0xba, 0xc0, 0x98, 0xaf, 0x62, 0xb6, 0xe8, 0xcc, 0x4d, 0x00, + 0x30, 0xf1, 0x33, 0xc2, 0x04, 0x52, 0xa9, 0x40, 0x22, 0xeb, 0x55, 0xcc, 0xf6, 0x16, 0xf3, 0x41, + 0xae, 0xdc, 0x1d, 0xb0, 0xd2, 0x47, 0xc1, 0xfe, 0x70, 0xd0, 0x1d, 0xc0, 0x2c, 0x46, 0x21, 0xd6, + 0x67, 0x73, 0x5f, 0x4d, 0x47, 0xde, 0x35, 0xce, 0xdd, 0x1c, 0xb6, 0x3d, 0x4b, 0xcd, 0xf5, 0xce, + 0x31, 0x2e, 0x9b, 0xc3, 0xda, 0x2e, 0x38, 0xcf, 0xe1, 0x65, 0xb6, 0xe6, 0x6b, 0x64, 0x5b, 0xe1, + 0xd1, 0x22, 0x9d, 0xdc, 0xbb, 0x2f, 0x5e, 0x3c, 0xb6, 0x1a, 0x52, 0xef, 0x36, 0x64, 0xde, 0xc9, + 0xfd, 0xb1, 0xaf, 0x08, 0x16, 0x56, 0x43, 0x1e, 0xc4, 0x03, 0x94, 0x62, 0x68, 0xff, 0x3d, 0x23, + 0x60, 0xee, 0xc2, 0x2c, 0xf1, 0x53, 0x98, 0x92, 0xaf, 0x51, 0xb0, 0x0f, 0xc3, 0x77, 0x67, 0xf3, + 0xbb, 0x6b, 0xc0, 0xce, 0x56, 0x6d, 0xd7, 0x5c, 0x95, 0x29, 0x4f, 0x25, 0xab, 0xa8, 0x65, 0x7f, + 0x04, 0xae, 0x4d, 0x10, 0xb4, 0x14, 0xff, 0x8f, 0x53, 0xe2, 0xc7, 0x28, 0x8c, 0x83, 0x53, 0x3d, + 0x76, 0x45, 0x26, 0x7e, 0x55, 0xe3, 0xcb, 0x67, 0x35, 0x16, 0xc5, 0xbc, 0x7c, 0xb6, 0x67, 0xc4, + 0xe6, 0xf0, 0xce, 0x9e, 0xe7, 0xe9, 0xba, 0x63, 0x91, 0x2a, 0xcf, 0xc4, 0xab, 0x3d, 0xd4, 0x4d, + 0xf1, 0x50, 0x6f, 0xd5, 0x1e, 0xea, 0x3a, 0x69, 0x63, 0x14, 0x52, 0x39, 0x6a, 0xa4, 0x95, 0xc8, + 0x55, 0x4a, 0x2b, 0x42, 0xe5, 0xdd, 0x51, 0x42, 0x9f, 0x2b, 0x60, 0x89, 0x62, 0x39, 0xea, 0xed, + 0xbe, 0x39, 0x57, 0xc1, 0xca, 0xbd, 0x61, 0x1a, 0xc2, 0xec, 0x94, 0x1f, 0xe7, 0xd8, 0x6c, 0x01, + 0xd3, 0xc1, 0x7c, 0x11, 0x57, 0xf3, 0x78, 0x31, 0xa4, 0x7e, 0x87, 0x10, 0x93, 0x92, 0x3e, 0xcb, + 0xfc, 0xa6, 0x73, 0x9c, 0xdc, 0x71, 0xa5, 0x1a, 0xb6, 0xaa, 0x1a, 0x0a, 0x3b, 0xb2, 0x2f, 0x81, + 0x8b, 0xc2, 0xb0, 0xdc, 0xf8, 0x23, 0x05, 0x9c, 0xdf, 0xc5, 0x91, 0x07, 0xc9, 0x30, 0x4b, 0xbf, + 0xca, 0xfc, 0x94, 0xe0, 0xb7, 0xdb, 0xbc, 0xb0, 0xab, 0x99, 0xca, 0xae, 0x3a, 0x9f, 0x48, 0x4b, + 0x36, 0xaa, 0x25, 0x8b, 0x85, 0xd8, 0xad, 0xfc, 0x51, 0x20, 0x4e, 0x15, 0x75, 0xdf, 0x78, 0x32, + 0x07, 0xd4, 0x5d, 0x1c, 0x69, 0x0f, 0x15, 0xb0, 0x2a, 0x7d, 0x35, 0xb8, 0x75, 0x27, 0xb7, 0xe6, + 0x36, 0x34, 0x6e, 0xbd, 0x26, 0xa1, 0x28, 0x45, 0xfb, 0x4d, 0x01, 0xef, 0x8f, 0xbd, 0x3b, 0x27, + 0x67, 0x96, 0x13, 0x8d, 0xad, 0x37, 0x24, 0xca, 0x4b, 0x93, 0xdd, 0x2c, 0x53, 0x95, 0x26, 0x21, + 0x4e, 0x57, 0xda, 0x98, 0xe6, 0x14, 0x4a, 0xab, 0x79, 0x58, 0x4c, 0x2e, 0x4d, 0x4e, 0x9c, 0xa2, + 0xb4, 0xf1, 0x97, 0x81, 0xf6, 0x03, 0x58, 0x28, 0x2f, 0x82, 0x0f, 0xc6, 0x25, 0xe3, 0x20, 0xe3, + 0xe3, 0x29, 0x40, 0x65, 0xf6, 0x3d, 0xb0, 0x5c, 0xe9, 0xb6, 0x6b, 0x63, 0xc8, 0x22, 0xd0, 0x70, + 0xa7, 0x04, 0x16, 0x2b, 0x19, 0xcd, 0x87, 0xf4, 0x62, 0xde, 0xbe, 0xf3, 0xf4, 0xc8, 0x54, 0x9e, + 0x1d, 0x99, 0xca, 0x7f, 0x47, 0xa6, 0xf2, 0xcb, 0xb1, 0xd9, 0x78, 0x76, 0x6c, 0x36, 0xfe, 0x3d, + 0x36, 0x1b, 0xdf, 0x6f, 0x8e, 0xfd, 0x5e, 0x3e, 0x70, 0xfd, 0x21, 0xd9, 0x2b, 0x1f, 0xf9, 0xf9, + 0xe7, 0xb3, 0x37, 0x97, 0xbf, 0xd7, 0x3f, 0xfd, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xdd, 0x10, 0x59, + 0x23, 0x8d, 0x0c, 0x00, 0x00, } func (this *MsgCreateVestingAccount) Equal(that interface{}) bool { @@ -465,6 +840,9 @@ func (this *MsgCreateVestingAccount) Equal(that interface{}) bool { if this.Delayed != that1.Delayed { return false } + if this.Merge != that1.Merge { + return false + } return true } func (this *MsgCreatePermanentLockedAccount) Equal(that interface{}) bool { @@ -528,6 +906,13 @@ type MsgClient interface { // // Since: cosmos-sdk 0.46 CreatePeriodicVestingAccount(ctx context.Context, in *MsgCreatePeriodicVestingAccount, opts ...grpc.CallOption) (*MsgCreatePeriodicVestingAccountResponse, error) + // CreateClawbackVestingAccount defines a method that enables creating a + // vesting account that is subject to clawback. + CreateClawbackVestingAccount(ctx context.Context, in *MsgCreateClawbackVestingAccount, opts ...grpc.CallOption) (*MsgCreateClawbackVestingAccountResponse, error) + // Clawback removes the unvested tokens from a ClawbackVestingAccount. + Clawback(ctx context.Context, in *MsgClawback, opts ...grpc.CallOption) (*MsgClawbackResponse, error) + // ReturnGrants returns vesting grants to the funder. + ReturnGrants(ctx context.Context, in *MsgReturnGrants, opts ...grpc.CallOption) (*MsgReturnGrantsResponse, error) } type msgClient struct { @@ -565,6 +950,33 @@ func (c *msgClient) CreatePeriodicVestingAccount(ctx context.Context, in *MsgCre return out, nil } +func (c *msgClient) CreateClawbackVestingAccount(ctx context.Context, in *MsgCreateClawbackVestingAccount, opts ...grpc.CallOption) (*MsgCreateClawbackVestingAccountResponse, error) { + out := new(MsgCreateClawbackVestingAccountResponse) + err := c.cc.Invoke(ctx, "/cosmos.vesting.v1beta1.Msg/CreateClawbackVestingAccount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Clawback(ctx context.Context, in *MsgClawback, opts ...grpc.CallOption) (*MsgClawbackResponse, error) { + out := new(MsgClawbackResponse) + err := c.cc.Invoke(ctx, "/cosmos.vesting.v1beta1.Msg/Clawback", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ReturnGrants(ctx context.Context, in *MsgReturnGrants, opts ...grpc.CallOption) (*MsgReturnGrantsResponse, error) { + out := new(MsgReturnGrantsResponse) + err := c.cc.Invoke(ctx, "/cosmos.vesting.v1beta1.Msg/ReturnGrants", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // CreateVestingAccount defines a method that enables creating a vesting @@ -580,6 +992,13 @@ type MsgServer interface { // // Since: cosmos-sdk 0.46 CreatePeriodicVestingAccount(context.Context, *MsgCreatePeriodicVestingAccount) (*MsgCreatePeriodicVestingAccountResponse, error) + // CreateClawbackVestingAccount defines a method that enables creating a + // vesting account that is subject to clawback. + CreateClawbackVestingAccount(context.Context, *MsgCreateClawbackVestingAccount) (*MsgCreateClawbackVestingAccountResponse, error) + // Clawback removes the unvested tokens from a ClawbackVestingAccount. + Clawback(context.Context, *MsgClawback) (*MsgClawbackResponse, error) + // ReturnGrants returns vesting grants to the funder. + ReturnGrants(context.Context, *MsgReturnGrants) (*MsgReturnGrantsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -595,6 +1014,15 @@ func (*UnimplementedMsgServer) CreatePermanentLockedAccount(ctx context.Context, func (*UnimplementedMsgServer) CreatePeriodicVestingAccount(ctx context.Context, req *MsgCreatePeriodicVestingAccount) (*MsgCreatePeriodicVestingAccountResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreatePeriodicVestingAccount not implemented") } +func (*UnimplementedMsgServer) CreateClawbackVestingAccount(ctx context.Context, req *MsgCreateClawbackVestingAccount) (*MsgCreateClawbackVestingAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateClawbackVestingAccount not implemented") +} +func (*UnimplementedMsgServer) Clawback(ctx context.Context, req *MsgClawback) (*MsgClawbackResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Clawback not implemented") +} +func (*UnimplementedMsgServer) ReturnGrants(ctx context.Context, req *MsgReturnGrants) (*MsgReturnGrantsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReturnGrants not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -654,29 +1082,95 @@ func _Msg_CreatePeriodicVestingAccount_Handler(srv interface{}, ctx context.Cont return interceptor(ctx, in, info, handler) } -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.vesting.v1beta1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateVestingAccount", - Handler: _Msg_CreateVestingAccount_Handler, - }, - { - MethodName: "CreatePermanentLockedAccount", - Handler: _Msg_CreatePermanentLockedAccount_Handler, - }, - { - MethodName: "CreatePeriodicVestingAccount", - Handler: _Msg_CreatePeriodicVestingAccount_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/vesting/v1beta1/tx.proto", -} - -func (m *MsgCreateVestingAccount) Marshal() (dAtA []byte, err error) { - size := m.Size() +func _Msg_CreateClawbackVestingAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateClawbackVestingAccount) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateClawbackVestingAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.vesting.v1beta1.Msg/CreateClawbackVestingAccount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateClawbackVestingAccount(ctx, req.(*MsgCreateClawbackVestingAccount)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Clawback_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgClawback) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Clawback(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.vesting.v1beta1.Msg/Clawback", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Clawback(ctx, req.(*MsgClawback)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ReturnGrants_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgReturnGrants) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ReturnGrants(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.vesting.v1beta1.Msg/ReturnGrants", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ReturnGrants(ctx, req.(*MsgReturnGrants)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.vesting.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateVestingAccount", + Handler: _Msg_CreateVestingAccount_Handler, + }, + { + MethodName: "CreatePermanentLockedAccount", + Handler: _Msg_CreatePermanentLockedAccount_Handler, + }, + { + MethodName: "CreatePeriodicVestingAccount", + Handler: _Msg_CreatePeriodicVestingAccount_Handler, + }, + { + MethodName: "CreateClawbackVestingAccount", + Handler: _Msg_CreateClawbackVestingAccount_Handler, + }, + { + MethodName: "Clawback", + Handler: _Msg_Clawback_Handler, + }, + { + MethodName: "ReturnGrants", + Handler: _Msg_ReturnGrants_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/vesting/v1beta1/tx.proto", +} + +func (m *MsgCreateVestingAccount) Marshal() (dAtA []byte, err error) { + size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { @@ -695,6 +1189,16 @@ func (m *MsgCreateVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.Merge { + i-- + if m.Merge { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } if m.Delayed { i-- if m.Delayed { @@ -741,6 +1245,86 @@ func (m *MsgCreateVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgCreateClawbackVestingAccount) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateClawbackVestingAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateClawbackVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Merge { + i-- + if m.Merge { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if len(m.VestingPeriods) > 0 { + for iNdEx := len(m.VestingPeriods) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.VestingPeriods[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.LockupPeriods) > 0 { + for iNdEx := len(m.LockupPeriods) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LockupPeriods[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.StartTime != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.StartTime)) + i-- + dAtA[i] = 0x18 + } + if len(m.ToAddress) > 0 { + i -= len(m.ToAddress) + copy(dAtA[i:], m.ToAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ToAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.FromAddress) > 0 { + i -= len(m.FromAddress) + copy(dAtA[i:], m.FromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *MsgCreateVestingAccountResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -858,6 +1442,16 @@ func (m *MsgCreatePeriodicVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int _ = i var l int _ = l + if m.Merge { + i-- + if m.Merge { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } if len(m.VestingPeriods) > 0 { for iNdEx := len(m.VestingPeriods) - 1; iNdEx >= 0; iNdEx-- { { @@ -917,102 +1511,297 @@ func (m *MsgCreatePeriodicVestingAccountResponse) MarshalToSizedBuffer(dAtA []by return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgCreateClawbackVestingAccountResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgCreateVestingAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ToAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if m.EndTime != 0 { - n += 1 + sovTx(uint64(m.EndTime)) - } - if m.Delayed { - n += 2 - } - return n + +func (m *MsgCreateClawbackVestingAccountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCreateVestingAccountResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgCreateClawbackVestingAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func (m *MsgCreatePermanentLockedAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ToAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } +func (m *MsgClawback) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *MsgCreatePermanentLockedAccountResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n +func (m *MsgClawback) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCreatePeriodicVestingAccount) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgClawback) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.DestAddress) > 0 { + i -= len(m.DestAddress) + copy(dAtA[i:], m.DestAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DestAddress))) + i-- + dAtA[i] = 0x22 } - l = len(m.ToAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x1a } - if m.StartTime != 0 { + if len(m.FunderAddress) > 0 { + i -= len(m.FunderAddress) + copy(dAtA[i:], m.FunderAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.FunderAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.FromAddress) > 0 { + i -= len(m.FromAddress) + copy(dAtA[i:], m.FromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgClawbackResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgClawbackResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClawbackResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgReturnGrants) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgReturnGrants) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReturnGrants) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + if len(m.FromAddress) > 0 { + i -= len(m.FromAddress) + copy(dAtA[i:], m.FromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgReturnGrantsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgReturnGrantsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReturnGrantsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCreateVestingAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ToAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if m.EndTime != 0 { + n += 1 + sovTx(uint64(m.EndTime)) + } + if m.Delayed { + n += 2 + } + if m.Merge { + n += 2 + } + return n +} + +func (m *MsgCreateClawbackVestingAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ToAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.StartTime != 0 { + n += 1 + sovTx(uint64(m.StartTime)) + } + if len(m.LockupPeriods) > 0 { + for _, e := range m.LockupPeriods { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.VestingPeriods) > 0 { + for _, e := range m.VestingPeriods { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if m.Merge { + n += 2 + } + return n +} + +func (m *MsgCreateVestingAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCreatePermanentLockedAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ToAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgCreatePermanentLockedAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCreatePeriodicVestingAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ToAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.StartTime != 0 { n += 1 + sovTx(uint64(m.StartTime)) } if len(m.VestingPeriods) > 0 { @@ -1021,25 +1810,773 @@ func (m *MsgCreatePeriodicVestingAccount) Size() (n int) { n += 1 + l + sovTx(uint64(l)) } } - return n -} + if m.Merge { + n += 2 + } + return n +} + +func (m *MsgCreatePeriodicVestingAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCreateClawbackVestingAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgClawback) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.FunderAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DestAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgClawbackResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgReturnGrants) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgReturnGrantsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateVestingAccount) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateVestingAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ToAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) + } + m.EndTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EndTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Delayed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Delayed = bool(v != 0) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Merge", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Merge = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateClawbackVestingAccount) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateClawbackVestingAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateClawbackVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ToAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + m.StartTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LockupPeriods", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LockupPeriods = append(m.LockupPeriods, Period{}) + if err := m.LockupPeriods[len(m.LockupPeriods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VestingPeriods", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VestingPeriods = append(m.VestingPeriods, Period{}) + if err := m.VestingPeriods[len(m.VestingPeriods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Merge", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Merge = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateVestingAccountResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateVestingAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateVestingAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreatePermanentLockedAccount) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreatePermanentLockedAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreatePermanentLockedAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ToAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreatePermanentLockedAccountResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreatePermanentLockedAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreatePermanentLockedAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func (m *MsgCreatePeriodicVestingAccountResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *MsgCreateVestingAccount) Unmarshal(dAtA []byte) error { +func (m *MsgCreatePeriodicVestingAccount) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1062,10 +2599,10 @@ func (m *MsgCreateVestingAccount) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateVestingAccount: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreatePeriodicVestingAccount: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreatePeriodicVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1133,8 +2670,27 @@ func (m *MsgCreateVestingAccount) Unmarshal(dAtA []byte) error { m.ToAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + m.StartTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VestingPeriods", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1161,33 +2717,14 @@ func (m *MsgCreateVestingAccount) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.VestingPeriods = append(m.VestingPeriods, Period{}) + if err := m.VestingPeriods[len(m.VestingPeriods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) - } - m.EndTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EndTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Delayed", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Merge", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -1204,7 +2741,7 @@ func (m *MsgCreateVestingAccount) Unmarshal(dAtA []byte) error { break } } - m.Delayed = bool(v != 0) + m.Merge = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -1226,7 +2763,7 @@ func (m *MsgCreateVestingAccount) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateVestingAccountResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCreatePeriodicVestingAccountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1249,10 +2786,10 @@ func (m *MsgCreateVestingAccountResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateVestingAccountResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreatePeriodicVestingAccountResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateVestingAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreatePeriodicVestingAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1276,7 +2813,7 @@ func (m *MsgCreateVestingAccountResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreatePermanentLockedAccount) Unmarshal(dAtA []byte) error { +func (m *MsgCreateClawbackVestingAccountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1299,10 +2836,60 @@ func (m *MsgCreatePermanentLockedAccount) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreatePermanentLockedAccount: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateClawbackVestingAccountResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreatePermanentLockedAccount: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateClawbackVestingAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgClawback) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgClawback: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClawback: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1339,7 +2926,7 @@ func (m *MsgCreatePermanentLockedAccount) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FunderAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1367,13 +2954,13 @@ func (m *MsgCreatePermanentLockedAccount) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ToAddress = string(dAtA[iNdEx:postIndex]) + m.FunderAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1383,25 +2970,55 @@ func (m *MsgCreatePermanentLockedAccount) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF } + m.DestAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1424,7 +3041,7 @@ func (m *MsgCreatePermanentLockedAccount) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreatePermanentLockedAccountResponse) Unmarshal(dAtA []byte) error { +func (m *MsgClawbackResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1447,10 +3064,10 @@ func (m *MsgCreatePermanentLockedAccountResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreatePermanentLockedAccountResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgClawbackResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreatePermanentLockedAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgClawbackResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1474,7 +3091,7 @@ func (m *MsgCreatePermanentLockedAccountResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreatePeriodicVestingAccount) Unmarshal(dAtA []byte) error { +func (m *MsgReturnGrants) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1497,10 +3114,10 @@ func (m *MsgCreatePeriodicVestingAccount) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreatePeriodicVestingAccount: wiretype end group for non-group") + return fmt.Errorf("proto: MsgReturnGrants: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreatePeriodicVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgReturnGrants: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1537,7 +3154,7 @@ func (m *MsgCreatePeriodicVestingAccount) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ToAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1565,60 +3182,7 @@ func (m *MsgCreatePeriodicVestingAccount) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ToAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) - } - m.StartTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VestingPeriods", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VestingPeriods = append(m.VestingPeriods, Period{}) - if err := m.VestingPeriods[len(m.VestingPeriods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1641,7 +3205,7 @@ func (m *MsgCreatePeriodicVestingAccount) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreatePeriodicVestingAccountResponse) Unmarshal(dAtA []byte) error { +func (m *MsgReturnGrantsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1664,10 +3228,10 @@ func (m *MsgCreatePeriodicVestingAccountResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreatePeriodicVestingAccountResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgReturnGrantsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreatePeriodicVestingAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgReturnGrantsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/auth/vesting/types/vesting.pb.go b/x/auth/vesting/types/vesting.pb.go index 0bf8f8a22fdc..6019d22cee0e 100644 --- a/x/auth/vesting/types/vesting.pb.go +++ b/x/auth/vesting/types/vesting.pb.go @@ -289,6 +289,54 @@ func (m *PermanentLockedAccount) XXX_DiscardUnknown() { var xxx_messageInfo_PermanentLockedAccount proto.InternalMessageInfo +// ClawbackVestingAccount implements the VestingAccount interface. It provides +// an account that can hold contributions subject to "lockup" (like a +// PeriodicVestingAccount), or vesting which is subject to clawback +// of unvested tokens, or a combination (tokens vest, but are still locked). +type ClawbackVestingAccount struct { + *BaseVestingAccount `protobuf:"bytes,1,opt,name=base_vesting_account,json=baseVestingAccount,proto3,embedded=base_vesting_account" json:"base_vesting_account,omitempty"` + // funder_address specifies the account which can perform clawback. + FunderAddress string `protobuf:"bytes,2,opt,name=funder_address,json=funderAddress,proto3" json:"funder_address,omitempty" yaml:"funder_address"` + StartTime int64 `protobuf:"varint,3,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty" yaml:"start_time"` + // unlocking schedule relative to the BaseVestingAccount start_time. + LockupPeriods []Period `protobuf:"bytes,4,rep,name=lockup_periods,json=lockupPeriods,proto3" json:"lockup_periods" yaml:"lockup_periods"` + // vesting (i.e. immunity from clawback) schedule relative to the BaseVestingAccount start_time. + VestingPeriods []Period `protobuf:"bytes,5,rep,name=vesting_periods,json=vestingPeriods,proto3" json:"vesting_periods" yaml:"vesting_periods"` +} + +func (m *ClawbackVestingAccount) Reset() { *m = ClawbackVestingAccount{} } +func (m *ClawbackVestingAccount) String() string { return proto.CompactTextString(m) } +func (*ClawbackVestingAccount) ProtoMessage() {} +func (*ClawbackVestingAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_89e80273ca606d6e, []int{6} +} +func (m *ClawbackVestingAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClawbackVestingAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClawbackVestingAccount.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ClawbackVestingAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClawbackVestingAccount.Merge(m, src) +} +func (m *ClawbackVestingAccount) XXX_Size() int { + return m.Size() +} +func (m *ClawbackVestingAccount) XXX_DiscardUnknown() { + xxx_messageInfo_ClawbackVestingAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_ClawbackVestingAccount proto.InternalMessageInfo + func init() { proto.RegisterType((*BaseVestingAccount)(nil), "cosmos.vesting.v1beta1.BaseVestingAccount") proto.RegisterType((*ContinuousVestingAccount)(nil), "cosmos.vesting.v1beta1.ContinuousVestingAccount") @@ -296,6 +344,7 @@ func init() { proto.RegisterType((*Period)(nil), "cosmos.vesting.v1beta1.Period") proto.RegisterType((*PeriodicVestingAccount)(nil), "cosmos.vesting.v1beta1.PeriodicVestingAccount") proto.RegisterType((*PermanentLockedAccount)(nil), "cosmos.vesting.v1beta1.PermanentLockedAccount") + proto.RegisterType((*ClawbackVestingAccount)(nil), "cosmos.vesting.v1beta1.ClawbackVestingAccount") } func init() { @@ -303,45 +352,53 @@ func init() { } var fileDescriptor_89e80273ca606d6e = []byte{ - // 605 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x4d, 0x6b, 0x13, 0x41, - 0x18, 0xce, 0x34, 0x35, 0xda, 0x69, 0xed, 0xc7, 0x52, 0x43, 0x5a, 0xe8, 0x26, 0xae, 0x22, 0x31, - 0xe8, 0x2e, 0xa9, 0xb7, 0xdc, 0x4c, 0xa5, 0x20, 0x7a, 0x90, 0x20, 0x1e, 0xbc, 0x84, 0xd9, 0xdd, - 0x71, 0x33, 0x34, 0x3b, 0x13, 0x76, 0x26, 0xc5, 0xfc, 0x83, 0x22, 0x22, 0x9e, 0xed, 0xc5, 0x93, - 0x14, 0x4f, 0xf9, 0x19, 0x05, 0x11, 0x72, 0xf4, 0x54, 0x25, 0x39, 0xe4, 0x6f, 0xc8, 0xce, 0xcc, - 0x6e, 0x43, 0x3e, 0x3c, 0x06, 0x2f, 0xc9, 0xbe, 0x1f, 0xf3, 0x3e, 0xcf, 0xf3, 0xe6, 0xd9, 0x0c, - 0xbc, 0xef, 0x31, 0x1e, 0x32, 0xee, 0x9c, 0x62, 0x2e, 0x08, 0x0d, 0x9c, 0xd3, 0xaa, 0x8b, 0x05, - 0xaa, 0x26, 0xb1, 0xdd, 0x89, 0x98, 0x60, 0x46, 0x5e, 0x75, 0xd9, 0x49, 0x56, 0x77, 0xed, 0xef, - 0xa0, 0x90, 0x50, 0xe6, 0xc8, 0x4f, 0xd5, 0xba, 0xbf, 0x1b, 0xb0, 0x80, 0xc9, 0x47, 0x27, 0x7e, - 0xd2, 0x59, 0x53, 0xc3, 0xb8, 0x88, 0xe3, 0x14, 0xc3, 0x63, 0x84, 0x4e, 0xd5, 0x51, 0x57, 0xb4, - 0xd2, 0x7a, 0x1c, 0xa8, 0xba, 0xf5, 0x73, 0x15, 0x1a, 0x75, 0xc4, 0xf1, 0x1b, 0x45, 0xe0, 0xa9, - 0xe7, 0xb1, 0x2e, 0x15, 0xc6, 0x73, 0xb8, 0x11, 0x4f, 0x6c, 0x22, 0x15, 0x17, 0x40, 0x09, 0x94, - 0xd7, 0x0f, 0x4b, 0xb6, 0xa6, 0x2b, 0x07, 0xe8, 0x69, 0x76, 0x7c, 0x5c, 0x9f, 0xab, 0xaf, 0x0e, - 0xae, 0x8a, 0xa0, 0xb1, 0xee, 0x5e, 0xa7, 0x8c, 0x8f, 0x00, 0x6e, 0xb3, 0x88, 0x04, 0x84, 0xa2, - 0x76, 0x53, 0xeb, 0x2c, 0xac, 0x94, 0xb2, 0xe5, 0xf5, 0xc3, 0xbd, 0x64, 0x5e, 0xdc, 0x9f, 0xce, - 0x3b, 0x62, 0x84, 0xd6, 0x8f, 0x2f, 0xaf, 0x8a, 0x99, 0xef, 0xbf, 0x8b, 0xe5, 0x80, 0x88, 0x56, - 0xd7, 0xb5, 0x3d, 0x16, 0x3a, 0x5a, 0x8a, 0xfa, 0x7a, 0xcc, 0xfd, 0x13, 0x47, 0xf4, 0x3a, 0x98, - 0xcb, 0x03, 0xfc, 0xcb, 0xb8, 0x5f, 0xd9, 0x68, 0xe3, 0x00, 0x79, 0xbd, 0x66, 0xac, 0x9f, 0x5f, - 0x8c, 0xfb, 0x15, 0xd0, 0xd8, 0x4a, 0xa0, 0xb5, 0x40, 0xe3, 0x0c, 0xc0, 0x4d, 0x1f, 0xc7, 0x8d, - 0x02, 0xfb, 0xcd, 0x77, 0x11, 0xc6, 0x85, 0xec, 0xb2, 0xc8, 0xdc, 0x4e, 0x81, 0x8f, 0x23, 0x8c, - 0x8d, 0x4f, 0x00, 0xee, 0x5c, 0x53, 0x49, 0x56, 0xb3, 0xba, 0x2c, 0x36, 0xdb, 0x29, 0x76, 0xb2, - 0x9b, 0x3d, 0x78, 0x0b, 0x53, 0xbf, 0x29, 0x48, 0x88, 0x0b, 0x37, 0x4a, 0xa0, 0x9c, 0x6d, 0xdc, - 0xc4, 0xd4, 0x7f, 0x4d, 0x42, 0x5c, 0x7b, 0x70, 0xf6, 0xb5, 0x98, 0xf9, 0x30, 0xee, 0x57, 0x0e, - 0x26, 0x30, 0x66, 0x8d, 0x63, 0xfd, 0x00, 0xb0, 0x70, 0xc4, 0xa8, 0x20, 0xb4, 0xcb, 0xba, 0x7c, - 0xca, 0x55, 0x2e, 0xdc, 0x95, 0xae, 0xd2, 0x52, 0xa7, 0xdc, 0x55, 0xb1, 0xe7, 0xbf, 0x0c, 0xf6, - 0x2c, 0x8c, 0xf6, 0x99, 0xe1, 0xce, 0x3a, 0xf7, 0x00, 0x42, 0x2e, 0x50, 0x24, 0x94, 0x8a, 0x15, - 0xa9, 0x62, 0x4d, 0x66, 0xa4, 0x8e, 0x47, 0x89, 0x8e, 0x7b, 0x13, 0x3a, 0x16, 0x11, 0xb6, 0xbe, - 0x01, 0x78, 0xe7, 0x19, 0x6e, 0xa3, 0x5e, 0xba, 0xa3, 0x25, 0x4a, 0xa9, 0x3d, 0x4c, 0xb8, 0x96, - 0x26, 0xb8, 0xce, 0xa5, 0x63, 0x9d, 0x03, 0x98, 0x7b, 0x85, 0x23, 0xc2, 0x7c, 0x23, 0x0f, 0x73, - 0x6d, 0x4c, 0x03, 0xd1, 0x92, 0x5c, 0xb2, 0x0d, 0x1d, 0x19, 0x3d, 0x98, 0x43, 0xa1, 0xe4, 0xb8, - 0xb4, 0x97, 0x4f, 0x03, 0x5a, 0xe7, 0x2b, 0x30, 0xaf, 0xd8, 0x11, 0xef, 0xbf, 0xb3, 0x84, 0xd1, - 0x80, 0x5b, 0x09, 0x7a, 0x47, 0x92, 0xe4, 0xfa, 0x1f, 0xc1, 0x5c, 0x84, 0xae, 0xb4, 0xd4, 0xd7, - 0xe2, 0x35, 0x29, 0xa5, 0x9b, 0xba, 0x45, 0x55, 0x78, 0xad, 0x92, 0xfc, 0x74, 0x77, 0x27, 0x16, - 0x36, 0x7f, 0x05, 0xd6, 0x05, 0x90, 0xdb, 0x09, 0x11, 0xc5, 0x54, 0xbc, 0x64, 0xde, 0x09, 0xf6, - 0x97, 0xe9, 0xb2, 0x45, 0x54, 0xe7, 0xf0, 0xa9, 0xbf, 0xb8, 0x1c, 0x9a, 0x60, 0x30, 0x34, 0xc1, - 0x9f, 0xa1, 0x09, 0x3e, 0x8f, 0xcc, 0xcc, 0x60, 0x64, 0x66, 0x7e, 0x8d, 0xcc, 0xcc, 0xdb, 0xea, - 0x3f, 0xad, 0xf2, 0x5e, 0xdf, 0x3f, 0xfa, 0x2e, 0x94, 0xce, 0x71, 0x73, 0xf2, 0x06, 0x7a, 0xf2, - 0x37, 0x00, 0x00, 0xff, 0xff, 0x47, 0xcb, 0xcd, 0xc9, 0x2a, 0x07, 0x00, 0x00, + // 733 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x41, 0x4f, 0x13, 0x4d, + 0x18, 0xee, 0xd0, 0xd2, 0xef, 0x63, 0x80, 0x02, 0x1b, 0x68, 0x0a, 0x09, 0xdb, 0x7e, 0xfb, 0x19, + 0x53, 0x1b, 0x6d, 0x03, 0x7a, 0xea, 0x49, 0x8a, 0x21, 0x31, 0x7a, 0x30, 0x8d, 0xf1, 0xe0, 0xa5, + 0x99, 0xdd, 0x1d, 0x96, 0x4d, 0x77, 0x67, 0x9a, 0x9d, 0x59, 0xb4, 0xff, 0x80, 0x18, 0x63, 0x3c, + 0xcb, 0xc5, 0x93, 0x21, 0x9e, 0xf8, 0x19, 0x24, 0xc6, 0x84, 0xa3, 0xa7, 0x6a, 0xe0, 0xc0, 0xd1, + 0x84, 0x5f, 0x60, 0x76, 0x66, 0x76, 0x5b, 0xda, 0x62, 0x38, 0x55, 0x2f, 0xed, 0xce, 0xfb, 0xbe, + 0xf3, 0x3e, 0xcf, 0xf3, 0xce, 0xb3, 0x9b, 0x81, 0xb7, 0x2c, 0xca, 0x7c, 0xca, 0x6a, 0xfb, 0x98, + 0x71, 0x97, 0x38, 0xb5, 0xfd, 0x0d, 0x13, 0x73, 0xb4, 0x11, 0xaf, 0xab, 0x9d, 0x80, 0x72, 0xaa, + 0xe5, 0x65, 0x55, 0x35, 0x8e, 0xaa, 0xaa, 0xb5, 0x25, 0xe4, 0xbb, 0x84, 0xd6, 0xc4, 0xaf, 0x2c, + 0x5d, 0x5b, 0x76, 0xa8, 0x43, 0xc5, 0x63, 0x2d, 0x7a, 0x52, 0x51, 0x5d, 0xc1, 0x98, 0x88, 0xe1, + 0x04, 0xc3, 0xa2, 0x2e, 0x19, 0xca, 0xa3, 0x90, 0xef, 0x25, 0xf9, 0x68, 0x21, 0xf3, 0xc6, 0xd7, + 0x0c, 0xd4, 0x1a, 0x88, 0xe1, 0x17, 0x92, 0xc0, 0x96, 0x65, 0xd1, 0x90, 0x70, 0xed, 0x31, 0x9c, + 0x8b, 0x3a, 0xb6, 0x90, 0x5c, 0x17, 0x40, 0x09, 0x94, 0x67, 0x37, 0x4b, 0x55, 0x45, 0x57, 0x34, + 0x50, 0xdd, 0xaa, 0xd1, 0x76, 0xb5, 0xaf, 0x91, 0x39, 0xed, 0x15, 0x41, 0x73, 0xd6, 0xec, 0x87, + 0xb4, 0xb7, 0x00, 0x2e, 0xd2, 0xc0, 0x75, 0x5c, 0x82, 0xbc, 0x96, 0xd2, 0x59, 0x98, 0x2a, 0xa5, + 0xcb, 0xb3, 0x9b, 0xab, 0x71, 0xbf, 0xa8, 0x3e, 0xe9, 0xb7, 0x4d, 0x5d, 0xd2, 0xd8, 0x39, 0xe9, + 0x15, 0x53, 0x9f, 0xbf, 0x17, 0xcb, 0x8e, 0xcb, 0xf7, 0x42, 0xb3, 0x6a, 0x51, 0xbf, 0xa6, 0xa4, + 0xc8, 0xbf, 0x7b, 0xcc, 0x6e, 0xd7, 0x78, 0xb7, 0x83, 0x99, 0xd8, 0xc0, 0x3e, 0x5c, 0x1c, 0x57, + 0xe6, 0x3c, 0xec, 0x20, 0xab, 0xdb, 0x8a, 0xf4, 0xb3, 0xa3, 0x8b, 0xe3, 0x0a, 0x68, 0x2e, 0xc4, + 0xd0, 0x4a, 0xa0, 0x76, 0x00, 0x60, 0xce, 0xc6, 0x51, 0x21, 0xc7, 0x76, 0x6b, 0x37, 0xc0, 0xb8, + 0x90, 0x9e, 0x14, 0x99, 0xf9, 0x04, 0x78, 0x27, 0xc0, 0x58, 0x7b, 0x07, 0xe0, 0x52, 0x9f, 0x4a, + 0x3c, 0x9a, 0xcc, 0xa4, 0xd8, 0x2c, 0x26, 0xd8, 0xf1, 0x6c, 0x56, 0xe1, 0xbf, 0x98, 0xd8, 0x2d, + 0xee, 0xfa, 0xb8, 0x30, 0x5d, 0x02, 0xe5, 0x74, 0xf3, 0x1f, 0x4c, 0xec, 0xe7, 0xae, 0x8f, 0xeb, + 0xb7, 0x0f, 0x3e, 0x16, 0x53, 0x6f, 0x2e, 0x8e, 0x2b, 0xeb, 0x03, 0x18, 0xa3, 0xc6, 0x31, 0xbe, + 0x00, 0x58, 0xd8, 0xa6, 0x84, 0xbb, 0x24, 0xa4, 0x21, 0x1b, 0x72, 0x95, 0x09, 0x97, 0x85, 0xab, + 0x94, 0xd4, 0x21, 0x77, 0x55, 0xaa, 0xe3, 0x5f, 0x86, 0xea, 0x28, 0x8c, 0xf2, 0x99, 0x66, 0x8e, + 0x3a, 0x77, 0x1d, 0x42, 0xc6, 0x51, 0xc0, 0xa5, 0x8a, 0x29, 0xa1, 0x62, 0x46, 0x44, 0x84, 0x8e, + 0xbb, 0xb1, 0x8e, 0xff, 0x07, 0x74, 0x5c, 0x47, 0xd8, 0xf8, 0x04, 0xe0, 0xca, 0x23, 0xec, 0xa1, + 0x6e, 0x32, 0xa3, 0x09, 0x4a, 0xa9, 0xdf, 0x89, 0xb9, 0x96, 0x06, 0xb8, 0x8e, 0xa5, 0x63, 0x1c, + 0x02, 0x98, 0x7d, 0x86, 0x03, 0x97, 0xda, 0x5a, 0x1e, 0x66, 0x3d, 0x4c, 0x1c, 0xbe, 0x27, 0xb8, + 0xa4, 0x9b, 0x6a, 0xa5, 0x75, 0x61, 0x16, 0xf9, 0x82, 0xe3, 0xc4, 0x5e, 0x3e, 0x05, 0x68, 0x1c, + 0x4e, 0xc1, 0xbc, 0x64, 0xe7, 0x5a, 0x7f, 0x9d, 0x25, 0xb4, 0x26, 0x5c, 0x88, 0xd1, 0x3b, 0x82, + 0x24, 0x53, 0x5f, 0x04, 0xfd, 0x3a, 0x74, 0xa9, 0xa5, 0x31, 0x13, 0x8d, 0x49, 0x2a, 0xcd, 0xa9, + 0x12, 0x99, 0x61, 0xf5, 0x4a, 0x7c, 0x74, 0xff, 0x0d, 0x0c, 0x6c, 0xfc, 0x08, 0x8c, 0x23, 0x20, + 0xa6, 0xe3, 0x23, 0x82, 0x09, 0x7f, 0x4a, 0xad, 0x36, 0xb6, 0x27, 0xe9, 0xb2, 0xeb, 0xa8, 0x8e, + 0xe1, 0x63, 0xfc, 0x4c, 0xc3, 0xfc, 0xb6, 0x87, 0x5e, 0x99, 0xc8, 0x6a, 0xff, 0x81, 0x83, 0x7c, + 0x08, 0x73, 0xbb, 0x21, 0xb1, 0x71, 0xd0, 0x42, 0xb6, 0x1d, 0x60, 0xc6, 0xc4, 0x61, 0xce, 0x34, + 0x56, 0x2f, 0x7b, 0xc5, 0x95, 0x2e, 0xf2, 0xbd, 0xba, 0x71, 0x35, 0x6f, 0x34, 0xe7, 0x65, 0x60, + 0x4b, 0xae, 0xb5, 0x07, 0x57, 0xac, 0x90, 0x8e, 0xac, 0xd0, 0x58, 0xb9, 0xec, 0x15, 0x97, 0xe4, + 0xee, 0x7e, 0xce, 0x18, 0x74, 0x88, 0x0d, 0x73, 0x1e, 0xb5, 0xda, 0x61, 0x27, 0x31, 0x48, 0xe6, + 0x46, 0x06, 0x59, 0x8f, 0x0c, 0xd2, 0xe7, 0x76, 0xb5, 0x87, 0xd1, 0x9c, 0x97, 0x01, 0xe5, 0x19, + 0xcd, 0x19, 0xf5, 0xe1, 0xf4, 0x8d, 0x60, 0x74, 0x05, 0x93, 0x97, 0x30, 0x43, 0x4d, 0x8c, 0x1b, + 0x9b, 0x73, 0xcc, 0x89, 0x37, 0x9e, 0x9c, 0x9c, 0xe9, 0xe0, 0xf4, 0x4c, 0x07, 0x3f, 0xce, 0x74, + 0xf0, 0xfe, 0x5c, 0x4f, 0x9d, 0x9e, 0xeb, 0xa9, 0x6f, 0xe7, 0x7a, 0xea, 0xe5, 0xc6, 0x6f, 0x3f, + 0x0e, 0xaf, 0xd5, 0x8d, 0x43, 0xdd, 0x7e, 0xc4, 0xb7, 0xc2, 0xcc, 0x8a, 0x3b, 0xc7, 0xfd, 0x5f, + 0x01, 0x00, 0x00, 0xff, 0xff, 0x57, 0x11, 0x63, 0xe6, 0x1c, 0x09, 0x00, 0x00, } func (m *BaseVestingAccount) Marshal() (dAtA []byte, err error) { @@ -632,6 +689,81 @@ func (m *PermanentLockedAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *ClawbackVestingAccount) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClawbackVestingAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClawbackVestingAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.VestingPeriods) > 0 { + for iNdEx := len(m.VestingPeriods) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.VestingPeriods[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVesting(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.LockupPeriods) > 0 { + for iNdEx := len(m.LockupPeriods) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LockupPeriods[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVesting(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.StartTime != 0 { + i = encodeVarintVesting(dAtA, i, uint64(m.StartTime)) + i-- + dAtA[i] = 0x18 + } + if len(m.FunderAddress) > 0 { + i -= len(m.FunderAddress) + copy(dAtA[i:], m.FunderAddress) + i = encodeVarintVesting(dAtA, i, uint64(len(m.FunderAddress))) + i-- + dAtA[i] = 0x12 + } + if m.BaseVestingAccount != nil { + { + size, err := m.BaseVestingAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVesting(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintVesting(dAtA []byte, offset int, v uint64) int { offset -= sovVesting(v) base := offset @@ -759,6 +891,38 @@ func (m *PermanentLockedAccount) Size() (n int) { return n } +func (m *ClawbackVestingAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BaseVestingAccount != nil { + l = m.BaseVestingAccount.Size() + n += 1 + l + sovVesting(uint64(l)) + } + l = len(m.FunderAddress) + if l > 0 { + n += 1 + l + sovVesting(uint64(l)) + } + if m.StartTime != 0 { + n += 1 + sovVesting(uint64(m.StartTime)) + } + if len(m.LockupPeriods) > 0 { + for _, e := range m.LockupPeriods { + l = e.Size() + n += 1 + l + sovVesting(uint64(l)) + } + } + if len(m.VestingPeriods) > 0 { + for _, e := range m.VestingPeriods { + l = e.Size() + n += 1 + l + sovVesting(uint64(l)) + } + } + return n +} + func sovVesting(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1491,6 +1655,211 @@ func (m *PermanentLockedAccount) Unmarshal(dAtA []byte) error { } return nil } +func (m *ClawbackVestingAccount) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVesting + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClawbackVestingAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClawbackVestingAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseVestingAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVesting + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVesting + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVesting + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BaseVestingAccount == nil { + m.BaseVestingAccount = &BaseVestingAccount{} + } + if err := m.BaseVestingAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FunderAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVesting + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVesting + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthVesting + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FunderAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + m.StartTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVesting + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LockupPeriods", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVesting + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVesting + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVesting + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LockupPeriods = append(m.LockupPeriods, Period{}) + if err := m.LockupPeriods[len(m.LockupPeriods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VestingPeriods", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVesting + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVesting + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVesting + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VestingPeriods = append(m.VestingPeriods, Period{}) + if err := m.VestingPeriods[len(m.VestingPeriods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVesting(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthVesting + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipVesting(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/auth/vesting/types/vesting_account.go b/x/auth/vesting/types/vesting_account.go index 868dc49588e7..0d4784ad0236 100644 --- a/x/auth/vesting/types/vesting_account.go +++ b/x/auth/vesting/types/vesting_account.go @@ -1,8 +1,13 @@ package types import ( + sdkerrors "cosmossdk.io/errors" "errors" "fmt" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + errors2 "github.com/cosmos/cosmos-sdk/types/errors" + stdmath "math" + "sigs.k8s.io/yaml" "time" "cosmossdk.io/math" @@ -162,6 +167,21 @@ func (bva BaseVestingAccount) Validate() error { return bva.BaseAccount.Validate() } +type vestingAccountYAML struct { + Address sdk.AccAddress `json:"address"` + PubKey string `json:"public_key"` + AccountNumber uint64 `json:"account_number"` + Sequence uint64 `json:"sequence"` + OriginalVesting sdk.Coins `json:"original_vesting"` + DelegatedFree sdk.Coins `json:"delegated_free"` + DelegatedVesting sdk.Coins `json:"delegated_vesting"` + EndTime int64 `json:"end_time"` + + // custom fields based on concrete vesting type which can be omitted + StartTime int64 `json:"start_time,omitempty"` + VestingPeriods Periods `json:"vesting_periods,omitempty"` +} + // Continuous Vesting Account var ( @@ -387,6 +407,48 @@ func (pva PeriodicVestingAccount) Validate() error { return pva.BaseVestingAccount.Validate() } +// addGrant merges a new periodic vesting grant into an existing PeriodicVestingAccount. +func (pva *PeriodicVestingAccount) AddGrant(ctx sdk.Context, sk StakingKeeper, grantStartTime int64, grantVestingPeriods []Period, grantCoins sdk.Coins) error { + // how much is really delegated? + bondedAmt, err := sk.GetDelegatorBonded(ctx, pva.GetAddress()) + if err != nil { + return err + } + unbondingAmt, err := sk.GetDelegatorUnbonding(ctx, pva.GetAddress()) + if err != nil { + return err + } + delegatedAmt := bondedAmt.Add(unbondingAmt) + bondDenom, err := sk.BondDenom(ctx) + if err != nil { + return err + } + delegated := sdk.NewCoins(sdk.NewCoin(bondDenom, delegatedAmt)) + + // discover what has been slashed + oldDelegated := pva.DelegatedVesting.Add(pva.DelegatedFree...) + slashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated)...) + + // rebase the DV+DF by capping slashed at the current unvested amount + unvested := pva.GetVestingCoins(ctx.BlockTime()) + newSlashed := coinsMin(unvested, slashed) + newTotalDelegated := delegated.Add(newSlashed...) + + // modify vesting schedule for the new grant + newStart, newEnd, newPeriods := DisjunctPeriods(pva.StartTime, grantStartTime, + pva.GetVestingPeriods(), grantVestingPeriods) + pva.StartTime = newStart + pva.EndTime = newEnd + pva.VestingPeriods = newPeriods + pva.OriginalVesting = pva.OriginalVesting.Add(grantCoins...) + + // cap DV at the current unvested amount, DF rounds out to newTotalDelegated + unvested2 := pva.GetVestingCoins(ctx.BlockTime()) + pva.DelegatedVesting = coinsMin(newTotalDelegated, unvested2) + pva.DelegatedFree = newTotalDelegated.Sub(pva.DelegatedVesting...) + return nil +} + // Delayed Vesting Account var ( @@ -518,3 +580,670 @@ func (plva PermanentLockedAccount) Validate() error { return plva.BaseVestingAccount.Validate() } + +type getPK interface { + GetPubKey() cryptotypes.PubKey +} + +func getPKString(g getPK) string { + if pk := g.GetPubKey(); pk != nil { + return pk.String() + } + return "" +} + +func marshalYaml(i interface{}) (interface{}, error) { + bz, err := yaml.Marshal(i) + if err != nil { + return nil, err + } + return string(bz), nil +} + +// Clawback Vesting Account + +var ( + _ vestexported.VestingAccount = (*ClawbackVestingAccount)(nil) + _ authtypes.GenesisAccount = (*ClawbackVestingAccount)(nil) +) + +// NewClawbackVestingAccount returns a new ClawbackVestingAccount +func NewClawbackVestingAccount(baseAcc *authtypes.BaseAccount, funder sdk.AccAddress, originalVesting sdk.Coins, startTime int64, lockupPeriods, vestingPeriods Periods) *ClawbackVestingAccount { + // copy and align schedules to avoid mutating inputs + lp := make(Periods, len(lockupPeriods)) + copy(lp, lockupPeriods) + vp := make(Periods, len(vestingPeriods)) + copy(vp, vestingPeriods) + _, endTime := AlignSchedules(startTime, startTime, lp, vp) + baseVestingAcc := &BaseVestingAccount{ + BaseAccount: baseAcc, + OriginalVesting: originalVesting, + EndTime: endTime, + } + + return &ClawbackVestingAccount{ + BaseVestingAccount: baseVestingAcc, + FunderAddress: funder.String(), + StartTime: startTime, + LockupPeriods: lp, + VestingPeriods: vp, + } +} + +// GetVestedCoins returns the total number of vested coins. If no coins are vested, +// nil is returned. +func (va ClawbackVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins { + // It's likely that one or the other schedule will be nearly trivial, + // so there should be little overhead in recomputing the conjunction each time. + coins := coinsMin(va.GetUnlockedOnly(blockTime), va.GetVestedOnly(blockTime)) + if coins.IsZero() { + return nil + } + return coins +} + +// GetVestingCoins returns the total number of vesting coins. If no coins are +// vesting, nil is returned. +func (va ClawbackVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins { + return va.OriginalVesting.Sub(va.GetVestedCoins(blockTime)...) +} + +// LockedCoins returns the set of coins that are not spendable (i.e. locked), +// defined as the vesting coins that are not delegated. +func (va ClawbackVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins { + return va.BaseVestingAccount.LockedCoinsFromVesting(va.GetVestingCoins(blockTime)) +} + +// TrackDelegation tracks a desired delegation amount by setting the appropriate +// values for the amount of delegated vesting, delegated free, and reducing the +// overall amount of base coins. +func (va *ClawbackVestingAccount) TrackDelegation(blockTime time.Time, balance, amount sdk.Coins) { + va.BaseVestingAccount.TrackDelegation(balance, va.GetVestingCoins(blockTime), amount) +} + +// GetStartTime returns the time when vesting starts for a periodic vesting +// account. +func (va ClawbackVestingAccount) GetStartTime() int64 { + return va.StartTime +} + +// GetVestingPeriods returns vesting periods associated with periodic vesting account. +func (va ClawbackVestingAccount) GetVestingPeriods() Periods { + return va.VestingPeriods +} + +// coinEq returns whether two Coins are equal. +// The IsEqual() method can panic. +func coinEq(a, b sdk.Coins) bool { + return a.IsAllLTE(b) && b.IsAllLTE(a) +} + +// Validate checks for errors on the account fields +func (va ClawbackVestingAccount) Validate() error { + if va.GetStartTime() > va.GetEndTime() { + return errors.New("vesting end-time cannot precede start-time") + } + + lockupEnd := va.StartTime + lockupCoins := sdk.NewCoins() + for _, p := range va.LockupPeriods { + lockupEnd += p.Length + lockupCoins = lockupCoins.Add(p.Amount...) + } + if lockupEnd > va.EndTime { + return errors.New("lockup schedule extends beyond account end time") + } + if !coinEq(lockupCoins, va.OriginalVesting) { + return errors.New("original vesting coins does not match the sum of all coins in lockup periods") + } + + vestingEnd := va.StartTime + vestingCoins := sdk.NewCoins() + for _, p := range va.VestingPeriods { + vestingEnd += p.Length + vestingCoins = vestingCoins.Add(p.Amount...) + } + if vestingEnd > va.EndTime { + return errors.New("vesting schedule exteds beyond account end time") + } + if !coinEq(vestingCoins, va.OriginalVesting) { + return errors.New("original vesting coins does not match the sum of all coins in vesting periods") + } + + return va.BaseVestingAccount.Validate() +} + +// MarshalYAML returns the YAML representation of a ClawbackVestingAccount. +func (va ClawbackVestingAccount) MarshalYAML() (interface{}, error) { + accAddr, err := sdk.AccAddressFromBech32(va.Address) + if err != nil { + return nil, err + } + + out := vestingAccountYAML{ + Address: accAddr, + AccountNumber: va.AccountNumber, + PubKey: getPKString(va), + Sequence: va.Sequence, + OriginalVesting: va.OriginalVesting, + DelegatedFree: va.DelegatedFree, + DelegatedVesting: va.DelegatedVesting, + EndTime: va.EndTime, + StartTime: va.StartTime, + VestingPeriods: va.VestingPeriods, + } + return marshalYaml(out) +} + +// addGrant merges a new clawback vesting grant into an existing ClawbackVestingAccount. +func (va *ClawbackVestingAccount) AddGrant(ctx sdk.Context, funderAddress string, sk StakingKeeper, grantStartTime int64, grantLockupPeriods, grantVestingPeriods []Period, grantCoins sdk.Coins) error { + if funderAddress != va.FunderAddress { + return sdkerrors.Wrapf(errors2.ErrInvalidRequest, "account %s can only accept grants from account %s", + va.GetAddress(), va.FunderAddress) + } + + // how much is really delegated? + bondedAmt, err := sk.GetDelegatorBonded(ctx, va.GetAddress()) + if err != nil { + return err + } + unbondingAmt, err := sk.GetDelegatorUnbonding(ctx, va.GetAddress()) + if err != nil { + return err + } + delegatedAmt := bondedAmt.Add(unbondingAmt) + bondedDenom, err := sk.BondDenom(ctx) + if err != nil { + return err + } + delegated := sdk.NewCoins(sdk.NewCoin(bondedDenom, delegatedAmt)) + + // discover what has been slashed + oldDelegated := va.DelegatedVesting.Add(va.DelegatedFree...) + slashed := oldDelegated.Sub(coinsMin(oldDelegated, delegated)...) + + // rebase the DV + DF by capping slashed at the current unvested amount + unvested := va.OriginalVesting.Sub(va.GetVestedOnly(ctx.BlockTime())...) + newSlashed := coinsMin(slashed, unvested) + newDelegated := delegated.Add(newSlashed...) + + // modify schedules for the new grant + newLockupStart, newLockupEnd, newLockupPeriods := DisjunctPeriods(va.StartTime, grantStartTime, va.LockupPeriods, grantLockupPeriods) + newVestingStart, newVestingEnd, newVestingPeriods := DisjunctPeriods(va.StartTime, grantStartTime, + va.GetVestingPeriods(), grantVestingPeriods) + if newLockupStart != newVestingStart { + panic("bad start time calculation") + } + va.StartTime = newLockupStart + va.EndTime = max64(newLockupEnd, newVestingEnd) + va.LockupPeriods = newLockupPeriods + va.VestingPeriods = newVestingPeriods + va.OriginalVesting = va.OriginalVesting.Add(grantCoins...) + + // cap DV at the current unvested amount, DF rounds out to newDelegated + unvested2 := va.GetVestingCoins(ctx.BlockTime()) + va.DelegatedVesting = coinsMin(newDelegated, unvested2) + va.DelegatedFree = newDelegated.Sub(va.DelegatedVesting...) + return nil +} + +// GetFunder implements the vestexported.ClawbackVestingAccountI interface. +func (va ClawbackVestingAccount) GetFunder() sdk.AccAddress { + addr, err := sdk.AccAddressFromBech32(va.FunderAddress) + if err != nil { + panic(err) + } + return addr +} + +// GetUnlockedOnly implements the vestexported.ClawbackVestingAccountI interface. +// It returns the unlocking schedule at blockTIme. +// Like GetVestedCoins, but only for the lockup component. +func (va ClawbackVestingAccount) GetUnlockedOnly(blockTime time.Time) sdk.Coins { + return ReadSchedule(va.StartTime, va.EndTime, va.LockupPeriods, va.OriginalVesting, blockTime.Unix()) +} + +// GetVestedOnly implements the vestexported.ClawbackVestingAccountI interface. +// It returns the vesting schedule and blockTime. +// Like GetVestedCoins, but only for the vesting (in the clawback sense) component. +func (va ClawbackVestingAccount) GetVestedOnly(blockTime time.Time) sdk.Coins { + return ReadSchedule(va.StartTime, va.EndTime, va.VestingPeriods, va.OriginalVesting, blockTime.Unix()) +} + +// computeClawback removes all future vesting events from the account, +// returns the total sum of these events. When removing the future vesting events, +// the lockup schedule will also have to be capped to keep the total sums the same. +// (But future unlocking events might be preserved if they unlock currently vested coins.) +// If the amount returned is zero, then the returned account should be unchanged. +// Does not adjust DelegatedVesting +func (va *ClawbackVestingAccount) computeClawback(clawbackTime int64) sdk.Coins { + // Compute the truncated vesting schedule and amounts. + // Work with the schedule as the primary data and recompute derived fields, e.g. OriginalVesting. + vestTime := va.StartTime + totalVested := sdk.NewCoins() + totalUnvested := sdk.NewCoins() + unvestedIdx := 0 + for i, period := range va.VestingPeriods { + vestTime += period.Length + // tie in time goes to clawback + if vestTime < clawbackTime { + totalVested = totalVested.Add(period.Amount...) + unvestedIdx = i + 1 + } else { + totalUnvested = totalUnvested.Add(period.Amount...) + } + } + lastVestTime := vestTime + newVestingPeriods := va.VestingPeriods[:unvestedIdx] + + // To cap the unlocking schedule to the new total vested, conjunct with a limiting schedule + capPeriods := []Period{ + { + Length: 0, + Amount: totalVested, + }, + } + _, lastLockTime, newLockupPeriods := ConjunctPeriods(va.StartTime, va.StartTime, va.LockupPeriods, capPeriods) + + // Now construct the new account state + va.OriginalVesting = totalVested + va.EndTime = max64(lastVestTime, lastLockTime) + va.LockupPeriods = newLockupPeriods + va.VestingPeriods = newVestingPeriods + // DelegatedVesting and DelegatedFree will be adjusted elsewhere + + return totalUnvested +} + +// updateDelegation returns an account with its delegation bookkeeping modified for clawback, +// given the current disposition of the account's bank and staking state. Also returns +// the modified amount to claw back. +// +// Computation steps: +// - first, compute the total amount in bonded and unbonding states, used for BaseAccount bookkeeping; +// - based on the old bookkeeping, determine the amount lost to slashing since origin; +// - clip the amount to claw back to be at most the full funds in the account; +// - first claw back the unbonded funds, then go after what's delegated; +// - to the remaining delegated amount, add what's slashed; +// - the "encumbered" (locked up and/or vesting) amount of this goes in DV; +// - the remainder of the new delegated amount goes in DF. +func (va *ClawbackVestingAccount) updateDelegation(encumbered, toClawBack, bonded, unbonding, unbonded sdk.Coins) sdk.Coins { + delegated := bonded.Add(unbonding...) + oldDelegated := va.DelegatedVesting.Add(va.DelegatedFree...) + slashed := oldDelegated.Sub(coinsMin(delegated, oldDelegated)...) + total := delegated.Add(unbonded...) + toClawBack = coinsMin(toClawBack, total) // might have been slashed + newDelegated := coinsMin(delegated, total.Sub(toClawBack...)).Add(slashed...) + va.DelegatedVesting = coinsMin(encumbered, newDelegated) + va.DelegatedFree = newDelegated.Sub(va.DelegatedVesting...) + return toClawBack +} + +// Clawback transfers unvested tokens in a ClawbackVestingAccount to dest. +// Future vesting events are removed. Unstaked tokens are simply sent. +// Unbonding and staked tokens are transferred with their staking state +// intact. Account state is updated to reflect the removals. +func (va *ClawbackVestingAccount) Clawback(ctx sdk.Context, requestor, dest sdk.AccAddress, ak AccountKeeper, bk BankKeeper, sk StakingKeeper) error { + if requestor.String() != va.FunderAddress { + return sdkerrors.Wrapf(errors2.ErrInvalidRequest, "clawback can only be requested by original funder %s", va.FunderAddress) + } + + // Compute the clawback based on the account state only, and update account + toClawBack := va.computeClawback(ctx.BlockTime().Unix()) + if toClawBack.IsZero() { + return nil + } + addr := va.GetAddress() + bondDenom, err := sk.BondDenom(ctx) + if err != nil { + return err + } + + // Compute the clawback based on bank balance and delegation, and update account + encumbered := va.GetVestingCoins(ctx.BlockTime()) + bondedAmt, err := sk.GetDelegatorBonded(ctx, addr) + if err != nil { + return err + } + unbondingAmt, err := sk.GetDelegatorUnbonding(ctx, addr) + if err != nil { + return err + } + bonded := sdk.NewCoins(sdk.NewCoin(bondDenom, bondedAmt)) + unbonding := sdk.NewCoins(sdk.NewCoin(bondDenom, unbondingAmt)) + unbonded := bk.GetAllBalances(ctx, addr) + toClawBack = va.updateDelegation(encumbered, toClawBack, bonded, unbonding, unbonded) + + // Write now now so that the bank module sees unvested tokens are unlocked. + // Note that all store writes are aborted if there is a panic, so there is + // no danger in writing incomplete results. + ak.SetAccount(ctx, va) + + // Now that future vesting events (and associated lockup) are removed, + // the balance of the account is unlocked and can be freely transferred. + spendable := bk.SpendableCoins(ctx, addr) + toXfer := coinsMin(toClawBack, spendable) + err = bk.SendCoins(ctx, addr, dest, toXfer) + if err != nil { + return err // shouldn't happen, given spendable check + } + toClawBack = toClawBack.Sub(toXfer...) + + // We need to traverse the staking data structures to update the + // vesting account bookkeeping, and to recover more funds if necessary. + // Staking is the only way unvested tokens should be missing from the bank balance. + + // If we need more, transfer UnbondingDelegations. + want := toClawBack.AmountOf(bondDenom) + unbondings, err := sk.GetUnbondingDelegations(ctx, addr, stdmath.MaxUint16) + if err != nil { + return err + } + for _, unbonding := range unbondings { + valAddr, err := sdk.ValAddressFromBech32(unbonding.ValidatorAddress) + if err != nil { + panic(err) + } + transferred, err := sk.TransferUnbonding(ctx, addr, dest, valAddr, want) + if err != nil { + return err + } + want = want.Sub(transferred) + if !want.IsPositive() { + break + } + } + + // If we need more, transfer Delegations. + if want.IsPositive() { + delegations, err := sk.GetDelegatorDelegations(ctx, addr, stdmath.MaxUint16) + if err != nil { + return err + } + for _, delegation := range delegations { + validatorAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) + if err != nil { + panic(err) // shouldn't happen + } + validator, err := sk.GetValidator(ctx, validatorAddr) + + if err != nil { + // validator has been removed + continue + } + wantShares, err := validator.SharesFromTokensTruncated(want) + if err != nil { + // validator has no tokens + continue + } + transferredShares, err := sk.TransferDelegation(ctx, addr, dest, sdk.ValAddress(delegation.GetValidatorAddr()), wantShares) + if err != nil { + return err + } + // to be conservative in what we're clawing back, round transferred shares up + transferred := validator.TokensFromSharesRoundUp(transferredShares).RoundInt() + want = want.Sub(transferred) + if !want.IsPositive() { + // Could be slightly negative, due to rounding? + // Don't think so, due to the precautions above. + break + } + } + } + + // If we've transferred everything and still haven't transferred the desired clawback amount, + // then the account must have most some unvested tokens from slashing. + return nil +} + +// forceTransfer sends up to amt assets to the dest account. +// It will first send spendable coins, then unbonding tokens, +// and finally staked tokens. The tokens must not be otherwise +// encumbered - e.g. they cannot be locked or unvested. +// Any changes to the account encumbrance must be written to the store +// before calling this method so that bank.SendCoins() will work. +// Any unbonding or staked tokens transferred are deducted from +// the DelegatedFree/Vesting fields. +// TODO: refactor to de-dup with clawback() +func (va *BaseVestingAccount) forceTransfer(ctx sdk.Context, amt sdk.Coins, dest sdk.AccAddress, ak AccountKeeper, bk BankKeeper, sk StakingKeeper) error { + if amt.IsZero() { + return nil + } + addr := va.GetAddress() + + // Now that future vesting events (and associated lockup) are removed, + // the balance of the account is unlocked and can be freely transferred. + spendable := bk.SpendableCoins(ctx, addr) + toXfer := coinsMin(amt, spendable) + err := bk.SendCoins(ctx, addr, dest, toXfer) + if err != nil { + panic(err) // shouldn't happen, given spendable check + } + amt = amt.Sub(toXfer...) + + // We need to traverse the staking data structures to update the + // vesting account bookkeeping, and to recover more funds if necessary. + // Staking is the only way unvested tokens should be missing from the bank balance. + + // If we need more, transfer UnbondingDelegations. + bondDenom, err := sk.BondDenom(ctx) + if err != nil { + return err + } + want := amt.AmountOf(bondDenom) + if !want.IsPositive() { + return nil + } + got := math.NewInt(0) + unbondings, err := sk.GetUnbondingDelegations(ctx, addr, stdmath.MaxUint16) + if err != nil { + return err + } + for _, unbonding := range unbondings { + valAddr, err := sdk.ValAddressFromBech32(unbonding.ValidatorAddress) + if err != nil { + panic(err) + } + transferred, err := sk.TransferUnbonding(ctx, addr, dest, valAddr, want) + if err != nil { + return err + } + want = want.Sub(transferred) + got = got.Add(transferred) + if !want.IsPositive() { + break + } + } + + // If we need more, transfer Delegations. + if want.IsPositive() { + delegations, err := sk.GetDelegatorDelegations(ctx, addr, stdmath.MaxUint16) + if err != nil { + return err + } + for _, delegation := range delegations { + validatorAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) + if err != nil { + panic(err) // shouldn't happen + } + validator, err := sk.GetValidator(ctx, validatorAddr) + if err != nil { + // validator has been removed + continue + } + wantShares, err := validator.SharesFromTokensTruncated(want) + if err != nil { + // validator has no tokens + continue + } + // the following might transfer fewer shares than wanted + transferredShares, err := sk.TransferDelegation(ctx, addr, dest, sdk.ValAddress(delegation.GetValidatorAddr()), wantShares) + if err != nil { + return err + } + // to be conservative in what we're clawing back, round transferred shares up + transferred := validator.TokensFromSharesRoundUp(transferredShares).RoundInt() + want = want.Sub(transferred) + got = got.Add(transferred) + if !want.IsPositive() { + // Could be slightly negative, due to rounding? + // Don't think so, due to the precautions above. + break + } + } + } + + // Reduce DelegatedFree/Vesting by actual unbonding/staked amount transferred. + // The distinction between DF and DV is not significant in practice - only the + // sum is meaningful. Furthermore, DF/DV is not updated on each vesting event, + // so the distinction isn't required to be exact. Nevertheless, we'll prefer to + // overlap the "delegated" and "vesting" encumbrances as much as possible, so + // we'll decrement DF first. + + gotCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, got)) + decrFree := coinsMin(gotCoins, va.DelegatedFree) + va.DelegatedFree = va.DelegatedFree.Sub(decrFree...) + gotCoins = gotCoins.Sub(decrFree...) + decrVesting := coinsMin(gotCoins, va.DelegatedVesting) + va.DelegatedVesting = va.DelegatedVesting.Sub(decrVesting...) + gotCoins = gotCoins.Sub(decrVesting...) + ak.SetAccount(ctx, va) + // gotCoins should be zero at this point, unless DF+DV was not accurate + if !gotCoins.IsZero() { + ctx.Logger().Error("more staked than tracked in vesting delegation - %s undercounted by %s", va.Address, gotCoins) + } + + // If we've transferred everything and still haven't transferred the desired clawback amount, + // then the account must have lost some unvested tokens from slashing. + return nil +} + +// returnGrants transfers the original vesting tokens back to the funder, zeroing out all grant-related accounting. +// It prefers to transfer unbonded tokens from the account, but will transfer unbonding or staked tokens +// if necessary. +func (va *ClawbackVestingAccount) ReturnGrants(ctx sdk.Context, ak AccountKeeper, bk BankKeeper, sk StakingKeeper) { + // TODO withdraw rewards - requires integration with DistributionKeeper + toReturn := va.OriginalVesting + if toReturn.IsZero() { + return + } + va.OriginalVesting = sdk.NewCoins() + va.LockupPeriods = []Period{} + va.VestingPeriods = []Period{} + va.DelegatedFree = va.DelegatedFree.Add(va.DelegatedVesting...) + va.DelegatedVesting = sdk.NewCoins() + va.EndTime = va.StartTime + + // Store the modified account so that all funds are vested and unlocked, + // which will allow funds to be transferred via normal means. + ak.SetAccount(ctx, va) + + va.forceTransfer(ctx, toReturn, va.GetFunder(), ak, bk, sk) +} + +// distributeReward adds the reward to the future vesting schedule in proportion to the future vesting +// staking tokens. +func (va ClawbackVestingAccount) distributeReward(ctx sdk.Context, ak AccountKeeper, bondDenom string, reward sdk.Coins) { + now := ctx.BlockTime().Unix() + t := va.StartTime + firstUnvestedPeriod := 0 + unvestedTokens := math.ZeroInt() + for i, period := range va.VestingPeriods { + t += period.Length + if t <= now { + firstUnvestedPeriod = i + 1 + continue + } + unvestedTokens = unvestedTokens.Add(period.Amount.AmountOf(bondDenom)) + } + + runningTotReward := sdk.NewCoins() + runningTotStaking := math.ZeroInt() + for i := firstUnvestedPeriod; i < len(va.VestingPeriods); i++ { + period := va.VestingPeriods[i] + runningTotStaking = runningTotStaking.Add(period.Amount.AmountOf(bondDenom)) + runningTotRatio := math.LegacyNewDecFromInt(runningTotStaking).Quo(math.LegacyNewDecFromInt(unvestedTokens)) + targetCoins := scaleCoins(reward, runningTotRatio) + thisReward := targetCoins.Sub(runningTotReward...) + runningTotReward = targetCoins + period.Amount = period.Amount.Add(thisReward...) + va.VestingPeriods[i] = period + } + + va.OriginalVesting = va.OriginalVesting.Add(reward...) + ak.SetAccount(ctx, &va) +} + +// scaleCoins scales the given coins, rounding down. +func scaleCoins(coins sdk.Coins, scale math.LegacyDec) sdk.Coins { + scaledCoins := sdk.NewCoins() + for _, coin := range coins { + amt := math.LegacyNewDecFromInt(coin.Amount).Mul(scale).TruncateInt() // round down + scaledCoins = scaledCoins.Add(sdk.NewCoin(coin.Denom, amt)) + } + return scaledCoins +} + +// intMin returns the minimum of its arguments. +func intMin(a, b math.Int) math.Int { + if a.GT(b) { + return b + } + return a +} + +// postReward encumbers a previously-deposited reward according to the current vesting apportionment of staking. +// Note that rewards might be unvested, but are unlocked. +func (va ClawbackVestingAccount) PostReward(ctx sdk.Context, reward sdk.Coins, ak AccountKeeper, bk BankKeeper, sk StakingKeeper) error { + // Find the scheduled amount of vested and unvested staking tokens + bondDenom, err := sk.BondDenom(ctx) + if err != nil { + return err + } + vested := ReadSchedule(va.StartTime, va.EndTime, va.VestingPeriods, va.OriginalVesting, ctx.BlockTime().Unix()).AmountOf(bondDenom) + unvested := va.OriginalVesting.AmountOf(bondDenom).Sub(vested) + + if unvested.IsZero() { + // no need to adjust the vesting schedule + return nil + } + + if vested.IsZero() { + // all staked tokens must be unvested + va.distributeReward(ctx, ak, bondDenom, reward) + return nil + } + + // Find current split of account balance on staking axis + bonded, err := sk.GetDelegatorBonded(ctx, va.GetAddress()) + if err != nil { + return err + } + unbonding, err := sk.GetDelegatorUnbonding(ctx, va.GetAddress()) + if err != nil { + return err + } + delegated := bonded.Add(unbonding) + + // discover what has been slashed and remove from delegated amount + oldDelegated := va.DelegatedVesting.AmountOf(bondDenom).Add(va.DelegatedFree.AmountOf(bondDenom)) + slashed := oldDelegated.Sub(intMin(oldDelegated, delegated)) + delegated = delegated.Sub(intMin(delegated, slashed)) + + // Prefer delegated tokens to be unvested + unvested = intMin(unvested, delegated) + vested = delegated.Sub(unvested) + + // Compute the unvested amount of reward and add to vesting schedule + if unvested.IsZero() { + return nil + } + if vested.IsZero() { + va.distributeReward(ctx, ak, bondDenom, reward) + return nil + } + unvestedRatio := math.LegacyNewDecFromInt(unvested).QuoTruncate(math.LegacyNewDecFromInt(bonded)) // round down + unvestedReward := scaleCoins(reward, unvestedRatio) + va.distributeReward(ctx, ak, bondDenom, unvestedReward) + return nil +} diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index 74cdfe59c5a5..961215b26d32 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -373,6 +373,194 @@ func TestTrackUndelegationDelVestingAcc(t *testing.T) { require.Equal(t, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 25)}, dva.DelegatedVesting) } +//func TestCreatePeriodicVestingAccBricked(t *testing.T) { +// c := sdk.NewCoins +// fee := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(feeDenom, amt) } +// stake := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, amt) } +// now := tmtime.Now() +// +// // set up simapp +// app := simapp.Setup(t, false) +// ctx := app.BaseApp.NewContext(false, tmproto.Header{}).WithBlockTime((now)) +// require.Equal(t, "stake", app.StakingKeeper.BondDenom(ctx)) +// +// bogusPeriods := types.Periods{ +// {Length: 1, Amount: c(fee(10000), stake(100))}, +// {Length: 1000, Amount: []sdk.Coin{{Denom: feeDenom, Amount: sdk.NewInt(-9000)}}}, +// } +// bacc, origCoins := initBaseAccount() +// pva, err := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), bogusPeriods) +// require.NoError(t, err) +// addr := pva.GetAddress() +// app.AccountKeeper.SetAccount(ctx, pva) +// +// err := testutil.FundAccount(app.BankKeeper, ctx, addr, c(fee(6000), stake(100))) +// require.NoError(t, err) +// require.Equal(t, int64(100), app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) +// +// ctx = ctx.WithBlockTime(now.Add(160 * time.Second)) +// _, _, dest := testdata.KeyTestPubAddr() +// require.Panics(t, func() { app.BankKeeper.SendCoins(ctx, addr, dest, c(fee(750))) }) +//} + +//func TestAddGrantPeriodicVestingAcc(t *testing.T) { +// c := sdk.NewCoins +// fee := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(feeDenom, amt) } +// stake := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, amt) } +// now := tmtime.Now() +// +// // set up simapp +// app := simapp.Setup(t, false) +// ctx := app.BaseApp.NewContext(false, tmproto.Header{}).WithBlockTime((now)) +// require.Equal(t, "stake", app.StakingKeeper.BondDenom(ctx)) +// +// // create an account with an initial grant +// periods := types.Periods{ +// {Length: 100, Amount: c(fee(250), stake(25))}, +// {Length: 100, Amount: c(fee(250), stake(25))}, +// {Length: 100, Amount: c(fee(250), stake(25))}, +// {Length: 100, Amount: c(fee(250), stake(25))}, +// } +// bacc, origCoins := initBaseAccount() +// pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) +// addr := pva.GetAddress() +// +// // simulate 60stake (unvested) lost to slashing +// pva.DelegatedVesting = c(stake(60)) +// +// // At now+150, 75stake unvested but only 15stake locked, due to slashing +// ctx = ctx.WithBlockTime(now.Add(150 * time.Second)) +// require.Equal(t, int64(75), pva.GetVestingCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(15), pva.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// +// // Add a new grant while all slashing is covered by unvested tokens +// pva.AddGrant(ctx, app.StakingKeeper, ctx.BlockTime().Unix(), periods, origCoins) +// +// // After new grant, 115stake locked at now+150 due to slashing, +// // delegation bookkeeping unchanged +// require.Equal(t, int64(115), pva.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(60), pva.DelegatedVesting.AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(0), pva.DelegatedFree.AmountOf(stakeDenom).Int64()) +// +// // At now+425, 50stake unvested, nothing locked due to slashing +// ctx = ctx.WithBlockTime(now.Add(425 * time.Second)) +// require.Equal(t, int64(50), pva.GetVestingCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(0), pva.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// +// // Add a new grant, while slashed amount is 50 unvested, 10 vested +// pva.AddGrant(ctx, app.StakingKeeper, ctx.BlockTime().Unix(), periods, origCoins) +// +// // After new grant, slashed amount reduced to 50 vested, locked is 100 +// require.Equal(t, int64(100), pva.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(50), pva.DelegatedVesting.AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(0), pva.DelegatedFree.AmountOf(stakeDenom).Int64()) +// +// // At now+1000, nothing unvested, nothing locked +// ctx = ctx.WithBlockTime(now.Add(1000 * time.Second)) +// require.Equal(t, int64(0), pva.GetVestingCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(0), pva.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// +// // Add a new grant with residual slashed amount, but no unvested +// pva.AddGrant(ctx, app.StakingKeeper, ctx.BlockTime().Unix(), periods, origCoins) +// +// // After new grant, all 100 locked, no residual delegation bookkeeping +// require.Equal(t, int64(100), pva.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(0), pva.DelegatedVesting.AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(0), pva.DelegatedFree.AmountOf(stakeDenom).Int64()) +// +// app.AccountKeeper.SetAccount(ctx, pva) +// +// // fund the vesting account with new grant (old has vested and transferred out) +// err := testutil.FundAccount(app.BankKeeper, ctx, addr, origCoins) +// require.NoError(t, err) +// require.Equal(t, int64(100), app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) +// +// // we should not be able to transfer the latest grant out until it has vested +// _, _, dest := testdata.KeyTestPubAddr() +// err = app.BankKeeper.SendCoins(ctx, addr, dest, c(stake(1))) +// require.Error(t, err) +// ctx = ctx.WithBlockTime(now.Add(1500 * time.Second)) +// err = app.BankKeeper.SendCoins(ctx, addr, dest, origCoins) +// require.NoError(t, err) +//} + +//func TestAddGrantPeriodicVestingAcc_FullSlash(t *testing.T) { +// c := sdk.NewCoins +// stake := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, amt) } +// now := tmtime.Now() +// +// // set up simapp +// app := simapp.Setup(t, false) +// ctx := app.BaseApp.NewContext(false, tmproto.Header{}).WithBlockTime((now)) +// require.Equal(t, "stake", app.StakingKeeper.BondDenom(ctx)) +// +// // create an account with an initial grant +// periods := types.Periods{ +// {Length: 100, Amount: c(stake(40))}, +// {Length: 100, Amount: c(stake(60))}, +// } +// bacc, _ := initBaseAccount() +// origCoins := c(stake(100)) +// pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) +// +// // simulate all 100stake lost to slashing +// pva.DelegatedVesting = c(stake(100)) +// +// // Nothing locked at now+150 since all unvested lost to slashing +// require.Equal(t, int64(0), pva.LockedCoins(now.Add(150*time.Second)).AmountOf(stakeDenom).Int64()) +// +// // Add a new grant of 50stake +// newGrant := c(stake(50)) +// pva.AddGrant(ctx, app.StakingKeeper, now.Add(500*time.Second).Unix(), []types.Period{{Length: 50, Amount: newGrant}}, newGrant) +// app.AccountKeeper.SetAccount(ctx, pva) +// +// // Only 10 of the new grant locked, since 40 fell into the "hole" of slashed-vested +// require.Equal(t, int64(10), pva.LockedCoins(now.Add(150*time.Second)).AmountOf(stakeDenom).Int64()) +//} + +//func TestAddGrantPeriodicVestingAcc_negAmount(t *testing.T) { +// c := sdk.NewCoins +// fee := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(feeDenom, amt) } +// stake := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, amt) } +// now := tmtime.Now() +// +// // set up simapp +// app := simapp.Setup(t, false) +// ctx := app.BaseApp.NewContext(false, tmproto.Header{}).WithBlockTime((now)) +// require.Equal(t, "stake", app.StakingKeeper.BondDenom(ctx)) +// +// // create an account with an initial grant +// periods := types.Periods{ +// {Length: 100, Amount: c(fee(250), stake(25))}, +// {Length: 100, Amount: c(fee(250), stake(25))}, +// {Length: 100, Amount: c(fee(250), stake(25))}, +// {Length: 100, Amount: c(fee(250), stake(25))}, +// } +// bacc, origCoins := initBaseAccount() +// pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) +// addr := pva.GetAddress() +// +// // At now+150, add a new grant which attempts to prematurely vest the grant +// bogusPeriods := types.Periods{ +// {Length: 1, Amount: c(fee(750))}, +// {Length: 1000, Amount: []sdk.Coin{{Denom: feeDenom, Amount: sdk.NewInt(-749)}}}, +// } +// ctx = ctx.WithBlockTime(now.Add(150 * time.Second)) +// pva.AddGrant(ctx, app.StakingKeeper, ctx.BlockTime().Unix(), bogusPeriods, c(fee(1))) +// app.AccountKeeper.SetAccount(ctx, pva) +// +// // fund the vesting account with new grant (old has vested and transferred out) +// err := testutil.FundAccount(app.BankKeeper, ctx, addr, c(fee(1001), stake(100))) +// require.NoError(t, err) +// require.Equal(t, int64(100), app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) +// +// // try to transfer the original grant before its time +// ctx = ctx.WithBlockTime(now.Add(160 * time.Second)) +// _, _, dest := testdata.KeyTestPubAddr() +// err = app.BankKeeper.SendCoins(ctx, addr, dest, c(fee(750))) +// require.NoError(t, err) +//} + func TestGetVestedCoinsPeriodicVestingAcc(t *testing.T) { now := tmtime.Now() endTime := now.Add(24 * time.Hour) @@ -796,6 +984,782 @@ func TestTrackUndelegationPermLockedVestingAcc(t *testing.T) { require.Equal(t, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 25)}, plva.DelegatedVesting) } +func TestGetVestedCoinsClawbackVestingAcc(t *testing.T) { + now := tmtime.Now() + endTime := now.Add(24 * time.Hour) + lockupPeriods := types.Periods{ + types.Period{Length: int64(16 * 60 * 60), Amount: sdk.NewCoins(sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100))}, + } + vestingPeriods := types.Periods{ + types.Period{Length: int64(12 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}}, + types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, + types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, + } + + bacc, origCoins := initBaseAccount() + va := types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + + // require no coins vested at the beginning of the vesting schedule + vestedCoins := va.GetVestedCoins(now) + require.Nil(t, vestedCoins) + + // require all coins vested at the end of the vesting schedule + vestedCoins = va.GetVestedCoins(endTime) + require.Equal(t, origCoins, vestedCoins) + + // require no coins vested during first vesting period + vestedCoins = va.GetVestedCoins(now.Add(6 * time.Hour)) + require.Nil(t, vestedCoins) + + // require no coins vested after period1 before unlocking + vestedCoins = va.GetVestedCoins(now.Add(14 * time.Hour)) + require.Nil(t, vestedCoins) + + // require 50% of coins vested after period 1 at unlocking + vestedCoins = va.GetVestedCoins(now.Add(16 * time.Hour)) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, vestedCoins) + + // require period 2 coins don't vest until period is over + vestedCoins = va.GetVestedCoins(now.Add(17 * time.Hour)) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, vestedCoins) + + // require 75% of coins vested after period 2 + vestedCoins = va.GetVestedCoins(now.Add(18 * time.Hour)) + require.Equal(t, + sdk.Coins{ + sdk.NewInt64Coin(feeDenom, 750), sdk.NewInt64Coin(stakeDenom, 75), + }, vestedCoins) + + // require 100% of coins vested + vestedCoins = va.GetVestedCoins(now.Add(48 * time.Hour)) + require.Equal(t, origCoins, vestedCoins) +} + +func TestGetVestingCoinsClawbackVestingAcc(t *testing.T) { + now := tmtime.Now() + endTime := now.Add(24 * time.Hour) + lockupPeriods := types.Periods{ + types.Period{Length: int64(16 * 60 * 60), Amount: sdk.NewCoins(sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100))}, + } + vestingPeriods := types.Periods{ + types.Period{Length: int64(12 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}}, + types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, + types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, + } + + bacc, origCoins := initBaseAccount() + va := types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + + // require all coins vesting at the beginning of the vesting schedule + vestingCoins := va.GetVestingCoins(now) + require.Equal(t, origCoins, vestingCoins) + + // require no coins vesting at the end of the vesting schedule + vestingCoins = va.GetVestingCoins(endTime) + require.Nil(t, vestingCoins) + + // require all coins vesting at first vesting event + vestingCoins = va.GetVestingCoins(now.Add(12 * time.Hour)) + require.Equal(t, origCoins, vestingCoins) + + // require all coins vesting after period 1 before unlocking + vestingCoins = va.GetVestingCoins(now.Add(15 * time.Hour)) + require.Equal(t, origCoins, vestingCoins) + + // require 50% of coins vesting after period 1 at unlocking + vestingCoins = va.GetVestingCoins(now.Add(16 * time.Hour)) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, vestingCoins) + + // require 50% of coins vesting after period 1, after unlocking + vestingCoins = va.GetVestingCoins(now.Add(17 * time.Hour)) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, vestingCoins) + + // require 25% of coins vesting after period 2 + vestingCoins = va.GetVestingCoins(now.Add(18 * time.Hour)) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}, vestingCoins) + + // require 0% of coins vesting after vesting complete + vestingCoins = va.GetVestingCoins(now.Add(48 * time.Hour)) + require.Nil(t, vestingCoins) +} + +func TestSpendableCoinsClawbackVestingAcc(t *testing.T) { + now := tmtime.Now() + endTime := now.Add(24 * time.Hour) + lockupPeriods := types.Periods{ + types.Period{Length: int64(16 * 60 * 60), Amount: sdk.NewCoins(sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100))}, + } + vestingPeriods := types.Periods{ + types.Period{Length: int64(12 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}}, + types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, + types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, + } + + bacc, origCoins := initBaseAccount() + va := types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + + // require that there exist no spendable coins at the beginning of the + // vesting schedule + lockedCoins := va.LockedCoins(now) + require.Equal(t, origCoins, lockedCoins) + + // require that all original coins are spendable at the end of the vesting + // schedule + lockedCoins = va.LockedCoins(endTime) + require.Equal(t, sdk.NewCoins(), lockedCoins) + + // require that all still vesting coins (50%) are locked + lockedCoins = va.LockedCoins(now.Add(17 * time.Hour)) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, lockedCoins) +} + +func TestTrackDelegationClawbackVestingAcc(t *testing.T) { + now := tmtime.Now() + endTime := now.Add(24 * time.Hour) + lockupPeriods := types.Periods{ + types.Period{Length: int64(16 * 60 * 60), Amount: sdk.NewCoins(sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100))}, + } + vestingPeriods := types.Periods{ + types.Period{Length: int64(12 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}}, + types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, + types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, + } + + bacc, origCoins := initBaseAccount() + + // require the ability to delegate all vesting coins + va := types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + va.TrackDelegation(now, origCoins, origCoins) + require.Equal(t, origCoins, va.DelegatedVesting) + require.Nil(t, va.DelegatedFree) + + // require the ability to delegate all vested coins + va = types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + va.TrackDelegation(endTime, origCoins, origCoins) + require.Nil(t, va.DelegatedVesting) + require.Equal(t, origCoins, va.DelegatedFree) + + // delegate half of vesting coins + va = types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + va.TrackDelegation(now, origCoins, vestingPeriods[0].Amount) + // require that all delegated coins are delegated vesting + require.Equal(t, va.DelegatedVesting, vestingPeriods[0].Amount) + require.Nil(t, va.DelegatedFree) + + // delegate 75% of coins, split between vested and vesting + va = types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + va.TrackDelegation(now.Add(17*time.Hour), origCoins, vestingPeriods[0].Amount.Add(vestingPeriods[1].Amount...)) + // require that the maximum possible amount of vesting coins are chosen for delegation. + require.Equal(t, va.DelegatedFree, vestingPeriods[1].Amount) + require.Equal(t, va.DelegatedVesting, vestingPeriods[0].Amount) + + // require the ability to delegate all vesting coins (50%) and all vested coins (50%) + va = types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + va.TrackDelegation(now.Add(17*time.Hour), origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}, va.DelegatedVesting) + require.Nil(t, va.DelegatedFree) + + va.TrackDelegation(now.Add(17*time.Hour), origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}, va.DelegatedVesting) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}, va.DelegatedFree) + + // require no modifications when delegation amount is zero or not enough funds + va = types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + require.Panics(t, func() { + va.TrackDelegation(endTime, origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 1000000)}) + }) + require.Nil(t, va.DelegatedVesting) + require.Nil(t, va.DelegatedFree) +} + +func TestTrackUndelegationClawbackVestingAcc(t *testing.T) { + now := tmtime.Now() + endTime := now.Add(24 * time.Hour) + lockupPeriods := types.Periods{ + types.Period{Length: int64(16 * 60 * 60), Amount: sdk.NewCoins(sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100))}, + } + vestingPeriods := types.Periods{ + types.Period{Length: int64(12 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}}, + types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, + types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, + } + + bacc, origCoins := initBaseAccount() + + // require the ability to undelegate all vesting coins at the beginning of vesting + va := types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + va.TrackDelegation(now, origCoins, origCoins) + va.TrackUndelegation(origCoins) + require.Nil(t, va.DelegatedFree) + require.Nil(t, va.DelegatedVesting) + + // require the ability to undelegate all vested coins at the end of vesting + va = types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + + va.TrackDelegation(endTime, origCoins, origCoins) + va.TrackUndelegation(origCoins) + require.Nil(t, va.DelegatedFree) + require.Nil(t, va.DelegatedVesting) + + // require the ability to undelegate half of coins + va = types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + va.TrackDelegation(endTime, origCoins, vestingPeriods[0].Amount) + va.TrackUndelegation(vestingPeriods[0].Amount) + require.Nil(t, va.DelegatedFree) + require.Nil(t, va.DelegatedVesting) + + // require no modifications when the undelegation amount is zero + va = types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + + require.Panics(t, func() { + va.TrackUndelegation(sdk.Coins{sdk.NewInt64Coin(stakeDenom, 0)}) + }) + require.Nil(t, va.DelegatedFree) + require.Nil(t, va.DelegatedVesting) + + // vest 50% and delegate to two validators + va = types.NewClawbackVestingAccount(bacc, sdk.AccAddress([]byte("funder")), origCoins, now.Unix(), lockupPeriods, vestingPeriods) + va.TrackDelegation(now.Add(17*time.Hour), origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) + va.TrackDelegation(now.Add(17*time.Hour), origCoins, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) + + // undelegate from one validator that got slashed 50% + va.TrackUndelegation(sdk.Coins{sdk.NewInt64Coin(stakeDenom, 25)}) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 25)}, va.DelegatedFree) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}, va.DelegatedVesting) + + // undelegate from the other validator that did not get slashed + va.TrackUndelegation(sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) + require.Nil(t, va.DelegatedFree) + require.Equal(t, sdk.Coins{sdk.NewInt64Coin(stakeDenom, 25)}, va.DelegatedVesting) +} + +// createValidator creates a validator in the given SimApp. +//func createValidator(t *testing.T, ctx sdk.Context, app *simapp.SimApp, powers int64) (sdk.ValAddress, stakingtypes.Validator) { +// valTokens := sdk.TokensFromConsensusPower(powers, sdk.DefaultPowerReduction) +// addrs := simapp.AddTestAddrsIncremental(app, ctx, 1, valTokens) +// valAddrs := simapp.ConvertAddrsToValAddrs(addrs) +// pks := simapp.CreateTestPubKeys(1) +// cdc := app.AppCodec() // simapp.MakeTestEncodingConfig().Marshaler +// +// app.StakingKeeper = stakingkeeper.NewKeeper( +// cdc, +// app.GetKey(stakingtypes.StoreKey), +// app.AccountKeeper, +// app.BankKeeper, +// app.GetSubspace(stakingtypes.ModuleName), +// ) +// +// val, err := stakingtypes.NewValidator(valAddrs[0], pks[0], stakingtypes.Description{}) +// require.NoError(t, err) +// +// app.StakingKeeper.SetValidator(ctx, val) +// require.NoError(t, app.StakingKeeper.SetValidatorByConsAddr(ctx, val)) +// app.StakingKeeper.SetNewValidatorByPowerIndex(ctx, val) +// +// _, err = app.StakingKeeper.Delegate(ctx, addrs[0], valTokens, stakingtypes.Unbonded, val, true) +// require.NoError(t, err) +// +// _ = staking.EndBlocker(ctx, app.StakingKeeper) +// +// return valAddrs[0], val +//} + +//func TestClawback(t *testing.T) { +// c := sdk.NewCoins +// fee := func(x int64) sdk.Coin { return sdk.NewInt64Coin(feeDenom, x) } +// stake := func(x int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, x) } +// now := tmtime.Now() +// +// // set up simapp and validators +// app := simapp.Setup(t, false) +// ctx := app.BaseApp.NewContext(false, tmproto.Header{}).WithBlockTime((now)) +// valAddr, val := createValidator(t, ctx, app, 100) +// require.Equal(t, "stake", app.StakingKeeper.BondDenom(ctx)) +// +// lockupPeriods := types.Periods{ +// {Length: int64(12 * 3600), Amount: c(fee(1000), stake(100))}, // noon +// } +// vestingPeriods := types.Periods{ +// {Length: int64(8 * 3600), Amount: c(fee(200))}, // 8am +// {Length: int64(1 * 3600), Amount: c(fee(200), stake(50))}, // 9am +// {Length: int64(6 * 3600), Amount: c(fee(200), stake(50))}, // 3pm +// {Length: int64(2 * 3600), Amount: c(fee(200))}, // 5pm +// {Length: int64(1 * 3600), Amount: c(fee(200))}, // 6pm +// } +// +// bacc, origCoins := initBaseAccount() +// _, _, funder := testdata.KeyTestPubAddr() +// va := types.NewClawbackVestingAccount(bacc, funder, origCoins, now.Unix(), lockupPeriods, vestingPeriods) +// // simulate 17stake lost to slashing +// va.DelegatedVesting = c(stake(17)) +// addr := va.GetAddress() +// app.AccountKeeper.SetAccount(ctx, va) +// +// // fund the vesting account with 17 take lost to slashing +// err := testutil.FundAccount(app.BankKeeper, ctx, addr, c(fee(1000), stake(83))) +// require.NoError(t, err) +// require.Equal(t, int64(1000), app.BankKeeper.GetBalance(ctx, addr, feeDenom).Amount.Int64()) +// require.Equal(t, int64(83), app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) +// ctx = ctx.WithBlockTime(now.Add(11 * time.Hour)) +// +// // delegate 65 +// shares, err := app.StakingKeeper.Delegate(ctx, addr, sdk.NewInt(65), stakingtypes.Unbonded, val, true) +// require.NoError(t, err) +// require.Equal(t, sdk.NewInt(65), shares.TruncateInt()) +// require.Equal(t, int64(18), app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) +// +// // undelegate 5 +// _, err = app.StakingKeeper.Undelegate(ctx, addr, valAddr, sdk.NewDec(5)) +// require.NoError(t, err) +// +// // clawback the unvested funds (600fee, 50stake) +// _, _, dest := testdata.KeyTestPubAddr() +// va2 := app.AccountKeeper.GetAccount(ctx, addr).(*types.ClawbackVestingAccount) +// err = va2.Clawback(ctx, funder, dest, app.AccountKeeper, app.BankKeeper, app.StakingKeeper) +// require.NoError(t, err) +// +// // check vesting account +// // want 400fee, 33stake (delegated), all vested +// feeAmt := app.BankKeeper.GetBalance(ctx, addr, feeDenom).Amount +// require.Equal(t, int64(400), feeAmt.Int64()) +// stakeAmt := app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount +// require.Equal(t, int64(0), stakeAmt.Int64()) +// del, found := app.StakingKeeper.GetDelegation(ctx, addr, valAddr) +// require.True(t, found) +// shares = del.GetShares() +// val, found = app.StakingKeeper.GetValidator(ctx, valAddr) +// require.True(t, found) +// stakeAmt = val.TokensFromSharesTruncated(shares).RoundInt() +// require.Equal(t, sdk.NewInt(33), stakeAmt) +// +// // check destination account +// // want 600fee, 50stake (18 unbonded, 5 unboinding, 27 bonded) +// feeAmt = app.BankKeeper.GetBalance(ctx, dest, feeDenom).Amount +// require.Equal(t, int64(600), feeAmt.Int64()) +// stakeAmt = app.BankKeeper.GetBalance(ctx, dest, stakeDenom).Amount +// require.Equal(t, int64(18), stakeAmt.Int64()) +// del, found = app.StakingKeeper.GetDelegation(ctx, dest, valAddr) +// require.True(t, found) +// shares = del.GetShares() +// stakeAmt = val.TokensFromSharesTruncated(shares).RoundInt() +// require.Equal(t, sdk.NewInt(27), stakeAmt) +// ubd, found := app.StakingKeeper.GetUnbondingDelegation(ctx, dest, valAddr) +// require.True(t, found) +// require.Equal(t, sdk.NewInt(5), ubd.Entries[0].Balance) +//} + +//func TestClawback_finalUnlock(t *testing.T) { +// // tests a variant of TestClawback with unlock events after the last vesting event +// c := sdk.NewCoins +// fee := func(x int64) sdk.Coin { return sdk.NewInt64Coin(feeDenom, x) } +// stake := func(x int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, x) } +// now := tmtime.Now() +// +// // set up simapp and validators +// app := simapp.Setup(t, false) +// ctx := app.BaseApp.NewContext(false, tmproto.Header{}).WithBlockTime((now)) +// require.Equal(t, "stake", app.StakingKeeper.BondDenom(ctx)) +// +// lockupPeriods := types.Periods{ +// {Length: int64(20 * 3600), Amount: c(fee(1000), stake(100))}, // 8pm +// } +// vestingPeriods := types.Periods{ +// {Length: int64(8 * 3600), Amount: c(fee(200))}, // 8am +// {Length: int64(1 * 3600), Amount: c(fee(200), stake(50))}, // 9am +// {Length: int64(6 * 3600), Amount: c(fee(200), stake(50))}, // 3pm +// {Length: int64(2 * 3600), Amount: c(fee(200))}, // 5pm +// {Length: int64(1 * 3600), Amount: c(fee(200))}, // 6pm +// } +// +// bacc, origCoins := initBaseAccount() +// _, _, funder := testdata.KeyTestPubAddr() +// va := types.NewClawbackVestingAccount(bacc, funder, origCoins, now.Unix(), lockupPeriods, vestingPeriods) +// addr := va.GetAddress() +// app.AccountKeeper.SetAccount(ctx, va) +// +// // fund the vesting account with 17 take lost to slashing +// err := testutil.FundAccount(app.BankKeeper, ctx, addr, c(fee(1000), stake(100))) +// require.NoError(t, err) +// require.Equal(t, int64(1000), app.BankKeeper.GetBalance(ctx, addr, feeDenom).Amount.Int64()) +// require.Equal(t, int64(100), app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) +// ctx = ctx.WithBlockTime(now.Add(11 * time.Hour)) +// +// // clawback the unvested funds (600fee, 50stake) +// _, _, dest := testdata.KeyTestPubAddr() +// va2 := app.AccountKeeper.GetAccount(ctx, addr).(*types.ClawbackVestingAccount) +// err = va2.Clawback(ctx, funder, dest, app.AccountKeeper, app.BankKeeper, app.StakingKeeper) +// require.NoError(t, err) +// +// // check vesting account +// // want 400fee, 50stake, all vested +// feeAmt := app.BankKeeper.GetBalance(ctx, addr, feeDenom).Amount +// require.Equal(t, int64(400), feeAmt.Int64()) +// stakeAmt := app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount +// require.Equal(t, int64(50), stakeAmt.Int64()) +// +// // check destination account +// // want 600fee, 50stake +// feeAmt = app.BankKeeper.GetBalance(ctx, dest, feeDenom).Amount +// require.Equal(t, int64(600), feeAmt.Int64()) +// stakeAmt = app.BankKeeper.GetBalance(ctx, dest, stakeDenom).Amount +// require.Equal(t, int64(50), stakeAmt.Int64()) +// +// // Remaining funds in vesting account should still be locked at 7pm +// ctx = ctx.WithBlockTime(now.Add(19 * time.Hour)) +// spendable := app.BankKeeper.SpendableCoins(ctx, addr) +// require.True(t, spendable.IsZero()) +// err = app.BankKeeper.SendCoins(ctx, addr, dest, c(fee(10))) +// require.Error(t, err) +//} + +//func TestRewards(t *testing.T) { +// c := sdk.NewCoins +// stake := func(x int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, x) } +// now := tmtime.Now() +// +// // set up simapp and validators +// app := simapp.Setup(t, false) +// ctx := app.BaseApp.NewContext(false, tmproto.Header{}).WithBlockTime((now)) +// _, val := createValidator(t, ctx, app, 100) +// require.Equal(t, "stake", app.StakingKeeper.BondDenom(ctx)) +// +// // create vesting account +// lockupPeriods := types.Periods{ +// {Length: 1, Amount: c(stake(4000))}, +// } +// vestingPeriods := types.Periods{ +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// } +// bacc, _ := initBaseAccount() +// origCoins := c(stake(4000)) +// _, _, funder := testdata.KeyTestPubAddr() +// va := types.NewClawbackVestingAccount(bacc, funder, origCoins, now.Unix(), lockupPeriods, vestingPeriods) +// addr := va.GetAddress() +// app.AccountKeeper.SetAccount(ctx, va) +// +// // fund the vesting account with 300stake lost to transfer +// err := testutil.FundAccount(app.BankKeeper, ctx, addr, c(stake(3700))) +// require.NoError(t, err) +// require.Equal(t, int64(3700), app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) +// ctx = ctx.WithBlockTime(now.Add(650 * time.Second)) +// +// // delegate 1600 +// shares, err := app.StakingKeeper.Delegate(ctx, addr, sdk.NewInt(1600), stakingtypes.Unbonded, val, true) +// require.NoError(t, err) +// require.Equal(t, sdk.NewInt(1600), shares.TruncateInt()) +// require.Equal(t, int64(2100), app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) +// va = app.AccountKeeper.GetAccount(ctx, addr).(*types.ClawbackVestingAccount) +// require.Equal(t, int64(1000), va.GetVestingCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// +// // distribute a reward of 120stake +// err = testutil.FundAccount(app.BankKeeper, ctx, addr, c(stake(120))) +// require.NoError(t, err) +// va.PostReward(ctx, c(stake(120)), app.AccountKeeper, app.BankKeeper, app.StakingKeeper) +// +// // With 1600 delegated, 1000 unvested, reward should be 75 unvested +// va = app.AccountKeeper.GetAccount(ctx, addr).(*types.ClawbackVestingAccount) +// require.Equal(t, int64(4075), va.OriginalVesting.AmountOf(stakeDenom).Int64()) +// require.Equal(t, 8, len(va.VestingPeriods)) +// for i := 0; i < 6; i++ { +// require.Equal(t, int64(500), va.VestingPeriods[i].Amount.AmountOf(stakeDenom).Int64()) +// } +// require.Equal(t, int64(537), va.VestingPeriods[6].Amount.AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(538), va.VestingPeriods[7].Amount.AmountOf(stakeDenom).Int64()) +//} + +//func TestRewards_PostSlash(t *testing.T) { +// c := sdk.NewCoins +// stake := func(x int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, x) } +// now := tmtime.Now() +// +// // set up simapp and validators +// app := simapp.Setup(t, false) +// ctx := app.BaseApp.NewContext(false, tmproto.Header{}).WithBlockTime((now)) +// _, val := createValidator(t, ctx, app, 100) +// require.Equal(t, "stake", app.StakingKeeper.BondDenom(ctx)) +// +// // create vesting account with a simulated 350stake lost to slashing +// lockupPeriods := types.Periods{ +// {Length: 1, Amount: c(stake(4000))}, +// } +// vestingPeriods := types.Periods{ +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// {Length: int64(100), Amount: c(stake(500))}, +// } +// bacc, _ := initBaseAccount() +// origCoins := c(stake(4000)) +// _, _, funder := testdata.KeyTestPubAddr() +// va := types.NewClawbackVestingAccount(bacc, funder, origCoins, now.Unix(), lockupPeriods, vestingPeriods) +// addr := va.GetAddress() +// va.DelegatedVesting = c(stake(350)) +// app.AccountKeeper.SetAccount(ctx, va) +// +// // fund the vesting account with 350 stake lost to slashing +// err := testutil.FundAccount(app.BankKeeper, ctx, addr, c(stake(3650))) +// require.NoError(t, err) +// require.Equal(t, int64(3650), app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) +// +// // delegate all 3650stake +// shares, err := app.StakingKeeper.Delegate(ctx, addr, sdk.NewInt(3650), stakingtypes.Unbonded, val, true) +// require.NoError(t, err) +// require.Equal(t, sdk.NewInt(3650), shares.TruncateInt()) +// require.Equal(t, int64(0), app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) +// va = app.AccountKeeper.GetAccount(ctx, addr).(*types.ClawbackVestingAccount) +// +// // distribute a reward of 160stake - should all be unvested +// err = testutil.FundAccount(app.BankKeeper, ctx, addr, c(stake(160))) +// require.NoError(t, err) +// va.PostReward(ctx, c(stake(160)), app.AccountKeeper, app.BankKeeper, app.StakingKeeper) +// va = app.AccountKeeper.GetAccount(ctx, addr).(*types.ClawbackVestingAccount) +// require.Equal(t, int64(4160), va.OriginalVesting.AmountOf(stakeDenom).Int64()) +// require.Equal(t, 8, len(va.VestingPeriods)) +// for i := 0; i < 8; i++ { +// require.Equal(t, int64(520), va.VestingPeriods[i].Amount.AmountOf(stakeDenom).Int64()) +// } +// +// // must not be able to transfer reward until it vests +// _, _, dest := testdata.KeyTestPubAddr() +// err = app.BankKeeper.SendCoins(ctx, addr, dest, c(stake(1))) +// require.Error(t, err) +// ctx = ctx.WithBlockTime(now.Add(600 * time.Second)) +// err = app.BankKeeper.SendCoins(ctx, addr, dest, c(stake(160))) +// require.NoError(t, err) +// +// // distribute another reward once everything has vested +// ctx = ctx.WithBlockTime(now.Add(1200 * time.Second)) +// err = testutil.FundAccount(app.BankKeeper, ctx, addr, c(stake(160))) +// require.NoError(t, err) +// va.PostReward(ctx, c(stake(160)), app.AccountKeeper, app.BankKeeper, app.StakingKeeper) +// va = app.AccountKeeper.GetAccount(ctx, addr).(*types.ClawbackVestingAccount) +// // shouldn't be added to vesting schedule +// require.Equal(t, int64(4160), va.OriginalVesting.AmountOf(stakeDenom).Int64()) +//} + +//func TestAddGrantClawbackVestingAcc_fullSlash(t *testing.T) { +// c := sdk.NewCoins +// stake := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, amt) } +// now := tmtime.Now() +// +// // set up simapp +// app := simapp.Setup(t, false) +// ctx := app.BaseApp.NewContext(false, tmproto.Header{}).WithBlockTime((now)) +// require.Equal(t, "stake", app.StakingKeeper.BondDenom(ctx)) +// +// // create an account with an initial grant +// _, _, funder := testdata.KeyTestPubAddr() +// lockupPeriods := types.Periods{{Length: 1, Amount: c(stake(100))}} +// vestingPeriods := types.Periods{ +// {Length: 100, Amount: c(stake(40))}, +// {Length: 100, Amount: c(stake(60))}, +// } +// bacc, _ := initBaseAccount() +// origCoins := c(stake(100)) +// va := types.NewClawbackVestingAccount(bacc, funder, origCoins, now.Unix(), lockupPeriods, vestingPeriods) +// +// // simulate all 100stake lost to slashing +// va.DelegatedVesting = c(stake(100)) +// +// // Nothing locked at now+150, due to slashing +// require.Equal(t, int64(0), va.LockedCoins(now.Add(150*time.Second)).AmountOf(stakeDenom).Int64()) +// +// // Add a new grant of 50stake +// newGrant := c(stake(50)) +// err := va.AddGrant(ctx, funder.String(), app.StakingKeeper, now.Add(500*time.Second).Unix(), +// []types.Period{{Length: 1, Amount: newGrant}}, +// []types.Period{{Length: 50, Amount: newGrant}}, newGrant) +// require.NoError(t, err) +// app.AccountKeeper.SetAccount(ctx, va) +// +// // Only 10 of the new grant locked, since 40 fell into the "hole" of slashed-vested. +// require.Equal(t, int64(10), va.LockedCoins(now.Add(150*time.Second)).AmountOf(stakeDenom).Int64()) +//} + +//func TestAddGrantClawbackVestingAcc(t *testing.T) { +// c := sdk.NewCoins +// fee := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(feeDenom, amt) } +// stake := func(amt int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, amt) } +// now := tmtime.Now() +// +// // set up simapp +// app := simapp.Setup(t, false) +// ctx := app.BaseApp.NewContext(false, tmproto.Header{}).WithBlockTime((now)) +// require.Equal(t, "stake", app.StakingKeeper.BondDenom(ctx)) +// +// // create an account with an initial grant +// _, _, funder := testdata.KeyTestPubAddr() +// lockupPeriods := types.Periods{{Length: 1, Amount: c(fee(1000), stake(100))}} +// vestingPeriods := types.Periods{ +// {Length: 100, Amount: c(fee(250), stake(25))}, +// {Length: 100, Amount: c(fee(250), stake(25))}, +// {Length: 100, Amount: c(fee(250), stake(25))}, +// {Length: 100, Amount: c(fee(250), stake(25))}, +// } +// bacc, origCoins := initBaseAccount() +// va := types.NewClawbackVestingAccount(bacc, funder, origCoins, now.Unix(), lockupPeriods, vestingPeriods) +// addr := va.GetAddress() +// +// // simulate 60stake (unvested) lost to slashing +// va.DelegatedVesting = c(stake(60)) +// +// // At now+150, 75stake unvested but only 15stake are locked, due to slashing +// ctx = ctx.WithBlockTime(now.Add(150 * time.Second)) +// require.Equal(t, int64(75), va.GetVestingCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(15), va.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// +// // Add a new grant while all slashing is covered by unvested tokens +// err := va.AddGrant(ctx, funder.String(), app.StakingKeeper, ctx.BlockTime().Unix(), +// lockupPeriods, vestingPeriods, origCoins) +// require.NoError(t, err) +// +// // After new grant, 115stake locked at now+150, due to slashing, +// // delegation bookkeeping unchanged +// require.Equal(t, int64(115), va.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(60), va.DelegatedVesting.AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(0), va.DelegatedFree.AmountOf(stakeDenom).Int64()) +// +// // At now+425, 50stake unvested, nothing locked due to slashing +// ctx = ctx.WithBlockTime(now.Add(425 * time.Second)) +// require.Equal(t, int64(50), va.GetVestingCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(0), va.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// +// // Add a new grant, while slashed amount is 50 unvested, 10 vested +// err = va.AddGrant(ctx, funder.String(), app.StakingKeeper, ctx.BlockTime().Unix(), lockupPeriods, vestingPeriods, origCoins) +// require.NoError(t, err) +// +// // After new grant, slashed amount reduced to 50 vested, locked is 100 +// require.Equal(t, int64(100), va.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(50), va.DelegatedVesting.AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(0), va.DelegatedFree.AmountOf(stakeDenom).Int64()) +// +// // At now+1000, nothing unvested, nothing locked +// ctx = ctx.WithBlockTime(now.Add(1000 * time.Second)) +// require.Equal(t, int64(0), va.GetVestingCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(0), va.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// +// // Add a new grant with residual slashed amount, but no unvested +// err = va.AddGrant(ctx, funder.String(), app.StakingKeeper, ctx.BlockTime().Unix(), lockupPeriods, vestingPeriods, origCoins) +// require.NoError(t, err) +// +// // After new grant, all 100 locked, no residual delegation bookkeeping +// require.Equal(t, int64(100), va.LockedCoins(ctx.BlockTime()).AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(0), va.DelegatedVesting.AmountOf(stakeDenom).Int64()) +// require.Equal(t, int64(0), va.DelegatedFree.AmountOf(stakeDenom).Int64()) +// +// app.AccountKeeper.SetAccount(ctx, va) +// +// // fund the vesting account with new grant (old has vested and transferred out) +// err = testutil.FundAccount(app.BankKeeper, ctx, addr, origCoins) +// require.NoError(t, err) +// require.Equal(t, int64(100), app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) +// +// // we should not be able to transfer the latest grant out until it has vested +// _, _, dest := testdata.KeyTestPubAddr() +// err = app.BankKeeper.SendCoins(ctx, addr, dest, c(stake(1))) +// require.Error(t, err) +// ctx = ctx.WithBlockTime(now.Add(1500 * time.Second)) +// err = app.BankKeeper.SendCoins(ctx, addr, dest, origCoins) +// require.NoError(t, err) +//} + +//func TestReturnGrants(t *testing.T) { +// c := sdk.NewCoins +// fee := func(x int64) sdk.Coin { return sdk.NewInt64Coin(feeDenom, x) } +// stake := func(x int64) sdk.Coin { return sdk.NewInt64Coin(stakeDenom, x) } +// now := tmtime.Now() +// +// // set up simapp and validators +// app := simapp.Setup(t, false) +// ctx := app.BaseApp.NewContext(false, tmproto.Header{}).WithBlockTime((now)) +// valAddr, val := createValidator(t, ctx, app, 100) +// require.Equal(t, "stake", app.StakingKeeper.BondDenom(ctx)) +// +// lockupPeriods := types.Periods{ +// {Length: int64(12 * 3600), Amount: c(fee(1000), stake(100))}, // noon +// } +// vestingPeriods := types.Periods{ +// {Length: int64(8 * 3600), Amount: c(fee(200))}, // 8am +// {Length: int64(1 * 3600), Amount: c(fee(200), stake(50))}, // 9am +// {Length: int64(6 * 3600), Amount: c(fee(200), stake(50))}, // 3pm +// {Length: int64(2 * 3600), Amount: c(fee(200))}, // 5pm +// {Length: int64(1 * 3600), Amount: c(fee(200))}, // 6pm +// } +// +// bacc, origCoins := initBaseAccount() +// _, _, funder := testdata.KeyTestPubAddr() +// va := types.NewClawbackVestingAccount(bacc, funder, origCoins, now.Unix(), lockupPeriods, vestingPeriods) +// // simulate 17stake lost to slashing +// va.DelegatedVesting = c(stake(17)) +// addr := va.GetAddress() +// app.AccountKeeper.SetAccount(ctx, va) +// +// // fund the vesting account with an extra 200fee but 17stake lost to slashing +// err := testutil.FundAccount(app.BankKeeper, ctx, addr, c(fee(1200), stake(83))) +// require.NoError(t, err) +// require.Equal(t, int64(1200), app.BankKeeper.GetBalance(ctx, addr, feeDenom).Amount.Int64()) +// require.Equal(t, int64(83), app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) +// ctx = ctx.WithBlockTime(now.Add(11 * time.Hour)) +// +// // delegate 65 +// shares, err := app.StakingKeeper.Delegate(ctx, addr, sdk.NewInt(65), stakingtypes.Unbonded, val, true) +// require.NoError(t, err) +// require.Equal(t, sdk.NewInt(65), shares.TruncateInt()) +// require.Equal(t, int64(18), app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount.Int64()) +// +// // undelegate 5 +// _, err = app.StakingKeeper.Undelegate(ctx, addr, valAddr, sdk.NewDec(5)) +// require.NoError(t, err) +// +// // Return the grant (1000fee, 100stake) with (1200fee, 83stake) available +// va2 := app.AccountKeeper.GetAccount(ctx, addr).(*types.ClawbackVestingAccount) +// va2.ReturnGrants(ctx, app.AccountKeeper, app.BankKeeper, app.StakingKeeper) +// +// // check vesting account +// // want 200fee all vested +// dest := funder +// feeAmt := app.BankKeeper.GetBalance(ctx, addr, feeDenom).Amount +// require.Equal(t, int64(200), feeAmt.Int64()) +// stakeAmt := app.BankKeeper.GetBalance(ctx, addr, stakeDenom).Amount +// require.Equal(t, int64(0), stakeAmt.Int64()) +// spendable := app.BankKeeper.SpendableCoins(ctx, addr) +// require.Equal(t, int64(200), spendable.AmountOf(feeDenom).Int64()) +// _, found := app.StakingKeeper.GetDelegation(ctx, addr, valAddr) +// require.False(t, found) +// _, found = app.StakingKeeper.GetUnbondingDelegation(ctx, addr, valAddr) +// require.False(t, found) +// +// // check destination account +// // want 1000fee, 83stake (18 unbonded, 5 unbonding, 60 bonded) +// +// feeAmt = app.BankKeeper.GetBalance(ctx, dest, feeDenom).Amount +// require.Equal(t, int64(1000), feeAmt.Int64()) +// stakeAmt = app.BankKeeper.GetBalance(ctx, dest, stakeDenom).Amount +// require.Equal(t, int64(18), stakeAmt.Int64()) +// del, found := app.StakingKeeper.GetDelegation(ctx, dest, valAddr) +// require.True(t, found) +// shares = del.GetShares() +// val, found = app.StakingKeeper.GetValidator(ctx, valAddr) +// require.True(t, found) +// stakeAmt = val.TokensFromSharesTruncated(shares).RoundInt() +// require.Equal(t, sdk.NewInt(60), stakeAmt) +// ubd, found := app.StakingKeeper.GetUnbondingDelegation(ctx, dest, valAddr) +// require.True(t, found) +// require.Equal(t, 1, len(ubd.Entries)) +// require.Equal(t, sdk.NewInt(5), ubd.Entries[0].Balance) +//} + func TestGenesisAccountValidate(t *testing.T) { pubkey := secp256k1.GenPrivKey().PubKey() addr := sdk.AccAddress(pubkey.Address()) diff --git a/x/params/types/table.go b/x/params/types/table.go index 9daf24888b7d..2eda84304e51 100644 --- a/x/params/types/table.go +++ b/x/params/types/table.go @@ -1,9 +1,8 @@ package types import ( - "reflect" - sdk "github.com/cosmos/cosmos-sdk/types" + "reflect" ) type attribute struct { @@ -36,8 +35,9 @@ func (t KeyTable) RegisterType(psp ParamSetPair) KeyTable { if len(psp.Key) == 0 { panic("cannot register ParamSetPair with an parameter empty key") } - if !sdk.IsAlphaNumeric(string(psp.Key)) { - panic("cannot register ParamSetPair with a non-alphanumeric parameter key") + // [AGORIC] We allow underscores as well for params + if !sdk.IsAlphaNumericOrUnderscore(string(psp.Key)) { + panic("cannot register ParamSetPair with a non-alphanumeric or underscore parameter key") } if psp.ValidatorFn == nil { panic("cannot register ParamSetPair without a value validation function") diff --git a/x/staking/keeper/delegation.go b/x/staking/keeper/delegation.go index 606cb1e51c89..6a523cb0caab 100644 --- a/x/staking/keeper/delegation.go +++ b/x/staking/keeper/delegation.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + stdmath "math" "time" corestore "cosmossdk.io/core/store" @@ -1151,6 +1152,70 @@ func (k Keeper) Undelegate( return completionTime, returnAmount, nil } +// TransferUnbonding changes the ownership of UnbondingDelegation entries +// until the desired number of tokens have changed hands. Returns the actual +// number of tokens transferred. +func (k Keeper) TransferUnbonding(ctx context.Context, fromAddr, toAddr sdk.AccAddress, valAddr sdk.ValAddress, wantAmt math.Int) (math.Int, error) { + transferred := math.ZeroInt() + ubdFrom, err := k.GetUnbondingDelegation(ctx, fromAddr, valAddr) + if errors.Is(err, types.ErrNoUnbondingDelegation) { + return transferred, nil + } + if err != nil { + return math.Int{}, err + } + ubdFromModified := false + + for i := 0; i < len(ubdFrom.Entries) && wantAmt.IsPositive(); i++ { + entry := ubdFrom.Entries[i] + toXfer := entry.Balance + if toXfer.GT(wantAmt) { + toXfer = wantAmt + } + if !toXfer.IsPositive() { + continue + } + + hasMaxUnboundingDelegation, err := k.HasMaxUnbondingDelegationEntries(ctx, toAddr, valAddr) + if err != nil { + return math.Int{}, err + } + if hasMaxUnboundingDelegation { + // TODO pre-compute the maximum entries we can add rather than checking each time + break + } + ubdTo, err := k.SetUnbondingDelegationEntry(ctx, toAddr, valAddr, entry.CreationHeight, entry.CompletionTime, toXfer) + if err != nil { + return math.Int{}, err + } + err = k.InsertUBDQueue(ctx, ubdTo, entry.CompletionTime) + if err != nil { + return math.Int{}, err + } + transferred = transferred.Add(toXfer) + wantAmt = wantAmt.Sub(toXfer) + + ubdFromModified = true + remaining := entry.Balance.Sub(toXfer) + if remaining.IsZero() { + ubdFrom.RemoveEntry(int64(i)) + i-- + continue + } + entry.Balance = remaining + ubdFrom.Entries[i] = entry + } + + if ubdFromModified { + if len(ubdFrom.Entries) == 0 { + k.RemoveUnbondingDelegation(ctx, ubdFrom) + } else { + k.SetUnbondingDelegation(ctx, ubdFrom) + } + } + return transferred, nil +} + // CompleteUnbonding completes the unbonding of all mature entries in the // retrieved unbonding delegation object and returns the total unbonding balance // or an error upon failure. @@ -1385,3 +1450,199 @@ func (k Keeper) ValidateUnbondAmount( return shares, nil } + +// TransferDelegation changes the ownership of at most the desired number of shares. +// Returns the actual number of shares transferred. Will also transfer redelegation +// entries to ensure that all redelegations are matched by sufficient shares. +// Note that no tokens are transferred to or from any pool or account, since no +// delegation is actually changing state. +func (k Keeper) TransferDelegation(ctx context.Context, fromAddr, toAddr sdk.AccAddress, valAddr sdk.ValAddress, wantShares math.LegacyDec) (math.LegacyDec, error) { + transferred := math.LegacyZeroDec() + + // sanity checks + if !wantShares.IsPositive() { + return transferred, errors.New("wantShares needs to be positive") + } + validator, err := k.GetValidator(ctx, valAddr) + if err != nil { + return transferred, err + } + delFrom, err := k.GetDelegation(ctx, fromAddr, valAddr) + if err != nil { + return transferred, err + } + + valAddrString, err := k.validatorAddressCodec.BytesToString(valAddr) + if err != nil { + return transferred, err + } + + maxEntries, err := k.MaxEntries(ctx) + if err != nil { + return transferred, err + } + + operatorAddress, err := k.validatorAddressCodec.StringToBytes(validator.GetOperator()) + if err != nil { + return transferred, err + } + + toAddrString, err := k.validatorAddressCodec.BytesToString(toAddr) + if err != nil { + return transferred, err + } + + // Check redelegation entry limits while we can still return early. + // Assume the worst case that we need to transfer all redelegation entries + mightExceedLimit := false + k.IterateDelegatorRedelegations(ctx, fromAddr, func(toRedelegation types.Redelegation) (stop bool) { + // There's no redelegation index by delegator and dstVal or vice-versa. + // The minimum cardinality is to look up by delegator, so scan and skip. + if toRedelegation.ValidatorDstAddress != valAddrString { + return false + } + fromRedelegation, err := k.GetRedelegation(ctx, fromAddr, sdk.ValAddress(toRedelegation.ValidatorSrcAddress), sdk.ValAddress(toRedelegation.ValidatorDstAddress)) + if err != nil && len(toRedelegation.Entries)+len(fromRedelegation.Entries) >= int(maxEntries) { + mightExceedLimit = true + return true + } + return false + }) + if mightExceedLimit { + // avoid types.ErrMaxRedelegationEntries + return transferred, nil + } + + // compute shares to transfer, amount left behind + transferred = delFrom.Shares + if transferred.GT(wantShares) { + transferred = wantShares + } + remaining := delFrom.Shares.Sub(transferred) + + // Update or create the delTo object, calling appropriate hooks + delTo, err := k.GetDelegation(ctx, toAddr, operatorAddress) + if err != nil { + delTo = types.NewDelegation(toAddrString, validator.GetOperator(), math.LegacyZeroDec()) + } + if err == nil { + k.Hooks().BeforeDelegationSharesModified(ctx, toAddr, operatorAddress) + } else { + k.Hooks().BeforeDelegationCreated(ctx, toAddr, operatorAddress) + } + delTo.Shares = delTo.Shares.Add(transferred) + k.SetDelegation(ctx, delTo) + k.Hooks().AfterDelegationModified(ctx, toAddr, valAddr) + + // Update source delegation + if remaining.IsZero() { + k.Hooks().BeforeDelegationRemoved(ctx, fromAddr, valAddr) + k.RemoveDelegation(ctx, delFrom) + } else { + k.Hooks().BeforeDelegationSharesModified(ctx, fromAddr, valAddr) + delFrom.Shares = remaining + k.SetDelegation(ctx, delFrom) + k.Hooks().AfterDelegationModified(ctx, fromAddr, valAddr) + } + + // If there are not enough remaining shares to be responsible for + // the redelegations, transfer some redelegations. + // For instance, if the original delegation of 300 shares to validator A + // had redelegations for 100 shares each from validators B, C, and D, + // and if we're transferring 175 shares, then we might keep the redelegation + // from B, transfer the one from D, and split the redelegation from C + // keeping a liability for 25 shares and transferring one for 75 shares. + // Of course, the redelegations themselves can have multiple entries for + // different timestamps, so we're actually working at a finer granularity. + var redelegationErrors []error + redelegations, err := k.GetRedelegations(ctx, fromAddr, stdmath.MaxUint16) + if err != nil { + redelegationErrors = append(redelegationErrors, err) + } + for _, redelegation := range redelegations { + // There's no redelegation index by delegator and dstVal or vice-versa. + // The minimum cardinality is to look up by delegator, so scan and skip. + if redelegation.ValidatorDstAddress != valAddrString { + continue + } + redelegationModified := false + entriesRemaining := false + for i := 0; i < len(redelegation.Entries); i++ { + entry := redelegation.Entries[i] + + // Partition SharesDst between keeping and sending + sharesToKeep := entry.SharesDst + sharesToSend := math.LegacyZeroDec() + if entry.SharesDst.GT(remaining) { + sharesToKeep = remaining + sharesToSend = entry.SharesDst.Sub(sharesToKeep) + } + remaining = remaining.Sub(sharesToKeep) // fewer local shares available to cover liability + + if sharesToSend.IsZero() { + // Leave the entry here + entriesRemaining = true + continue + } + if sharesToKeep.IsZero() { + // Transfer the whole entry, delete locally + toRed, err := k.SetRedelegationEntry( + ctx, toAddr, sdk.ValAddress(redelegation.ValidatorSrcAddress), + sdk.ValAddress(redelegation.ValidatorDstAddress), + entry.CreationHeight, entry.CompletionTime, entry.InitialBalance, math.LegacyZeroDec(), sharesToSend, + ) + if err != nil { + redelegationErrors = append(redelegationErrors, err) + continue + } + + k.InsertRedelegationQueue(ctx, toRed, entry.CompletionTime) + redelegation.RemoveEntry(int64(i)) + i-- + // okay to leave an obsolete entry in the queue for the removed entry + redelegationModified = true + } else { + // Proportionally divide the entry + fracSending := sharesToSend.Quo(entry.SharesDst) + balanceToSend := fracSending.MulInt(entry.InitialBalance).TruncateInt() + balanceToKeep := entry.InitialBalance.Sub(balanceToSend) + toRed, err := k.SetRedelegationEntry( + ctx, toAddr, sdk.ValAddress(redelegation.ValidatorSrcAddress), + sdk.ValAddress(redelegation.ValidatorDstAddress), + entry.CreationHeight, entry.CompletionTime, balanceToSend, math.LegacyZeroDec(), sharesToSend, + ) + if err != nil { + redelegationErrors = append(redelegationErrors, err) + continue + } + k.InsertRedelegationQueue(ctx, toRed, entry.CompletionTime) + entry.InitialBalance = balanceToKeep + entry.SharesDst = sharesToKeep + redelegation.Entries[i] = entry + // not modifying the completion time, so no need to change the queue + redelegationModified = true + entriesRemaining = true + } + } + if redelegationModified { + if entriesRemaining { + err = k.SetRedelegation(ctx, redelegation) + if err != nil { + redelegationErrors = append(redelegationErrors, err) + continue + } + } else { + err = k.RemoveRedelegation(ctx, redelegation) + if err != nil { + redelegationErrors = append(redelegationErrors, err) + continue + } + } + } + } + + if len(redelegationErrors) > 0 { + return transferred, redelegationErrors[0] + } + return transferred, nil +} diff --git a/x/staking/keeper/keeper.go b/x/staking/keeper/keeper.go index 45948f72224c..6ecac7756cbe 100644 --- a/x/staking/keeper/keeper.go +++ b/x/staking/keeper/keeper.go @@ -2,14 +2,12 @@ package keeper import ( "context" - "fmt" - - abci "github.com/cometbft/cometbft/abci/types" - addresscodec "cosmossdk.io/core/address" storetypes "cosmossdk.io/core/store" "cosmossdk.io/log" "cosmossdk.io/math" + "fmt" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types"