From 6bbd4d80d40b1ceae38bf95645729a7176604994 Mon Sep 17 00:00:00 2001 From: Troy Kessler <43882936+troykessler@users.noreply.github.com> Date: Tue, 4 Jun 2024 09:51:38 +0200 Subject: [PATCH] chore: multiple coins migration (#187) Co-authored-by: mbreithecker --- app/app.go | 3 + app/upgrades/v1_5/upgrade.go | 161 +- .../{ => bundles}/getters_params.go | 4 +- .../v1_4_types/{ => bundles}/params.pb.go | 8 +- .../v1_4_types/delegation/delegation.pb.go | 2121 +++++++++++++++++ .../delegation/getters_delegation.go | 41 + .../v1_5/v1_4_types/funders/funders.pb.go | 1124 +++++++++ .../v1_4_types/funders/getters_funding.go | 25 + .../v1_5/v1_4_types/funders/getters_params.go | 28 + .../v1_5/v1_4_types/funders/params.pb.go | 380 +++ .../v1_5/v1_4_types/pool/getters_pool.go | 18 + .../v1_5/v1_4_types/pool/params.pb.go | 367 +++ .../v1_5/v1_4_types/stakers/getters_staker.go | 27 + .../v1_5/v1_4_types/stakers/stakers.pb.go | 1811 ++++++++++++++ x/funders/keeper/keeper_test.go | 2 +- x/stakers/keeper/keeper.go | 7 + 16 files changed, 6089 insertions(+), 38 deletions(-) rename app/upgrades/v1_5/v1_4_types/{ => bundles}/getters_params.go (77%) rename app/upgrades/v1_5/v1_4_types/{ => bundles}/params.pb.go (97%) create mode 100644 app/upgrades/v1_5/v1_4_types/delegation/delegation.pb.go create mode 100644 app/upgrades/v1_5/v1_4_types/delegation/getters_delegation.go create mode 100644 app/upgrades/v1_5/v1_4_types/funders/funders.pb.go create mode 100644 app/upgrades/v1_5/v1_4_types/funders/getters_funding.go create mode 100644 app/upgrades/v1_5/v1_4_types/funders/getters_params.go create mode 100644 app/upgrades/v1_5/v1_4_types/funders/params.pb.go create mode 100644 app/upgrades/v1_5/v1_4_types/pool/getters_pool.go create mode 100644 app/upgrades/v1_5/v1_4_types/pool/params.pb.go create mode 100644 app/upgrades/v1_5/v1_4_types/stakers/getters_staker.go create mode 100644 app/upgrades/v1_5/v1_4_types/stakers/stakers.pb.go diff --git a/app/app.go b/app/app.go index 6275e8c5..cb52faaa 100644 --- a/app/app.go +++ b/app/app.go @@ -416,6 +416,9 @@ func New( app.appCodec, app.GetStoreKeys(), app.BundlesKeeper, + app.DelegationKeeper, + app.FundersKeeper, + app.StakersKeeper, app.PoolKeeper, ), ) diff --git a/app/upgrades/v1_5/upgrade.go b/app/upgrades/v1_5/upgrade.go index fdffb067..7fa6d2b3 100644 --- a/app/upgrades/v1_5/upgrade.go +++ b/app/upgrades/v1_5/upgrade.go @@ -4,15 +4,30 @@ import ( "context" "fmt" + poolKeeper "github.com/KYVENetwork/chain/x/pool/keeper" + poolTypes "github.com/KYVENetwork/chain/x/pool/types" + + "github.com/KYVENetwork/chain/app/upgrades/v1_5/v1_4_types/bundles" + "github.com/KYVENetwork/chain/app/upgrades/v1_5/v1_4_types/delegation" + "github.com/KYVENetwork/chain/app/upgrades/v1_5/v1_4_types/funders" + "github.com/KYVENetwork/chain/app/upgrades/v1_5/v1_4_types/pool" + "github.com/KYVENetwork/chain/app/upgrades/v1_5/v1_4_types/stakers" + delegationKeeper "github.com/KYVENetwork/chain/x/delegation/keeper" + delegationTypes "github.com/KYVENetwork/chain/x/delegation/types" + fundersKeeper "github.com/KYVENetwork/chain/x/funders/keeper" + funderTypes "github.com/KYVENetwork/chain/x/funders/types" + fundersTypes "github.com/KYVENetwork/chain/x/funders/types" + globalTypes "github.com/KYVENetwork/chain/x/global/types" + stakersKeeper "github.com/KYVENetwork/chain/x/stakers/keeper" + stakersTypes "github.com/KYVENetwork/chain/x/stakers/types" + "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" upgradetypes "cosmossdk.io/x/upgrade/types" - "github.com/KYVENetwork/chain/app/upgrades/v1_5/v1_4_types" - "github.com/KYVENetwork/chain/x/bundles/keeper" - bundlestypes "github.com/KYVENetwork/chain/x/bundles/types" - poolkeeper "github.com/KYVENetwork/chain/x/pool/keeper" + bundlesKeeper "github.com/KYVENetwork/chain/x/bundles/keeper" + bundlesTypes "github.com/KYVENetwork/chain/x/bundles/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -22,56 +37,140 @@ const ( UpgradeName = "v1.5.0" ) -func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, cdc codec.Codec, storeKeys []storetypes.StoreKey, bundlesKeeper keeper.Keeper, poolKeeper *poolkeeper.Keeper) upgradetypes.UpgradeHandler { +func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, cdc codec.Codec, storeKeys []storetypes.StoreKey, bundlesKeeper bundlesKeeper.Keeper, delegationKeeper delegationKeeper.Keeper, fundersKeeper fundersKeeper.Keeper, stakersKeeper *stakersKeeper.Keeper, poolKeeper *poolKeeper.Keeper) upgradetypes.UpgradeHandler { return func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) logger := sdkCtx.Logger().With("upgrade", UpgradeName) logger.Info(fmt.Sprintf("performing upgrade %v", UpgradeName)) - if err := migrateStorageCosts(sdkCtx, bundlesKeeper, poolKeeper, storeKeys, cdc); err != nil { - return nil, err - } - // TODO: migrate gov params + // TODO emit events if necessary - // TODO: migrate fundings + // migrate fundings + MigrateFundersModule(sdkCtx, cdc, MustGetStoreKey(storeKeys, fundersTypes.StoreKey), fundersKeeper) - // TODO: migrate delegation outstanding rewards + // migrate delegations + migrateDelegationModule(sdkCtx, cdc, MustGetStoreKey(storeKeys, delegationTypes.StoreKey), delegationKeeper) - // TODO: migrate network fee and whitelist weights + // migrate stakers + migrateStakersModule(sdkCtx, cdc, MustGetStoreKey(storeKeys, stakersTypes.StoreKey), stakersKeeper) - // TODO: migrate MaxVotingPowerPerPool in pool params + // migrate bundles + migrateBundlesModule(sdkCtx, cdc, MustGetStoreKey(storeKeys, bundlesTypes.StoreKey), bundlesKeeper) + + // migrate pool + migrateMaxVotingPowerInPool(sdkCtx, cdc, MustGetStoreKey(storeKeys, poolTypes.StoreKey), *poolKeeper) return mm.RunMigrations(ctx, configurator, fromVM) } } -func migrateStorageCosts(sdkCtx sdk.Context, bundlesKeeper keeper.Keeper, poolKeeper *poolkeeper.Keeper, storeKeys []storetypes.StoreKey, cdc codec.Codec) error { - var bundlesStoreKey storetypes.StoreKey +func MustGetStoreKey(storeKeys []storetypes.StoreKey, storeName string) storetypes.StoreKey { for _, k := range storeKeys { - if k.Name() == "bundles" { - bundlesStoreKey = k - break + if k.Name() == storeName { + return k } } - if bundlesStoreKey == nil { - return fmt.Errorf("store key not found: bundles") + + panic(fmt.Sprintf("failed to find store key: %s", fundersTypes.StoreKey)) +} + +func MigrateFundersModule(sdkCtx sdk.Context, cdc codec.Codec, fundersStoreKey storetypes.StoreKey, fundersKeeper fundersKeeper.Keeper) { + // migrate params + // TODO: define final prices and initial whitelisted coins + oldParams := funders.GetParams(sdkCtx, cdc, fundersStoreKey) + fundersKeeper.SetParams(sdkCtx, fundersTypes.Params{ + CoinWhitelist: []*fundersTypes.WhitelistCoinEntry{ + { + CoinDenom: globalTypes.Denom, + MinFundingAmount: oldParams.MinFundingAmount, + MinFundingAmountPerBundle: oldParams.MinFundingAmountPerBundle, + CoinWeight: math.LegacyMustNewDecFromStr("0.06"), + }, + }, + MinFundingMultiple: oldParams.MinFundingMultiple, + }) + + // migrate fundings + oldFundings := funders.GetAllFundings(sdkCtx, cdc, fundersStoreKey) + for _, f := range oldFundings { + fundersKeeper.SetFunding(sdkCtx, &funderTypes.Funding{ + FunderAddress: f.FunderAddress, + PoolId: f.PoolId, + Amounts: sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(f.Amount))), + AmountsPerBundle: sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(f.AmountPerBundle))), + TotalFunded: sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(f.TotalFunded))), + }) + } +} + +func migrateDelegationModule(sdkCtx sdk.Context, cdc codec.Codec, delegationStoreKey storetypes.StoreKey, delegationKeeper delegationKeeper.Keeper) { + // migrate delegation entries + oldDelegationEntries := delegation.GetAllDelegationEntries(sdkCtx, cdc, delegationStoreKey) + for _, d := range oldDelegationEntries { + delegationKeeper.SetDelegationEntry(sdkCtx, delegationTypes.DelegationEntry{ + Staker: d.Staker, + KIndex: d.KIndex, + Value: sdk.NewDecCoins(sdk.NewDecCoinFromDec(globalTypes.Denom, d.Value)), + }) } - // Copy storage cost from old params to new params - // The storage cost of all storage providers will be the same after this migration - oldParams := v1_4_types.GetParams(sdkCtx, bundlesStoreKey, cdc) - newParams := bundlestypes.Params{ + // migrate delegation data + oldDelegationData := delegation.GetAllDelegationData(sdkCtx, cdc, delegationStoreKey) + for _, d := range oldDelegationData { + delegationKeeper.SetDelegationData(sdkCtx, delegationTypes.DelegationData{ + Staker: d.Staker, + CurrentRewards: sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(d.CurrentRewards))), + TotalDelegation: d.TotalDelegation, + LatestIndexK: d.LatestIndexK, + DelegatorCount: d.DelegatorCount, + LatestIndexWasUndelegation: d.LatestIndexWasUndelegation, + }) + } +} + +func migrateStakersModule(sdkCtx sdk.Context, cdc codec.Codec, stakersStoreKey storetypes.StoreKey, stakersKeeper *stakersKeeper.Keeper) { + // migrate stakers + oldStakers := stakers.GetAllStakers(sdkCtx, cdc, stakersStoreKey) + for _, s := range oldStakers { + stakersKeeper.Migration_SetStaker(sdkCtx, stakersTypes.Staker{ + Address: s.Address, + Commission: s.Commission, + Moniker: s.Moniker, + Website: s.Website, + Identity: s.Identity, + SecurityContact: s.SecurityContact, + Details: s.Details, + CommissionRewards: sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(s.CommissionRewards))), + }) + } +} + +func migrateBundlesModule(sdkCtx sdk.Context, cdc codec.Codec, bundlesStoreKey storetypes.StoreKey, bundlesKeeper bundlesKeeper.Keeper) { + oldParams := bundles.GetParams(sdkCtx, cdc, bundlesStoreKey) + + // TODO: define final storage cost prices + bundlesKeeper.SetParams(sdkCtx, bundlesTypes.Params{ UploadTimeout: oldParams.UploadTimeout, - StorageCosts: []bundlestypes.StorageCost{ - // TODO: define value for storage provider id 1 and 2 - {StorageProviderId: 1, Cost: math.LegacyMustNewDecFromStr("0.00")}, - {StorageProviderId: 2, Cost: math.LegacyMustNewDecFromStr("0.00")}, + StorageCosts: []bundlesTypes.StorageCost{ + // Arweave: https://arweave.net/price/1048576 -> 699 winston/byte * 40 USD/AR * 1.5 / 10**12 + {StorageProviderId: 1, Cost: math.LegacyMustNewDecFromStr("0.000000004194")}, + // Irys: https://node1.bundlr.network/price/1048576 -> 1048 winston/byte * 40 USD/AR * 1.5 / 10**12 + {StorageProviderId: 2, Cost: math.LegacyMustNewDecFromStr("0.000000006288")}, + // KYVE Storage Provider: zero since it is free to use for testnet participants + {StorageProviderId: 3, Cost: math.LegacyMustNewDecFromStr("0.00")}, }, NetworkFee: oldParams.NetworkFee, MaxPoints: oldParams.MaxPoints, - } + }) +} + +func migrateMaxVotingPowerInPool(sdkCtx sdk.Context, cdc codec.Codec, poolStoreKey storetypes.StoreKey, poolKeeper poolKeeper.Keeper) { + oldParams := pool.GetParams(sdkCtx, cdc, poolStoreKey) - bundlesKeeper.SetParams(sdkCtx, newParams) - return nil + poolKeeper.SetParams(sdkCtx, poolTypes.Params{ + ProtocolInflationShare: oldParams.ProtocolInflationShare, + PoolInflationPayoutRate: oldParams.PoolInflationPayoutRate, + MaxVotingPowerPerPool: math.LegacyMustNewDecFromStr("0.5"), + }) } diff --git a/app/upgrades/v1_5/v1_4_types/getters_params.go b/app/upgrades/v1_5/v1_4_types/bundles/getters_params.go similarity index 77% rename from app/upgrades/v1_5/v1_4_types/getters_params.go rename to app/upgrades/v1_5/v1_4_types/bundles/getters_params.go index d3f98bef..f2e9aac6 100644 --- a/app/upgrades/v1_5/v1_4_types/getters_params.go +++ b/app/upgrades/v1_5/v1_4_types/bundles/getters_params.go @@ -1,4 +1,4 @@ -package v1_4_types +package bundles import ( storeTypes "cosmossdk.io/store/types" @@ -8,7 +8,7 @@ import ( ) // GetParams returns the current x/bundles module parameters. -func GetParams(ctx sdk.Context, storeKey storeTypes.StoreKey, cdc codec.Codec) (params Params) { +func GetParams(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (params Params) { store := ctx.KVStore(storeKey) bz := store.Get(types.ParamsPrefix) diff --git a/app/upgrades/v1_5/v1_4_types/params.pb.go b/app/upgrades/v1_5/v1_4_types/bundles/params.pb.go similarity index 97% rename from app/upgrades/v1_5/v1_4_types/params.pb.go rename to app/upgrades/v1_5/v1_4_types/bundles/params.pb.go index d57b8070..1385f7c3 100644 --- a/app/upgrades/v1_5/v1_4_types/params.pb.go +++ b/app/upgrades/v1_5/v1_4_types/bundles/params.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: kyve/bundles/v1beta1/params.proto +// source: kyve/bundles/legacy/params.proto -package v1_4_types +package bundles import ( cosmossdk_io_math "cosmossdk.io/math" @@ -84,10 +84,10 @@ func (m *Params) GetMaxPoints() uint64 { } func init() { - proto.RegisterType((*Params)(nil), "kyve.bundles.v1beta1.Params") + proto.RegisterType((*Params)(nil), "kyve.bundles.legacy.Params") } -func init() { proto.RegisterFile("kyve/bundles/v1beta1/params.proto", fileDescriptor_cfd3a74b72a01aaa) } +func init() { proto.RegisterFile("kyve/bundles/legacy/params.proto", fileDescriptor_cfd3a74b72a01aaa) } var fileDescriptor_cfd3a74b72a01aaa = []byte{ // 300 bytes of a gzipped FileDescriptorProto diff --git a/app/upgrades/v1_5/v1_4_types/delegation/delegation.pb.go b/app/upgrades/v1_5/v1_4_types/delegation/delegation.pb.go new file mode 100644 index 00000000..812e72fc --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/delegation/delegation.pb.go @@ -0,0 +1,2121 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/delegation/legacy/delegation.proto + +package delegation + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// SlashType ... +type SlashType int32 + +const ( + // SLASH_TYPE_UNSPECIFIED ... + SLASH_TYPE_UNSPECIFIED SlashType = 0 + // SLASH_TYPE_TIMEOUT ... + SLASH_TYPE_TIMEOUT SlashType = 1 + // SLASH_TYPE_VOTE ... + SLASH_TYPE_VOTE SlashType = 2 + // SLASH_TYPE_UPLOAD ... + SLASH_TYPE_UPLOAD SlashType = 3 +) + +var SlashType_name = map[int32]string{ + 0: "SLASH_TYPE_UNSPECIFIED", + 1: "SLASH_TYPE_TIMEOUT", + 2: "SLASH_TYPE_VOTE", + 3: "SLASH_TYPE_UPLOAD", +} + +var SlashType_value = map[string]int32{ + "SLASH_TYPE_UNSPECIFIED": 0, + "SLASH_TYPE_TIMEOUT": 1, + "SLASH_TYPE_VOTE": 2, + "SLASH_TYPE_UPLOAD": 3, +} + +func (x SlashType) String() string { + return proto.EnumName(SlashType_name, int32(x)) +} + +func (SlashType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{0} +} + +// Delegator stores the information that one address has delegated to another address +// It stores important information for the F1-Fee distribution algorithm +type Delegator struct { + // staker corresponds to a KYVE-staker on the protocol-side + Staker string `protobuf:"bytes,1,opt,name=staker,proto3" json:"staker,omitempty"` + // delegator the user who delegate to the staker. + // If staker and delegator are the same we call it: self-delegation + Delegator string `protobuf:"bytes,2,opt,name=delegator,proto3" json:"delegator,omitempty"` + // k_index is an internal index for the f1-distribution algorithm + KIndex uint64 `protobuf:"varint,3,opt,name=k_index,json=kIndex,proto3" json:"k_index,omitempty"` + // initial_amount of stake the user had when it delegated. + // slashes can cause that the actual stake is lower. + InitialAmount uint64 `protobuf:"varint,4,opt,name=initial_amount,json=initialAmount,proto3" json:"initial_amount,omitempty"` +} + +func (m *Delegator) Reset() { *m = Delegator{} } +func (m *Delegator) String() string { return proto.CompactTextString(m) } +func (*Delegator) ProtoMessage() {} +func (*Delegator) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{0} +} +func (m *Delegator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Delegator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Delegator.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 *Delegator) XXX_Merge(src proto.Message) { + xxx_messageInfo_Delegator.Merge(m, src) +} +func (m *Delegator) XXX_Size() int { + return m.Size() +} +func (m *Delegator) XXX_DiscardUnknown() { + xxx_messageInfo_Delegator.DiscardUnknown(m) +} + +var xxx_messageInfo_Delegator proto.InternalMessageInfo + +func (m *Delegator) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *Delegator) GetDelegator() string { + if m != nil { + return m.Delegator + } + return "" +} + +func (m *Delegator) GetKIndex() uint64 { + if m != nil { + return m.KIndex + } + return 0 +} + +func (m *Delegator) GetInitialAmount() uint64 { + if m != nil { + return m.InitialAmount + } + return 0 +} + +// DelegationEntry represents an entry according to the F1-Fee-Distribution algorithm. +// Take a look at x/delegation/keeper/logic_f1distribution.go for more details +type DelegationEntry struct { + // staker on protocol level + Staker string `protobuf:"bytes,1,opt,name=staker,proto3" json:"staker,omitempty"` + // k_index is the of the period this entry ends + KIndex uint64 `protobuf:"varint,2,opt,name=k_index,json=kIndex,proto3" json:"k_index,omitempty"` + // value is the quotient of collected rewards and total stake according to F1-distribution + Value cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=value,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"value"` +} + +func (m *DelegationEntry) Reset() { *m = DelegationEntry{} } +func (m *DelegationEntry) String() string { return proto.CompactTextString(m) } +func (*DelegationEntry) ProtoMessage() {} +func (*DelegationEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{1} +} +func (m *DelegationEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DelegationEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DelegationEntry.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 *DelegationEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelegationEntry.Merge(m, src) +} +func (m *DelegationEntry) XXX_Size() int { + return m.Size() +} +func (m *DelegationEntry) XXX_DiscardUnknown() { + xxx_messageInfo_DelegationEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_DelegationEntry proto.InternalMessageInfo + +func (m *DelegationEntry) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *DelegationEntry) GetKIndex() uint64 { + if m != nil { + return m.KIndex + } + return 0 +} + +// DelegationPoolData stores general delegation information for every staker +type DelegationData struct { + // Every staker has one DelegationData + Staker string `protobuf:"bytes,1,opt,name=staker,proto3" json:"staker,omitempty"` + // current_rewards ... + CurrentRewards uint64 `protobuf:"varint,2,opt,name=current_rewards,json=currentRewards,proto3" json:"current_rewards,omitempty"` + // total_delegation ... + TotalDelegation uint64 `protobuf:"varint,3,opt,name=total_delegation,json=totalDelegation,proto3" json:"total_delegation,omitempty"` + // latest_index_k ... + LatestIndexK uint64 `protobuf:"varint,4,opt,name=latest_index_k,json=latestIndexK,proto3" json:"latest_index_k,omitempty"` + // delegator_count the amount of different addresses delegating to the staker + DelegatorCount uint64 `protobuf:"varint,5,opt,name=delegator_count,json=delegatorCount,proto3" json:"delegator_count,omitempty"` + // latest_index_was_undelegation helps indicates when an entry can be deleted + LatestIndexWasUndelegation bool `protobuf:"varint,6,opt,name=latest_index_was_undelegation,json=latestIndexWasUndelegation,proto3" json:"latest_index_was_undelegation,omitempty"` +} + +func (m *DelegationData) Reset() { *m = DelegationData{} } +func (m *DelegationData) String() string { return proto.CompactTextString(m) } +func (*DelegationData) ProtoMessage() {} +func (*DelegationData) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{2} +} +func (m *DelegationData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DelegationData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DelegationData.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 *DelegationData) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelegationData.Merge(m, src) +} +func (m *DelegationData) XXX_Size() int { + return m.Size() +} +func (m *DelegationData) XXX_DiscardUnknown() { + xxx_messageInfo_DelegationData.DiscardUnknown(m) +} + +var xxx_messageInfo_DelegationData proto.InternalMessageInfo + +func (m *DelegationData) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *DelegationData) GetCurrentRewards() uint64 { + if m != nil { + return m.CurrentRewards + } + return 0 +} + +func (m *DelegationData) GetTotalDelegation() uint64 { + if m != nil { + return m.TotalDelegation + } + return 0 +} + +func (m *DelegationData) GetLatestIndexK() uint64 { + if m != nil { + return m.LatestIndexK + } + return 0 +} + +func (m *DelegationData) GetDelegatorCount() uint64 { + if m != nil { + return m.DelegatorCount + } + return 0 +} + +func (m *DelegationData) GetLatestIndexWasUndelegation() bool { + if m != nil { + return m.LatestIndexWasUndelegation + } + return false +} + +// DelegationSlash represents an f1-slash +// these entries needs to be iterated to obtain the current amount of the actual stake +// Every staker can have n slash-entries +type DelegationSlash struct { + // staker who got slashed + Staker string `protobuf:"bytes,1,opt,name=staker,proto3" json:"staker,omitempty"` + // k_index for f1-algorithm + KIndex uint64 `protobuf:"varint,2,opt,name=k_index,json=kIndex,proto3" json:"k_index,omitempty"` + // fraction that got slashed + Fraction cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=fraction,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"fraction"` +} + +func (m *DelegationSlash) Reset() { *m = DelegationSlash{} } +func (m *DelegationSlash) String() string { return proto.CompactTextString(m) } +func (*DelegationSlash) ProtoMessage() {} +func (*DelegationSlash) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{3} +} +func (m *DelegationSlash) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DelegationSlash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DelegationSlash.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 *DelegationSlash) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelegationSlash.Merge(m, src) +} +func (m *DelegationSlash) XXX_Size() int { + return m.Size() +} +func (m *DelegationSlash) XXX_DiscardUnknown() { + xxx_messageInfo_DelegationSlash.DiscardUnknown(m) +} + +var xxx_messageInfo_DelegationSlash proto.InternalMessageInfo + +func (m *DelegationSlash) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *DelegationSlash) GetKIndex() uint64 { + if m != nil { + return m.KIndex + } + return 0 +} + +// UndelegationQueueEntry ... +type UndelegationQueueEntry struct { + // index ... + Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + // staker ... + Staker string `protobuf:"bytes,2,opt,name=staker,proto3" json:"staker,omitempty"` + // delegator ... + Delegator string `protobuf:"bytes,3,opt,name=delegator,proto3" json:"delegator,omitempty"` + // amount ... + Amount uint64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` + // creation_time ... + CreationTime uint64 `protobuf:"varint,5,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty"` +} + +func (m *UndelegationQueueEntry) Reset() { *m = UndelegationQueueEntry{} } +func (m *UndelegationQueueEntry) String() string { return proto.CompactTextString(m) } +func (*UndelegationQueueEntry) ProtoMessage() {} +func (*UndelegationQueueEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{4} +} +func (m *UndelegationQueueEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UndelegationQueueEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UndelegationQueueEntry.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 *UndelegationQueueEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_UndelegationQueueEntry.Merge(m, src) +} +func (m *UndelegationQueueEntry) XXX_Size() int { + return m.Size() +} +func (m *UndelegationQueueEntry) XXX_DiscardUnknown() { + xxx_messageInfo_UndelegationQueueEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_UndelegationQueueEntry proto.InternalMessageInfo + +func (m *UndelegationQueueEntry) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *UndelegationQueueEntry) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *UndelegationQueueEntry) GetDelegator() string { + if m != nil { + return m.Delegator + } + return "" +} + +func (m *UndelegationQueueEntry) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *UndelegationQueueEntry) GetCreationTime() uint64 { + if m != nil { + return m.CreationTime + } + return 0 +} + +// QueueState ... +type QueueState struct { + // low_index ... + LowIndex uint64 `protobuf:"varint,1,opt,name=low_index,json=lowIndex,proto3" json:"low_index,omitempty"` + // high_index ... + HighIndex uint64 `protobuf:"varint,2,opt,name=high_index,json=highIndex,proto3" json:"high_index,omitempty"` +} + +func (m *QueueState) Reset() { *m = QueueState{} } +func (m *QueueState) String() string { return proto.CompactTextString(m) } +func (*QueueState) ProtoMessage() {} +func (*QueueState) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{5} +} +func (m *QueueState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueueState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueueState.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 *QueueState) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueueState.Merge(m, src) +} +func (m *QueueState) XXX_Size() int { + return m.Size() +} +func (m *QueueState) XXX_DiscardUnknown() { + xxx_messageInfo_QueueState.DiscardUnknown(m) +} + +var xxx_messageInfo_QueueState proto.InternalMessageInfo + +func (m *QueueState) GetLowIndex() uint64 { + if m != nil { + return m.LowIndex + } + return 0 +} + +func (m *QueueState) GetHighIndex() uint64 { + if m != nil { + return m.HighIndex + } + return 0 +} + +// RedelegationCooldown ... +type RedelegationCooldown struct { + // low_index ... + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // high_index ... + CreationDate uint64 `protobuf:"varint,2,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"` +} + +func (m *RedelegationCooldown) Reset() { *m = RedelegationCooldown{} } +func (m *RedelegationCooldown) String() string { return proto.CompactTextString(m) } +func (*RedelegationCooldown) ProtoMessage() {} +func (*RedelegationCooldown) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{6} +} +func (m *RedelegationCooldown) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RedelegationCooldown) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RedelegationCooldown.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 *RedelegationCooldown) XXX_Merge(src proto.Message) { + xxx_messageInfo_RedelegationCooldown.Merge(m, src) +} +func (m *RedelegationCooldown) XXX_Size() int { + return m.Size() +} +func (m *RedelegationCooldown) XXX_DiscardUnknown() { + xxx_messageInfo_RedelegationCooldown.DiscardUnknown(m) +} + +var xxx_messageInfo_RedelegationCooldown proto.InternalMessageInfo + +func (m *RedelegationCooldown) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *RedelegationCooldown) GetCreationDate() uint64 { + if m != nil { + return m.CreationDate + } + return 0 +} + +func init() { + proto.RegisterEnum("kyve.delegation.legacy.SlashType", SlashType_name, SlashType_value) + proto.RegisterType((*Delegator)(nil), "kyve.delegation.legacy.Delegator") + proto.RegisterType((*DelegationEntry)(nil), "kyve.delegation.legacy.DelegationEntry") + proto.RegisterType((*DelegationData)(nil), "kyve.delegation.legacy.DelegationData") + proto.RegisterType((*DelegationSlash)(nil), "kyve.delegation.legacy.DelegationSlash") + proto.RegisterType((*UndelegationQueueEntry)(nil), "kyve.delegation.legacy.UndelegationQueueEntry") + proto.RegisterType((*QueueState)(nil), "kyve.delegation.legacy.QueueState") + proto.RegisterType((*RedelegationCooldown)(nil), "kyve.delegation.legacy.RedelegationCooldown") +} + +func init() { + proto.RegisterFile("kyve/delegation/legacy/delegation.proto", fileDescriptor_e07f10cb3da486ac) +} + +var fileDescriptor_e07f10cb3da486ac = []byte{ + // 664 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4d, 0x4f, 0xdb, 0x40, + 0x10, 0x8d, 0x03, 0x04, 0x3c, 0x82, 0x24, 0xdd, 0xd2, 0x10, 0x85, 0x62, 0x90, 0x69, 0xd5, 0xb4, + 0x87, 0x58, 0xa8, 0xa7, 0x9e, 0xaa, 0x80, 0x5d, 0x11, 0x41, 0x81, 0xe6, 0x83, 0x8a, 0x5e, 0xac, + 0xc5, 0xde, 0x26, 0x96, 0x1d, 0x2f, 0xb5, 0xd7, 0x84, 0x1c, 0x7a, 0xa8, 0x7a, 0xe9, 0xa9, 0xea, + 0x5f, 0xa8, 0xfa, 0x67, 0x38, 0x72, 0xac, 0x7a, 0x40, 0x15, 0xfc, 0x91, 0x2a, 0x6b, 0xe3, 0x6c, + 0x2a, 0x45, 0x6a, 0x6f, 0x9e, 0x37, 0xe3, 0x79, 0x6f, 0xde, 0x8c, 0x16, 0xaa, 0xee, 0xf0, 0x9c, + 0x68, 0x36, 0xf1, 0x48, 0x17, 0x33, 0x87, 0xfa, 0xda, 0xf9, 0xd6, 0x29, 0x61, 0x78, 0x4b, 0x80, + 0x6a, 0x67, 0x01, 0x65, 0x14, 0xad, 0x8c, 0x2a, 0x6b, 0x02, 0x9c, 0x54, 0x56, 0x96, 0xbb, 0xb4, + 0x4b, 0x79, 0x8d, 0x36, 0xfa, 0x8a, 0xcb, 0xd5, 0x4f, 0x12, 0xc8, 0x7a, 0x5c, 0x4c, 0x03, 0x54, + 0x82, 0x5c, 0xc8, 0xb0, 0x4b, 0x82, 0xb2, 0xb4, 0x21, 0x55, 0xe5, 0x66, 0x12, 0xa1, 0x87, 0x20, + 0xdb, 0x77, 0x45, 0xe5, 0x2c, 0x4f, 0x8d, 0x01, 0xb4, 0x02, 0xf3, 0xae, 0xe9, 0xf8, 0x36, 0xb9, + 0x28, 0xcf, 0x6c, 0x48, 0xd5, 0xd9, 0x66, 0xce, 0x6d, 0x8c, 0x22, 0xf4, 0x18, 0xf2, 0x8e, 0xef, + 0x30, 0x07, 0x7b, 0x26, 0xee, 0xd3, 0xc8, 0x67, 0xe5, 0x59, 0x9e, 0x5f, 0x4a, 0xd0, 0x3a, 0x07, + 0xd5, 0x8f, 0x50, 0xd0, 0x53, 0xbd, 0x86, 0xcf, 0x82, 0xe1, 0x54, 0x21, 0x02, 0x55, 0x76, 0x82, + 0xea, 0x05, 0xcc, 0x9d, 0x63, 0x2f, 0x22, 0x5c, 0x81, 0xbc, 0xbd, 0x79, 0x79, 0xbd, 0x9e, 0xf9, + 0x75, 0xbd, 0xbe, 0x6a, 0xd1, 0xb0, 0x4f, 0xc3, 0xd0, 0x76, 0x6b, 0x0e, 0xd5, 0xfa, 0x98, 0xf5, + 0x6a, 0xfb, 0xa4, 0x8b, 0xad, 0xa1, 0x4e, 0xac, 0x66, 0xfc, 0x87, 0xfa, 0x35, 0x0b, 0xf9, 0x31, + 0xbf, 0x8e, 0x19, 0x9e, 0x4a, 0xff, 0x04, 0x0a, 0x56, 0x14, 0x04, 0xc4, 0x67, 0x66, 0x40, 0x06, + 0x38, 0xb0, 0xc3, 0x44, 0x46, 0x3e, 0x81, 0x9b, 0x31, 0x8a, 0x9e, 0x42, 0x91, 0x51, 0x86, 0x3d, + 0x73, 0xbc, 0x88, 0xc4, 0x9b, 0x02, 0xc7, 0xc7, 0x7c, 0xe8, 0x11, 0xe4, 0x3d, 0xcc, 0x48, 0xc8, + 0xe2, 0xb9, 0x4c, 0x37, 0x31, 0x69, 0x31, 0x46, 0xf9, 0x78, 0x7b, 0x23, 0xe6, 0xd4, 0x70, 0xd3, + 0xe2, 0x5e, 0xce, 0xc5, 0xcc, 0x29, 0xbc, 0x33, 0x42, 0x51, 0x1d, 0xd6, 0x26, 0xda, 0x0d, 0x70, + 0x68, 0x46, 0xbe, 0x20, 0x23, 0xb7, 0x21, 0x55, 0x17, 0x9a, 0x15, 0xa1, 0xfb, 0x5b, 0x1c, 0x76, + 0x84, 0x0a, 0xf5, 0xb3, 0x24, 0x2e, 0xa4, 0xe5, 0xe1, 0xb0, 0xf7, 0xff, 0x0b, 0x79, 0x09, 0x0b, + 0xef, 0x03, 0x6c, 0xa5, 0x93, 0xff, 0xe3, 0x4e, 0xd2, 0x9f, 0xd4, 0xef, 0x12, 0x94, 0x44, 0x59, + 0x6f, 0x22, 0x12, 0x91, 0xf8, 0x3a, 0x96, 0x61, 0x2e, 0xa6, 0x94, 0x38, 0x65, 0x1c, 0x08, 0x12, + 0xb3, 0xd3, 0x8f, 0x77, 0xe6, 0xef, 0xe3, 0x2d, 0x41, 0x6e, 0xe2, 0x36, 0x93, 0x08, 0x6d, 0xc2, + 0x92, 0x15, 0x10, 0xce, 0x6c, 0x32, 0xa7, 0x4f, 0x12, 0xbb, 0x17, 0xef, 0xc0, 0xb6, 0xd3, 0x27, + 0xea, 0x2e, 0x00, 0x97, 0xd5, 0x62, 0x98, 0x11, 0xb4, 0x0a, 0xb2, 0x47, 0x07, 0xa6, 0x28, 0x6d, + 0xc1, 0xa3, 0x83, 0xd8, 0x8f, 0x35, 0x80, 0x9e, 0xd3, 0xed, 0x4d, 0x78, 0x25, 0x8f, 0x10, 0x9e, + 0x56, 0x3b, 0xb0, 0xdc, 0x24, 0xe3, 0x61, 0x77, 0x28, 0xf5, 0x6c, 0x3a, 0xf0, 0x51, 0x19, 0xe6, + 0xb1, 0x6d, 0x07, 0x24, 0x0c, 0x13, 0xe3, 0xef, 0xc2, 0x09, 0x81, 0x36, 0x66, 0x24, 0xe9, 0x99, + 0x0a, 0xd4, 0x31, 0x23, 0xcf, 0x3e, 0x80, 0xcc, 0xf7, 0xd7, 0x1e, 0x9e, 0x11, 0x54, 0x81, 0x52, + 0x6b, 0xbf, 0xde, 0xda, 0x35, 0xdb, 0x27, 0x47, 0x86, 0xd9, 0x39, 0x68, 0x1d, 0x19, 0x3b, 0x8d, + 0x57, 0x0d, 0x43, 0x2f, 0x66, 0x50, 0x09, 0x90, 0x90, 0x6b, 0x37, 0x5e, 0x1b, 0x87, 0x9d, 0x76, + 0x51, 0x42, 0xf7, 0xa1, 0x20, 0xe0, 0xc7, 0x87, 0x6d, 0xa3, 0x98, 0x45, 0x0f, 0xe0, 0x9e, 0xd8, + 0xe8, 0x68, 0xff, 0xb0, 0xae, 0x17, 0x67, 0x2a, 0xb3, 0x5f, 0x7e, 0x28, 0x99, 0xed, 0xc6, 0xe5, + 0x8d, 0x22, 0x5d, 0xdd, 0x28, 0xd2, 0xef, 0x1b, 0x45, 0xfa, 0x76, 0xab, 0x64, 0xae, 0x6e, 0x95, + 0xcc, 0xcf, 0x5b, 0x25, 0xf3, 0x4e, 0xeb, 0x3a, 0xac, 0x17, 0x9d, 0xd6, 0x2c, 0xda, 0xd7, 0xf6, + 0x4e, 0x8e, 0x8d, 0x03, 0xc2, 0x06, 0x34, 0x70, 0x35, 0xab, 0x87, 0x1d, 0x5f, 0xbb, 0x10, 0x9f, + 0x37, 0x36, 0x3c, 0x23, 0xe1, 0x69, 0x8e, 0xbf, 0x51, 0xcf, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, + 0x71, 0xb7, 0xbb, 0xf9, 0xfe, 0x04, 0x00, 0x00, +} + +func (m *Delegator) 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 *Delegator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Delegator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.InitialAmount != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.InitialAmount)) + i-- + dAtA[i] = 0x20 + } + if m.KIndex != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.KIndex)) + i-- + dAtA[i] = 0x18 + } + if len(m.Delegator) > 0 { + i -= len(m.Delegator) + copy(dAtA[i:], m.Delegator) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Delegator))) + i-- + dAtA[i] = 0x12 + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DelegationEntry) 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 *DelegationEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintDelegation(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.KIndex != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.KIndex)) + i-- + dAtA[i] = 0x10 + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DelegationData) 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 *DelegationData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DelegationData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LatestIndexWasUndelegation { + i-- + if m.LatestIndexWasUndelegation { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.DelegatorCount != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.DelegatorCount)) + i-- + dAtA[i] = 0x28 + } + if m.LatestIndexK != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.LatestIndexK)) + i-- + dAtA[i] = 0x20 + } + if m.TotalDelegation != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.TotalDelegation)) + i-- + dAtA[i] = 0x18 + } + if m.CurrentRewards != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.CurrentRewards)) + i-- + dAtA[i] = 0x10 + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DelegationSlash) 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 *DelegationSlash) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DelegationSlash) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Fraction.Size() + i -= size + if _, err := m.Fraction.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintDelegation(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.KIndex != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.KIndex)) + i-- + dAtA[i] = 0x10 + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UndelegationQueueEntry) 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 *UndelegationQueueEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UndelegationQueueEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationTime != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.CreationTime)) + i-- + dAtA[i] = 0x28 + } + if m.Amount != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x20 + } + if len(m.Delegator) > 0 { + i -= len(m.Delegator) + copy(dAtA[i:], m.Delegator) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Delegator))) + i-- + dAtA[i] = 0x1a + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0x12 + } + if m.Index != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueueState) 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 *QueueState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueueState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HighIndex != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.HighIndex)) + i-- + dAtA[i] = 0x10 + } + if m.LowIndex != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.LowIndex)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *RedelegationCooldown) 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 *RedelegationCooldown) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RedelegationCooldown) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationDate != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.CreationDate)) + i-- + dAtA[i] = 0x10 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintDelegation(dAtA []byte, offset int, v uint64) int { + offset -= sovDelegation(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Delegator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + l = len(m.Delegator) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + if m.KIndex != 0 { + n += 1 + sovDelegation(uint64(m.KIndex)) + } + if m.InitialAmount != 0 { + n += 1 + sovDelegation(uint64(m.InitialAmount)) + } + return n +} + +func (m *DelegationEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + if m.KIndex != 0 { + n += 1 + sovDelegation(uint64(m.KIndex)) + } + l = m.Value.Size() + n += 1 + l + sovDelegation(uint64(l)) + return n +} + +func (m *DelegationData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + if m.CurrentRewards != 0 { + n += 1 + sovDelegation(uint64(m.CurrentRewards)) + } + if m.TotalDelegation != 0 { + n += 1 + sovDelegation(uint64(m.TotalDelegation)) + } + if m.LatestIndexK != 0 { + n += 1 + sovDelegation(uint64(m.LatestIndexK)) + } + if m.DelegatorCount != 0 { + n += 1 + sovDelegation(uint64(m.DelegatorCount)) + } + if m.LatestIndexWasUndelegation { + n += 2 + } + return n +} + +func (m *DelegationSlash) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + if m.KIndex != 0 { + n += 1 + sovDelegation(uint64(m.KIndex)) + } + l = m.Fraction.Size() + n += 1 + l + sovDelegation(uint64(l)) + return n +} + +func (m *UndelegationQueueEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Index != 0 { + n += 1 + sovDelegation(uint64(m.Index)) + } + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + l = len(m.Delegator) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovDelegation(uint64(m.Amount)) + } + if m.CreationTime != 0 { + n += 1 + sovDelegation(uint64(m.CreationTime)) + } + return n +} + +func (m *QueueState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LowIndex != 0 { + n += 1 + sovDelegation(uint64(m.LowIndex)) + } + if m.HighIndex != 0 { + n += 1 + sovDelegation(uint64(m.HighIndex)) + } + return n +} + +func (m *RedelegationCooldown) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + if m.CreationDate != 0 { + n += 1 + sovDelegation(uint64(m.CreationDate)) + } + return n +} + +func sovDelegation(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozDelegation(x uint64) (n int) { + return sovDelegation(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Delegator) 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 ErrIntOverflowDelegation + } + 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: Delegator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Delegator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Staker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Delegator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KIndex", wireType) + } + m.KIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.KIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialAmount", wireType) + } + m.InitialAmount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InitialAmount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DelegationEntry) 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 ErrIntOverflowDelegation + } + 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: DelegationEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DelegationEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Staker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KIndex", wireType) + } + m.KIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.KIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DelegationData) 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 ErrIntOverflowDelegation + } + 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: DelegationData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DelegationData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Staker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentRewards", wireType) + } + m.CurrentRewards = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentRewards |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalDelegation", wireType) + } + m.TotalDelegation = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalDelegation |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestIndexK", wireType) + } + m.LatestIndexK = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestIndexK |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorCount", wireType) + } + m.DelegatorCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DelegatorCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestIndexWasUndelegation", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.LatestIndexWasUndelegation = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DelegationSlash) 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 ErrIntOverflowDelegation + } + 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: DelegationSlash: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DelegationSlash: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Staker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KIndex", wireType) + } + m.KIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.KIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fraction", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Fraction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UndelegationQueueEntry) 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 ErrIntOverflowDelegation + } + 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: UndelegationQueueEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UndelegationQueueEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Staker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Delegator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationTime", wireType) + } + m.CreationTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationTime |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueueState) 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 ErrIntOverflowDelegation + } + 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: QueueState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueueState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LowIndex", wireType) + } + m.LowIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LowIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HighIndex", wireType) + } + m.HighIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HighIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RedelegationCooldown) 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 ErrIntOverflowDelegation + } + 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: RedelegationCooldown: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RedelegationCooldown: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationDate", wireType) + } + m.CreationDate = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationDate |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDelegation(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDelegation + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDelegation + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDelegation + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthDelegation + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupDelegation + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthDelegation + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthDelegation = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDelegation = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupDelegation = fmt.Errorf("proto: unexpected end of group") +) diff --git a/app/upgrades/v1_5/v1_4_types/delegation/getters_delegation.go b/app/upgrades/v1_5/v1_4_types/delegation/getters_delegation.go new file mode 100644 index 00000000..79e120a8 --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/delegation/getters_delegation.go @@ -0,0 +1,41 @@ +package delegation + +import ( + "cosmossdk.io/store/prefix" + storeTypes "cosmossdk.io/store/types" + delegationTypes "github.com/KYVENetwork/chain/x/delegation/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func GetAllDelegationEntries(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (list []DelegationEntry) { + store := prefix.NewStore(ctx.KVStore(storeKey), delegationTypes.DelegationEntriesKeyPrefix) + + iterator := storeTypes.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val DelegationEntry + cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} + +// GetAllDelegationData returns all delegationData entries +func GetAllDelegationData(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (list []DelegationData) { + store := prefix.NewStore(ctx.KVStore(storeKey), delegationTypes.DelegationDataKeyPrefix) + + iterator := storeTypes.KVStorePrefixIterator(store, []byte{}) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val DelegationData + cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/app/upgrades/v1_5/v1_4_types/funders/funders.pb.go b/app/upgrades/v1_5/v1_4_types/funders/funders.pb.go new file mode 100644 index 00000000..4fae8e43 --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/funders/funders.pb.go @@ -0,0 +1,1124 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/funders/legacy/funders.proto + +package funders + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Funder is the object which holds info about a single pool funder +type Funder struct { + // address ... + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // moniker ... + Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` + // identity is the 64 bit keybase.io identity string + Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` + // website ... + Website string `protobuf:"bytes,4,opt,name=website,proto3" json:"website,omitempty"` + // contact ... + Contact string `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"` + // description are some additional notes the funder finds important + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` +} + +func (m *Funder) Reset() { *m = Funder{} } +func (m *Funder) String() string { return proto.CompactTextString(m) } +func (*Funder) ProtoMessage() {} +func (*Funder) Descriptor() ([]byte, []int) { + return fileDescriptor_252d80f89b0fa299, []int{0} +} +func (m *Funder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Funder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Funder.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 *Funder) XXX_Merge(src proto.Message) { + xxx_messageInfo_Funder.Merge(m, src) +} +func (m *Funder) XXX_Size() int { + return m.Size() +} +func (m *Funder) XXX_DiscardUnknown() { + xxx_messageInfo_Funder.DiscardUnknown(m) +} + +var xxx_messageInfo_Funder proto.InternalMessageInfo + +func (m *Funder) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Funder) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *Funder) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *Funder) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *Funder) GetContact() string { + if m != nil { + return m.Contact + } + return "" +} + +func (m *Funder) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +// Funding is the object which holds info about the current funding +// funder_address and pool_id (m2m) are unique together which means that +// a funder can only fund each pool once and a pool can only be funded +// by each funder once. However, a funder can update the amount of funds. +type Funding struct { + // funder_id is the id of the funder + FunderAddress string `protobuf:"bytes,1,opt,name=funder_address,json=funderAddress,proto3" json:"funder_address,omitempty"` + // pool_id is the id of the pool this funding is for + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // amount is the amount of funds in ukyve the funder has left + Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` + // amount_per_bundle is the amount of funds in ukyve the funder pays per bundle + AmountPerBundle uint64 `protobuf:"varint,4,opt,name=amount_per_bundle,json=amountPerBundle,proto3" json:"amount_per_bundle,omitempty"` + // total_funded is the total amount of funds in ukyve the funder has funded + TotalFunded uint64 `protobuf:"varint,5,opt,name=total_funded,json=totalFunded,proto3" json:"total_funded,omitempty"` +} + +func (m *Funding) Reset() { *m = Funding{} } +func (m *Funding) String() string { return proto.CompactTextString(m) } +func (*Funding) ProtoMessage() {} +func (*Funding) Descriptor() ([]byte, []int) { + return fileDescriptor_252d80f89b0fa299, []int{1} +} +func (m *Funding) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Funding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Funding.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 *Funding) XXX_Merge(src proto.Message) { + xxx_messageInfo_Funding.Merge(m, src) +} +func (m *Funding) XXX_Size() int { + return m.Size() +} +func (m *Funding) XXX_DiscardUnknown() { + xxx_messageInfo_Funding.DiscardUnknown(m) +} + +var xxx_messageInfo_Funding proto.InternalMessageInfo + +func (m *Funding) GetFunderAddress() string { + if m != nil { + return m.FunderAddress + } + return "" +} + +func (m *Funding) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *Funding) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *Funding) GetAmountPerBundle() uint64 { + if m != nil { + return m.AmountPerBundle + } + return 0 +} + +func (m *Funding) GetTotalFunded() uint64 { + if m != nil { + return m.TotalFunded + } + return 0 +} + +// FundingState is the object which holds info about the funding state of a pool +type FundingState struct { + // pool_id is the id of the pool this funding is for + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // active_funder_addresses is the list of all active fundings + ActiveFunderAddresses []string `protobuf:"bytes,2,rep,name=active_funder_addresses,json=activeFunderAddresses,proto3" json:"active_funder_addresses,omitempty"` +} + +func (m *FundingState) Reset() { *m = FundingState{} } +func (m *FundingState) String() string { return proto.CompactTextString(m) } +func (*FundingState) ProtoMessage() {} +func (*FundingState) Descriptor() ([]byte, []int) { + return fileDescriptor_252d80f89b0fa299, []int{2} +} +func (m *FundingState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FundingState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FundingState.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 *FundingState) XXX_Merge(src proto.Message) { + xxx_messageInfo_FundingState.Merge(m, src) +} +func (m *FundingState) XXX_Size() int { + return m.Size() +} +func (m *FundingState) XXX_DiscardUnknown() { + xxx_messageInfo_FundingState.DiscardUnknown(m) +} + +var xxx_messageInfo_FundingState proto.InternalMessageInfo + +func (m *FundingState) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *FundingState) GetActiveFunderAddresses() []string { + if m != nil { + return m.ActiveFunderAddresses + } + return nil +} + +func init() { + proto.RegisterType((*Funder)(nil), "kyve.funders.legacy.Funder") + proto.RegisterType((*Funding)(nil), "kyve.funders.legacy.Funding") + proto.RegisterType((*FundingState)(nil), "kyve.funders.legacy.FundingState") +} + +func init() { + proto.RegisterFile("kyve/funders/legacy/funders.proto", fileDescriptor_252d80f89b0fa299) +} + +var fileDescriptor_252d80f89b0fa299 = []byte{ + // 386 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x92, 0xd1, 0x8a, 0xd3, 0x40, + 0x14, 0x86, 0x3b, 0xbb, 0x31, 0x75, 0x67, 0x57, 0xc5, 0x41, 0xdd, 0xc1, 0x8b, 0x50, 0x03, 0xc2, + 0x22, 0xd2, 0xb0, 0x08, 0xde, 0x5b, 0xb0, 0x20, 0x82, 0x48, 0x04, 0x41, 0x6f, 0xc2, 0x24, 0x73, + 0x6c, 0x87, 0xb6, 0x33, 0x61, 0xe6, 0xa4, 0xb5, 0x6f, 0xe1, 0x93, 0x88, 0x8f, 0xe1, 0x65, 0x2f, + 0xbd, 0x94, 0xf6, 0x45, 0x96, 0xcc, 0xa4, 0xa5, 0xbd, 0xcb, 0xff, 0xff, 0xe7, 0x90, 0xef, 0x1f, + 0x0e, 0x4d, 0x67, 0xeb, 0x25, 0x64, 0x3f, 0x1a, 0x2d, 0xc1, 0xba, 0x6c, 0x79, 0x5b, 0x02, 0x8a, + 0xdb, 0xbd, 0x1e, 0xd6, 0xd6, 0xa0, 0x61, 0x4f, 0xda, 0x99, 0xe1, 0xde, 0xeb, 0x66, 0xd2, 0xdf, + 0x84, 0xc6, 0x63, 0xef, 0x31, 0x4e, 0xfb, 0x42, 0x4a, 0x0b, 0xce, 0x71, 0x32, 0x20, 0x37, 0x17, + 0xf9, 0x5e, 0xb6, 0xc9, 0xc2, 0x68, 0x35, 0x03, 0xcb, 0xcf, 0x42, 0xd2, 0x49, 0xf6, 0x9c, 0xde, + 0x57, 0x12, 0x34, 0x2a, 0x5c, 0xf3, 0x73, 0x1f, 0x1d, 0x74, 0xbb, 0xb5, 0x82, 0xd2, 0x29, 0x04, + 0x1e, 0x85, 0xad, 0x4e, 0xb6, 0x49, 0x65, 0x34, 0x8a, 0x0a, 0xf9, 0xbd, 0x90, 0x74, 0x92, 0x0d, + 0xe8, 0xa5, 0x04, 0x57, 0x59, 0x55, 0xa3, 0x32, 0x9a, 0xc7, 0x3e, 0x3d, 0xb6, 0xd2, 0x3f, 0x84, + 0xf6, 0x5b, 0x60, 0xa5, 0x27, 0xec, 0x25, 0x7d, 0x18, 0xfa, 0x14, 0xa7, 0xe0, 0x0f, 0x82, 0xfb, + 0xae, 0xc3, 0xbf, 0xa6, 0xfd, 0xda, 0x98, 0x79, 0xa1, 0xa4, 0xc7, 0x8f, 0xf2, 0xb8, 0x95, 0x1f, + 0x24, 0x7b, 0x46, 0x63, 0xb1, 0x30, 0x8d, 0x46, 0xcf, 0x1e, 0xe5, 0x9d, 0x62, 0xaf, 0xe8, 0xe3, + 0xf0, 0x55, 0xd4, 0x60, 0x8b, 0xb2, 0xd1, 0x72, 0x1e, 0x3a, 0x44, 0xf9, 0xa3, 0x10, 0x7c, 0x06, + 0x3b, 0xf2, 0x36, 0x7b, 0x41, 0xaf, 0xd0, 0xa0, 0x98, 0x17, 0xfe, 0x9f, 0xd2, 0x17, 0x8a, 0xf2, + 0x4b, 0xef, 0xf9, 0x87, 0x95, 0x69, 0x41, 0xaf, 0x3a, 0xe2, 0x2f, 0x28, 0x10, 0x8e, 0x79, 0xc8, + 0x09, 0xcf, 0x5b, 0x7a, 0x2d, 0x2a, 0x54, 0x4b, 0x28, 0x4e, 0x6b, 0x81, 0xe3, 0x67, 0x83, 0xf3, + 0x9b, 0x8b, 0xfc, 0x69, 0x88, 0xc7, 0xc7, 0xf5, 0xc0, 0x8d, 0xc6, 0x7f, 0xb7, 0x09, 0xd9, 0x6c, + 0x13, 0xf2, 0x7f, 0x9b, 0x90, 0x5f, 0xbb, 0xa4, 0xb7, 0xd9, 0x25, 0xbd, 0x7f, 0xbb, 0xa4, 0xf7, + 0xfd, 0xf5, 0x44, 0xe1, 0xb4, 0x29, 0x87, 0x95, 0x59, 0x64, 0x1f, 0xbf, 0x7d, 0x7d, 0xff, 0x09, + 0x70, 0x65, 0xec, 0x2c, 0xab, 0xa6, 0x42, 0xe9, 0xec, 0xe7, 0xe1, 0x64, 0x70, 0x5d, 0x83, 0x2b, + 0x63, 0x7f, 0x29, 0x6f, 0xee, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf6, 0x1c, 0xef, 0x4f, 0x4f, 0x02, + 0x00, 0x00, +} + +func (m *Funder) 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 *Funder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Funder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x32 + } + if len(m.Contact) > 0 { + i -= len(m.Contact) + copy(dAtA[i:], m.Contact) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Contact))) + i-- + dAtA[i] = 0x2a + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x22 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x1a + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Funding) 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 *Funding) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Funding) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TotalFunded != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.TotalFunded)) + i-- + dAtA[i] = 0x28 + } + if m.AmountPerBundle != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.AmountPerBundle)) + i-- + dAtA[i] = 0x20 + } + if m.Amount != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x18 + } + if m.PoolId != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if len(m.FunderAddress) > 0 { + i -= len(m.FunderAddress) + copy(dAtA[i:], m.FunderAddress) + i = encodeVarintFunders(dAtA, i, uint64(len(m.FunderAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FundingState) 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 *FundingState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FundingState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ActiveFunderAddresses) > 0 { + for iNdEx := len(m.ActiveFunderAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ActiveFunderAddresses[iNdEx]) + copy(dAtA[i:], m.ActiveFunderAddresses[iNdEx]) + i = encodeVarintFunders(dAtA, i, uint64(len(m.ActiveFunderAddresses[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.PoolId != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintFunders(dAtA []byte, offset int, v uint64) int { + offset -= sovFunders(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Funder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Contact) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + return n +} + +func (m *Funding) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FunderAddress) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovFunders(uint64(m.PoolId)) + } + if m.Amount != 0 { + n += 1 + sovFunders(uint64(m.Amount)) + } + if m.AmountPerBundle != 0 { + n += 1 + sovFunders(uint64(m.AmountPerBundle)) + } + if m.TotalFunded != 0 { + n += 1 + sovFunders(uint64(m.TotalFunded)) + } + return n +} + +func (m *FundingState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovFunders(uint64(m.PoolId)) + } + if len(m.ActiveFunderAddresses) > 0 { + for _, s := range m.ActiveFunderAddresses { + l = len(s) + n += 1 + l + sovFunders(uint64(l)) + } + } + return n +} + +func sovFunders(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozFunders(x uint64) (n int) { + return sovFunders(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Funder) 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 ErrIntOverflowFunders + } + 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: Funder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Funder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Funding) 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 ErrIntOverflowFunders + } + 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: Funding: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Funding: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FunderAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountPerBundle", wireType) + } + m.AmountPerBundle = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AmountPerBundle |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalFunded", wireType) + } + m.TotalFunded = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalFunded |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FundingState) 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 ErrIntOverflowFunders + } + 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: FundingState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FundingState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ActiveFunderAddresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ActiveFunderAddresses = append(m.ActiveFunderAddresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipFunders(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFunders + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFunders + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFunders + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthFunders + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupFunders + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthFunders + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthFunders = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowFunders = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupFunders = fmt.Errorf("proto: unexpected end of group") +) diff --git a/app/upgrades/v1_5/v1_4_types/funders/getters_funding.go b/app/upgrades/v1_5/v1_4_types/funders/getters_funding.go new file mode 100644 index 00000000..c7f3a642 --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/funders/getters_funding.go @@ -0,0 +1,25 @@ +package funders + +import ( + "cosmossdk.io/store/prefix" + storeTypes "cosmossdk.io/store/types" + fundersTypes "github.com/KYVENetwork/chain/x/funders/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetAllFundings returns all fundings +func GetAllFundings(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (fundings []Funding) { + store := prefix.NewStore(ctx.KVStore(storeKey), fundersTypes.FundingKeyPrefixByFunder) + iterator := storeTypes.KVStorePrefixIterator(store, []byte{}) + + //goland:noinspection GoUnhandledErrorResult + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + var val Funding + cdc.MustUnmarshal(iterator.Value(), &val) + fundings = append(fundings, val) + } + + return fundings +} diff --git a/app/upgrades/v1_5/v1_4_types/funders/getters_params.go b/app/upgrades/v1_5/v1_4_types/funders/getters_params.go new file mode 100644 index 00000000..22c35bf9 --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/funders/getters_params.go @@ -0,0 +1,28 @@ +package funders + +import ( + storeTypes "cosmossdk.io/store/types" + "github.com/KYVENetwork/chain/x/funders/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams get all parameters as types.Params +func GetParams(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (params Params) { + store := ctx.KVStore(storeKey) + + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set the params +func SetParams(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey, params Params) { + store := ctx.KVStore(storeKey) + bz := cdc.MustMarshal(¶ms) + store.Set(types.ParamsKey, bz) +} diff --git a/app/upgrades/v1_5/v1_4_types/funders/params.pb.go b/app/upgrades/v1_5/v1_4_types/funders/params.pb.go new file mode 100644 index 00000000..90273155 --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/funders/params.pb.go @@ -0,0 +1,380 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/funders/legacy/params.proto + +package funders + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the funders module parameters. +type Params struct { + // Minimum amount of tokens that can be funded. + MinFundingAmount uint64 `protobuf:"varint,1,opt,name=min_funding_amount,json=minFundingAmount,proto3" json:"min_funding_amount,omitempty"` + // Minimum amount of tokens that can be funded per bundle. + MinFundingAmountPerBundle uint64 `protobuf:"varint,2,opt,name=min_funding_amount_per_bundle,json=minFundingAmountPerBundle,proto3" json:"min_funding_amount_per_bundle,omitempty"` + // Minimum ratio between the funded amount and the amount_per_bundle. + // In other words this param ensures, that a funder provides at least funding for + // `min_funding_multiple` bundles. + MinFundingMultiple uint64 `protobuf:"varint,3,opt,name=min_funding_multiple,json=minFundingMultiple,proto3" json:"min_funding_multiple,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_906a9a55094dc984, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetMinFundingAmount() uint64 { + if m != nil { + return m.MinFundingAmount + } + return 0 +} + +func (m *Params) GetMinFundingAmountPerBundle() uint64 { + if m != nil { + return m.MinFundingAmountPerBundle + } + return 0 +} + +func (m *Params) GetMinFundingMultiple() uint64 { + if m != nil { + return m.MinFundingMultiple + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "kyve.funders.legacy.Params") +} + +func init() { proto.RegisterFile("kyve/funders/legacy/params.proto", fileDescriptor_906a9a55094dc984) } + +var fileDescriptor_906a9a55094dc984 = []byte{ + // 241 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcc, 0xae, 0x2c, 0x4b, + 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, + 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, + 0x29, 0xd1, 0x83, 0x2a, 0xd1, 0x83, 0x2a, 0x51, 0x5a, 0xc5, 0xc8, 0xc5, 0x16, 0x00, 0x56, 0x26, + 0xa4, 0xc3, 0x25, 0x94, 0x9b, 0x99, 0x17, 0x0f, 0x52, 0x91, 0x99, 0x97, 0x1e, 0x9f, 0x98, 0x9b, + 0x5f, 0x9a, 0x57, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x12, 0x24, 0x90, 0x9b, 0x99, 0xe7, 0x06, + 0x91, 0x70, 0x04, 0x8b, 0x0b, 0x39, 0x70, 0xc9, 0x62, 0xaa, 0x8e, 0x2f, 0x48, 0x2d, 0x8a, 0x4f, + 0x2a, 0xcd, 0x4b, 0xc9, 0x49, 0x95, 0x60, 0x02, 0x6b, 0x94, 0x44, 0xd7, 0x18, 0x90, 0x5a, 0xe4, + 0x04, 0x56, 0x20, 0x64, 0xc0, 0x25, 0x82, 0x6c, 0x42, 0x6e, 0x69, 0x4e, 0x49, 0x66, 0x41, 0x4e, + 0xaa, 0x04, 0x33, 0x58, 0xa3, 0x10, 0x42, 0xa3, 0x2f, 0x54, 0xc6, 0xc9, 0xed, 0xc4, 0x23, 0x39, + 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, + 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x74, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, + 0xf3, 0x73, 0xf5, 0xbd, 0x23, 0xc3, 0x5c, 0xfd, 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xf5, 0x93, + 0x33, 0x12, 0x33, 0xf3, 0xf4, 0x2b, 0xe0, 0x21, 0x53, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, + 0x0e, 0x11, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x66, 0xb6, 0xfa, 0xe0, 0x36, 0x01, 0x00, + 0x00, +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MinFundingMultiple != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinFundingMultiple)) + i-- + dAtA[i] = 0x18 + } + if m.MinFundingAmountPerBundle != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinFundingAmountPerBundle)) + i-- + dAtA[i] = 0x10 + } + if m.MinFundingAmount != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinFundingAmount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MinFundingAmount != 0 { + n += 1 + sovParams(uint64(m.MinFundingAmount)) + } + if m.MinFundingAmountPerBundle != 0 { + n += 1 + sovParams(uint64(m.MinFundingAmountPerBundle)) + } + if m.MinFundingMultiple != 0 { + n += 1 + sovParams(uint64(m.MinFundingMultiple)) + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinFundingAmount", wireType) + } + m.MinFundingAmount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinFundingAmount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinFundingAmountPerBundle", wireType) + } + m.MinFundingAmountPerBundle = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinFundingAmountPerBundle |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinFundingMultiple", wireType) + } + m.MinFundingMultiple = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinFundingMultiple |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/app/upgrades/v1_5/v1_4_types/pool/getters_pool.go b/app/upgrades/v1_5/v1_4_types/pool/getters_pool.go new file mode 100644 index 00000000..4b66c4ce --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/pool/getters_pool.go @@ -0,0 +1,18 @@ +package pool + +import ( + storeTypes "cosmossdk.io/store/types" + "github.com/KYVENetwork/chain/x/pool/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams returns the x/pool params from state. +func GetParams(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (params types.Params) { + bz := ctx.KVStore(storeKey).Get(types.ParamsKey) + if bz != nil { + cdc.MustUnmarshal(bz, ¶ms) + } + + return +} diff --git a/app/upgrades/v1_5/v1_4_types/pool/params.pb.go b/app/upgrades/v1_5/v1_4_types/pool/params.pb.go new file mode 100644 index 00000000..1441026d --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/pool/params.pb.go @@ -0,0 +1,367 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/pool/v1beta1/params.proto + +package pool + +import ( + math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the pool module parameters. +type Params struct { + // protocol_inflation_share ... + ProtocolInflationShare math.LegacyDec `protobuf:"bytes,1,opt,name=protocol_inflation_share,json=protocolInflationShare,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"protocol_inflation_share"` + // pool_inflation_payout_rate ... + PoolInflationPayoutRate math.LegacyDec `protobuf:"bytes,2,opt,name=pool_inflation_payout_rate,json=poolInflationPayoutRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"pool_inflation_payout_rate"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_7d8646dfa6da3b4d, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Params)(nil), "kyve.pool.legacy.Params") +} + +func init() { proto.RegisterFile("kyve/pool/legacy/params.proto", fileDescriptor_7d8646dfa6da3b4d) } + +var fileDescriptor_7d8646dfa6da3b4d = []byte{ + // 268 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcb, 0xae, 0x2c, 0x4b, + 0xd5, 0x2f, 0xc8, 0xcf, 0xcf, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x48, + 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x04, 0xc9, 0xeb, 0x81, + 0xe4, 0xf5, 0xa0, 0xf2, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x59, 0x7d, 0x10, 0x0b, 0xa2, + 0x50, 0xe9, 0x3e, 0x23, 0x17, 0x5b, 0x00, 0x58, 0xa7, 0x50, 0x06, 0x97, 0x04, 0x58, 0x2c, 0x39, + 0x3f, 0x27, 0x3e, 0x33, 0x2f, 0x2d, 0x27, 0xb1, 0x24, 0x33, 0x3f, 0x2f, 0xbe, 0x38, 0x23, 0xb1, + 0x28, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0xd3, 0x49, 0xef, 0xc4, 0x3d, 0x79, 0x86, 0x5b, 0xf7, + 0xe4, 0xd5, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x93, 0xf3, 0x8b, + 0x73, 0xf3, 0x8b, 0xa1, 0x94, 0x6e, 0x71, 0x4a, 0xb6, 0x7e, 0x49, 0x65, 0x41, 0x6a, 0xb1, 0x9e, + 0x4b, 0x6a, 0x72, 0x90, 0x18, 0xcc, 0x3c, 0x4f, 0x98, 0x71, 0xc1, 0x20, 0xd3, 0x84, 0xb2, 0xb9, + 0xa4, 0x40, 0x4e, 0x43, 0xb2, 0xa5, 0x20, 0xb1, 0x32, 0xbf, 0xb4, 0x24, 0xbe, 0x28, 0xb1, 0x24, + 0x55, 0x82, 0x89, 0x2c, 0xbb, 0xc4, 0x41, 0x26, 0xc2, 0xed, 0x09, 0x00, 0x9b, 0x17, 0x94, 0x58, + 0x92, 0xea, 0xe4, 0x7c, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, + 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x9a, 0x48, + 0x46, 0x7b, 0x47, 0x86, 0xb9, 0xfa, 0xa5, 0x96, 0x94, 0xe7, 0x17, 0x65, 0xeb, 0x27, 0x67, 0x24, + 0x66, 0xe6, 0xe9, 0x57, 0x40, 0x82, 0x17, 0x6c, 0x43, 0x12, 0x1b, 0xd8, 0x27, 0xc6, 0x80, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xd3, 0x1a, 0xf2, 0x59, 0x78, 0x01, 0x00, 0x00, +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.PoolInflationPayoutRate.Size() + i -= size + if _, err := m.PoolInflationPayoutRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.ProtocolInflationShare.Size() + i -= size + if _, err := m.ProtocolInflationShare.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ProtocolInflationShare.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.PoolInflationPayoutRate.Size() + n += 1 + l + sovParams(uint64(l)) + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProtocolInflationShare", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProtocolInflationShare.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolInflationPayoutRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PoolInflationPayoutRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/app/upgrades/v1_5/v1_4_types/stakers/getters_staker.go b/app/upgrades/v1_5/v1_4_types/stakers/getters_staker.go new file mode 100644 index 00000000..331ae6a8 --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/stakers/getters_staker.go @@ -0,0 +1,27 @@ +package stakers + +import ( + "cosmossdk.io/store/prefix" + storeTypes "cosmossdk.io/store/types" + stakersTypes "github.com/KYVENetwork/chain/x/stakers/types" + "github.com/cosmos/cosmos-sdk/codec" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetAllStakers returns all staker +func GetAllStakers(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (list []Staker) { + store := prefix.NewStore(ctx.KVStore(storeKey), stakersTypes.StakerKeyPrefix) + + iterator := storeTypes.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val Staker + cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/app/upgrades/v1_5/v1_4_types/stakers/stakers.pb.go b/app/upgrades/v1_5/v1_4_types/stakers/stakers.pb.go new file mode 100644 index 00000000..32a2751b --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/stakers/stakers.pb.go @@ -0,0 +1,1811 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/stakers/legacy/stakers.proto + +package stakers + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Staker contains all metadata for a staker +// Every address can only create one staker (itself) +type Staker struct { + // address ... + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // commission ... + Commission cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=commission,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"commission"` + // moniker ... + Moniker string `protobuf:"bytes,3,opt,name=moniker,proto3" json:"moniker,omitempty"` + // website ... + Website string `protobuf:"bytes,4,opt,name=website,proto3" json:"website,omitempty"` + // identity is the 64 bit keybase.io identity string + Identity string `protobuf:"bytes,5,opt,name=identity,proto3" json:"identity,omitempty"` + // security_contact ... + SecurityContact string `protobuf:"bytes,6,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty"` + // details are some additional notes the staker finds important + Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` + // commission_rewards are the rewards in $KYVE earned through commission + CommissionRewards uint64 `protobuf:"varint,8,opt,name=commission_rewards,json=commissionRewards,proto3" json:"commission_rewards,omitempty"` +} + +func (m *Staker) Reset() { *m = Staker{} } +func (m *Staker) String() string { return proto.CompactTextString(m) } +func (*Staker) ProtoMessage() {} +func (*Staker) Descriptor() ([]byte, []int) { + return fileDescriptor_d209d1a2a74d375d, []int{0} +} +func (m *Staker) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Staker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Staker.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 *Staker) XXX_Merge(src proto.Message) { + xxx_messageInfo_Staker.Merge(m, src) +} +func (m *Staker) XXX_Size() int { + return m.Size() +} +func (m *Staker) XXX_DiscardUnknown() { + xxx_messageInfo_Staker.DiscardUnknown(m) +} + +var xxx_messageInfo_Staker proto.InternalMessageInfo + +func (m *Staker) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Staker) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *Staker) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *Staker) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *Staker) GetSecurityContact() string { + if m != nil { + return m.SecurityContact + } + return "" +} + +func (m *Staker) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +func (m *Staker) GetCommissionRewards() uint64 { + if m != nil { + return m.CommissionRewards + } + return 0 +} + +// Valaccount gets authorized by a staker to +// vote in a given pool by favor of the staker. +type Valaccount struct { + // pool_id defines the pool in which the address + // is allowed to vote in. + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // staker is the address the valaccount is voting for. + Staker string `protobuf:"bytes,2,opt,name=staker,proto3" json:"staker,omitempty"` + // valaddress is the account stored on the protocol + // node which votes for the staker in the given pool + Valaddress string `protobuf:"bytes,3,opt,name=valaddress,proto3" json:"valaddress,omitempty"` + // When a node is inactive (does not vote at all) + // A point is added, after a certain amount of points + // is reached the node gets kicked out. + Points uint64 `protobuf:"varint,4,opt,name=points,proto3" json:"points,omitempty"` + // isLeaving indicates if a staker is leaving the given pool. + IsLeaving bool `protobuf:"varint,5,opt,name=is_leaving,json=isLeaving,proto3" json:"is_leaving,omitempty"` +} + +func (m *Valaccount) Reset() { *m = Valaccount{} } +func (m *Valaccount) String() string { return proto.CompactTextString(m) } +func (*Valaccount) ProtoMessage() {} +func (*Valaccount) Descriptor() ([]byte, []int) { + return fileDescriptor_d209d1a2a74d375d, []int{1} +} +func (m *Valaccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Valaccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Valaccount.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 *Valaccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_Valaccount.Merge(m, src) +} +func (m *Valaccount) XXX_Size() int { + return m.Size() +} +func (m *Valaccount) XXX_DiscardUnknown() { + xxx_messageInfo_Valaccount.DiscardUnknown(m) +} + +var xxx_messageInfo_Valaccount proto.InternalMessageInfo + +func (m *Valaccount) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *Valaccount) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *Valaccount) GetValaddress() string { + if m != nil { + return m.Valaddress + } + return "" +} + +func (m *Valaccount) GetPoints() uint64 { + if m != nil { + return m.Points + } + return 0 +} + +func (m *Valaccount) GetIsLeaving() bool { + if m != nil { + return m.IsLeaving + } + return false +} + +// CommissionChangeEntry stores the information for an +// upcoming commission change. A commission change is never +// instant, so delegators have time to redelegate in case +// they don't agree with the new commission. +type CommissionChangeEntry struct { + // index is needed for the queue-algorithm which + // processes the commission changes + Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + // staker is the address of the affected staker + Staker string `protobuf:"bytes,2,opt,name=staker,proto3" json:"staker,omitempty"` + // commission is the new commission which will + // be applied after the waiting time is over. + Commission cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=commission,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"commission"` + // creation_date is the UNIX-timestamp in seconds + // when the entry was created. + CreationDate int64 `protobuf:"varint,4,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"` +} + +func (m *CommissionChangeEntry) Reset() { *m = CommissionChangeEntry{} } +func (m *CommissionChangeEntry) String() string { return proto.CompactTextString(m) } +func (*CommissionChangeEntry) ProtoMessage() {} +func (*CommissionChangeEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_d209d1a2a74d375d, []int{2} +} +func (m *CommissionChangeEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommissionChangeEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CommissionChangeEntry.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 *CommissionChangeEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommissionChangeEntry.Merge(m, src) +} +func (m *CommissionChangeEntry) XXX_Size() int { + return m.Size() +} +func (m *CommissionChangeEntry) XXX_DiscardUnknown() { + xxx_messageInfo_CommissionChangeEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_CommissionChangeEntry proto.InternalMessageInfo + +func (m *CommissionChangeEntry) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *CommissionChangeEntry) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *CommissionChangeEntry) GetCreationDate() int64 { + if m != nil { + return m.CreationDate + } + return 0 +} + +// LeavePoolEntry stores the information for an upcoming +// pool leave. A staker can't leave a pool instantly. +// Instead a the `LeaveTime` needs to be awaited. +// If a staker start to leave a pool, it will be shown +// in the UI to the delegators. +type LeavePoolEntry struct { + // index is needed for the queue-algorithm which + // processes the commission changes + Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + // staker is the address of the affected staker + Staker string `protobuf:"bytes,2,opt,name=staker,proto3" json:"staker,omitempty"` + // pool_id indicates the pool the staker wants to leave + PoolId uint64 `protobuf:"varint,3,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // creation_date is the UNIX-timestamp in seconds + // when the entry was created. + CreationDate int64 `protobuf:"varint,4,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"` +} + +func (m *LeavePoolEntry) Reset() { *m = LeavePoolEntry{} } +func (m *LeavePoolEntry) String() string { return proto.CompactTextString(m) } +func (*LeavePoolEntry) ProtoMessage() {} +func (*LeavePoolEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_d209d1a2a74d375d, []int{3} +} +func (m *LeavePoolEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeavePoolEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeavePoolEntry.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 *LeavePoolEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeavePoolEntry.Merge(m, src) +} +func (m *LeavePoolEntry) XXX_Size() int { + return m.Size() +} +func (m *LeavePoolEntry) XXX_DiscardUnknown() { + xxx_messageInfo_LeavePoolEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_LeavePoolEntry proto.InternalMessageInfo + +func (m *LeavePoolEntry) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *LeavePoolEntry) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *LeavePoolEntry) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *LeavePoolEntry) GetCreationDate() int64 { + if m != nil { + return m.CreationDate + } + return 0 +} + +// UnbondingState stores the state for the unbonding of stakes and delegations. +type QueueState struct { + // low_index is the tail of the queue. It is the + // oldest entry in the queue. If this entry isn't + // due, non of the other entries is. + LowIndex uint64 `protobuf:"varint,1,opt,name=low_index,json=lowIndex,proto3" json:"low_index,omitempty"` + // high_index is the head of the queue. New entries + // are added to the top. + HighIndex uint64 `protobuf:"varint,2,opt,name=high_index,json=highIndex,proto3" json:"high_index,omitempty"` +} + +func (m *QueueState) Reset() { *m = QueueState{} } +func (m *QueueState) String() string { return proto.CompactTextString(m) } +func (*QueueState) ProtoMessage() {} +func (*QueueState) Descriptor() ([]byte, []int) { + return fileDescriptor_d209d1a2a74d375d, []int{4} +} +func (m *QueueState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueueState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueueState.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 *QueueState) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueueState.Merge(m, src) +} +func (m *QueueState) XXX_Size() int { + return m.Size() +} +func (m *QueueState) XXX_DiscardUnknown() { + xxx_messageInfo_QueueState.DiscardUnknown(m) +} + +var xxx_messageInfo_QueueState proto.InternalMessageInfo + +func (m *QueueState) GetLowIndex() uint64 { + if m != nil { + return m.LowIndex + } + return 0 +} + +func (m *QueueState) GetHighIndex() uint64 { + if m != nil { + return m.HighIndex + } + return 0 +} + +func init() { + proto.RegisterType((*Staker)(nil), "kyve.stakers.legacy.Staker") + proto.RegisterType((*Valaccount)(nil), "kyve.stakers.legacy.Valaccount") + proto.RegisterType((*CommissionChangeEntry)(nil), "kyve.stakers.legacy.CommissionChangeEntry") + proto.RegisterType((*LeavePoolEntry)(nil), "kyve.stakers.legacy.LeavePoolEntry") + proto.RegisterType((*QueueState)(nil), "kyve.stakers.legacy.QueueState") +} + +func init() { + proto.RegisterFile("kyve/stakers/legacy/stakers.proto", fileDescriptor_d209d1a2a74d375d) +} + +var fileDescriptor_d209d1a2a74d375d = []byte{ + // 536 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcb, 0x6a, 0xdb, 0x40, + 0x14, 0xb5, 0x62, 0xc7, 0x8f, 0x4b, 0x9f, 0x83, 0xdb, 0x8a, 0x84, 0x28, 0xc1, 0xd9, 0xa4, 0xd0, + 0x5a, 0x84, 0xfe, 0x41, 0x9c, 0x94, 0x86, 0x86, 0xd2, 0x2a, 0x10, 0x68, 0x37, 0x66, 0x3c, 0xba, + 0x48, 0x83, 0x25, 0x8d, 0xd1, 0x8c, 0xed, 0x08, 0xfa, 0x11, 0x5d, 0xf4, 0x2f, 0xba, 0xe8, 0x6f, + 0x64, 0x99, 0x65, 0xe9, 0x22, 0x14, 0xfb, 0x47, 0xca, 0xcc, 0x48, 0x8e, 0xb3, 0x28, 0x94, 0xec, + 0x74, 0x1e, 0xba, 0xf7, 0x70, 0x2e, 0x03, 0xbd, 0x71, 0x31, 0x43, 0x5f, 0x2a, 0x3a, 0xc6, 0x5c, + 0xfa, 0xb3, 0xc3, 0x11, 0x2a, 0x7a, 0x58, 0xe1, 0xfe, 0x24, 0x17, 0x4a, 0x90, 0xae, 0xf6, 0xf4, + 0x2b, 0xae, 0xf4, 0x6c, 0x75, 0x23, 0x11, 0x09, 0x63, 0xf0, 0xf5, 0x97, 0xf5, 0xf6, 0x7e, 0x6c, + 0x40, 0xf3, 0xdc, 0x38, 0x89, 0x0b, 0x2d, 0x1a, 0x86, 0x39, 0x4a, 0xe9, 0x3a, 0x7b, 0xce, 0x41, + 0x27, 0xa8, 0x20, 0x19, 0x00, 0x30, 0x91, 0xa6, 0x5c, 0x4a, 0x2e, 0x32, 0x77, 0x43, 0x8b, 0x47, + 0xfb, 0x57, 0x37, 0xbb, 0xb5, 0xdf, 0x37, 0xbb, 0xdb, 0x4c, 0xc8, 0x54, 0x48, 0x19, 0x8e, 0xfb, + 0x5c, 0xf8, 0x29, 0x55, 0x71, 0xff, 0x0c, 0x23, 0xca, 0x8a, 0x63, 0x64, 0xc1, 0xda, 0x6f, 0x7a, + 0x7c, 0x2a, 0x32, 0x3e, 0xc6, 0xdc, 0xad, 0xdb, 0xf1, 0x25, 0xd4, 0xca, 0x1c, 0x47, 0x92, 0x2b, + 0x74, 0x1b, 0x56, 0x29, 0x21, 0xd9, 0x82, 0x36, 0x0f, 0x31, 0x53, 0x5c, 0x15, 0xee, 0xa6, 0x91, + 0x56, 0x98, 0xbc, 0x84, 0x27, 0x12, 0xd9, 0x34, 0xe7, 0xaa, 0x18, 0x32, 0x91, 0x29, 0xca, 0x94, + 0xdb, 0x34, 0x9e, 0xc7, 0x15, 0x3f, 0xb0, 0xb4, 0x5e, 0x10, 0xa2, 0xa2, 0x3c, 0x91, 0x6e, 0xcb, + 0x2e, 0x28, 0x21, 0x79, 0x0d, 0xe4, 0x36, 0xe2, 0x30, 0xc7, 0x39, 0xcd, 0x43, 0xe9, 0xb6, 0xf7, + 0x9c, 0x83, 0x46, 0xf0, 0xf4, 0x56, 0x09, 0xac, 0xd0, 0xfb, 0xee, 0x00, 0x5c, 0xd0, 0x84, 0x32, + 0x26, 0xa6, 0x99, 0x22, 0x2f, 0xa0, 0x35, 0x11, 0x22, 0x19, 0xf2, 0xd0, 0x34, 0xd6, 0x08, 0x9a, + 0x1a, 0x9e, 0x86, 0xe4, 0x39, 0x34, 0x6d, 0xfd, 0xb6, 0xac, 0xa0, 0x44, 0xc4, 0x03, 0x98, 0xd1, + 0xa4, 0x6a, 0xd9, 0xd6, 0xb0, 0xc6, 0xe8, 0xff, 0x26, 0x82, 0x67, 0x4a, 0x9a, 0x22, 0xcc, 0x3c, + 0x8d, 0xc8, 0x0e, 0x00, 0x97, 0xc3, 0x04, 0xe9, 0x8c, 0x67, 0x91, 0x69, 0xa2, 0x1d, 0x74, 0xb8, + 0x3c, 0xb3, 0x44, 0xef, 0xa7, 0x03, 0xcf, 0x06, 0xab, 0xb0, 0x83, 0x98, 0x66, 0x11, 0x9e, 0x64, + 0x2a, 0x2f, 0x48, 0x17, 0x36, 0x79, 0x16, 0xe2, 0x65, 0x99, 0xcf, 0x82, 0x7f, 0xc6, 0xbb, 0x7b, + 0xe7, 0xfa, 0xfd, 0xee, 0xbc, 0x0f, 0x0f, 0x59, 0x8e, 0x54, 0xe9, 0x42, 0x43, 0x5a, 0xde, 0xb4, + 0x1e, 0x3c, 0xa8, 0xc8, 0x63, 0xaa, 0xb0, 0xf7, 0x15, 0x1e, 0xe9, 0xf0, 0xf8, 0x51, 0x88, 0xe4, + 0x3e, 0x49, 0xd7, 0x9a, 0xaf, 0xdf, 0x69, 0xfe, 0xbf, 0xb6, 0xbf, 0x03, 0xf8, 0x34, 0xc5, 0x29, + 0x9e, 0x2b, 0xaa, 0x90, 0x6c, 0x43, 0x27, 0x11, 0xf3, 0xe1, 0xfa, 0xf6, 0x76, 0x22, 0xe6, 0xa7, + 0x26, 0xc0, 0x0e, 0x40, 0xcc, 0xa3, 0xb8, 0x54, 0x37, 0x8c, 0xda, 0xd1, 0x8c, 0x91, 0x8f, 0xde, + 0x5e, 0x2d, 0x3c, 0xe7, 0x7a, 0xe1, 0x39, 0x7f, 0x16, 0x9e, 0xf3, 0x6d, 0xe9, 0xd5, 0xae, 0x97, + 0x5e, 0xed, 0xd7, 0xd2, 0xab, 0x7d, 0x79, 0x15, 0x71, 0x15, 0x4f, 0x47, 0x7d, 0x26, 0x52, 0xff, + 0xfd, 0xe7, 0x8b, 0x93, 0x0f, 0xa8, 0xe6, 0x22, 0x1f, 0xfb, 0x2c, 0xa6, 0x3c, 0xf3, 0x2f, 0x57, + 0x4f, 0x58, 0x15, 0x13, 0x94, 0xa3, 0xa6, 0x79, 0x8d, 0x6f, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, + 0xcb, 0x5e, 0xbc, 0x8d, 0xdf, 0x03, 0x00, 0x00, +} + +func (m *Staker) 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 *Staker) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Staker) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CommissionRewards != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.CommissionRewards)) + i-- + dAtA[i] = 0x40 + } + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x3a + } + if len(m.SecurityContact) > 0 { + i -= len(m.SecurityContact) + copy(dAtA[i:], m.SecurityContact) + i = encodeVarintStakers(dAtA, i, uint64(len(m.SecurityContact))) + i-- + dAtA[i] = 0x32 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x2a + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x22 + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x1a + } + { + size := m.Commission.Size() + i -= size + if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStakers(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Valaccount) 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 *Valaccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Valaccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsLeaving { + i-- + if m.IsLeaving { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.Points != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.Points)) + i-- + dAtA[i] = 0x20 + } + if len(m.Valaddress) > 0 { + i -= len(m.Valaddress) + copy(dAtA[i:], m.Valaddress) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Valaddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0x12 + } + if m.PoolId != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *CommissionChangeEntry) 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 *CommissionChangeEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommissionChangeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationDate != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.CreationDate)) + i-- + dAtA[i] = 0x20 + } + { + size := m.Commission.Size() + i -= size + if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStakers(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0x12 + } + if m.Index != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *LeavePoolEntry) 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 *LeavePoolEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeavePoolEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationDate != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.CreationDate)) + i-- + dAtA[i] = 0x20 + } + if m.PoolId != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x18 + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0x12 + } + if m.Index != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueueState) 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 *QueueState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueueState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HighIndex != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.HighIndex)) + i-- + dAtA[i] = 0x10 + } + if m.LowIndex != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.LowIndex)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintStakers(dAtA []byte, offset int, v uint64) int { + offset -= sovStakers(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Staker) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = m.Commission.Size() + n += 1 + l + sovStakers(uint64(l)) + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = len(m.SecurityContact) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + if m.CommissionRewards != 0 { + n += 1 + sovStakers(uint64(m.CommissionRewards)) + } + return n +} + +func (m *Valaccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovStakers(uint64(m.PoolId)) + } + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = len(m.Valaddress) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + if m.Points != 0 { + n += 1 + sovStakers(uint64(m.Points)) + } + if m.IsLeaving { + n += 2 + } + return n +} + +func (m *CommissionChangeEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Index != 0 { + n += 1 + sovStakers(uint64(m.Index)) + } + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = m.Commission.Size() + n += 1 + l + sovStakers(uint64(l)) + if m.CreationDate != 0 { + n += 1 + sovStakers(uint64(m.CreationDate)) + } + return n +} + +func (m *LeavePoolEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Index != 0 { + n += 1 + sovStakers(uint64(m.Index)) + } + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovStakers(uint64(m.PoolId)) + } + if m.CreationDate != 0 { + n += 1 + sovStakers(uint64(m.CreationDate)) + } + return n +} + +func (m *QueueState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LowIndex != 0 { + n += 1 + sovStakers(uint64(m.LowIndex)) + } + if m.HighIndex != 0 { + n += 1 + sovStakers(uint64(m.HighIndex)) + } + return n +} + +func sovStakers(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStakers(x uint64) (n int) { + return sovStakers(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Staker) 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 ErrIntOverflowStakers + } + 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: Staker: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Staker: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SecurityContact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CommissionRewards", wireType) + } + m.CommissionRewards = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CommissionRewards |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStakers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Valaccount) 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 ErrIntOverflowStakers + } + 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: Valaccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Valaccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Staker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Valaddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Valaddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Points", wireType) + } + m.Points = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Points |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsLeaving", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsLeaving = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipStakers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommissionChangeEntry) 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 ErrIntOverflowStakers + } + 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: CommissionChangeEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommissionChangeEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Staker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationDate", wireType) + } + m.CreationDate = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationDate |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStakers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LeavePoolEntry) 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 ErrIntOverflowStakers + } + 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: LeavePoolEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LeavePoolEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Staker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationDate", wireType) + } + m.CreationDate = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationDate |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStakers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueueState) 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 ErrIntOverflowStakers + } + 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: QueueState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueueState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LowIndex", wireType) + } + m.LowIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LowIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HighIndex", wireType) + } + m.HighIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HighIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStakers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStakers(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStakers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStakers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStakers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthStakers + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStakers + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStakers + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStakers = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStakers = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStakers = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/funders/keeper/keeper_test.go b/x/funders/keeper/keeper_test.go index 6d2ee851..281c350a 100644 --- a/x/funders/keeper/keeper_test.go +++ b/x/funders/keeper/keeper_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/KYVENetwork/chain/x/team/types" + "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/x/stakers/keeper/keeper.go b/x/stakers/keeper/keeper.go index 8d362475..6a850686 100644 --- a/x/stakers/keeper/keeper.go +++ b/x/stakers/keeper/keeper.go @@ -3,6 +3,8 @@ package keeper import ( "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/core/store" "github.com/KYVENetwork/chain/util" @@ -68,3 +70,8 @@ func SetDelegationKeeper(k *Keeper, delegationKeeper delegationKeeper.Keeper) { func (k Keeper) Logger() log.Logger { return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +// TODO: remove after migration +func (k Keeper) Migration_SetStaker(ctx sdk.Context, staker types.Staker) { + k.setStaker(ctx, staker) +}