From f1f17bdc50d31c1593fdd68eb07dfbadf990f7bc Mon Sep 17 00:00:00 2001 From: testinginprod <98415576+testinginprod@users.noreply.github.com> Date: Wed, 22 Nov 2023 13:48:04 +0100 Subject: [PATCH] feat(perp): add volume based rebates (#1663) * introduce global volumes * remove volume GC * add rebates * add allocate epoch rebates message * implement AllocateEpochRebates * add withdrawal logic * finalise testing * add genesis for global volumes and rebate allocations * add genesis testing * chore: CHANGELOG.md * ci: build latest docker image on master push * ci: build latest chaosnet image on master push * ci: only run goreleaser on tagged commits * ci: temporarily disable goreleaser on master pushes * address all PR reviews * maybe finish merging * fix testing and rename for clarity * ci: revert workflow changes from master * Update x/perp/v2/keeper/dnr.go --------- Co-authored-by: godismercilex Co-authored-by: Kevin Yang <5478483+k-yang@users.noreply.github.com> Co-authored-by: Unique Divine --- CHANGELOG.md | 1 + app/keepers.go | 26 +- proto/nibiru/perp/v2/genesis.proto | 12 + proto/nibiru/perp/v2/state.proto | 11 + proto/nibiru/perp/v2/tx.proto | 35 + x/perp/v2/integration/action/dnr.go | 87 ++ x/perp/v2/keeper/clearing_house.go | 2 +- x/perp/v2/keeper/dnr.go | 118 ++- x/perp/v2/keeper/dnr_test.go | 47 +- x/perp/v2/keeper/keeper.go | 36 +- x/perp/v2/keeper/msg_server.go | 32 + x/perp/v2/module/genesis.go | 33 + x/perp/v2/module/genesis_test.go | 7 + x/perp/v2/types/genesis.pb.go | 420 ++++++++- x/perp/v2/types/keys.go | 10 +- x/perp/v2/types/msgs.go | 46 + x/perp/v2/types/state.pb.go | 365 ++++++-- x/perp/v2/types/tx.pb.go | 1232 ++++++++++++++++++++++++--- 18 files changed, 2210 insertions(+), 310 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3d33874b..b9cb1daee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#1573](https://github.com/NibiruChain/nibiru/pull/1573) - feat(perp): Close markets and compute settlement price * [#1632](https://github.com/NibiruChain/nibiru/pull/1632) - feat(perp): Add settle position transaction * [#1656](https://github.com/NibiruChain/nibiru/pull/1656) - feat(perp): Make the collateral denom a stateful collections.Item +* [#1663](https://github.com/NibiruChain/nibiru/pull/1663) - feat(perp): Add volume based rebates * [#1670](https://github.com/NibiruChain/nibiru/pull/1670) - feat(inflation): Make inflation polynomial ### State Machine Breaking diff --git a/app/keepers.go b/app/keepers.go index dd3a5bfe7..84619298c 100644 --- a/app/keepers.go +++ b/app/keepers.go @@ -802,10 +802,12 @@ func ModuleAccPerms() map[string][]string { ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, ibcfeetypes.ModuleName: {}, - perptypes.ModuleName: {}, - perptypes.VaultModuleAccount: {}, - perptypes.PerpEFModuleAccount: {}, - perptypes.FeePoolModuleAccount: {}, + perptypes.ModuleName: {}, + perptypes.VaultModuleAccount: {}, + perptypes.PerpEFModuleAccount: {}, + perptypes.FeePoolModuleAccount: {}, + perptypes.DNRAllocationModuleAccount: {}, + perptypes.DNREscrowModuleAccount: {}, epochstypes.ModuleName: {}, sudotypes.ModuleName: {}, @@ -848,12 +850,12 @@ func initParamsKeeper( func (app *NibiruApp) InitSimulationManager( appCodec codec.Codec, ) { - //// create the simulation manager and define the order of the modules for deterministic simulations - //// - //// NOTE: this is not required apps that don't use the simulator for fuzz testing - //// transactions - //epochsModule := epochs.NewAppModule(appCodec, app.EpochsKeeper) - //app.sm = module.NewSimulationManager( + // // create the simulation manager and define the order of the modules for deterministic simulations + // // + // // NOTE: this is not required apps that don't use the simulator for fuzz testing + // // transactions + // epochsModule := epochs.NewAppModule(appCodec, app.EpochsKeeper) + // app.sm = module.NewSimulationManager( // auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts), // bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), // feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), @@ -871,7 +873,7 @@ func (app *NibiruApp) InitSimulationManager( // ibc.NewAppModule(app.ibcKeeper), // ibctransfer.NewAppModule(app.transferKeeper), // ibcfee.NewAppModule(app.ibcFeeKeeper), - //) + // ) // - //app.sm.RegisterStoreDecoders() + // app.sm.RegisterStoreDecoders() } diff --git a/proto/nibiru/perp/v2/genesis.proto b/proto/nibiru/perp/v2/genesis.proto index 01410cdcc..8d5300acb 100644 --- a/proto/nibiru/perp/v2/genesis.proto +++ b/proto/nibiru/perp/v2/genesis.proto @@ -60,6 +60,18 @@ message GenesisState { repeated nibiru.perp.v2.GenesisMarketLastVersion market_last_versions = 10 [ (gogoproto.nullable) = false ]; + + repeated GlobalVolume global_volumes = 13 [ (gogoproto.nullable) = false ]; + + repeated DNRAllocation rebates_allocations = 12 [ (gogoproto.nullable) = false ]; + + message GlobalVolume { + uint64 epoch = 1; + string volume = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + } } // GenesisMarketLastVersion is the last version including pair only used for diff --git a/proto/nibiru/perp/v2/state.proto b/proto/nibiru/perp/v2/state.proto index 364a685a9..986aba141 100644 --- a/proto/nibiru/perp/v2/state.proto +++ b/proto/nibiru/perp/v2/state.proto @@ -227,3 +227,14 @@ message ReserveSnapshot { // milliseconds since unix epoch int64 timestamp_ms = 2; } + +// DNRAllocation represents a rebates allocation for a given epoch. +message DNRAllocation { + // epoch defines the reference epoch for the allocation. + uint64 epoch = 1; + // amount of DNR allocated for the epoch. + repeated cosmos.base.v1beta1.Coin amount = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} diff --git a/proto/nibiru/perp/v2/tx.proto b/proto/nibiru/perp/v2/tx.proto index f6b799694..433b78eb5 100644 --- a/proto/nibiru/perp/v2/tx.proto +++ b/proto/nibiru/perp/v2/tx.proto @@ -31,6 +31,10 @@ service Msg { rpc ChangeCollateralDenom(MsgChangeCollateralDenom) returns (MsgChangeCollateralDenomResponse) {} + + rpc AllocateEpochRebates(MsgAllocateEpochRebates) returns (MsgAllocateEpochRebatesResponse) {} + + rpc WithdrawEpochRebates(MsgWithdrawEpochRebates) returns (MsgWithdrawEpochRebatesResponse) {} } // -------------------------- Settle Position -------------------------- @@ -342,3 +346,34 @@ message MsgChangeCollateralDenom { } message MsgChangeCollateralDenomResponse {} + +// -------------------------- AllocateEpochRebates -------------------------- +message MsgAllocateEpochRebates { + string sender = 1; + + // rebates to allocate + repeated cosmos.base.v1beta1.Coin rebates = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +message MsgAllocateEpochRebatesResponse { + repeated cosmos.base.v1beta1.Coin total_epoch_rebates = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// -------------------------- WithdrawEpochRebates -------------------------- +message MsgWithdrawEpochRebates { + string sender = 1; + repeated uint64 epochs = 2; +} + +message MsgWithdrawEpochRebatesResponse { + repeated cosmos.base.v1beta1.Coin withdrawn_rebates = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} \ No newline at end of file diff --git a/x/perp/v2/integration/action/dnr.go b/x/perp/v2/integration/action/dnr.go index 7c3546c99..110c4779e 100644 --- a/x/perp/v2/integration/action/dnr.go +++ b/x/perp/v2/integration/action/dnr.go @@ -7,6 +7,8 @@ import ( "github.com/NibiruChain/collections" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/NibiruChain/nibiru/x/common/testutil" + "github.com/NibiruChain/nibiru/app" "github.com/NibiruChain/nibiru/x/common/asset" "github.com/NibiruChain/nibiru/x/common/testutil/action" @@ -212,3 +214,88 @@ func (s *setCustomDiscountAction) Do(app *app.NibiruApp, ctx sdk.Context) (outCt app.PerpKeeperV2.TraderDiscounts.Insert(ctx, collections.Join(s.user, s.volume), s.fee) return ctx, nil, true } + +type fundDnREpoch struct { + amt sdk.Coins +} + +func (f fundDnREpoch) Do(app *app.NibiruApp, ctx sdk.Context) (outCtx sdk.Context, err error, isMandatory bool) { + tmpAcc := testutil.AccAddress() + ctx, err, _ = action.FundAccount(tmpAcc, f.amt).Do(app, ctx) + if err != nil { + return ctx, err, true + } + _, err = app.PerpKeeperV2.AllocateEpochRebates(ctx, tmpAcc, f.amt) + if err != nil { + return ctx, err, true + } + return ctx, nil, true +} + +func FundDnREpoch(amt sdk.Coins) action.Action { + return fundDnREpoch{amt} +} + +type startNewDnRepochAction struct { +} + +func (s startNewDnRepochAction) Do(app *app.NibiruApp, ctx sdk.Context) (outCtx sdk.Context, err error, isMandatory bool) { + currentEpoch, err := app.PerpKeeperV2.DnREpoch.Get(ctx) + if err != nil { + return ctx, err, true + } + err = app.PerpKeeperV2.StartNewEpoch(ctx, currentEpoch+1) + if err != nil { + return ctx, err, true + } + return ctx, nil, true +} + +func StartNewDnREpoch() action.Action { + return &startNewDnRepochAction{} +} + +type dnrRebateIsAction struct { + user sdk.AccAddress + epoch uint64 + expectedRewards sdk.Coins +} + +func (d dnrRebateIsAction) Do(app *app.NibiruApp, ctx sdk.Context) (outCtx sdk.Context, err error, isMandatory bool) { + withdrawn, err := app.PerpKeeperV2.WithdrawEpochRebates(ctx, d.epoch, d.user) + if err != nil { + return ctx, err, true + } + if !withdrawn.IsEqual(d.expectedRewards) { + return ctx, fmt.Errorf("expected %s, got %s", d.expectedRewards, withdrawn), true + } + return ctx, nil, true +} + +func DnRRebateIs(user sdk.AccAddress, epoch uint64, expectedRewards sdk.Coins) action.Action { + return &dnrRebateIsAction{ + user: user, + epoch: epoch, + expectedRewards: expectedRewards, + } +} + +func DnRRebateFails(user sdk.AccAddress, epoch uint64) action.Action { + return &dnrRebateFailsAction{ + user: user, + epoch: epoch, + } +} + +type dnrRebateFailsAction struct { + user sdk.AccAddress + epoch uint64 +} + +func (d dnrRebateFailsAction) Do(app *app.NibiruApp, ctx sdk.Context) (outCtx sdk.Context, err error, isMandatory bool) { + withdrawn, err := app.PerpKeeperV2.WithdrawEpochRebates(ctx, d.epoch, d.user) + if err == nil { + return ctx, fmt.Errorf("expected withdrawal error but got instead: %s rewards", withdrawn.String()), true + } + return ctx, nil, true +} diff --git a/x/perp/v2/keeper/clearing_house.go b/x/perp/v2/keeper/clearing_house.go index 2022bf471..7a1f49fa8 100644 --- a/x/perp/v2/keeper/clearing_house.go +++ b/x/perp/v2/keeper/clearing_house.go @@ -646,7 +646,7 @@ func (k Keeper) transferFee( return sdkmath.Int{}, err } - exchangeFeeRatio, err = k.applyDiscountAndRebate(ctx, pair, trader, positionNotional, exchangeFeeRatio) + exchangeFeeRatio, err = k.calculateDiscount(ctx, pair, trader, positionNotional, exchangeFeeRatio) if err != nil { return sdkmath.Int{}, err } diff --git a/x/perp/v2/keeper/dnr.go b/x/perp/v2/keeper/dnr.go index 599a0a8f9..909f79462 100644 --- a/x/perp/v2/keeper/dnr.go +++ b/x/perp/v2/keeper/dnr.go @@ -7,12 +7,11 @@ import ( "github.com/NibiruChain/collections" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/NibiruChain/nibiru/x/perp/v2/types" + "github.com/NibiruChain/nibiru/x/common/asset" ) -// DnRGCFrequency is the frequency at which the DnR garbage collector runs. -const DnRGCFrequency = 1000 - // IntValueEncoder instructs collections on how to encode a math.Int as a value. // TODO: move to collections. var IntValueEncoder collections.ValueEncoder[math.Int] = intValueEncoder{} @@ -69,32 +68,34 @@ func (intKeyEncoder) Decode(b []byte) (int, math.Int) { func (intKeyEncoder) Stringify(key math.Int) string { return key.String() } +// StartNewEpoch is called by the epochs hooks when a new 30day epoch starts. +func (k Keeper) StartNewEpoch(ctx sdk.Context, identifier uint64) error { + // set the current epoch + k.DnREpoch.Set(ctx, identifier) + // we now check the rebates allocated for the previous epoch, + // and move them to the escrow such that they can be claimed lazily + // by users. + previousEpoch := identifier - 1 + allocationAddr := k.AccountKeeper.GetModuleAddress(types.DNRAllocationModuleAccount) + allocationBalance := k.BankKeeper.GetAllBalances(ctx, allocationAddr) + err := k.BankKeeper.SendCoinsFromModuleToModule(ctx, types.DNRAllocationModuleAccount, types.DNREscrowModuleAccount, allocationBalance) + if err != nil { + return err + } + k.EpochRebateAllocations.Insert(ctx, previousEpoch, types.DNRAllocation{ + Epoch: previousEpoch, + Amount: allocationBalance, + }) + return nil +} + // IncreaseTraderVolume adds the volume to the user's volume for the current epoch. +// It also increases the global volume for the current epoch. func (k Keeper) IncreaseTraderVolume(ctx sdk.Context, currentEpoch uint64, user sdk.AccAddress, volume math.Int) { currentVolume := k.TraderVolumes.GetOr(ctx, collections.Join(user, currentEpoch), math.ZeroInt()) newVolume := currentVolume.Add(volume) k.TraderVolumes.Insert(ctx, collections.Join(user, currentEpoch), newVolume) - k.gcUserVolume(ctx, user, currentEpoch) -} - -// gcUserVolume deletes the un-needed user epochs. -func (k Keeper) gcUserVolume(ctx sdk.Context, user sdk.AccAddress, currentEpoch uint64) { - // we do not want to do this always. - if ctx.BlockHeight()%DnRGCFrequency != 0 { - return - } - - rng := collections.PairRange[sdk.AccAddress, uint64]{}. - Prefix(user). // only iterate over the user's epochs. - EndExclusive(currentEpoch - 1). // we want to preserve current and last epoch, as it's needed to compute DnR rewards. - Descending() - - for _, key := range k.TraderVolumes.Iterate(ctx, rng).Keys() { - err := k.TraderVolumes.Delete(ctx, key) - if err != nil { - panic(err) - } - } + k.GlobalVolumes.Insert(ctx, currentEpoch, k.GlobalVolumes.GetOr(ctx, currentEpoch, math.ZeroInt()).Add(volume)) } // GetTraderVolumeLastEpoch returns the user's volume for the last epoch. @@ -139,10 +140,10 @@ func (k Keeper) GetTraderDiscount(ctx sdk.Context, trader sdk.AccAddress, volume return math.LegacyZeroDec(), false } -// applyDiscountAndRebate applies the discount and rebate to the given exchange fee ratio. +// calculateDiscount applies the discount to the given exchange fee ratio. // It updates the current epoch trader volume. // It returns the new exchange fee ratio. -func (k Keeper) applyDiscountAndRebate( +func (k Keeper) calculateDiscount( ctx sdk.Context, _ asset.Pair, trader sdk.AccAddress, @@ -172,3 +173,68 @@ func (k Keeper) applyDiscountAndRebate( // return discounted fee ratios return discountedFeeRatio, nil } + +// WithdrawEpochRebates will withdraw the user's rebates for the given epoch. +func (k Keeper) WithdrawEpochRebates(ctx sdk.Context, epoch uint64, addr sdk.AccAddress) (withdrawn sdk.Coins, err error) { + // get the allocation for the epoch, this also ensures that if the user is trying to withdraw + // from current epoch the function immediately fails. + allocationCoins, err := k.EpochRebateAllocations.Get(ctx, epoch) + if err != nil { + return nil, err + } + + // compute user weight + weight, err := k.computeUserWeight(ctx, addr, epoch) + if err != nil { + return nil, err + } + if weight.IsZero() { + return sdk.NewCoins(), nil + } + + // calculate coins to distribute based on user weight + distrCoins := sdk.NewCoins() + for _, coin := range allocationCoins.Amount { + amt := coin.Amount.ToLegacyDec().Mul(weight).TruncateInt() + distrCoins = distrCoins.Add(sdk.NewCoin(coin.Denom, amt)) + } + + // send money to user from escrow only in case there's anything to distribute. + // this should never happen, since we're checking if the user has any weight. + if !distrCoins.IsZero() { + err = k.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.DNREscrowModuleAccount, addr, distrCoins) + if err != nil { + return nil, err + } + } + + // garbage collect user volume. This ensures state is not bloated, + // and that the user cannot claim from the same allocation twice. + return distrCoins, k.TraderVolumes.Delete(ctx, collections.Join(addr, epoch)) +} + +// computeUserWeight computes the user's weight for the given epoch. +func (k Keeper) computeUserWeight(ctx sdk.Context, addr sdk.AccAddress, epoch uint64) (math.LegacyDec, error) { + // get user volume for the epoch + userVolume := k.TraderVolumes.GetOr(ctx, collections.Join(addr, epoch), math.ZeroInt()) + if userVolume.IsZero() { + return math.LegacyZeroDec(), nil + } + + // calculate the user's share + globalVolume, err := k.GlobalVolumes.Get(ctx, epoch) + if err != nil { + return math.LegacyDec{}, err + } + weight := userVolume.ToLegacyDec().Quo(globalVolume.ToLegacyDec()) + return weight, nil +} + +// AllocateEpochRebates will allocate the given amount of coins to the current epoch. +func (k Keeper) AllocateEpochRebates(ctx sdk.Context, sender sdk.AccAddress, amount sdk.Coins) (total sdk.Coins, err error) { + err = k.BankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.DNRAllocationModuleAccount, amount) + if err != nil { + return sdk.Coins{}, err + } + return k.BankKeeper.GetAllBalances(ctx, k.AccountKeeper.GetModuleAddress(types.DNRAllocationModuleAccount)), nil +} diff --git a/x/perp/v2/keeper/dnr_test.go b/x/perp/v2/keeper/dnr_test.go index 349579263..e79852e23 100644 --- a/x/perp/v2/keeper/dnr_test.go +++ b/x/perp/v2/keeper/dnr_test.go @@ -12,7 +12,6 @@ import ( "github.com/NibiruChain/nibiru/x/common/testutil" . "github.com/NibiruChain/nibiru/x/common/testutil/action" . "github.com/NibiruChain/nibiru/x/perp/v2/integration/action" - "github.com/NibiruChain/nibiru/x/perp/v2/keeper" "github.com/NibiruChain/nibiru/x/perp/v2/types" ) @@ -89,13 +88,11 @@ func TestUserVolumes(t *testing.T) { MarketOrder(alice, pairBtcNusd, types.Direction_SHORT, sdk.NewInt(5_000), sdk.OneDec(), sdk.ZeroDec()), // reduce epoch 2 DnREpochIs(3), MarketOrder(alice, pairBtcNusd, types.Direction_SHORT, sdk.NewInt(2_000), sdk.OneDec(), sdk.ZeroDec()), // reduce epoch 3 - SetBlockNumber(keeper.DnRGCFrequency), MarketOrder(alice, pairBtcNusd, types.Direction_SHORT, sdk.NewInt(2_000), sdk.OneDec(), sdk.ZeroDec()), // reduce more epoch 3 ). Then( DnRCurrentVolumeIs(alice, math.NewInt(4000)), // for current epoch only 4k in volume. DnRPreviousVolumeIs(alice, math.NewInt(5000)), // for previous epoch only 5k in volume. - DnRVolumeNotExist(alice, 1), // volume for epoch 1 should not exist. ), } NewTestSuite(t).WithTestCases(tests...).Run() @@ -210,3 +207,47 @@ func TestDiscount(t *testing.T) { } NewTestSuite(t).WithTestCases(tests...).Run() } + +func TestRebates(t *testing.T) { + alice := testutil.AccAddress() + bob := testutil.AccAddress() + + pairBtcNusd := asset.Registry.Pair(denoms.BTC, denoms.NUSD) + positionSize := sdk.NewInt(10_000) + startBlockTime := time.Now() + + allocation := sdk.NewCoins(sdk.NewCoin(denoms.NUSD, sdk.NewInt(1_000_000))) + + tests := TestCases{ + TC("rebates correctly apply"). + Given( + CreateCustomMarket( + pairBtcNusd, + WithEnabled(true), + WithPricePeg(sdk.OneDec()), + WithSqrtDepth(sdk.NewDec(100_000)), + ), + SetBlockNumber(1), + SetBlockTime(startBlockTime), + + FundAccount(alice, sdk.NewCoins(sdk.NewCoin(types.TestingCollateralDenomNUSD, positionSize.AddRaw(100_000)))), + FundAccount(bob, sdk.NewCoins(sdk.NewCoin(types.TestingCollateralDenomNUSD, positionSize.AddRaw(100_000)))), + FundModule(types.PerpEFModuleAccount, sdk.NewCoins(sdk.NewCoin(denoms.NUSD, sdk.NewInt(100_000_000)))), + ). + When( + DnREpochIs(1), + FundDnREpoch(allocation), + MarketOrder(alice, pairBtcNusd, types.Direction_LONG, sdk.NewInt(10_000), sdk.OneDec(), sdk.ZeroDec()), + MarketOrder(bob, pairBtcNusd, types.Direction_SHORT, sdk.NewInt(30_000), sdk.OneDec(), sdk.ZeroDec()), + StartNewDnREpoch(), + ). + Then( + DnRRebateIs(alice, 1, allocation.QuoInt(sdk.NewInt(4))), // 1/4 of the allocation + DnRRebateIs(bob, 1, allocation.QuoInt(sdk.NewInt(4)).MulInt(sdk.NewInt(3))), // 3/4 of the allocation + DnRRebateIs(alice, 1, sdk.NewCoins()), // can only claim once + DnREpochIs(2), + DnRRebateIs(alice, 1, sdk.NewCoins()), // claiming again after the epoch is not possible. + ), + } + NewTestSuite(t).WithTestCases(tests...).Run() +} diff --git a/x/perp/v2/keeper/keeper.go b/x/perp/v2/keeper/keeper.go index ec7aa71bd..f8851a38d 100644 --- a/x/perp/v2/keeper/keeper.go +++ b/x/perp/v2/keeper/keeper.go @@ -36,12 +36,14 @@ type Keeper struct { AMMs collections.Map[collections.Pair[asset.Pair, uint64], types.AMM] Collateral collections.Item[string] - Positions collections.Map[collections.Pair[collections.Pair[asset.Pair, uint64], sdk.AccAddress], types.Position] - ReserveSnapshots collections.Map[collections.Pair[asset.Pair, time.Time], types.ReserveSnapshot] - DnREpoch collections.Item[uint64] - TraderVolumes collections.Map[collections.Pair[sdk.AccAddress, uint64], math.Int] // Keeps track of user volumes for each epoch. - GlobalDiscounts collections.Map[math.Int, math.LegacyDec] // maps a volume level to a discount - TraderDiscounts collections.Map[collections.Pair[sdk.AccAddress, math.Int], math.LegacyDec] // maps a user and volume level to a discount, supersedes global discounts + Positions collections.Map[collections.Pair[collections.Pair[asset.Pair, uint64], sdk.AccAddress], types.Position] + ReserveSnapshots collections.Map[collections.Pair[asset.Pair, time.Time], types.ReserveSnapshot] + DnREpoch collections.Item[uint64] + GlobalVolumes collections.Map[uint64, math.Int] // Keeps track of global volumes for each epoch. + TraderVolumes collections.Map[collections.Pair[sdk.AccAddress, uint64], math.Int] // Keeps track of user volumes for each epoch. + GlobalDiscounts collections.Map[math.Int, math.LegacyDec] // maps a volume level to a discount + TraderDiscounts collections.Map[collections.Pair[sdk.AccAddress, math.Int], math.LegacyDec] // maps a user and volume level to a discount, supersedes global discounts + EpochRebateAllocations collections.Map[uint64, types.DNRAllocation] // maps an epoch to a string representing the allocation of rebates for that epoch } // NewKeeper Creates a new x/perp Keeper instance. @@ -68,16 +70,16 @@ func NewKeeper( OracleKeeper: oracleKeeper, EpochKeeper: epochKeeper, SudoKeeper: sudoKeeper, - Markets: collections.NewMap( - storeKey, NamespaceMarkets, - collections.PairKeyEncoder(asset.PairKeyEncoder, collections.Uint64KeyEncoder), - collections.ProtoValueEncoder[types.Market](cdc), - ), MarketLastVersion: collections.NewMap( storeKey, NamespaceMarketLastVersion, asset.PairKeyEncoder, collections.ProtoValueEncoder[types.MarketLastVersion](cdc), ), + Markets: collections.NewMap( + storeKey, NamespaceMarkets, + collections.PairKeyEncoder(asset.PairKeyEncoder, collections.Uint64KeyEncoder), + collections.ProtoValueEncoder[types.Market](cdc), + ), AMMs: collections.NewMap( storeKey, NamespaceAmms, collections.PairKeyEncoder(asset.PairKeyEncoder, collections.Uint64KeyEncoder), @@ -97,6 +99,11 @@ func NewKeeper( storeKey, NamespaceDnrEpoch, collections.Uint64ValueEncoder, ), + GlobalVolumes: collections.NewMap( + storeKey, NamespaceGlobalVolumes, + collections.Uint64KeyEncoder, + IntValueEncoder, + ), TraderVolumes: collections.NewMap( storeKey, NamespaceUserVolumes, collections.PairKeyEncoder(collections.AccAddressKeyEncoder, collections.Uint64KeyEncoder), @@ -112,6 +119,11 @@ func NewKeeper( collections.PairKeyEncoder(collections.AccAddressKeyEncoder, IntKeyEncoder), collections.DecValueEncoder, ), + EpochRebateAllocations: collections.NewMap( + storeKey, NamespaceRebatesAllocations, + collections.Uint64KeyEncoder, + collections.ProtoValueEncoder[types.DNRAllocation](cdc), + ), Collateral: collections.NewItem( storeKey, NamespaceCollateral, common.StringValueEncoder, @@ -127,9 +139,11 @@ const ( NamespacePositions NamespaceReserveSnapshots NamespaceDnrEpoch + NamespaceGlobalVolumes NamespaceUserVolumes NamespaceGlobalDiscounts NamespaceUserDiscounts + NamespaceRebatesAllocations NamespaceMarketLastVersion NamespaceCollateral ) diff --git a/x/perp/v2/keeper/msg_server.go b/x/perp/v2/keeper/msg_server.go index c8ed657bd..ae2e9d35c 100644 --- a/x/perp/v2/keeper/msg_server.go +++ b/x/perp/v2/keeper/msg_server.go @@ -157,3 +157,35 @@ func (m msgServer) ChangeCollateralDenom( return &types.MsgChangeCollateralDenomResponse{}, err } + +func (m msgServer) AllocateEpochRebates(ctx context.Context, msg *types.MsgAllocateEpochRebates) (*types.MsgAllocateEpochRebatesResponse, error) { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + total, err := m.k.AllocateEpochRebates(sdk.UnwrapSDKContext(ctx), sender, msg.Rebates) + if err != nil { + return nil, err + } + + return &types.MsgAllocateEpochRebatesResponse{TotalEpochRebates: total}, nil +} + +func (m msgServer) WithdrawEpochRebates(ctx context.Context, msg *types.MsgWithdrawEpochRebates) (*types.MsgWithdrawEpochRebatesResponse, error) { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + sdkCtx := sdk.UnwrapSDKContext(ctx) + totalWithdrawn := sdk.NewCoins() + for _, epoch := range msg.Epochs { + withdrawn, err := m.k.WithdrawEpochRebates(sdkCtx, epoch, sender) + if err != nil { + return nil, err + } + totalWithdrawn = totalWithdrawn.Add(withdrawn...) + } + return &types.MsgWithdrawEpochRebatesResponse{ + WithdrawnRebates: totalWithdrawn, + }, nil +} diff --git a/x/perp/v2/module/genesis.go b/x/perp/v2/module/genesis.go index b22b5e935..36fb20100 100644 --- a/x/perp/v2/module/genesis.go +++ b/x/perp/v2/module/genesis.go @@ -77,6 +77,25 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) panic(err) } } + + for _, globalVolume := range genState.GlobalVolumes { + k.GlobalVolumes.Insert( + ctx, + globalVolume.Epoch, + globalVolume.Volume, + ) + } + + for _, rebateAlloc := range genState.RebatesAllocations { + k.EpochRebateAllocations.Insert( + ctx, + rebateAlloc.Epoch, + types.DNRAllocation{ + Epoch: rebateAlloc.Epoch, + Amount: rebateAlloc.Amount, + }, + ) + } } // ExportGenesis returns the capability module's exported genesis. @@ -147,5 +166,19 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { panic(err) } genesis.CollateralDenom = collateral + + // export global volumes + globalVolumes := k.GlobalVolumes.Iterate(ctx, collections.Range[uint64]{}) + defer globalVolumes.Close() + for ; globalVolumes.Valid(); globalVolumes.Next() { + genesis.GlobalVolumes = append(genesis.GlobalVolumes, types.GenesisState_GlobalVolume{ + Epoch: globalVolumes.Key(), + Volume: globalVolumes.Value(), + }) + } + + // export rebates allocations + genesis.RebatesAllocations = k.EpochRebateAllocations.Iterate(ctx, collections.Range[uint64]{}).Values() + return genesis } diff --git a/x/perp/v2/module/genesis_test.go b/x/perp/v2/module/genesis_test.go index 2077ce6ff..48097d770 100644 --- a/x/perp/v2/module/genesis_test.go +++ b/x/perp/v2/module/genesis_test.go @@ -99,6 +99,11 @@ func RunTestGenesis(t *testing.T, tc TestCase) { app.PerpKeeperV2.TraderDiscounts.Insert(ctx, collections.Join(testutil.AccAddress(), math.NewInt(1_000_000)), sdk.MustNewDecFromStr("0.1")) app.PerpKeeperV2.GlobalDiscounts.Insert(ctx, sdk.NewInt(1_000_000), sdk.MustNewDecFromStr("0.05")) app.PerpKeeperV2.TraderVolumes.Insert(ctx, collections.Join(testutil.AccAddress(), uint64(0)), math.NewInt(1_000_000)) + app.PerpKeeperV2.GlobalVolumes.Insert(ctx, uint64(0), math.NewInt(1_000_000)) + app.PerpKeeperV2.EpochRebateAllocations.Insert(ctx, uint64(0), types.DNRAllocation{ + Epoch: 0, + Amount: sdk.NewCoins(sdk.NewCoin(denoms.NUSD, sdk.NewInt(1_000_000))), + }) // create some positions for _, position := range tc.positions { @@ -144,6 +149,8 @@ func RunTestGenesis(t *testing.T, tc TestCase) { require.Equal(t, genState.GlobalDiscount, genStateAfterInit.GlobalDiscount) require.Equal(t, genState.TraderVolumes, genStateAfterInit.TraderVolumes) require.Equal(t, genState.CollateralDenom, genStateAfterInit.CollateralDenom) + require.Equal(t, genState.GlobalVolumes, genStateAfterInit.GlobalVolumes) + require.Equal(t, genState.RebatesAllocations, genStateAfterInit.RebatesAllocations) } func TestNewAppModuleBasic(t *testing.T) { diff --git a/x/perp/v2/types/genesis.pb.go b/x/perp/v2/types/genesis.pb.go index b46ab116e..a97d842db 100644 --- a/x/perp/v2/types/genesis.pb.go +++ b/x/perp/v2/types/genesis.pb.go @@ -42,6 +42,8 @@ type GenesisState struct { GlobalDiscount []GenesisState_Discount `protobuf:"bytes,8,rep,name=global_discount,json=globalDiscount,proto3" json:"global_discount"` CustomDiscounts []GenesisState_CustomDiscount `protobuf:"bytes,9,rep,name=custom_discounts,json=customDiscounts,proto3" json:"custom_discounts"` MarketLastVersions []GenesisMarketLastVersion `protobuf:"bytes,10,rep,name=market_last_versions,json=marketLastVersions,proto3" json:"market_last_versions"` + GlobalVolumes []GenesisState_GlobalVolume `protobuf:"bytes,13,rep,name=global_volumes,json=globalVolumes,proto3" json:"global_volumes"` + RebatesAllocations []DNRAllocation `protobuf:"bytes,12,rep,name=rebates_allocations,json=rebatesAllocations,proto3" json:"rebates_allocations"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -147,6 +149,20 @@ func (m *GenesisState) GetMarketLastVersions() []GenesisMarketLastVersion { return nil } +func (m *GenesisState) GetGlobalVolumes() []GenesisState_GlobalVolume { + if m != nil { + return m.GlobalVolumes + } + return nil +} + +func (m *GenesisState) GetRebatesAllocations() []DNRAllocation { + if m != nil { + return m.RebatesAllocations + } + return nil +} + type GenesisState_TraderVolume struct { Trader string `protobuf:"bytes,1,opt,name=trader,proto3" json:"trader,omitempty"` Epoch uint64 `protobuf:"varint,2,opt,name=epoch,proto3" json:"epoch,omitempty"` @@ -290,6 +306,51 @@ func (m *GenesisState_CustomDiscount) GetDiscount() *GenesisState_Discount { return nil } +type GenesisState_GlobalVolume struct { + Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + Volume github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=volume,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"volume"` +} + +func (m *GenesisState_GlobalVolume) Reset() { *m = GenesisState_GlobalVolume{} } +func (m *GenesisState_GlobalVolume) String() string { return proto.CompactTextString(m) } +func (*GenesisState_GlobalVolume) ProtoMessage() {} +func (*GenesisState_GlobalVolume) Descriptor() ([]byte, []int) { + return fileDescriptor_c2c7acfef3993fde, []int{0, 3} +} +func (m *GenesisState_GlobalVolume) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState_GlobalVolume) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState_GlobalVolume.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 *GenesisState_GlobalVolume) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState_GlobalVolume.Merge(m, src) +} +func (m *GenesisState_GlobalVolume) XXX_Size() int { + return m.Size() +} +func (m *GenesisState_GlobalVolume) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState_GlobalVolume.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState_GlobalVolume proto.InternalMessageInfo + +func (m *GenesisState_GlobalVolume) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + // GenesisMarketLastVersion is the last version including pair only used for // genesis type GenesisMarketLastVersion struct { @@ -395,6 +456,7 @@ func init() { proto.RegisterType((*GenesisState_TraderVolume)(nil), "nibiru.perp.v2.GenesisState.TraderVolume") proto.RegisterType((*GenesisState_Discount)(nil), "nibiru.perp.v2.GenesisState.Discount") proto.RegisterType((*GenesisState_CustomDiscount)(nil), "nibiru.perp.v2.GenesisState.CustomDiscount") + proto.RegisterType((*GenesisState_GlobalVolume)(nil), "nibiru.perp.v2.GenesisState.GlobalVolume") proto.RegisterType((*GenesisMarketLastVersion)(nil), "nibiru.perp.v2.GenesisMarketLastVersion") proto.RegisterType((*GenesisPosition)(nil), "nibiru.perp.v2.GenesisPosition") } @@ -402,51 +464,56 @@ func init() { func init() { proto.RegisterFile("nibiru/perp/v2/genesis.proto", fileDescriptor_c2c7acfef3993fde) } var fileDescriptor_c2c7acfef3993fde = []byte{ - // 700 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xdf, 0x6a, 0x13, 0x4d, - 0x14, 0xcf, 0x36, 0x69, 0x9a, 0x4c, 0xfb, 0x25, 0xfd, 0xc6, 0x52, 0x96, 0x58, 0xd2, 0x52, 0x50, - 0x52, 0xa4, 0x3b, 0x34, 0x82, 0xa0, 0x57, 0x36, 0xad, 0x16, 0xc1, 0x48, 0xd9, 0x96, 0x5e, 0x88, - 0x10, 0x27, 0x9b, 0x31, 0x59, 0x9a, 0x9d, 0x59, 0xe6, 0x4c, 0x82, 0x5e, 0xeb, 0x03, 0x78, 0xe1, - 0xb3, 0xf8, 0x0c, 0xbd, 0xb3, 0x97, 0xe2, 0x45, 0x91, 0xf6, 0x45, 0x64, 0x67, 0x26, 0x69, 0xb2, - 0x98, 0xaa, 0x08, 0x5e, 0x65, 0xe7, 0xcc, 0xf9, 0xfd, 0x99, 0x73, 0x4e, 0x0e, 0x5a, 0xe3, 0x61, - 0x3b, 0x94, 0x03, 0x12, 0x33, 0x19, 0x93, 0x61, 0x9d, 0x74, 0x19, 0x67, 0x10, 0x82, 0x17, 0x4b, - 0xa1, 0x04, 0x2e, 0x99, 0x5b, 0x2f, 0xb9, 0xf5, 0x86, 0xf5, 0x4a, 0x35, 0x10, 0x10, 0x09, 0x20, - 0x6d, 0x0a, 0x8c, 0x0c, 0x77, 0xda, 0x4c, 0xd1, 0x1d, 0x12, 0x88, 0x90, 0x9b, 0xfc, 0xca, 0x5a, - 0x57, 0x88, 0x6e, 0x9f, 0x11, 0x1a, 0x87, 0x84, 0x72, 0x2e, 0x14, 0x55, 0xa1, 0xe0, 0x96, 0xad, - 0xb2, 0xd2, 0x15, 0x5d, 0xa1, 0x3f, 0x49, 0xf2, 0x65, 0xa3, 0x95, 0x94, 0x03, 0x50, 0x54, 0x31, - 0x73, 0xb7, 0xf9, 0xa5, 0x80, 0x96, 0x0e, 0x8c, 0xa3, 0xa3, 0x24, 0x8c, 0x1f, 0xa0, 0x85, 0x88, - 0xca, 0x53, 0xa6, 0xc0, 0x9d, 0xdb, 0xc8, 0xd6, 0x16, 0xeb, 0xab, 0xde, 0xb4, 0x45, 0xaf, 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xc8, 0x9d, 0xd5, 0x41, 0xdc, 0x44, 0xb9, - 0x98, 0x86, 0x56, 0xb5, 0xf1, 0xd0, 0xbe, 0x67, 0x67, 0xe2, 0x3d, 0x2f, 0xb4, 0xda, 0x5e, 0x8f, - 0x86, 0x9c, 0xd8, 0xbd, 0xf5, 0x96, 0x04, 0x22, 0x8a, 0x04, 0x27, 0x14, 0x80, 0x29, 0xef, 0x90, - 0x86, 0xd2, 0xd7, 0x34, 0xd8, 0x45, 0x0b, 0x76, 0x98, 0x6c, 0x3f, 0x47, 0xc7, 0xcd, 0xcf, 0x0e, - 0x2a, 0xa7, 0xf6, 0xc7, 0x3f, 0x13, 0xc7, 0x8f, 0x50, 0x61, 0xb4, 0xa4, 0xf4, 0x40, 0x2d, 0xd6, - 0xdd, 0x74, 0x15, 0x53, 0x4b, 0x6d, 0x9c, 0xdf, 0x38, 0x38, 0xbb, 0xac, 0x3a, 0xe7, 0x97, 0x55, - 0xe7, 0xfb, 0x65, 0xd5, 0xf9, 0x78, 0x55, 0xcd, 0x9c, 0x5f, 0x55, 0x33, 0x5f, 0xaf, 0xaa, 0x99, - 0x97, 0xdb, 0xbf, 0x32, 0x3a, 0xda, 0xef, 0x7a, 0x00, 0xda, 0x79, 0xbd, 0xe0, 0xef, 0xff, 0x08, - 0x00, 0x00, 0xff, 0xff, 0xa2, 0xa1, 0x80, 0x9e, 0x80, 0x06, 0x00, 0x00, + // 772 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0x4f, 0x4f, 0xdb, 0x48, + 0x14, 0x8f, 0x49, 0x08, 0xc9, 0x10, 0x12, 0x76, 0x40, 0xc8, 0xca, 0xb2, 0x01, 0x21, 0xed, 0x2a, + 0x68, 0x85, 0x2d, 0xb2, 0xd2, 0x4a, 0xbb, 0xa7, 0x25, 0x64, 0x8b, 0x2a, 0x35, 0x08, 0x19, 0xc4, + 0xa1, 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 0xb4, 0x87, 0x12, 0x94, 0x22, 0xaf, 0xb8, 0x33, 0x51, 0xc0, 0x2f, 0xd1, 0xba, 0xb2, 0x49, 0x27, + 0x20, 0x20, 0x3a, 0x43, 0xca, 0x41, 0x9e, 0x3b, 0x92, 0x1d, 0xea, 0x73, 0x3a, 0x28, 0x9f, 0x3d, + 0x23, 0x20, 0xce, 0x15, 0x40, 0xd3, 0xe3, 0x30, 0x9d, 0x80, 0x64, 0xda, 0x7a, 0x2a, 0xa3, 0x69, + 0xaf, 0x3c, 0x60, 0xda, 0x47, 0x12, 0x32, 0x3b, 0x6d, 0x6f, 0x2a, 0x96, 0x4c, 0x7b, 0x8d, 0xd3, + 0x2e, 0x11, 0x14, 0x3a, 0x24, 0x08, 0x98, 0xab, 0x6e, 0x9b, 0x59, 0x92, 0xe4, 0xbf, 0xa5, 0xc9, + 0x5b, 0xc7, 0xce, 0xc1, 0xb8, 0x6a, 0xa4, 0x56, 0xe3, 0x27, 0x09, 0xa8, 0xbe, 0x33, 0x50, 0x69, + 0xfa, 0xa4, 0xf1, 0x06, 0xca, 0xab, 0x53, 0x36, 0x0d, 0xe9, 0x26, 0xbd, 0xc2, 0xeb, 0x68, 0x51, + 0x19, 0x71, 0x41, 0x1a, 0x51, 0x2d, 0xf0, 0x13, 0x94, 0x57, 0xbb, 0x34, 0xb3, 0x49, 0x75, 0xd3, + 0x4a, 0x1a, 0x7d, 0xbe, 0xde, 0xfa, 0xc3, 0xf3, 0x45, 0x7f, 0xd0, 0xb5, 0x5c, 0x16, 0xda, 0xfa, + 0x19, 0x51, 0x3f, 0x7b, 0xd0, 0xbb, 0xb0, 0xc5, 0x9b, 0x98, 0x82, 0xf5, 0x34, 0x12, 0x8e, 0x46, + 0x57, 0x3f, 0x18, 0xa8, 0x30, 0x76, 0xc0, 0x7f, 0x28, 0xfb, 0x8a, 0x52, 0xd5, 0xff, 0x87, 0x18, + 0x5b, 0xd4, 0x75, 0x12, 0xe8, 0x94, 0xac, 0x85, 0x47, 0xc9, 0xba, 0x40, 0xe5, 0x59, 0x5b, 0xcd, + 0x1d, 0xcf, 0x01, 0x2a, 0x8c, 0x2f, 0x41, 0xd2, 0xf3, 0xa1, 0x97, 0xc0, 0x19, 0xc3, 0xaa, 0x01, + 0x2a, 0x4d, 0xbb, 0x60, 0x32, 0x71, 0xe3, 0xee, 0x89, 0x3f, 0x6a, 0x6b, 0x3b, 0x6f, 0x0d, 0x64, + 0xce, 0x73, 0x37, 0x6e, 0xa3, 0x5c, 0x4c, 0x7c, 0xbd, 0xc7, 0xe6, 0x3f, 0xba, 0xc5, 0xfe, 0x54, + 0x8b, 0x63, 0xb9, 0xb7, 0xc3, 0x3e, 0xf1, 0x23, 0x5b, 0xbf, 0xe9, 0xaf, 0x6d, 0x97, 0x85, 0x21, + 0x8b, 0x6c, 0x02, 0x40, 0x85, 0x75, 0x42, 0x7c, 0xee, 0x48, 0x1a, 0x6c, 0xa2, 0x25, 0x7d, 0xd1, + 0xb4, 0x7b, 0x46, 0xcb, 0x9d, 0x8f, 0x06, 0xaa, 0xa4, 0xde, 0xd6, 0x9f, 0xd6, 0x1c, 0xff, 0x8b, + 0x0a, 0xa3, 0x07, 0x5c, 0xda, 0x77, 0xb9, 0x61, 0xa6, 0xcf, 0x2c, 0xf5, 0xe0, 0x8f, 0xeb, 0x9b, + 0x47, 0x97, 0x37, 0x35, 0xe3, 0xea, 0xa6, 0x66, 0x7c, 0xb9, 0xa9, 0x19, 0xef, 0x6f, 0x6b, 0x99, + 0xab, 0xdb, 0x5a, 0xe6, 0xd3, 0x6d, 0x2d, 0xf3, 0x7c, 0xef, 0x7b, 0x42, 0x47, 0xdf, 0x3e, 0x79, + 0x26, 0xdd, 0xbc, 0xfc, 0xf8, 0xfd, 0xf5, 0x2d, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x78, 0x24, 0x04, + 0x9c, 0x07, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -469,6 +536,34 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.GlobalVolumes) > 0 { + for iNdEx := len(m.GlobalVolumes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GlobalVolumes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6a + } + } + if len(m.RebatesAllocations) > 0 { + for iNdEx := len(m.RebatesAllocations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RebatesAllocations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } + } if len(m.CollateralDenom) > 0 { i -= len(m.CollateralDenom) copy(dAtA[i:], m.CollateralDenom) @@ -726,6 +821,44 @@ func (m *GenesisState_CustomDiscount) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *GenesisState_GlobalVolume) 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 *GenesisState_GlobalVolume) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState_GlobalVolume) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Volume.Size() + i -= size + if _, err := m.Volume.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Epoch != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *GenesisMarketLastVersion) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -884,6 +1017,18 @@ func (m *GenesisState) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } + if len(m.RebatesAllocations) > 0 { + for _, e := range m.RebatesAllocations { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.GlobalVolumes) > 0 { + for _, e := range m.GlobalVolumes { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -935,6 +1080,20 @@ func (m *GenesisState_CustomDiscount) Size() (n int) { return n } +func (m *GenesisState_GlobalVolume) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovGenesis(uint64(m.Epoch)) + } + l = m.Volume.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + func (m *GenesisMarketLastVersion) Size() (n int) { if m == nil { return 0 @@ -1323,6 +1482,74 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } m.CollateralDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RebatesAllocations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RebatesAllocations = append(m.RebatesAllocations, DNRAllocation{}) + if err := m.RebatesAllocations[len(m.RebatesAllocations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalVolumes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GlobalVolumes = append(m.GlobalVolumes, GenesisState_GlobalVolume{}) + if err := m.GlobalVolumes[len(m.GlobalVolumes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) @@ -1715,6 +1942,109 @@ func (m *GenesisState_CustomDiscount) Unmarshal(dAtA []byte) error { } return nil } +func (m *GenesisState_GlobalVolume) 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 ErrIntOverflowGenesis + } + 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: GlobalVolume: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GlobalVolume: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Volume", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Volume.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *GenesisMarketLastVersion) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/perp/v2/types/keys.go b/x/perp/v2/types/keys.go index c7658450f..3ce91b28a 100644 --- a/x/perp/v2/types/keys.go +++ b/x/perp/v2/types/keys.go @@ -3,10 +3,12 @@ package types import "github.com/NibiruChain/nibiru/x/common" const ( - ModuleName = "perp" - VaultModuleAccount = "vault" - PerpEFModuleAccount = "perp_ef" - FeePoolModuleAccount = "fee_pool" + ModuleName = "perp" + VaultModuleAccount = "vault" + PerpEFModuleAccount = "perp_ef" + FeePoolModuleAccount = "fee_pool" + DNRAllocationModuleAccount = "dnr_allocation" + DNREscrowModuleAccount = "dnr_escrow" ) var ( diff --git a/x/perp/v2/types/msgs.go b/x/perp/v2/types/msgs.go index 551ad0baa..d67370e3c 100644 --- a/x/perp/v2/types/msgs.go +++ b/x/perp/v2/types/msgs.go @@ -17,6 +17,8 @@ var ( _ sdk.Msg = &MsgClosePosition{} _ sdk.Msg = &MsgDonateToEcosystemFund{} _ sdk.Msg = &MsgPartialClose{} + _ sdk.Msg = &MsgAllocateEpochRebates{} + _ sdk.Msg = &MsgWithdrawEpochRebates{} ) // MsgRemoveMargin @@ -301,3 +303,47 @@ func (m MsgChangeCollateralDenom) GetSigners() []sdk.AccAddress { } return []sdk.AccAddress{signer} } + +func (m MsgAllocateEpochRebates) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Sender); err != nil { + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + if err := m.Rebates.Validate(); err != nil { + return err + } + return nil +} + +func (m MsgAllocateEpochRebates) GetSigners() []sdk.AccAddress { + signer, err := sdk.AccAddressFromBech32(m.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{signer} +} + +func (m MsgAllocateEpochRebates) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgWithdrawEpochRebates) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Sender); err != nil { + return sdkerrors.Wrapf(errors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + if len(m.Epochs) == 0 { + return fmt.Errorf("epochs cannot be empty") + } + return nil +} + +func (m MsgWithdrawEpochRebates) GetSigners() []sdk.AccAddress { + signer, err := sdk.AccAddressFromBech32(m.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{signer} +} + +func (m MsgWithdrawEpochRebates) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} diff --git a/x/perp/v2/types/state.pb.go b/x/perp/v2/types/state.pb.go index 0849e70f6..f8d525290 100644 --- a/x/perp/v2/types/state.pb.go +++ b/x/perp/v2/types/state.pb.go @@ -434,6 +434,61 @@ func (m *ReserveSnapshot) GetTimestampMs() int64 { return 0 } +// DNRAllocation represents a rebates allocation for a given epoch. +type DNRAllocation struct { + // epoch defines the reference epoch for the allocation. + Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + // amount of DNR allocated for the epoch. + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` +} + +func (m *DNRAllocation) Reset() { *m = DNRAllocation{} } +func (m *DNRAllocation) String() string { return proto.CompactTextString(m) } +func (*DNRAllocation) ProtoMessage() {} +func (*DNRAllocation) Descriptor() ([]byte, []int) { + return fileDescriptor_8f4829f34f7b8040, []int{5} +} +func (m *DNRAllocation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DNRAllocation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DNRAllocation.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 *DNRAllocation) XXX_Merge(src proto.Message) { + xxx_messageInfo_DNRAllocation.Merge(m, src) +} +func (m *DNRAllocation) XXX_Size() int { + return m.Size() +} +func (m *DNRAllocation) XXX_DiscardUnknown() { + xxx_messageInfo_DNRAllocation.DiscardUnknown(m) +} + +var xxx_messageInfo_DNRAllocation proto.InternalMessageInfo + +func (m *DNRAllocation) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *DNRAllocation) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Amount + } + return nil +} + func init() { proto.RegisterEnum("nibiru.perp.v2.Direction", Direction_name, Direction_value) proto.RegisterEnum("nibiru.perp.v2.TwapCalcOption", TwapCalcOption_name, TwapCalcOption_value) @@ -442,82 +497,87 @@ func init() { proto.RegisterType((*AMM)(nil), "nibiru.perp.v2.AMM") proto.RegisterType((*Position)(nil), "nibiru.perp.v2.Position") proto.RegisterType((*ReserveSnapshot)(nil), "nibiru.perp.v2.ReserveSnapshot") + proto.RegisterType((*DNRAllocation)(nil), "nibiru.perp.v2.DNRAllocation") } func init() { proto.RegisterFile("nibiru/perp/v2/state.proto", fileDescriptor_8f4829f34f7b8040) } var fileDescriptor_8f4829f34f7b8040 = []byte{ - // 1118 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0xcf, 0x6f, 0xdc, 0x44, - 0x14, 0xc7, 0xb3, 0xc9, 0x36, 0xcd, 0x4e, 0xd2, 0x64, 0x99, 0x36, 0xc5, 0xa9, 0xd0, 0x26, 0x44, - 0x02, 0x45, 0x45, 0xb5, 0x95, 0x70, 0xaa, 0x38, 0xed, 0x8f, 0xa4, 0x44, 0xda, 0x5f, 0xf5, 0x6e, - 0xa8, 0x40, 0x45, 0xa3, 0xb1, 0xfd, 0xe2, 0x1d, 0x62, 0x7b, 0xdc, 0x99, 0xf1, 0x26, 0x85, 0x3f, - 0x02, 0x8e, 0xf0, 0xd7, 0x70, 0xed, 0xb1, 0x47, 0xc4, 0xa1, 0xa0, 0xf6, 0x1f, 0x41, 0x33, 0xf6, - 0x6e, 0x36, 0x12, 0x12, 0x60, 0xd1, 0x53, 0x32, 0xf3, 0xfc, 0x3e, 0xdf, 0xe7, 0xb7, 0x6f, 0xbe, - 0x63, 0xf4, 0x20, 0x61, 0x1e, 0x13, 0x99, 0x93, 0x82, 0x48, 0x9d, 0xe9, 0x91, 0x23, 0x15, 0x55, - 0x60, 0xa7, 0x82, 0x2b, 0x8e, 0x37, 0xf3, 0x98, 0xad, 0x63, 0xf6, 0xf4, 0xe8, 0xc1, 0xbd, 0x90, - 0x87, 0xdc, 0x84, 0x1c, 0xfd, 0x5f, 0xfe, 0xd4, 0x83, 0x86, 0xcf, 0x65, 0xcc, 0xa5, 0xe3, 0x51, - 0x09, 0xce, 0xf4, 0xd0, 0x03, 0x45, 0x0f, 0x1d, 0x9f, 0xb3, 0xa4, 0x88, 0xef, 0xe4, 0x71, 0x92, - 0x27, 0xe6, 0x8b, 0x59, 0x6a, 0xc8, 0x79, 0x18, 0x81, 0x63, 0x56, 0x5e, 0x76, 0xee, 0x04, 0x99, - 0xa0, 0x8a, 0xf1, 0x22, 0x75, 0xff, 0xc7, 0x1a, 0x5a, 0xed, 0x51, 0x71, 0x01, 0x0a, 0xf7, 0x50, - 0x35, 0xa5, 0x4c, 0x58, 0x95, 0xbd, 0xca, 0x41, 0xad, 0xf5, 0xf8, 0xd5, 0x9b, 0xdd, 0xa5, 0xdf, - 0xdf, 0xec, 0x1e, 0x86, 0x4c, 0x4d, 0x32, 0xcf, 0xf6, 0x79, 0xec, 0xf4, 0x4d, 0xb1, 0xed, 0x09, - 0x65, 0x89, 0x53, 0xbc, 0xd4, 0x95, 0xe3, 0xf3, 0x38, 0xe6, 0x89, 0x43, 0xa5, 0x04, 0x65, 0x0f, - 0x29, 0x13, 0xae, 0xc1, 0x60, 0x0b, 0xdd, 0x86, 0x84, 0x7a, 0x11, 0x04, 0xd6, 0xf2, 0x5e, 0xe5, - 0x60, 0xcd, 0x9d, 0x2d, 0x75, 0x64, 0x0a, 0x42, 0x32, 0x9e, 0x58, 0x9b, 0x7b, 0x95, 0x83, 0xaa, - 0x3b, 0x5b, 0xe2, 0x09, 0xb2, 0x62, 0xca, 0x12, 0x05, 0x09, 0x4d, 0x7c, 0x20, 0x31, 0x15, 0x21, - 0x4b, 0x88, 0x29, 0xd8, 0x5a, 0x31, 0x65, 0xd9, 0x45, 0x59, 0x9f, 0x2e, 0x94, 0x55, 0x74, 0x27, - 0xff, 0xf3, 0x48, 0x06, 0x17, 0x8e, 0x7a, 0x99, 0x82, 0xb4, 0x3b, 0xe0, 0xbb, 0xf7, 0x17, 0x78, - 0x3d, 0x83, 0x73, 0x35, 0x0d, 0x3f, 0x45, 0x1b, 0x31, 0xbd, 0x22, 0x11, 0x4c, 0x41, 0xd0, 0x10, - 0xac, 0x6a, 0x29, 0xfa, 0x7a, 0x4c, 0xaf, 0xba, 0x05, 0x02, 0xff, 0x80, 0xf6, 0x23,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1, 0xf4, 0xfa, 0x5d, 0x63, 0xe9, 0xb7, 0x77, 0x8d, 0xa5, - 0x6f, 0x1e, 0xfd, 0xd3, 0xd0, 0xcf, 0xbe, 0xbb, 0xcd, 0x2f, 0xe6, 0xad, 0x9a, 0x8b, 0xf3, 0xf3, - 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x73, 0x2a, 0x4b, 0xe9, 0x96, 0x0b, 0x00, 0x00, + // 1173 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x97, 0xcd, 0x6e, 0xdb, 0x46, + 0x10, 0xc7, 0x4d, 0x4b, 0x76, 0xac, 0xf5, 0x97, 0xba, 0xb1, 0x53, 0x3a, 0x28, 0x64, 0x57, 0x40, + 0x0b, 0x23, 0x45, 0xc8, 0xda, 0x3d, 0x05, 0x3d, 0xe9, 0xc3, 0x4e, 0x05, 0xe8, 0x2b, 0x94, 0xdc, + 0xa0, 0x45, 0x8a, 0xc5, 0x92, 0x5c, 0x53, 0x5b, 0x93, 0x5c, 0x86, 0xbb, 0x94, 0x9d, 0xf6, 0x0d, + 0x7a, 0x69, 0x8f, 0xed, 0x2b, 0xf4, 0x25, 0x7a, 0xcd, 0x31, 0xc7, 0xa2, 0x87, 0xa4, 0x48, 0x5e, + 0xa4, 0xd8, 0xe5, 0x4a, 0x96, 0x81, 0xa2, 0x4d, 0x89, 0xe6, 0x24, 0xed, 0x0e, 0xe7, 0x37, 0xc3, + 0xc1, 0xcc, 0x7f, 0x24, 0x70, 0x37, 0xa6, 0x2e, 0x4d, 0x33, 0x3b, 0x21, 0x69, 0x62, 0x4f, 0x8f, + 0x6d, 0x2e, 0xb0, 0x20, 0x56, 0x92, 0x32, 0xc1, 0xe0, 0x56, 0x6e, 0xb3, 0xa4, 0xcd, 0x9a, 0x1e, + 0xdf, 0xdd, 0x09, 0x58, 0xc0, 0x94, 0xc9, 0x96, 0xdf, 0x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b7, 0xda, 0xc4, + 0x73, 0xee, 0x2c, 0xf0, 0x7a, 0x0a, 0xe7, 0x48, 0x1a, 0x7c, 0x04, 0x36, 0x22, 0x7c, 0x85, 0x42, + 0x32, 0x25, 0x29, 0x0e, 0x88, 0x59, 0x2e, 0x44, 0x5f, 0x8f, 0xf0, 0x55, 0x57, 0x23, 0xe0, 0xf7, + 0xa0, 0x1e, 0x62, 0x41, 0xb8, 0x40, 0x5e, 0x16, 0x65, 0x21, 0x16, 0x74, 0x4a, 0x50, 0x92, 0x92, + 0x88, 0x66, 0x11, 0x3a, 0x4f, 0xb1, 0x27, 0xcb, 0x6e, 0xae, 0x14, 0x0a, 0xb4, 0x9f, 0x93, 0x5b, + 0x73, 0xf0, 0x30, 0xe7, 0x9e, 0x6a, 0x2c, 0x7c, 0x02, 0x20, 0xb9, 0xf2, 0x26, 0x38, 0x0e, 0x08, + 0x3a, 0x27, 0x44, 0xd7, 0x6c, 0xb5, 0x50, 0xb0, 0xea, 0x8c, 0x74, 0x4a, 0x48, 0x5e, 0xad, 0x00, + 0x98, 0xc4, 0x63, 0xfc, 0x19, 0x17, 0x24, 0x42, 0xe7, 0x59, 0xec, 0x2f, 0xc4, 0xb8, 0x55, 0x28, + 0xc6, 0xee, 0x9c, 0x77, 0x9a, 0xc5, 0xfe, 0x3c, 0x90, 0x0b, 0x76, 0x43, 0xfa, 0x34, 0xa3, 0xbe, + 0xea, 0xd1, 0x85, 0x28, 0x6b, 0x85, 0xa2, 0xdc, 0x5e, 0x80, 0xcd, 0x63, 0x7c, 0x0b, 0xf6, 0x12, + 0x9c, 0x0a, 0x8a, 0x43, 0xb4, 0x18, 0x2b, 0x8f, 0x53, 0x29, 0x14, 0xe7, 0x7d, 0x0d, 0xec, 0x5e, + 0xf3, 0xf2, 0x58, 0x47, 0x60, 0x57, 0x96, 0x8b, 0xc6, 0x81, 0xe4, 0x13, 0x44, 0x12, 0xe6, 0x4d, + 0x10, 0xf5, 0x4d, 0x20, 0xe3, 0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c, 0x89, 0x6b, 0x66, + 0x31, 0xad, 0xdb, 0x50, 0x90, 0x19, 0xb4, 0x07, 0x00, 0x7f, 0x9a, 0x0a, 0xe4, 0x93, 0x44, 0x4c, + 0x0a, 0xea, 0x5b, 0x45, 0x12, 0xda, 0x12, 0x00, 0xbf, 0x92, 0xfd, 0x43, 0xa5, 0x28, 0x67, 0xa1, + 0xa0, 0x49, 0x48, 0x49, 0x5a, 0x50, 0xcb, 0xb6, 0x15, 0xa7, 0x37, 0xc7, 0xc8, 0x4c, 0x05, 0x13, + 0x72, 0x1c, 0x59, 0x1c, 0x14, 0xd4, 0xac, 0x8a, 0x22, 0x74, 0x59, 0x1c, 0xc0, 0x01, 0x58, 0xcf, + 0x71, 0x7c, 0xc2, 0x52, 0x51, 0x50, 0x9f, 0xf2, 0x8c, 0x46, 0x92, 0x00, 0xbf, 0x01, 0x55, 0x4e, + 0x84, 0x08, 0x49, 0x44, 0x62, 0x81, 0x54, 0xf6, 0x5a, 0x27, 0x8a, 0xf4, 0xfb, 0xf6, 0x35, 0x6b, + 0x28, 0x51, 0xf5, 0x5f, 0xca, 0x60, 0x6d, 0xc8, 0x38, 0x55, 0x3a, 0xfe, 0x11, 0xd8, 0x12, 0x29, + 0xf6, 0x49, 0x8a, 0xb0, 0xef, 0xa7, 0x84, 0xf3, 0xbc, 0xa1, 0x9d, 0xcd, 0xfc, 0xb6, 0x91, 0x5f, + 0xce, 0xbb, 0x7d, 0xf9, 0xff, 0xe9, 0xf6, 0x26, 0x28, 0x73, 0xfa, 0x5d, 0xd1, 0xbe, 0x53, 0xbe, + 0xf0, 0x14, 0xac, 0xe6, 0xfb, 0xba, 0x60, 0xaf, 0x69, 0x6f, 0x39, 0x0c, 0x2c, 0x21, 0x31, 0x8a, + 0x99, 0x2c, 0x08, 0x0e, 0x0b, 0x76, 0xd9, 0x86, 0x84, 0xf4, 0x35, 0xe3, 0x2d, 0x77, 0xf3, 0xea, + 0xbb, 0xd9, 0xcd, 0x0f, 0x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17, 0x03, 0x67, 0x5c, 0x5d, 0xbe, + 0x17, 0x80, 0xad, 0xf1, 0x25, 0x4e, 0x5a, 0x38, 0xf4, 0x06, 0x89, 0x22, 0x1c, 0x80, 0x0f, 0xc6, + 0x8f, 0x1b, 0x43, 0xd4, 0x6a, 0x74, 0x5b, 0x68, 0x30, 0xfc, 0x7b, 0xd0, 0x68, 0x38, 0x18, 0x57, + 0x0d, 0xb8, 0x03, 0xaa, 0x8f, 0xce, 0x06, 0xe3, 0x13, 0xd4, 0x18, 0x8d, 0x4e, 0xc6, 0x68, 0xf4, + 0xb8, 0x31, 0xac, 0x2e, 0xc3, 0xdb, 0x60, 0xbb, 0xd9, 0x18, 0xdd, 0xb8, 0x2c, 0x35, 0x1f, 0x3e, + 0x7f, 0x5d, 0x33, 0x5e, 0xbc, 0xae, 0x19, 0x7f, 0xbe, 0xae, 0x19, 0x3f, 0xbd, 0xa9, 0x2d, 0xbd, + 0x78, 0x53, 0x5b, 0xfa, 0xfd, 0x4d, 0x6d, 0xe9, 0xeb, 0xfb, 0xff, 0x36, 0x81, 0xb3, 0x3f, 0x01, + 0xea, 0xe5, 0xdd, 0x55, 0xb5, 0xc5, 0x3f, 0xfb, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x17, 0xec, 0xac, + 0x5e, 0x23, 0x0c, 0x00, 0x00, } func (m *Market) Marshal() (dAtA []byte, err error) { @@ -932,6 +992,48 @@ func (m *ReserveSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DNRAllocation) 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 *DNRAllocation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DNRAllocation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintState(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Epoch != 0 { + i = encodeVarintState(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintState(dAtA []byte, offset int, v uint64) int { offset -= sovState(v) base := offset @@ -1064,6 +1166,24 @@ func (m *ReserveSnapshot) Size() (n int) { return n } +func (m *DNRAllocation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovState(uint64(m.Epoch)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovState(uint64(l)) + } + } + return n +} + func sovState(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2346,6 +2466,109 @@ func (m *ReserveSnapshot) Unmarshal(dAtA []byte) error { } return nil } +func (m *DNRAllocation) 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 ErrIntOverflowState + } + 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: DNRAllocation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DNRAllocation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipState(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipState(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/perp/v2/types/tx.pb.go b/x/perp/v2/types/tx.pb.go index 31ed8fd93..54ba4245b 100644 --- a/x/perp/v2/types/tx.pb.go +++ b/x/perp/v2/types/tx.pb.go @@ -1004,6 +1004,201 @@ func (m *MsgChangeCollateralDenomResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgChangeCollateralDenomResponse proto.InternalMessageInfo +// -------------------------- AllocateEpochRebates -------------------------- +type MsgAllocateEpochRebates struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + // rebates to allocate + Rebates github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=rebates,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"rebates"` +} + +func (m *MsgAllocateEpochRebates) Reset() { *m = MsgAllocateEpochRebates{} } +func (m *MsgAllocateEpochRebates) String() string { return proto.CompactTextString(m) } +func (*MsgAllocateEpochRebates) ProtoMessage() {} +func (*MsgAllocateEpochRebates) Descriptor() ([]byte, []int) { + return fileDescriptor_b95cda40bf0a0f91, []int{17} +} +func (m *MsgAllocateEpochRebates) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAllocateEpochRebates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAllocateEpochRebates.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 *MsgAllocateEpochRebates) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAllocateEpochRebates.Merge(m, src) +} +func (m *MsgAllocateEpochRebates) XXX_Size() int { + return m.Size() +} +func (m *MsgAllocateEpochRebates) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAllocateEpochRebates.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAllocateEpochRebates proto.InternalMessageInfo + +func (m *MsgAllocateEpochRebates) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgAllocateEpochRebates) GetRebates() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Rebates + } + return nil +} + +type MsgAllocateEpochRebatesResponse struct { + TotalEpochRebates github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=total_epoch_rebates,json=totalEpochRebates,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"total_epoch_rebates"` +} + +func (m *MsgAllocateEpochRebatesResponse) Reset() { *m = MsgAllocateEpochRebatesResponse{} } +func (m *MsgAllocateEpochRebatesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAllocateEpochRebatesResponse) ProtoMessage() {} +func (*MsgAllocateEpochRebatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b95cda40bf0a0f91, []int{18} +} +func (m *MsgAllocateEpochRebatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAllocateEpochRebatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAllocateEpochRebatesResponse.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 *MsgAllocateEpochRebatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAllocateEpochRebatesResponse.Merge(m, src) +} +func (m *MsgAllocateEpochRebatesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAllocateEpochRebatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAllocateEpochRebatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAllocateEpochRebatesResponse proto.InternalMessageInfo + +func (m *MsgAllocateEpochRebatesResponse) GetTotalEpochRebates() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.TotalEpochRebates + } + return nil +} + +// -------------------------- WithdrawEpochRebates -------------------------- +type MsgWithdrawEpochRebates struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Epochs []uint64 `protobuf:"varint,2,rep,packed,name=epochs,proto3" json:"epochs,omitempty"` +} + +func (m *MsgWithdrawEpochRebates) Reset() { *m = MsgWithdrawEpochRebates{} } +func (m *MsgWithdrawEpochRebates) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawEpochRebates) ProtoMessage() {} +func (*MsgWithdrawEpochRebates) Descriptor() ([]byte, []int) { + return fileDescriptor_b95cda40bf0a0f91, []int{19} +} +func (m *MsgWithdrawEpochRebates) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawEpochRebates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawEpochRebates.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 *MsgWithdrawEpochRebates) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawEpochRebates.Merge(m, src) +} +func (m *MsgWithdrawEpochRebates) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawEpochRebates) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawEpochRebates.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawEpochRebates proto.InternalMessageInfo + +func (m *MsgWithdrawEpochRebates) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgWithdrawEpochRebates) GetEpochs() []uint64 { + if m != nil { + return m.Epochs + } + return nil +} + +type MsgWithdrawEpochRebatesResponse struct { + WithdrawnRebates github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=withdrawn_rebates,json=withdrawnRebates,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"withdrawn_rebates"` +} + +func (m *MsgWithdrawEpochRebatesResponse) Reset() { *m = MsgWithdrawEpochRebatesResponse{} } +func (m *MsgWithdrawEpochRebatesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawEpochRebatesResponse) ProtoMessage() {} +func (*MsgWithdrawEpochRebatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b95cda40bf0a0f91, []int{20} +} +func (m *MsgWithdrawEpochRebatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawEpochRebatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawEpochRebatesResponse.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 *MsgWithdrawEpochRebatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawEpochRebatesResponse.Merge(m, src) +} +func (m *MsgWithdrawEpochRebatesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawEpochRebatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawEpochRebatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawEpochRebatesResponse proto.InternalMessageInfo + +func (m *MsgWithdrawEpochRebatesResponse) GetWithdrawnRebates() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.WithdrawnRebates + } + return nil +} + func init() { proto.RegisterType((*MsgSettlePosition)(nil), "nibiru.perp.v2.MsgSettlePosition") proto.RegisterType((*MsgRemoveMargin)(nil), "nibiru.perp.v2.MsgRemoveMargin") @@ -1024,93 +1219,107 @@ func init() { proto.RegisterType((*MsgDonateToEcosystemFundResponse)(nil), "nibiru.perp.v2.MsgDonateToEcosystemFundResponse") proto.RegisterType((*MsgChangeCollateralDenom)(nil), "nibiru.perp.v2.MsgChangeCollateralDenom") proto.RegisterType((*MsgChangeCollateralDenomResponse)(nil), "nibiru.perp.v2.MsgChangeCollateralDenomResponse") + proto.RegisterType((*MsgAllocateEpochRebates)(nil), "nibiru.perp.v2.MsgAllocateEpochRebates") + proto.RegisterType((*MsgAllocateEpochRebatesResponse)(nil), "nibiru.perp.v2.MsgAllocateEpochRebatesResponse") + proto.RegisterType((*MsgWithdrawEpochRebates)(nil), "nibiru.perp.v2.MsgWithdrawEpochRebates") + proto.RegisterType((*MsgWithdrawEpochRebatesResponse)(nil), "nibiru.perp.v2.MsgWithdrawEpochRebatesResponse") } func init() { proto.RegisterFile("nibiru/perp/v2/tx.proto", fileDescriptor_b95cda40bf0a0f91) } var fileDescriptor_b95cda40bf0a0f91 = []byte{ - // 1287 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0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0x85, 0xc4, 0x92, 0x44, 0x34, - 0xfd, 0x1b, 0x0d, 0xce, 0xd6, 0x85, 0x73, 0x93, 0x48, 0xe9, 0x92, 0x2d, 0x2e, 0xa8, 0x52, 0x87, - 0xe6, 0x61, 0x5c, 0x10, 0xd6, 0x24, 0x7e, 0x45, 0x5b, 0xd2, 0x96, 0x27, 0xad, 0x78, 0x85, 0xea, - 0x50, 0x6a, 0x63, 0xea, 0x57, 0xc6, 0xd4, 0xd7, 0xf5, 0xf7, 0x9e, 0x3c, 0x5b, 0x2c, 0xfc, 0xfa, - 0x6c, 0xf1, 0x92, 0x43, 0xe5, 0x4e, 0xb0, 0x6d, 0x34, 0xb8, 0x67, 0x5e, 0x0b, 0x55, 0x6d, 0xec, - 0x60, 0xca, 0xcc, 0x58, 0xed, 0x23, 0xb3, 0xc1, 0x3d, 0x8f, 0x33, 0x13, 0x0b, 0x41, 0xa4, 0xb1, - 0x85, 0xa9, 0x6f, 0x85, 0x30, 0xa8, 0x02, 0xa7, 0x3b, 0xc4, 0x17, 0x94, 0xb3, 0x4a, 0x71, 0x49, - 0x5b, 0x2e, 0x59, 0xc9, 0x52, 0xff, 0x5e, 0x83, 0x99, 0xba, 0x70, 0x2c, 0xe2, 0xf1, 0x0e, 0xa9, - 0x63, 0xdf, 0xa1, 0x27, 0x66, 0xd4, 0xbb, 0x30, 0xee, 0x85, 0x0a, 0x43, 0x9b, 0xa6, 0x56, 0xcf, - 0x1b, 0x51, 0xd0, 0x0d, 0x15, 0x74, 0x23, 0x0e, 0xba, 0xb1, 0xc1, 0x29, 0x5b, 0x2f, 0x29, 0x5d, - 0x56, 0xcc, 0xae, 0xff, 0xae, 0xc1, 0x42, 0x9f, 0xcd, 0x16, 0x11, 0x6d, 0xce, 0x04, 0x41, 0x1f, - 0x02, 0x44, 0x5c, 0x36, 0x0f, 0x64, 0x68, 0xff, 0x00, 0xc0, 0x93, 0x91, 0xc8, 0xf5, 0x40, 0xa2, - 0x3b, 0x30, 0xd3,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xff, 0xff, 0x38, - 0x87, 0x87, 0xcc, 0x86, 0x15, 0x00, 0x00, + // 1447 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xf7, 0xc6, 0x6e, 0xea, 0xbc, 0xa4, 0x4e, 0xb2, 0x4d, 0x13, 0xd7, 0xdf, 0xca, 0xc9, 0x77, + 0x85, 0x4a, 0x38, 0x64, 0xb7, 0x0d, 0x48, 0x08, 0x24, 0x40, 0xf9, 0xd1, 0xa2, 0xa2, 0xba, 0x4d, + 0xb7, 0x55, 0x8b, 0x0a, 0x68, 0x3b, 0xb1, 0x27, 0x9b, 0x51, 0xd7, 0x33, 0xee, 0xce, 0xac, 0x93, + 0x94, 0x1b, 0x7f, 0x01, 0x07, 0x0e, 0x48, 0x48, 0xdc, 0xb8, 0x70, 0x40, 0xe2, 0x00, 0x5c, 0xf8, + 0x03, 0x7a, 0xec, 0x11, 0x71, 0x28, 0xd0, 0x5c, 0xb8, 0x52, 0xf1, 0x07, 0xa0, 0xd9, 0x5f, 0x5e, + 0xbb, 0x13, 0xc7, 0x09, 0x69, 0x24, 0x10, 0xa7, 0x78, 0xf7, 0xbd, 0xf7, 0x79, 0x9f, 0xf7, 0x63, + 0xde, 0xcc, 0x6c, 0x60, 0x86, 0x92, 0x75, 0xe2, 0x07, 0x56, 0x0b, 0xfb, 0x2d, 0xab, 0xbd, 0x68, + 0x89, 0x6d, 0xb3, 0xe5, 0x33, 0xc1, 0xf4, 0x52, 0x24, 0x30, 0xa5, 0xc0, 0x6c, 0x2f, 0x56, 0xce, + 0xb9, 0x8c, 0xb9, 0x1e, 0xb6, 0x50, 0x8b, 0x58, 0x88, 0x52, 0x26, 0x90, 0x20, 0x8c, 0xf2, 0x48, + 0xbb, 0x52, 0xad, 0x33, 0xde, 0x64, 0xdc, 0x5a, 0x47, 0x1c, 0x5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x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1134,6 +1343,8 @@ type MsgClient interface { SettlePosition(ctx context.Context, in *MsgSettlePosition, opts ...grpc.CallOption) (*MsgClosePositionResponse, error) DonateToEcosystemFund(ctx context.Context, in *MsgDonateToEcosystemFund, opts ...grpc.CallOption) (*MsgDonateToEcosystemFundResponse, error) ChangeCollateralDenom(ctx context.Context, in *MsgChangeCollateralDenom, opts ...grpc.CallOption) (*MsgChangeCollateralDenomResponse, error) + AllocateEpochRebates(ctx context.Context, in *MsgAllocateEpochRebates, opts ...grpc.CallOption) (*MsgAllocateEpochRebatesResponse, error) + WithdrawEpochRebates(ctx context.Context, in *MsgWithdrawEpochRebates, opts ...grpc.CallOption) (*MsgWithdrawEpochRebatesResponse, error) } type msgClient struct { @@ -1225,6 +1436,24 @@ func (c *msgClient) ChangeCollateralDenom(ctx context.Context, in *MsgChangeColl return out, nil } +func (c *msgClient) AllocateEpochRebates(ctx context.Context, in *MsgAllocateEpochRebates, opts ...grpc.CallOption) (*MsgAllocateEpochRebatesResponse, error) { + out := new(MsgAllocateEpochRebatesResponse) + err := c.cc.Invoke(ctx, "/nibiru.perp.v2.Msg/AllocateEpochRebates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) WithdrawEpochRebates(ctx context.Context, in *MsgWithdrawEpochRebates, opts ...grpc.CallOption) (*MsgWithdrawEpochRebatesResponse, error) { + out := new(MsgWithdrawEpochRebatesResponse) + err := c.cc.Invoke(ctx, "/nibiru.perp.v2.Msg/WithdrawEpochRebates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { RemoveMargin(context.Context, *MsgRemoveMargin) (*MsgRemoveMarginResponse, error) @@ -1236,6 +1465,8 @@ type MsgServer interface { SettlePosition(context.Context, *MsgSettlePosition) (*MsgClosePositionResponse, error) DonateToEcosystemFund(context.Context, *MsgDonateToEcosystemFund) (*MsgDonateToEcosystemFundResponse, error) ChangeCollateralDenom(context.Context, *MsgChangeCollateralDenom) (*MsgChangeCollateralDenomResponse, error) + AllocateEpochRebates(context.Context, *MsgAllocateEpochRebates) (*MsgAllocateEpochRebatesResponse, error) + WithdrawEpochRebates(context.Context, *MsgWithdrawEpochRebates) (*MsgWithdrawEpochRebatesResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1269,6 +1500,12 @@ func (*UnimplementedMsgServer) DonateToEcosystemFund(ctx context.Context, req *M func (*UnimplementedMsgServer) ChangeCollateralDenom(ctx context.Context, req *MsgChangeCollateralDenom) (*MsgChangeCollateralDenomResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ChangeCollateralDenom not implemented") } +func (*UnimplementedMsgServer) AllocateEpochRebates(ctx context.Context, req *MsgAllocateEpochRebates) (*MsgAllocateEpochRebatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllocateEpochRebates not implemented") +} +func (*UnimplementedMsgServer) WithdrawEpochRebates(ctx context.Context, req *MsgWithdrawEpochRebates) (*MsgWithdrawEpochRebatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WithdrawEpochRebates not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1436,6 +1673,42 @@ func _Msg_ChangeCollateralDenom_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _Msg_AllocateEpochRebates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAllocateEpochRebates) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AllocateEpochRebates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nibiru.perp.v2.Msg/AllocateEpochRebates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AllocateEpochRebates(ctx, req.(*MsgAllocateEpochRebates)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_WithdrawEpochRebates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdrawEpochRebates) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).WithdrawEpochRebates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nibiru.perp.v2.Msg/WithdrawEpochRebates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).WithdrawEpochRebates(ctx, req.(*MsgWithdrawEpochRebates)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "nibiru.perp.v2.Msg", HandlerType: (*MsgServer)(nil), @@ -1476,6 +1749,14 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ChangeCollateralDenom", Handler: _Msg_ChangeCollateralDenom_Handler, }, + { + MethodName: "AllocateEpochRebates", + Handler: _Msg_AllocateEpochRebates_Handler, + }, + { + MethodName: "WithdrawEpochRebates", + Handler: _Msg_WithdrawEpochRebates_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "nibiru/perp/v2/tx.proto", @@ -2467,76 +2748,242 @@ func (m *MsgChangeCollateralDenomResponse) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgAllocateEpochRebates) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgSettlePosition) Size() (n int) { - if m == nil { - return 0 - } + +func (m *MsgAllocateEpochRebates) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAllocateEpochRebates) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.Rebates) > 0 { + for iNdEx := len(m.Rebates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rebates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } } - l = m.Pair.Size() - n += 1 + l + sovTx(uint64(l)) - if m.Version != 0 { - n += 1 + sovTx(uint64(m.Version)) + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *MsgRemoveMargin) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) +func (m *MsgAllocateEpochRebatesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - l = m.Pair.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Margin.Size() - n += 1 + l + sovTx(uint64(l)) - return n + return dAtA[:n], nil } -func (m *MsgRemoveMarginResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.MarginOut.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.FundingPayment.Size() - n += 1 + l + sovTx(uint64(l)) - if m.Position != nil { - l = m.Position.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n +func (m *MsgAllocateEpochRebatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgAddMargin) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgAllocateEpochRebatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Sender) + if len(m.TotalEpochRebates) > 0 { + for iNdEx := len(m.TotalEpochRebates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TotalEpochRebates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawEpochRebates) 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 *MsgWithdrawEpochRebates) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawEpochRebates) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Epochs) > 0 { + dAtA11 := make([]byte, len(m.Epochs)*10) + var j10 int + for _, num := range m.Epochs { + for num >= 1<<7 { + dAtA11[j10] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j10++ + } + dAtA11[j10] = uint8(num) + j10++ + } + i -= j10 + copy(dAtA[i:], dAtA11[:j10]) + i = encodeVarintTx(dAtA, i, uint64(j10)) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawEpochRebatesResponse) 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 *MsgWithdrawEpochRebatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawEpochRebatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.WithdrawnRebates) > 0 { + for iNdEx := len(m.WithdrawnRebates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.WithdrawnRebates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSettlePosition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Pair.Size() + n += 1 + l + sovTx(uint64(l)) + if m.Version != 0 { + n += 1 + sovTx(uint64(m.Version)) + } + return n +} + +func (m *MsgRemoveMargin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Pair.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.Margin.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgRemoveMarginResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.MarginOut.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.FundingPayment.Size() + n += 1 + l + sovTx(uint64(l)) + if m.Position != nil { + l = m.Position.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgAddMargin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -2812,6 +3259,75 @@ func (m *MsgChangeCollateralDenomResponse) Size() (n int) { return n } +func (m *MsgAllocateEpochRebates) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Rebates) > 0 { + for _, e := range m.Rebates { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgAllocateEpochRebatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.TotalEpochRebates) > 0 { + for _, e := range m.TotalEpochRebates { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgWithdrawEpochRebates) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Epochs) > 0 { + l = 0 + for _, e := range m.Epochs { + l += sovTx(uint64(e)) + } + n += 1 + sovTx(uint64(l)) + l + } + return n +} + +func (m *MsgWithdrawEpochRebatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.WithdrawnRebates) > 0 { + for _, e := range m.WithdrawnRebates { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -5676,6 +6192,448 @@ func (m *MsgChangeCollateralDenomResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgAllocateEpochRebates) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAllocateEpochRebates: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAllocateEpochRebates: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rebates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rebates = append(m.Rebates, types.Coin{}) + if err := m.Rebates[len(m.Rebates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAllocateEpochRebatesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAllocateEpochRebatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAllocateEpochRebatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalEpochRebates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TotalEpochRebates = append(m.TotalEpochRebates, types.Coin{}) + if err := m.TotalEpochRebates[len(m.TotalEpochRebates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawEpochRebates) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawEpochRebates: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawEpochRebates: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Epochs = append(m.Epochs, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Epochs) == 0 { + m.Epochs = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Epochs = append(m.Epochs, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Epochs", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawEpochRebatesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawEpochRebatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawEpochRebatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawnRebates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WithdrawnRebates = append(m.WithdrawnRebates, types.Coin{}) + if err := m.WithdrawnRebates[len(m.WithdrawnRebates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0