From 8d340d261cbdcc49323f7d4d31a13c8eba6fc147 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Wed, 12 Feb 2025 15:22:32 +0100 Subject: [PATCH] chore: add spec files and small nits --- .../multi_coin_rewards/v1beta1/events.proto | 12 +- .../multi_coin_rewards/v1beta1/params.proto | 7 +- x/multi_coin_rewards/client/cli/query.go | 1 - x/multi_coin_rewards/genesis.go | 5 +- x/multi_coin_rewards/keeper/getters_queue.go | 4 +- x/multi_coin_rewards/keeper/grpc_query.go | 2 +- x/multi_coin_rewards/keeper/keeper.go | 4 +- .../keeper/keeper_suite_test.go | 2 +- .../keeper/logic_distribution.go | 30 +- .../keeper/logic_distribution_test.go | 1 - .../keeper/msg_server_toggle.go | 11 +- .../keeper/msg_server_update_params.go | 4 +- x/multi_coin_rewards/spec/01_concepts.md | 39 +++ x/multi_coin_rewards/spec/02_state.md | 47 +++ x/multi_coin_rewards/spec/03_messages.md | 16 + x/multi_coin_rewards/spec/04_begin_block.md | 9 + x/multi_coin_rewards/spec/05_params.md | 12 + x/multi_coin_rewards/spec/06_events.md | 31 ++ x/multi_coin_rewards/spec/07_exported.md | 17 + x/multi_coin_rewards/types/events.pb.go | 307 +++++++++++++++++- x/multi_coin_rewards/types/keys.go | 17 +- .../message_set_multi_coin_refund_policy.go | 6 +- .../message_toggle_multi_coin_rewards.go | 2 +- x/multi_coin_rewards/types/params.pb.go | 51 +-- 24 files changed, 552 insertions(+), 85 deletions(-) create mode 100644 x/multi_coin_rewards/spec/01_concepts.md create mode 100644 x/multi_coin_rewards/spec/02_state.md create mode 100644 x/multi_coin_rewards/spec/03_messages.md create mode 100644 x/multi_coin_rewards/spec/04_begin_block.md create mode 100644 x/multi_coin_rewards/spec/05_params.md create mode 100644 x/multi_coin_rewards/spec/06_events.md create mode 100644 x/multi_coin_rewards/spec/07_exported.md diff --git a/proto/kyve/multi_coin_rewards/v1beta1/events.proto b/proto/kyve/multi_coin_rewards/v1beta1/events.proto index de9b499a..904e024d 100644 --- a/proto/kyve/multi_coin_rewards/v1beta1/events.proto +++ b/proto/kyve/multi_coin_rewards/v1beta1/events.proto @@ -18,4 +18,14 @@ message EventUpdateParams { string payload = 3; } -// TODO add events +// EventToggleMultiCoinRewards ... +message EventToggleMultiCoinRewards { + // address ... + string address = 1; + + // enabled ... + bool enabled = 2; + + // pending_rewards_claimed ... + string pending_rewards_claimed = 3; +} diff --git a/proto/kyve/multi_coin_rewards/v1beta1/params.proto b/proto/kyve/multi_coin_rewards/v1beta1/params.proto index 546ce4f8..c3e842c5 100644 --- a/proto/kyve/multi_coin_rewards/v1beta1/params.proto +++ b/proto/kyve/multi_coin_rewards/v1beta1/params.proto @@ -7,9 +7,10 @@ option go_package = "github.com/KYVENetwork/chain/x/multi_coin_rewards/types"; // Params defines the multi_coin_rewards module parameters. message Params { // multi_coin_distribution_policy_admin_address specifies an address which is allowed to adjust the weights for - // the coin redistribution. This address can now drain coins, but only - string multi_coin_distribution_policy_admin_address = 7; + // the coin redistribution. This address can not drain coins, but only modify the in which pools coins + // get re-distributed. + string multi_coin_distribution_policy_admin_address = 1; // multi_coin_distribution_pending_time ... - uint64 multi_coin_distribution_pending_time = 8; + uint64 multi_coin_distribution_pending_time = 2; } diff --git a/x/multi_coin_rewards/client/cli/query.go b/x/multi_coin_rewards/client/cli/query.go index 20669f0f..7b2b88ef 100644 --- a/x/multi_coin_rewards/client/cli/query.go +++ b/x/multi_coin_rewards/client/cli/query.go @@ -16,7 +16,6 @@ import ( // GetQueryCmd returns the cli query commands for this module func GetQueryCmd(queryRoute string) *cobra.Command { - // Group stakers queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), diff --git a/x/multi_coin_rewards/genesis.go b/x/multi_coin_rewards/genesis.go index 4875d1bb..ff4813a3 100644 --- a/x/multi_coin_rewards/genesis.go +++ b/x/multi_coin_rewards/genesis.go @@ -34,7 +34,10 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis.QueueStatePendingRewards = k.GetQueueState(ctx, types.QUEUE_IDENTIFIER_MULTI_COIN_REWARDS) - policy, _ := k.MultiCoinDistributionPolicy.Get(ctx) + policy, err := k.MultiCoinDistributionPolicy.Get(ctx) + if err != nil { + panic(err) + } genesis.MultiCoinDistributionPolicy = &policy genesis.MultiCoinEnabled = k.GetAllEnabledMultiCoinAddresses(ctx) diff --git a/x/multi_coin_rewards/keeper/getters_queue.go b/x/multi_coin_rewards/keeper/getters_queue.go index c56a97df..1283b63c 100644 --- a/x/multi_coin_rewards/keeper/getters_queue.go +++ b/x/multi_coin_rewards/keeper/getters_queue.go @@ -6,8 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// GetQueueState returns a queue state object based on the identifier as -// there are multiple queues present in the stakers module +// GetQueueState returns a queue state object based on the identifier func (k Keeper) GetQueueState(ctx sdk.Context, identifier types.QUEUE_IDENTIFIER) (state types.QueueState) { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) b := store.Get(identifier) @@ -21,7 +20,6 @@ func (k Keeper) GetQueueState(ctx sdk.Context, identifier types.QUEUE_IDENTIFIER } // SetQueueState sets a endBlocker queue state based on the identifier. -// The identifier is used to distinguish between different queues. func (k Keeper) SetQueueState(ctx sdk.Context, identifier types.QUEUE_IDENTIFIER, state types.QueueState) { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) b := k.cdc.MustMarshal(&state) diff --git a/x/multi_coin_rewards/keeper/grpc_query.go b/x/multi_coin_rewards/keeper/grpc_query.go index 31307e4e..1a1f8de4 100644 --- a/x/multi_coin_rewards/keeper/grpc_query.go +++ b/x/multi_coin_rewards/keeper/grpc_query.go @@ -26,7 +26,7 @@ func (k Keeper) MultiCoinDistributionPolicyQuery(ctx context.Context, request *t if err != nil { return nil, err } - return &types.QueryMultiCoinDistributionPolicyResponse{Policy: policy}, err + return &types.QueryMultiCoinDistributionPolicyResponse{Policy: policy}, nil } func (k Keeper) MultiCoinStatus(ctx context.Context, request *types.QueryMultiCoinStatusRequest) (*types.QueryMultiCoinStatusResponse, error) { diff --git a/x/multi_coin_rewards/keeper/keeper.go b/x/multi_coin_rewards/keeper/keeper.go index 03dfb7c5..70e2de69 100644 --- a/x/multi_coin_rewards/keeper/keeper.go +++ b/x/multi_coin_rewards/keeper/keeper.go @@ -62,9 +62,9 @@ func NewKeeper( bankKeeper: bankKeeper, poolKeeper: poolKeeper, - MultiCoinRewardsEnabled: collections.NewKeySet(sb, types.MultiCoinRewardsEnabledKeyPrefix, + MultiCoinRewardsEnabled: collections.NewKeySet(sb, types.MultiCoinRewardsEnabledKey, "multi_coin_rewards_enabled", sdk.AccAddressKey), - MultiCoinDistributionPolicy: collections.NewItem(sb, types.MultiCoinDistributionPolicyKeyPrefix, + MultiCoinDistributionPolicy: collections.NewItem(sb, types.MultiCoinDistributionPolicyKey, "multi_coin_rewards_policy", codec.CollValue[types.MultiCoinDistributionPolicy](cdc)), } diff --git a/x/multi_coin_rewards/keeper/keeper_suite_test.go b/x/multi_coin_rewards/keeper/keeper_suite_test.go index c0bcde23..c148725f 100644 --- a/x/multi_coin_rewards/keeper/keeper_suite_test.go +++ b/x/multi_coin_rewards/keeper/keeper_suite_test.go @@ -14,7 +14,7 @@ import ( . "github.com/onsi/gomega" ) -func TestStakersKeeper(t *testing.T) { +func TestMultiCoinRewardsKeeper(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, fmt.Sprintf("x/%s Keeper Test Suite", types.ModuleName)) } diff --git a/x/multi_coin_rewards/keeper/logic_distribution.go b/x/multi_coin_rewards/keeper/logic_distribution.go index 34c67bd2..c32138e2 100644 --- a/x/multi_coin_rewards/keeper/logic_distribution.go +++ b/x/multi_coin_rewards/keeper/logic_distribution.go @@ -47,6 +47,8 @@ func (k Keeper) ProcessPendingRewardsQueue(ctx sdk.Context) { } } +// DistributeNonClaimedRewards takes all non-claimed rewards which have exceeding the claim time +// and re-distribute them to the pools according to the redistribution-policy. func (k Keeper) DistributeNonClaimedRewards(ctx sdk.Context) error { policy, err := k.MultiCoinDistributionPolicy.Get(ctx) if err != nil { @@ -59,16 +61,17 @@ func (k Keeper) DistributeNonClaimedRewards(ctx sdk.Context) error { } // Store rewards for all pools. There could be multiple rules which re-direct coins to the same pool - type PoolRewards struct { + type PoolRewardsBasket struct { account sdk.AccAddress rewards sdk.Coins poolId uint64 } - poolRewards := make(map[uint64]PoolRewards) + poolRewardBaskets := make(map[uint64]PoolRewardsBasket) // Get all rewards rewards := k.bankKeeper.GetAllBalances(ctx, k.accountKeeper.GetModuleAddress(types.MultiCoinRewardsRedistributionAccountName)) + // Iterate every coin denom and re-distribute accordingly for _, coin := range rewards { weightMap, ok := distributionMap[coin.Denom] if !ok { @@ -76,9 +79,11 @@ func (k Keeper) DistributeNonClaimedRewards(ctx sdk.Context) error { continue } + // weight-map contains for every denom the destination pools together with a weight. for _, weight := range weightMap { // Check if pool is already in temporary map - accounts, ok := poolRewards[weight.PoolId] + poolBasket, ok := poolRewardBaskets[weight.PoolId] + // If pool is not registered in map yet, initialize new pool basket. if !ok { // if not, get pool from id pool, err := k.poolKeeper.GetPoolWithError(ctx, weight.PoolId) @@ -87,34 +92,33 @@ func (k Keeper) DistributeNonClaimedRewards(ctx sdk.Context) error { return err } - accounts.poolId = pool.Id - accounts.account = pool.GetPoolAccount() - accounts.rewards = sdk.NewCoins() - poolRewards[weight.PoolId] = accounts + poolBasket.poolId = pool.Id + poolBasket.account = pool.GetPoolAccount() + poolBasket.rewards = sdk.NewCoins() + poolRewardBaskets[weight.PoolId] = poolBasket } // Truncate int ensures that there are never more tokens distributed than available poolReward := sdk.NewCoin(coin.Denom, weight.NormalizedWeight.MulInt(rewards.AmountOf(coin.Denom)).TruncateInt()) // Add reward to pool - accounts.rewards = accounts.rewards.Add(poolReward) + poolBasket.rewards = poolBasket.rewards.Add(poolReward) // Update map - poolRewards[weight.PoolId] = accounts + poolRewardBaskets[weight.PoolId] = poolBasket } } // Sort PoolRewards for determinism - accountList := make([]PoolRewards, 0) - for _, account := range poolRewards { + accountList := make([]PoolRewardsBasket, 0) + for _, account := range poolRewardBaskets { accountList = append(accountList, account) } sort.Slice(accountList, func(i, j int) bool { return accountList[i].poolId < accountList[j].poolId }) // Redistribute all tokens for _, account := range accountList { - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.MultiCoinRewardsRedistributionAccountName, account.account, account.rewards) - if err != nil { + if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.MultiCoinRewardsRedistributionAccountName, account.account, account.rewards); err != nil { return err } } diff --git a/x/multi_coin_rewards/keeper/logic_distribution_test.go b/x/multi_coin_rewards/keeper/logic_distribution_test.go index d9d69459..d336afdc 100644 --- a/x/multi_coin_rewards/keeper/logic_distribution_test.go +++ b/x/multi_coin_rewards/keeper/logic_distribution_test.go @@ -14,7 +14,6 @@ import ( TEST CASES - msg_server_leave_pool.go -TODO * Do not redistribute if no policy is set * Redistribute single * Redistribute multi diff --git a/x/multi_coin_rewards/keeper/msg_server_toggle.go b/x/multi_coin_rewards/keeper/msg_server_toggle.go index 28c10ddb..ef6dce7d 100644 --- a/x/multi_coin_rewards/keeper/msg_server_toggle.go +++ b/x/multi_coin_rewards/keeper/msg_server_toggle.go @@ -19,6 +19,7 @@ func (k msgServer) ToggleMultiCoinRewards(ctx context.Context, toggle *types.Msg return nil, err } + totalRewards := sdk.NewCoins() if toggle.Enabled { // User wants to enable multi-coin rewards @@ -27,13 +28,11 @@ func (k msgServer) ToggleMultiCoinRewards(ctx context.Context, toggle *types.Msg } rewards, _ := k.GetMultiCoinPendingRewardsEntriesByIndex2(sdk.UnwrapSDKContext(ctx), accountAddress.String()) - totalRewards := sdk.NewCoins() for _, reward := range rewards { totalRewards = totalRewards.Add(reward.Rewards...) } - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, accountAddress, totalRewards) - if err != nil { + if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, accountAddress, totalRewards); err != nil { return nil, err } @@ -52,5 +51,11 @@ func (k msgServer) ToggleMultiCoinRewards(ctx context.Context, toggle *types.Msg } } + _ = sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&types.EventToggleMultiCoinRewards{ + Address: toggle.Creator, + Enabled: toggle.Enabled, + PendingRewardsClaimed: totalRewards.String(), + }) + return &types.MsgToggleMultiCoinRewardsResponse{}, nil } diff --git a/x/multi_coin_rewards/keeper/msg_server_update_params.go b/x/multi_coin_rewards/keeper/msg_server_update_params.go index ee249028..13286117 100644 --- a/x/multi_coin_rewards/keeper/msg_server_update_params.go +++ b/x/multi_coin_rewards/keeper/msg_server_update_params.go @@ -7,10 +7,8 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - // Gov - govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" - // Stakers "github.com/KYVENetwork/chain/x/multi_coin_rewards/types" + govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { diff --git a/x/multi_coin_rewards/spec/01_concepts.md b/x/multi_coin_rewards/spec/01_concepts.md new file mode 100644 index 00000000..46fcb379 --- /dev/null +++ b/x/multi_coin_rewards/spec/01_concepts.md @@ -0,0 +1,39 @@ + + +# Concepts + +For policy reasons not everybody can or is allowed to receive, hold and +control other tokens. Therefore, users need to opt-in for multi-coin rewards. +Because users could miss the opt-in, there is a grace-period in which multi-coin +rewards can still be retrieved after a claim. If a user does not enable +multi-coin rewards and does not enable it within the grace-period after a claim, +the multi-coin rewards get re-distributed to the existing pools according to +a distribution policy which can be modified by an admin-address which is set +by the governance. + +## (Re-)distribution policy + +The redistribution policy defines which multi-coin denom gets re-distributed +to which pool depending on a certain weight. To allow quick updates an +admin address (other than the governance) can be specified which can update +the policy. The address can not drain any rewards, but only modify to which +pools the coins get re-distributed to. Therefore, the governance might +set the admin address to a trusted (multi-sig) address. + +## Token Flow +Within the withdraw-rewards function inside the CosmosSDK distribution module +the multi-coin-rewards module is called. +1. User has opted in: All tokens are directly paid out to the user +2. User has not opted in: Only the native token is paid out, the other tokens are + transferred to the `multi_coin_rewards` module account. A queue entry is + created and a user has a certain amount of time to enable multi-coin-rewards. + certain amount of time to enable + 1. User enables rewards within time: All pending rewards are transferred to the user + 2. User does not enable rewards within time: The rewards are transferred to + the `multi_coin_rewards_distribution` module account. + +Every 50 blocks all coins in `multi_coin_rewards_distribution` are +redistributed according to the distribution policy. If tokens are not +covered by the policy they remain inside the module account. diff --git a/x/multi_coin_rewards/spec/02_state.md b/x/multi_coin_rewards/spec/02_state.md new file mode 100644 index 00000000..21ead941 --- /dev/null +++ b/x/multi_coin_rewards/spec/02_state.md @@ -0,0 +1,47 @@ + + +# State + +The module is mainly responsible for holding the policy itself and keeping +track of who has opted in for multi-coin rewards. + +## MultiCoinRewardsEnabled + +The users who have opted in for multi-coin rewards are stored as a key in +the IAVL tree. There is no value associated with it. If the key exists, +the users has opted in. + +- MultiCoinRewardsEnabled: `0x01 | AccAddress -> {}` + +## MultiCoinDistributionPolicy + +The MultiCoinDistributionPolicy stores for every denom a list of pools and +weights. The weights determine on how the rewards of a given denom are +re-distributed under the pools. + +```protobuf +syntax = "proto3"; + +// MultiCoinDistributionPolicy ... +message MultiCoinDistributionPolicy { + repeated MultiCoinDistributionDenomEntry entries = 1; +} + +// MultiCoinDistributionDenomEntry ... +message MultiCoinDistributionDenomEntry { + string denom = 1; + repeated MultiCoinDistributionPoolWeightEntry pool_weights = 2; +} + +// MultiCoinDistributionPoolWeightEntry ... +message MultiCoinDistributionPoolWeightEntry { + uint64 pool_id = 1; + string weight = 2 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; +} + +``` diff --git a/x/multi_coin_rewards/spec/03_messages.md b/x/multi_coin_rewards/spec/03_messages.md new file mode 100644 index 00000000..4971cb2f --- /dev/null +++ b/x/multi_coin_rewards/spec/03_messages.md @@ -0,0 +1,16 @@ + + +# Messages + +## ToggleMultiCoinRewards + +User can enable or disable the retrieval of multi-coin-rewards. If they +enable multi-coin rewards all current pending rewards will be claimed. + +## SetMultiCoinRewardDistributionPolicy + +Sets the multi coin rewards distribution policy. This can only be done by +the admin address. This can either be the address of the governance itself +or a trusted entity. diff --git a/x/multi_coin_rewards/spec/04_begin_block.md b/x/multi_coin_rewards/spec/04_begin_block.md new file mode 100644 index 00000000..c16127b9 --- /dev/null +++ b/x/multi_coin_rewards/spec/04_begin_block.md @@ -0,0 +1,9 @@ + + +# BeginBlock + +Every 50 blocks all coins in the `multi_coin_rewards_distribution` module account +are re-distributed according to the current policy. If a coin is not covered +by the policy, it remains in the account. diff --git a/x/multi_coin_rewards/spec/05_params.md b/x/multi_coin_rewards/spec/05_params.md new file mode 100644 index 00000000..06782d62 --- /dev/null +++ b/x/multi_coin_rewards/spec/05_params.md @@ -0,0 +1,12 @@ + + +# Parameters + +The multi-coin-rewards module contains the following parameters: + +| Key | Type | Example | +|----------------------------------------------|--------|---------------------------------------------| +| multi_coin_distribution_policy_admin_address | string | kyve10d07y265gmmuvt4z0w9aw880jnsr700jdv7nah | +| multi_coin_distribution_pending_time | uint64 | 1,209,600 | diff --git a/x/multi_coin_rewards/spec/06_events.md b/x/multi_coin_rewards/spec/06_events.md new file mode 100644 index 00000000..c02fc011 --- /dev/null +++ b/x/multi_coin_rewards/spec/06_events.md @@ -0,0 +1,31 @@ + + +# Events + +The multi-coin-rewards module contains the following events: + +## EventToggleMultiCoinRewards + +EventToggleMultiCoinRewards indicates that someone has changed their +multi-coin-settings. + +```protobuf +syntax = "proto3"; + +message EventToggleMultiCoinRewards { + // address ... + string address = 1; + + // enabled ... + bool enabled = 2; + + // pending_rewards_claimed ... + string pending_rewards_claimed = 3; +} +``` + +It gets emitted by the following actions: + +- SetMultiCoinRewardDistributionPolicy diff --git a/x/multi_coin_rewards/spec/07_exported.md b/x/multi_coin_rewards/spec/07_exported.md new file mode 100644 index 00000000..e43fa379 --- /dev/null +++ b/x/multi_coin_rewards/spec/07_exported.md @@ -0,0 +1,17 @@ + + +# Exported + +The `x/multi_coin_rewards` module exports the following functions, which can be used +outside the module. + +```go +type MultiCoinRewardsKeeper interface { + + // HandleMultiCoinRewards checks if the user has opted in to receive multi-coin rewards + // and returns the amount which can get paid out. + HandleMultiCoinRewards(goCtx context.Context, withdrawAddress sdk.AccAddress, coins sdk.Coins) sdk.Coins +} +``` diff --git a/x/multi_coin_rewards/types/events.pb.go b/x/multi_coin_rewards/types/events.pb.go index 464a96f0..8f02ee9a 100644 --- a/x/multi_coin_rewards/types/events.pb.go +++ b/x/multi_coin_rewards/types/events.pb.go @@ -88,8 +88,73 @@ func (m *EventUpdateParams) GetPayload() string { return "" } +// EventToggleMultiCoinRewards ... +type EventToggleMultiCoinRewards struct { + // address ... + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // enabled ... + Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"` + // pending_rewards_claimed ... + PendingRewardsClaimed string `protobuf:"bytes,3,opt,name=pending_rewards_claimed,json=pendingRewardsClaimed,proto3" json:"pending_rewards_claimed,omitempty"` +} + +func (m *EventToggleMultiCoinRewards) Reset() { *m = EventToggleMultiCoinRewards{} } +func (m *EventToggleMultiCoinRewards) String() string { return proto.CompactTextString(m) } +func (*EventToggleMultiCoinRewards) ProtoMessage() {} +func (*EventToggleMultiCoinRewards) Descriptor() ([]byte, []int) { + return fileDescriptor_c8bb6f2da3c22458, []int{1} +} +func (m *EventToggleMultiCoinRewards) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventToggleMultiCoinRewards) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventToggleMultiCoinRewards.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 *EventToggleMultiCoinRewards) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventToggleMultiCoinRewards.Merge(m, src) +} +func (m *EventToggleMultiCoinRewards) XXX_Size() int { + return m.Size() +} +func (m *EventToggleMultiCoinRewards) XXX_DiscardUnknown() { + xxx_messageInfo_EventToggleMultiCoinRewards.DiscardUnknown(m) +} + +var xxx_messageInfo_EventToggleMultiCoinRewards proto.InternalMessageInfo + +func (m *EventToggleMultiCoinRewards) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *EventToggleMultiCoinRewards) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + +func (m *EventToggleMultiCoinRewards) GetPendingRewardsClaimed() string { + if m != nil { + return m.PendingRewardsClaimed + } + return "" +} + func init() { proto.RegisterType((*EventUpdateParams)(nil), "kyve.multi_coin_rewards.v1beta1.EventUpdateParams") + proto.RegisterType((*EventToggleMultiCoinRewards)(nil), "kyve.multi_coin_rewards.v1beta1.EventToggleMultiCoinRewards") } func init() { @@ -97,24 +162,29 @@ func init() { } var fileDescriptor_c8bb6f2da3c22458 = []byte{ - // 263 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xc9, 0xae, 0x2c, 0x4b, - 0xd5, 0xcf, 0x2d, 0xcd, 0x29, 0xc9, 0x8c, 0x4f, 0xce, 0xcf, 0xcc, 0x8b, 0x2f, 0x4a, 0x2d, 0x4f, - 0x2c, 0x4a, 0x29, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x2d, 0x4b, 0xcd, - 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x07, 0xa9, 0xd6, 0xc3, 0x54, 0xad, - 0x07, 0x55, 0x2d, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xab, 0x0f, 0x62, 0x41, 0xb4, 0x49, - 0x11, 0xb4, 0xa4, 0x20, 0xb1, 0x28, 0x31, 0x17, 0x6a, 0x89, 0xd2, 0x49, 0x46, 0x2e, 0x41, 0x57, - 0x90, 0xad, 0xa1, 0x05, 0x29, 0x89, 0x25, 0xa9, 0x01, 0x60, 0x39, 0x21, 0x1f, 0x2e, 0xae, 0xfc, - 0x9c, 0x94, 0x78, 0x88, 0x4a, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x75, 0x3d, 0x02, 0xee, - 0xd1, 0x83, 0x68, 0x76, 0x62, 0x39, 0x71, 0x4f, 0x9e, 0x21, 0x88, 0x33, 0x3f, 0x27, 0x05, 0x61, - 0x5a, 0x5e, 0x6a, 0x39, 0xcc, 0x34, 0x26, 0xb2, 0x4c, 0xcb, 0x4b, 0x2d, 0x87, 0x9a, 0x26, 0xc1, - 0xc5, 0x5e, 0x90, 0x58, 0x99, 0x93, 0x9f, 0x98, 0x22, 0xc1, 0xac, 0xc0, 0xa8, 0xc1, 0x19, 0x04, - 0xe3, 0x3a, 0x05, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, - 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x79, 0x7a, - 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, 0x77, 0x64, 0x98, 0xab, 0x5f, 0x6a, - 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x7e, 0x72, 0x46, 0x62, 0x66, 0x9e, 0x7e, 0x05, 0xb6, 0xd0, 0x2a, - 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x87, 0x92, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x68, - 0xa5, 0x31, 0x0d, 0xba, 0x01, 0x00, 0x00, + // 340 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0xcd, 0x4a, 0xfb, 0x40, + 0x14, 0xc5, 0x33, 0xff, 0xbf, 0xa8, 0x1d, 0x57, 0x16, 0xc5, 0x52, 0x21, 0x2d, 0xdd, 0xd8, 0x85, + 0x64, 0xa8, 0x82, 0xee, 0x5b, 0xba, 0xf2, 0x03, 0x0d, 0x2a, 0xe8, 0x26, 0x4c, 0x32, 0x97, 0x74, + 0xe8, 0x64, 0x26, 0x24, 0xd3, 0xc6, 0x3e, 0x82, 0x3b, 0x1f, 0xab, 0xee, 0xba, 0x74, 0x25, 0xd2, + 0xbe, 0x88, 0xe4, 0x63, 0x70, 0xa1, 0x50, 0x70, 0x37, 0x97, 0x73, 0xee, 0xef, 0x9c, 0xe1, 0xe2, + 0xe3, 0xf1, 0x6c, 0x0a, 0x24, 0x9a, 0x08, 0xcd, 0xbd, 0x40, 0x71, 0xe9, 0x25, 0x90, 0xd1, 0x84, + 0xa5, 0x64, 0xda, 0xf3, 0x41, 0xd3, 0x1e, 0x81, 0x29, 0x48, 0x9d, 0x3a, 0x71, 0xa2, 0xb4, 0xaa, + 0xb7, 0x72, 0xb7, 0xf3, 0xd3, 0xed, 0x54, 0xee, 0xe6, 0x5e, 0xa8, 0x42, 0x55, 0x78, 0x49, 0xfe, + 0x2a, 0xd7, 0x9a, 0x6b, 0x43, 0x62, 0x9a, 0xd0, 0xa8, 0x0a, 0xe9, 0xbc, 0x21, 0xbc, 0x3b, 0xcc, + 0x53, 0xef, 0x63, 0x46, 0x35, 0xdc, 0x14, 0x5a, 0xfd, 0x12, 0x63, 0x25, 0x98, 0x57, 0x3a, 0x1b, + 0xa8, 0x8d, 0xba, 0x3b, 0x27, 0x47, 0xce, 0x9a, 0x3e, 0x4e, 0xb9, 0xdc, 0xdf, 0x98, 0x7f, 0xb4, + 0x2c, 0xb7, 0xa6, 0x04, 0xfb, 0xa6, 0x49, 0xc8, 0x0c, 0xed, 0xdf, 0x9f, 0x68, 0x12, 0xb2, 0x8a, + 0xd6, 0xc0, 0x5b, 0x31, 0x9d, 0x09, 0x45, 0x59, 0xe3, 0x7f, 0x1b, 0x75, 0x6b, 0xae, 0x19, 0x3b, + 0x2f, 0x08, 0x1f, 0x16, 0x7f, 0xb9, 0x53, 0x61, 0x28, 0xe0, 0x2a, 0x67, 0x0f, 0x14, 0x97, 0x6e, + 0x49, 0xce, 0x37, 0x29, 0x63, 0x09, 0xa4, 0xe5, 0x97, 0x6a, 0xae, 0x19, 0x73, 0x05, 0x24, 0xf5, + 0x05, 0xb0, 0xa2, 0xde, 0xb6, 0x6b, 0xc6, 0xfa, 0x19, 0x3e, 0x88, 0x41, 0x32, 0x2e, 0x43, 0x53, + 0xd0, 0x0b, 0x04, 0xe5, 0x11, 0x98, 0xf4, 0xfd, 0x4a, 0xae, 0x42, 0x06, 0xa5, 0xd8, 0xbf, 0x9d, + 0x2f, 0x6d, 0xb4, 0x58, 0xda, 0xe8, 0x73, 0x69, 0xa3, 0xd7, 0x95, 0x6d, 0x2d, 0x56, 0xb6, 0xf5, + 0xbe, 0xb2, 0xad, 0xa7, 0xf3, 0x90, 0xeb, 0xd1, 0xc4, 0x77, 0x02, 0x15, 0x91, 0x8b, 0xc7, 0x87, + 0xe1, 0x35, 0xe8, 0x4c, 0x25, 0x63, 0x12, 0x8c, 0x28, 0x97, 0xe4, 0xf9, 0xb7, 0xcb, 0xe9, 0x59, + 0x0c, 0xa9, 0xbf, 0x59, 0x5c, 0xec, 0xf4, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x20, 0x1c, 0xe3, 0x77, + 0x46, 0x02, 0x00, 0x00, } func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { @@ -167,6 +237,53 @@ func (m *EventUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventToggleMultiCoinRewards) 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 *EventToggleMultiCoinRewards) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventToggleMultiCoinRewards) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PendingRewardsClaimed) > 0 { + i -= len(m.PendingRewardsClaimed) + copy(dAtA[i:], m.PendingRewardsClaimed) + i = encodeVarintEvents(dAtA, i, uint64(len(m.PendingRewardsClaimed))) + i-- + dAtA[i] = 0x1a + } + if m.Enabled { + i-- + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { offset -= sovEvents(v) base := offset @@ -195,6 +312,26 @@ func (m *EventUpdateParams) Size() (n int) { return n } +func (m *EventToggleMultiCoinRewards) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.Enabled { + n += 2 + } + l = len(m.PendingRewardsClaimed) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -349,6 +486,140 @@ func (m *EventUpdateParams) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventToggleMultiCoinRewards) 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 ErrIntOverflowEvents + } + 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: EventToggleMultiCoinRewards: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventToggleMultiCoinRewards: 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 ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + 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 Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Enabled = bool(v != 0) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PendingRewardsClaimed", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PendingRewardsClaimed = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/multi_coin_rewards/types/keys.go b/x/multi_coin_rewards/types/keys.go index a46085c7..9ec6475b 100644 --- a/x/multi_coin_rewards/types/keys.go +++ b/x/multi_coin_rewards/types/keys.go @@ -1,6 +1,7 @@ package types import ( + "cosmossdk.io/collections" "github.com/KYVENetwork/chain/util" ) @@ -19,16 +20,18 @@ const ( var ( // ParamsKey is the prefix for all module params defined in params.proto - ParamsKey = []byte{0x00} + ParamsKey = collections.NewPrefix(0) - // MultiCoinPendingRewardsEntryKeyPrefix | - MultiCoinPendingRewardsEntryKeyPrefix = []byte{8, 0} - // MultiCoinPendingRewardsEntryKeyPrefixIndex2 | | - MultiCoinPendingRewardsEntryKeyPrefixIndex2 = []byte{8, 1} + // MultiCoinRewardsEnabledKey is the key prefix for storing all users who have opted in for multi-coin-rewards. + MultiCoinRewardsEnabledKey = collections.NewPrefix(1) - MultiCoinRewardsEnabledKeyPrefix = []byte{9, 2} + // MultiCoinDistributionPolicyKey + MultiCoinDistributionPolicyKey = collections.NewPrefix(2) - MultiCoinDistributionPolicyKeyPrefix = []byte{9, 3} + // MultiCoinPendingRewardsEntryKeyPrefix | + MultiCoinPendingRewardsEntryKeyPrefix = []byte{3, 0} + // MultiCoinPendingRewardsEntryKeyPrefixIndex2 |
| + MultiCoinPendingRewardsEntryKeyPrefixIndex2 = []byte{3, 1} ) // ENUM queue types identifiers diff --git a/x/multi_coin_rewards/types/message_set_multi_coin_refund_policy.go b/x/multi_coin_rewards/types/message_set_multi_coin_refund_policy.go index 524cc98f..35e5730a 100644 --- a/x/multi_coin_rewards/types/message_set_multi_coin_refund_policy.go +++ b/x/multi_coin_rewards/types/message_set_multi_coin_refund_policy.go @@ -31,7 +31,7 @@ func (msg *MsgSetMultiCoinRewardsDistributionPolicy) Route() string { } func (msg *MsgSetMultiCoinRewardsDistributionPolicy) Type() string { - return "kyve/stakers/MsgSetMultiCoinRewardsDistributionPolicy" + return "kyve/multi_coin_rewards/MsgSetMultiCoinRewardsDistributionPolicy" } func (msg *MsgSetMultiCoinRewardsDistributionPolicy) ValidateBasic() error { @@ -39,6 +39,10 @@ func (msg *MsgSetMultiCoinRewardsDistributionPolicy) ValidateBasic() error { return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) } + if msg.Policy == nil { + return errors.Wrap(errorsTypes.ErrInvalidRequest, "policy cannot be nil") + } + if _, err := ParseMultiCoinDistributionMap(*msg.Policy); err != nil { return err } diff --git a/x/multi_coin_rewards/types/message_toggle_multi_coin_rewards.go b/x/multi_coin_rewards/types/message_toggle_multi_coin_rewards.go index bfa34083..b27b21c2 100644 --- a/x/multi_coin_rewards/types/message_toggle_multi_coin_rewards.go +++ b/x/multi_coin_rewards/types/message_toggle_multi_coin_rewards.go @@ -31,7 +31,7 @@ func (msg *MsgToggleMultiCoinRewards) Route() string { } func (msg *MsgToggleMultiCoinRewards) Type() string { - return "kyve/stakers/MsgToggleMultiCoinRewards" + return "kyve/multi_coin_rewards/MsgToggleMultiCoinRewards" } func (msg *MsgToggleMultiCoinRewards) ValidateBasic() error { diff --git a/x/multi_coin_rewards/types/params.pb.go b/x/multi_coin_rewards/types/params.pb.go index 2e46070b..f2e74ecd 100644 --- a/x/multi_coin_rewards/types/params.pb.go +++ b/x/multi_coin_rewards/types/params.pb.go @@ -25,10 +25,11 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the multi_coin_rewards module parameters. type Params struct { // multi_coin_distribution_policy_admin_address specifies an address which is allowed to adjust the weights for - // the coin redistribution. This address can now drain coins, but only - MultiCoinDistributionPolicyAdminAddress string `protobuf:"bytes,7,opt,name=multi_coin_distribution_policy_admin_address,json=multiCoinDistributionPolicyAdminAddress,proto3" json:"multi_coin_distribution_policy_admin_address,omitempty"` + // the coin redistribution. This address can not drain coins, but only modify the in which pools coins + // get re-distributed. + MultiCoinDistributionPolicyAdminAddress string `protobuf:"bytes,1,opt,name=multi_coin_distribution_policy_admin_address,json=multiCoinDistributionPolicyAdminAddress,proto3" json:"multi_coin_distribution_policy_admin_address,omitempty"` // multi_coin_distribution_pending_time ... - MultiCoinDistributionPendingTime uint64 `protobuf:"varint,8,opt,name=multi_coin_distribution_pending_time,json=multiCoinDistributionPendingTime,proto3" json:"multi_coin_distribution_pending_time,omitempty"` + MultiCoinDistributionPendingTime uint64 `protobuf:"varint,2,opt,name=multi_coin_distribution_pending_time,json=multiCoinDistributionPendingTime,proto3" json:"multi_coin_distribution_pending_time,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -87,24 +88,24 @@ func init() { } var fileDescriptor_b8e1a6cc59e13782 = []byte{ - // 260 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0xd0, 0x3f, 0x4b, 0x03, 0x31, - 0x18, 0xc7, 0xf1, 0x0b, 0x48, 0xd5, 0x1b, 0x6f, 0xea, 0x14, 0x0f, 0x11, 0xec, 0x50, 0x2e, 0x14, - 0x07, 0xe7, 0xfa, 0x67, 0x12, 0x4a, 0x2d, 0x22, 0x28, 0x48, 0xc8, 0x5d, 0x42, 0xfb, 0xd0, 0x26, - 0x39, 0x92, 0xe7, 0x5a, 0xef, 0x5d, 0xf8, 0x6e, 0x7c, 0x0b, 0x8e, 0x1d, 0x1d, 0xe5, 0xee, 0x8d, - 0x48, 0x53, 0x87, 0x82, 0xed, 0xfe, 0xf9, 0xfe, 0x86, 0x5f, 0xdc, 0x9f, 0xd7, 0x4b, 0xc5, 0x74, - 0xb5, 0x40, 0xe0, 0x85, 0x05, 0xc3, 0x9d, 0x5a, 0x09, 0x27, 0x3d, 0x5b, 0x0e, 0x72, 0x85, 0x62, - 0xc0, 0x4a, 0xe1, 0x84, 0xf6, 0x59, 0xe9, 0x2c, 0xda, 0xe4, 0x6c, 0xa3, 0xb3, 0xff, 0x3a, 0xfb, - 0xd3, 0xe7, 0x9f, 0x24, 0xee, 0x8c, 0x43, 0x91, 0xbc, 0xc5, 0xfd, 0x1d, 0x28, 0xc1, 0xa3, 0x83, - 0xbc, 0x42, 0xb0, 0x86, 0x97, 0x76, 0x01, 0x45, 0xcd, 0x85, 0xd4, 0x60, 0xb8, 0x90, 0xd2, 0x29, - 0xef, 0xbb, 0xc7, 0x29, 0xe9, 0x9d, 0x4e, 0x2e, 0x43, 0x73, 0x6b, 0xc1, 0xdc, 0xed, 0x14, 0xe3, - 0x10, 0x0c, 0x37, 0x7e, 0xb8, 0xe5, 0xc9, 0x28, 0xbe, 0x38, 0x38, 0xaf, 0x8c, 0x04, 0x33, 0xe5, - 0x08, 0x5a, 0x75, 0x4f, 0x52, 0xd2, 0x3b, 0x9a, 0xa4, 0xfb, 0x67, 0xb7, 0xf0, 0x09, 0xb4, 0xba, - 0x79, 0xfc, 0x6a, 0x28, 0x59, 0x37, 0x94, 0xfc, 0x34, 0x94, 0x7c, 0xb4, 0x34, 0x5a, 0xb7, 0x34, - 0xfa, 0x6e, 0x69, 0xf4, 0x7a, 0x3d, 0x05, 0x9c, 0x55, 0x79, 0x56, 0x58, 0xcd, 0x1e, 0x5e, 0x9e, - 0xef, 0x47, 0x0a, 0x57, 0xd6, 0xcd, 0x59, 0x31, 0x13, 0x60, 0xd8, 0xfb, 0xbe, 0xf3, 0xb0, 0x2e, - 0x95, 0xcf, 0x3b, 0xe1, 0xb4, 0xab, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x40, 0xad, 0x8a, 0x47, - 0x64, 0x01, 0x00, 0x00, + // 259 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0xd0, 0x3f, 0x4b, 0xc3, 0x40, + 0x18, 0xc7, 0xf1, 0x9e, 0x48, 0xc1, 0x8c, 0x99, 0x3a, 0x9d, 0x41, 0x04, 0x3b, 0x94, 0x1c, 0xc5, + 0xc1, 0xb9, 0xfe, 0x99, 0x84, 0x52, 0x8b, 0x08, 0x0a, 0x72, 0x5c, 0x72, 0x0f, 0xed, 0x43, 0x7b, + 0x77, 0xe1, 0xee, 0x49, 0x6b, 0xde, 0x85, 0xef, 0xc6, 0xb7, 0xe0, 0xd8, 0xd1, 0x51, 0x92, 0x37, + 0x22, 0x4d, 0x1d, 0x0a, 0xd6, 0xfd, 0xf3, 0xfd, 0x0d, 0xbf, 0x68, 0xb0, 0xa8, 0x56, 0x20, 0x4c, + 0xb9, 0x24, 0x94, 0xb9, 0x43, 0x2b, 0x3d, 0xac, 0x95, 0xd7, 0x41, 0xac, 0x86, 0x19, 0x90, 0x1a, + 0x8a, 0x42, 0x79, 0x65, 0x42, 0x5a, 0x78, 0x47, 0x2e, 0x3e, 0xdd, 0xea, 0xf4, 0xaf, 0x4e, 0x7f, + 0xf5, 0xd9, 0x07, 0x8b, 0xba, 0x93, 0xb6, 0x88, 0x5f, 0xa3, 0xc1, 0x1e, 0xd4, 0x18, 0xc8, 0x63, + 0x56, 0x12, 0x3a, 0x2b, 0x0b, 0xb7, 0xc4, 0xbc, 0x92, 0x4a, 0x1b, 0xb4, 0x52, 0x69, 0xed, 0x21, + 0x84, 0x1e, 0x4b, 0x58, 0xff, 0x64, 0x7a, 0xd1, 0x36, 0x37, 0x0e, 0xed, 0xed, 0x5e, 0x31, 0x69, + 0x83, 0xd1, 0xd6, 0x8f, 0x76, 0x3c, 0x1e, 0x47, 0xe7, 0xff, 0xce, 0x83, 0xd5, 0x68, 0x67, 0x92, + 0xd0, 0x40, 0xef, 0x28, 0x61, 0xfd, 0xe3, 0x69, 0x72, 0x78, 0x76, 0x07, 0x1f, 0xd1, 0xc0, 0xf5, + 0xc3, 0x67, 0xcd, 0xd9, 0xa6, 0xe6, 0xec, 0xbb, 0xe6, 0xec, 0xbd, 0xe1, 0x9d, 0x4d, 0xc3, 0x3b, + 0x5f, 0x0d, 0xef, 0xbc, 0x5c, 0xcd, 0x90, 0xe6, 0x65, 0x96, 0xe6, 0xce, 0x88, 0xfb, 0xe7, 0xa7, + 0xbb, 0x31, 0xd0, 0xda, 0xf9, 0x85, 0xc8, 0xe7, 0x0a, 0xad, 0x78, 0x3b, 0x74, 0x1e, 0x55, 0x05, + 0x84, 0xac, 0xdb, 0x9e, 0x76, 0xf9, 0x13, 0x00, 0x00, 0xff, 0xff, 0x67, 0x26, 0x66, 0x2a, 0x64, + 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -130,14 +131,14 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.MultiCoinDistributionPendingTime != 0 { i = encodeVarintParams(dAtA, i, uint64(m.MultiCoinDistributionPendingTime)) i-- - dAtA[i] = 0x40 + dAtA[i] = 0x10 } if len(m.MultiCoinDistributionPolicyAdminAddress) > 0 { i -= len(m.MultiCoinDistributionPolicyAdminAddress) copy(dAtA[i:], m.MultiCoinDistributionPolicyAdminAddress) i = encodeVarintParams(dAtA, i, uint64(len(m.MultiCoinDistributionPolicyAdminAddress))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -204,7 +205,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 7: + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MultiCoinDistributionPolicyAdminAddress", wireType) } @@ -236,7 +237,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } m.MultiCoinDistributionPolicyAdminAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MultiCoinDistributionPendingTime", wireType) }