diff --git a/Makefile b/Makefile index d2f75138b79..3fb9b2438fb 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ #!/usr/bin/make -f -PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation') VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//') COMMIT := $(shell git log -1 --format='%H') LEDGER_ENABLED ?= true diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 142e1312290..aa5a7feb8f3 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -2627,7 +2627,7 @@ GenesisState defines the mint module's genesis state. | ----- | ---- | ----- | ----------- | | `minter` | [Minter](#osmosis.mint.v1beta1.Minter) | | minter is a space for holding current rewards information. | | `params` | [Params](#osmosis.mint.v1beta1.Params) | | params defines all the paramaters of the module. | -| `halven_started_epoch` | [int64](#int64) | | current halven period start epoch | +| `reduction_started_epoch` | [int64](#int64) | | current reduction period start epoch | diff --git a/go.mod b/go.mod index 9426298e899..85703a747e3 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,12 @@ go 1.18 require ( github.com/CosmWasm/wasmd v0.24.0 +<<<<<<< HEAD github.com/cosmos/cosmos-sdk v0.45.5 +======= + github.com/cosmos/cosmos-proto v1.0.0-alpha7 + github.com/cosmos/cosmos-sdk v0.45.6 +>>>>>>> ee48cf58 (chore: x/mint docs and clean up, excluding mint keeper (#1857)) github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/iavl v0.17.3 github.com/cosmos/ibc-go/v3 v3.0.0 diff --git a/proto/osmosis/mint/v1beta1/genesis.proto b/proto/osmosis/mint/v1beta1/genesis.proto index 8a4dd8fe286..ef215f37e68 100644 --- a/proto/osmosis/mint/v1beta1/genesis.proto +++ b/proto/osmosis/mint/v1beta1/genesis.proto @@ -8,13 +8,14 @@ option go_package = "github.com/osmosis-labs/osmosis/v10/x/mint/types"; // GenesisState defines the mint module's genesis state. message GenesisState { - // minter is a space for holding current rewards information. + // minter is an abstraction for holding current rewards information. Minter minter = 1 [ (gogoproto.nullable) = false ]; - // params defines all the paramaters of the module. + // params defines all the paramaters of the mint module. Params params = 2 [ (gogoproto.nullable) = false ]; - // current halven period start epoch - int64 halven_started_epoch = 3 - [ (gogoproto.moretags) = "yaml:\"halven_started_epoch\"" ]; + // reduction_started_epoch is the first epoch in which the reduction of mint + // begins. + int64 reduction_started_epoch = 3 + [ (gogoproto.moretags) = "yaml:\"reduction_started_epoch\"" ]; } diff --git a/proto/osmosis/mint/v1beta1/mint.proto b/proto/osmosis/mint/v1beta1/mint.proto index 2f33028b0a3..f8502f6f6bf 100644 --- a/proto/osmosis/mint/v1beta1/mint.proto +++ b/proto/osmosis/mint/v1beta1/mint.proto @@ -10,7 +10,7 @@ import "google/protobuf/duration.proto"; // Minter represents the minting state. message Minter { - // current epoch provisions + // epoch_provisions represent rewards for the current epoch. string epoch_provisions = 1 [ (gogoproto.moretags) = "yaml:\"epoch_provisions\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -18,6 +18,9 @@ message Minter { ]; } +// WeightedAddress represents an address with a weight assigned to it. +// The weight is used to determine the proportion of the total minted +// tokens to be minted to the address. message WeightedAddress { string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; string weight = 2 [ @@ -27,29 +30,32 @@ message WeightedAddress { ]; } +// DistributionProportions defines the distribution proportions of the minted +// denom. In other words, defines which stakeholders will receive the minted +// denoms and how much. message DistributionProportions { - // staking defines the proportion of the minted minted_denom that is to be + // staking defines the proportion of the minted mint_denom that is to be // allocated as staking rewards. string staking = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.moretags) = "yaml:\"staking\"", (gogoproto.nullable) = false ]; - // pool_incentives defines the proportion of the minted minted_denom that is + // pool_incentives defines the proportion of the minted mint_denom that is // to be allocated as pool incentives. string pool_incentives = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.moretags) = "yaml:\"pool_incentives\"", (gogoproto.nullable) = false ]; - // developer_rewards defines the proportion of the minted minted_denom that is + // developer_rewards defines the proportion of the minted mint_denom that is // to be allocated to developer rewards address. string developer_rewards = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.moretags) = "yaml:\"developer_rewards\"", (gogoproto.nullable) = false ]; - // community_pool defines the proportion of the minted minted_denom that is + // community_pool defines the proportion of the minted mint_denom that is // to be allocated to the community pool. string community_pool = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -58,39 +64,47 @@ message DistributionProportions { ]; } -// Params holds parameters for the mint module. +// Params holds parameters for the x/mint module. message Params { option (gogoproto.goproto_stringer) = false; - // type of coin to mint + // mint_denom is the denom of the coin to mint. string mint_denom = 1; - // epoch provisions from the first epoch + // genesis_epoch_provisions epoch provisions from the first epoch. string genesis_epoch_provisions = 2 [ (gogoproto.moretags) = "yaml:\"genesis_epoch_provisions\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - // mint epoch identifier + // epoch_identifier mint epoch identifier e.g. (day, week). string epoch_identifier = 3 [ (gogoproto.moretags) = "yaml:\"epoch_identifier\"" ]; - // number of epochs take to reduce rewards + // reduction_period_in_epochs the number of epochs it takes + // to reduce the rewards. int64 reduction_period_in_epochs = 4 [ (gogoproto.moretags) = "yaml:\"reduction_period_in_epochs\"" ]; - // reduction multiplier to execute on each period + // reduction_factor is the reduction multiplier to execute + // at the end of each period set by reduction_period_in_epochs. string reduction_factor = 5 [ (gogoproto.moretags) = "yaml:\"reduction_factor\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - // distribution_proportions defines the proportion of the minted denom + // distribution_proportions defines the distribution proportions of the minted + // denom. In other words, defines which stakeholders will receive the minted + // denoms and how much. DistributionProportions distribution_proportions = 6 [ (gogoproto.nullable) = false ]; - // address to receive developer rewards + // weighted_developer_rewards_receivers is the address to receive developer + // rewards with weights assignedt to each address. The final amount that each + // address receives is: epoch_provisions * + // distribution_proportions.developer_rewards * Address's Weight. repeated WeightedAddress weighted_developer_rewards_receivers = 7 [ (gogoproto.moretags) = "yaml:\"developer_rewards_receiver\"", (gogoproto.nullable) = false ]; - // start epoch to distribute minting rewards + // minting_rewards_distribution_start_epoch start epoch to distribute minting + // rewards int64 minting_rewards_distribution_start_epoch = 8 [ (gogoproto.moretags) = "yaml:\"minting_rewards_distribution_start_epoch\"" ]; diff --git a/proto/osmosis/mint/v1beta1/query.proto b/proto/osmosis/mint/v1beta1/query.proto index 6812437ccf8..8cd9aecfc46 100644 --- a/proto/osmosis/mint/v1beta1/query.proto +++ b/proto/osmosis/mint/v1beta1/query.proto @@ -14,7 +14,7 @@ service Query { option (google.api.http).get = "/osmosis/mint/v1beta1/params"; } - // EpochProvisions current minting epoch provisions value. + // EpochProvisions returns the current minting epoch provisions value. rpc EpochProvisions(QueryEpochProvisionsRequest) returns (QueryEpochProvisionsResponse) { option (google.api.http).get = "/osmosis/mint/v1beta1/epoch_provisions"; diff --git a/proto/osmosis/superfluid/query.proto b/proto/osmosis/superfluid/query.proto index bffe9a0cd07..71a84df51a1 100644 --- a/proto/osmosis/superfluid/query.proto +++ b/proto/osmosis/superfluid/query.proto @@ -112,6 +112,17 @@ service Query { // option (google.api.http).get = // "/osmosis/superfluid/v1beta1/superfluid_unbondings_by_validator_denom"; // } +<<<<<<< HEAD +======= + + // Returns the specified delegations for a specific delegator + rpc TotalDelegationByDelegator(QueryTotalDelegationByDelegatorRequest) + returns (QueryTotalDelegationByDelegatorResponse) { + option (google.api.http).get = + "/osmosis/superfluid/v1beta1/" + "total_delegation_by_delegator/{delegator_address}"; + } +>>>>>>> ee48cf58 (chore: x/mint docs and clean up, excluding mint keeper (#1857)) } message QueryParamsRequest {} @@ -256,4 +267,26 @@ message EstimateSuperfluidDelegatedAmountByValidatorDenomResponse { // (gogoproto.nullable) = false, // (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" // ]; -// } \ No newline at end of file +<<<<<<< HEAD +// } +======= +// } + +message QueryTotalDelegationByDelegatorRequest { string delegator_address = 1; } + +message QueryTotalDelegationByDelegatorResponse { + repeated SuperfluidDelegationRecord superfluid_delegation_records = 1 + [ (gogoproto.nullable) = false ]; + + repeated cosmos.staking.v1beta1.DelegationResponse delegation_response = 2 + [ (gogoproto.nullable) = false ]; + repeated cosmos.base.v1beta1.Coin total_delegated_coins = 3 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + cosmos.base.v1beta1.Coin total_equivalent_staked_amount = 4 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin" + ]; +} +>>>>>>> ee48cf58 (chore: x/mint docs and clean up, excluding mint keeper (#1857)) diff --git a/x/mint/spec/README.md b/x/mint/README.md similarity index 79% rename from x/mint/spec/README.md rename to x/mint/README.md index c4b30dca5c1..2ba6a0bdd66 100644 --- a/x/mint/spec/README.md +++ b/x/mint/README.md @@ -1,11 +1,13 @@ # Mint -The ```mint``` module is responsible for creating tokens in a flexible way to reward -validators, incentivize providing pool liquidity, provide funds for Osmosis governance, and pay developers to maintain and improve Osmosis. +The `mint` module is responsible for creating tokens in a flexible way to reward +validators, incentivize providing pool liquidity, provide funds for Osmosis governance, +and pay developers to maintain and improve Osmosis. -The module is also responsible for reducing the token creation and distribution by a set amount and a set period of time until it reaches its maximum supply (see ```reduction_factor``` and ```reduction_period_in_epochs```) +The module is also responsible for reducing the token creation and distribution by a set period +until it reaches its maximum supply (see `reduction_factor` and `reduction_period_in_epochs`) -Module uses time basis epochs supported by ```epochs``` module. +The module uses time basis epochs supported by the `epochs` module. ## Contents @@ -23,19 +25,19 @@ The `x/mint` module is designed to handle the regular printing of new tokens within a chain. The design taken within Osmosis is to - Mint new tokens once per epoch (default one week) -- To have a "Reductioning factor" every period, which reduces the - amount of rewards per epoch. (default: period is 3 years, where a +- To have a "Reductioning factor" every period, which reduces the number of + rewards per epoch. (default: period is 3 years, where a year is 52 epochs. The next period's rewards are 2/3 of the prior period's rewards) -### Reductioning factor +### Reduction factor -This is a generalization over the Bitcoin style halvenings. Every year, -the amount of rewards issued per week will reduce by a governance -specified factor, instead of a fixed `1/2`. So +This is a generalization over the Bitcoin-style halvenings. Every year, the number + of rewards issued per week will reduce by a governance-specified +factor, instead of a fixed `1/2`. So `RewardsPerEpochNextPeriod = ReductionFactor * CurrentRewardsPerEpoch)`. When `ReductionFactor = 1/2`, the Bitcoin halvenings are recreated. We -default to having a reduction factor of `2/3`, and thus reduce rewards +default to having a reduction factor of `2/3` and thus reduce rewards at the end of every year by `33%`. The implication of this is that the total supply is finite, according to @@ -47,7 +49,7 @@ the following formula: ### Minter -The minter is a space for holding current rewards information. +The [`Minter`](https://github.com/osmosis-labs/osmosis/blob/cbb683e8395655042b4421355cd54a8c96bfa507/x/mint/types/mint.pb.go#L30) is an abstraction for holding current rewards information. ```go type Minter struct { @@ -57,65 +59,33 @@ type Minter struct { ### Params -Minting params are held in the global params store. +Minting [`Params`](https://github.com/osmosis-labs/osmosis/blob/cbb683e8395655042b4421355cd54a8c96bfa507/x/mint/types/mint.pb.go#L168) are held in the global params store. -```go -type Params struct { - MintDenom string // type of coin to mint - GenesisEpochProvisions sdk.Dec // initial epoch provisions at genesis - EpochIdentifier string // identifier of epoch - ReductionPeriodInEpochs int64 // number of epochs between reward reductions - ReductionFactor sdk.Dec // reduction multiplier to execute on each period - DistributionProportions DistributionProportions // distribution_proportions defines the proportion of the minted denom - WeightedDeveloperRewardsReceivers []WeightedAddress // address to receive developer rewards - MintingRewardsDistributionStartEpoch int64 // start epoch to distribute minting rewards -} -``` +### LastReductionEpoch -### LastHalvenEpoch - -Last halven epoch stores the epoch number when the last reduction of +Last reduction epoch stores the epoch number when the last reduction of coin mint amount per epoch has happened. -**TODO:** - -- Update the name to LastReductionEpoch as the reduction amount could - be set by governance. - ## Begin-Epoch -Minting parameters are recalculated and inflation paid at the beginning -of each epoch. An epoch is signalled by x/epochs +Minting parameters are recalculated and inflation is paid at the beginning +of each epoch. An epoch is signaled by x/epochs ### NextEpochProvisions The target epoch provision is recalculated on each reduction period -(default 3 years). At the time of reduction, the current provision is -multiplied by reduction factor (default `2/3`), to calculate the +(default 3 years). At the time of the reduction, the current provision is +multiplied by the reduction factor (default `2/3`), to calculate the provisions for the next epoch. Consequently, the rewards of the next -period will be lowered by `1 - reduction factor`. - -``` go -func (m Minter) NextEpochProvisions(params Params) sdk.Dec { - return m.EpochProvisions.Mul(params.ReductionFactor) -} -``` +period will be lowered by a `1` - reduction factor. ### EpochProvision Calculate the provisions generated for each epoch based on current epoch provisions. The provisions are then minted by the `mint` module's `ModuleMinterAccount`. These rewards are transferred to a -`FeeCollector`, which handles distributing the rewards per the chains -needs. (See TODO.md for details) This fee collector is specified as the -`auth` module's `FeeCollector` `ModuleAccount`. - -``` go -func (m Minter) EpochProvision(params Params) sdk.Coin { - provisionAmt := m.EpochProvisions.QuoInt(sdk.NewInt(int64(params.EpochsPerYear))) - return sdk.NewCoin(params.MintDenom, provisionAmt.TruncateInt()) -} -``` +`FeeCollector`, which handles distributing the rewards per the chain's needs. +This fee collector is specified as the `auth` module's `FeeCollector` `ModuleAccount`. ## Network Parameters @@ -139,10 +109,10 @@ The minting module contains the following parameters: Below are all the network parameters for the ```mint``` module: - **```mint_denom```** - Token type being minted -- **```genesis_epoch_provisions```** - Amount of tokens generated at epoch to the distribution categories (see distribution_proportions) +- **```genesis_epoch_provisions```** - Amount of tokens generated at the epoch to the distribution categories (see distribution_proportions) - **```epoch_identifier```** - Type of epoch that triggers token issuance (day, week, etc.) - **```reduction_period_in_epochs```** - How many epochs must occur before implementing the reduction factor -- **```reduction_factor```** - What the total token issuance factor will reduce by after reduction period passes (if set to 66.66%, token issuance will reduce by 1/3) +- **```reduction_factor```** - What the total token issuance factor will reduce by after the reduction period passes (if set to 66.66%, token issuance will reduce by 1/3) - **```distribution_proportions```** - Categories in which the specified proportion of newly released tokens are distributed to - **```staking```** - Proportion of minted funds to incentivize staking OSMO - **```pool_incentives```** - Proportion of minted funds to incentivize pools on Osmosis @@ -154,21 +124,16 @@ Below are all the network parameters for the ```mint``` module: **Notes** 1. `mint_denom` defines denom for minting token - uosmo -2. `genesis_epoch_provisions` provides minting tokens per epoch at - genesis. -3. `epoch_identifier` defines the epoch identifier to be used for mint - module e.g. "weekly" -4. `reduction_period_in_epochs` defines the number of epochs to pass to - reduce mint amount -5. `reduction_factor` defines the reduction factor of tokens at every - `reduction_period_in_epochs` -6. `distribution_proportions` defines distribution rules for minted - tokens, when developer rewards address is empty, it distribute - tokens to community pool. -7. `weighted_developer_rewards_receivers` provides the addresses that - receives developer rewards by weight -8. `minting_rewards_distribution_start_epoch` defines the start epoch - of minting to make sure minting start after initial pools are set +2. `genesis_epoch_provisions` provides minting tokens per epoch at genesis. +3. `epoch_identifier` defines the epoch identifier to be used for the mint module e.g. "weekly" +4. `reduction_period_in_epochs` defines the number of epochs to pass to reduce the mint amount +5. `reduction_factor` defines the reduction factor of tokens at every `reduction_period_in_epochs` +6. `distribution_proportions` defines distribution rules for minted tokens, when the developer + rewards address is empty, it distributes tokens to the community pool. +7. `weighted_developer_rewards_receivers` provides the addresses that receive developer + rewards by weight +8. `minting_rewards_distribution_start_epoch` defines the start epoch of minting to make sure + minting start after initial pools are set ## Events diff --git a/x/mint/client/cli/cli_test.go b/x/mint/client/cli/cli_test.go index 44b01915669..d9703eb8933 100644 --- a/x/mint/client/cli/cli_test.go +++ b/x/mint/client/cli/cli_test.go @@ -1,5 +1,4 @@ //go:build norace -// +build norace package cli_test diff --git a/x/mint/client/rest/grpc_query_test.go b/x/mint/client/rest/grpc_query_test.go index 8b7034c7d9d..9f8470cafe7 100644 --- a/x/mint/client/rest/grpc_query_test.go +++ b/x/mint/client/rest/grpc_query_test.go @@ -1,5 +1,4 @@ //go:build norace -// +build norace package rest_test diff --git a/x/mint/genesis_test.go b/x/mint/genesis_test.go index 5066c6b572b..d0431b5f4c6 100644 --- a/x/mint/genesis_test.go +++ b/x/mint/genesis_test.go @@ -25,5 +25,5 @@ func TestMintInitGenesis(t *testing.T) { expectedVestingCoins, ok := sdk.NewIntFromString("225000000000000") require.True(t, ok) require.Equal(t, expectedVestingCoins, initialVestingCoins.Amount) - require.Equal(t, int64(0), app.MintKeeper.GetLastHalvenEpochNum(ctx)) + require.Equal(t, int64(0), app.MintKeeper.GetLastReductionEpochNum(ctx)) } diff --git a/x/mint/keeper/genesis.go b/x/mint/keeper/genesis.go new file mode 100644 index 00000000000..b794a64c0fc --- /dev/null +++ b/x/mint/keeper/genesis.go @@ -0,0 +1,31 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/osmosis-labs/osmosis/v7/x/mint/types" +) + +// InitGenesis new mint genesis. +func (k Keeper) InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, data *types.GenesisState) { + data.Minter.EpochProvisions = data.Params.GenesisEpochProvisions + k.SetMinter(ctx, data.Minter) + k.SetParams(ctx, data.Params) + + if !ak.HasAccount(ctx, ak.GetModuleAddress(types.ModuleName)) { + ak.GetModuleAccount(ctx, types.ModuleName) + totalDeveloperVestingCoins := sdk.NewCoin(data.Params.MintDenom, sdk.NewInt(225_000_000_000_000)) + k.CreateDeveloperVestingModuleAccount(ctx, totalDeveloperVestingCoins) + bk.AddSupplyOffset(ctx, data.Params.MintDenom, sdk.NewInt(225_000_000_000_000).Neg()) + } + + k.SetLastReductionEpochNum(ctx, data.ReductionStartedEpoch) +} + +// ExportGenesis returns a GenesisState for a given context and keeper. +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + minter := k.GetMinter(ctx) + params := k.GetParams(ctx) + lastReductionEpoch := k.GetLastReductionEpochNum(ctx) + return types.NewGenesisState(minter, params, lastReductionEpoch) +} diff --git a/x/mint/keeper/hooks.go b/x/mint/keeper/hooks.go index 42b50e2202d..6fb37f37692 100644 --- a/x/mint/keeper/hooks.go +++ b/x/mint/keeper/hooks.go @@ -21,20 +21,22 @@ func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumb if epochNumber < params.MintingRewardsDistributionStartEpoch { return } else if epochNumber == params.MintingRewardsDistributionStartEpoch { - k.SetLastHalvenEpochNum(ctx, epochNumber) + k.SetLastReductionEpochNum(ctx, epochNumber) } // fetch stored minter & params minter := k.GetMinter(ctx) params := k.GetParams(ctx) // Check if we have hit an epoch where we update the inflation parameter. - // Since epochs only update based on BFT time data, it is safe to store the "halvening period time" - // in terms of the number of epochs that have transpired. - if epochNumber >= k.GetParams(ctx).ReductionPeriodInEpochs+k.GetLastHalvenEpochNum(ctx) { - // Halven the reward per halven period + // We measure time between reductions in number of epochs. + // This avoids issues with measuring in block numbers, as epochs have fixed intervals, with very + // low variance at the relevant sizes. As a result, it is safe to store the epoch number + // of the last reduction to be later retrieved for comparison. + if epochNumber >= k.GetParams(ctx).ReductionPeriodInEpochs+k.GetLastReductionEpochNum(ctx) { + // Reduce the reward per reduction period minter.EpochProvisions = minter.NextEpochProvisions(params) k.SetMinter(ctx, minter) - k.SetLastHalvenEpochNum(ctx, epochNumber) + k.SetLastReductionEpochNum(ctx, epochNumber) } // mint coins, update supply @@ -59,7 +61,7 @@ func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumb ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypeMint, + types.ModuleName, sdk.NewAttribute(types.AttributeEpochNumber, fmt.Sprintf("%d", epochNumber)), sdk.NewAttribute(types.AttributeKeyEpochProvisions, minter.EpochProvisions.String()), sdk.NewAttribute(sdk.AttributeKeyAmount, mintedCoin.Amount.String()), diff --git a/x/mint/keeper/hooks_test.go b/x/mint/keeper/hooks_test.go index 2f1fc3b631a..a09d7e07442 100644 --- a/x/mint/keeper/hooks_test.go +++ b/x/mint/keeper/hooks_test.go @@ -8,9 +8,15 @@ import ( abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" +<<<<<<< HEAD osmoapp "github.com/osmosis-labs/osmosis/v10/app" lockuptypes "github.com/osmosis-labs/osmosis/v10/x/lockup/types" "github.com/osmosis-labs/osmosis/v10/x/mint/types" +======= + osmoapp "github.com/osmosis-labs/osmosis/v7/app" + lockuptypes "github.com/osmosis-labs/osmosis/v7/x/lockup/types" + "github.com/osmosis-labs/osmosis/v7/x/mint/types" +>>>>>>> ee48cf58 (chore: x/mint docs and clean up, excluding mint keeper (#1857)) "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" @@ -43,9 +49,9 @@ func TestEndOfEpochMintedCoinDistribution(t *testing.T) { ctx, sdk.NewCoin("stake", sdk.NewInt(156*500000*2))) height := int64(1) - lastHalvenPeriod := app.MintKeeper.GetLastHalvenEpochNum(ctx) + lastReductionPeriod := app.MintKeeper.GetLastReductionEpochNum(ctx) // correct rewards - for ; height < lastHalvenPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { + for ; height < lastReductionPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { devRewardsModuleAcc := app.AccountKeeper.GetModuleAccount(ctx, types.DeveloperVestingModuleAcctName) devRewardsModuleOrigin := app.BankKeeper.GetAllBalances(ctx, devRewardsModuleAcc.GetAddress()) feePoolOrigin := app.DistrKeeper.GetFeePool(ctx) @@ -82,10 +88,10 @@ func TestEndOfEpochMintedCoinDistribution(t *testing.T) { app.EpochsKeeper.BeforeEpochStart(futureCtx, params.DistrEpochIdentifier, height) app.EpochsKeeper.AfterEpochEnd(futureCtx, params.DistrEpochIdentifier, height) - lastHalvenPeriod = app.MintKeeper.GetLastHalvenEpochNum(ctx) - require.Equal(t, lastHalvenPeriod, app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs) + lastReductionPeriod = app.MintKeeper.GetLastReductionEpochNum(ctx) + require.Equal(t, lastReductionPeriod, app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs) - for ; height < lastHalvenPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { + for ; height < lastReductionPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { devRewardsModuleAcc := app.AccountKeeper.GetModuleAccount(ctx, types.DeveloperVestingModuleAcctName) devRewardsModuleOrigin := app.BankKeeper.GetAllBalances(ctx, devRewardsModuleAcc.GetAddress()) feePoolOrigin := app.DistrKeeper.GetFeePool(ctx) @@ -126,9 +132,9 @@ func TestMintedCoinDistributionWhenDevRewardsAddressEmpty(t *testing.T) { ctx, sdk.NewCoin("stake", sdk.NewInt(156*500000*2))) height := int64(1) - lastHalvenPeriod := app.MintKeeper.GetLastHalvenEpochNum(ctx) + lastReductionPeriod := app.MintKeeper.GetLastReductionEpochNum(ctx) // correct rewards - for ; height < lastHalvenPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { + for ; height < lastReductionPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { devRewardsModuleAcc := app.AccountKeeper.GetModuleAccount(ctx, types.DeveloperVestingModuleAcctName) devRewardsModuleOrigin := app.BankKeeper.GetAllBalances(ctx, devRewardsModuleAcc.GetAddress()) feePoolOrigin := app.DistrKeeper.GetFeePool(ctx) @@ -153,10 +159,10 @@ func TestMintedCoinDistributionWhenDevRewardsAddressEmpty(t *testing.T) { app.EpochsKeeper.BeforeEpochStart(futureCtx, params.DistrEpochIdentifier, height) app.EpochsKeeper.AfterEpochEnd(futureCtx, params.DistrEpochIdentifier, height) - lastHalvenPeriod = app.MintKeeper.GetLastHalvenEpochNum(ctx) - require.Equal(t, lastHalvenPeriod, app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs) + lastReductionPeriod = app.MintKeeper.GetLastReductionEpochNum(ctx) + require.Equal(t, lastReductionPeriod, app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs) - for ; height < lastHalvenPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { + for ; height < lastReductionPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { devRewardsModuleAcc := app.AccountKeeper.GetModuleAccount(ctx, types.DeveloperVestingModuleAcctName) devRewardsModuleOrigin := app.BankKeeper.GetAllBalances(ctx, devRewardsModuleAcc.GetAddress()) feePoolOrigin := app.DistrKeeper.GetFeePool(ctx) @@ -215,9 +221,9 @@ func TestEndOfEpochNoDistributionWhenIsNotYetStartTime(t *testing.T) { require.NotEqual(t, sdk.DecCoins{}, app.DistrKeeper.GetFeePool(ctx).CommunityPool, "Tokens to community pool at start distribution epoch") - // halven period should be set to mintParams.MintingRewardsDistributionStartEpoch - lastHalvenPeriod := app.MintKeeper.GetLastHalvenEpochNum(ctx) - require.Equal(t, lastHalvenPeriod, mintParams.MintingRewardsDistributionStartEpoch) + // reduction period should be set to mintParams.MintingRewardsDistributionStartEpoch + lastReductionPeriod := app.MintKeeper.GetLastReductionEpochNum(ctx) + require.Equal(t, lastReductionPeriod, mintParams.MintingRewardsDistributionStartEpoch) } func setupGaugeForLPIncentives(t *testing.T, app *osmoapp.OsmosisApp, ctx sdk.Context) { diff --git a/x/mint/keeper/keeper.go b/x/mint/keeper/keeper.go index b02f7c0212c..ffdf0743dca 100644 --- a/x/mint/keeper/keeper.go +++ b/x/mint/keeper/keeper.go @@ -2,6 +2,12 @@ package keeper import ( "github.com/tendermint/tendermint/libs/log" +<<<<<<< HEAD +======= + + "github.com/osmosis-labs/osmosis/v7/x/mint/types" + poolincentivestypes "github.com/osmosis-labs/osmosis/v7/x/pool-incentives/types" +>>>>>>> ee48cf58 (chore: x/mint docs and clean up, excluding mint keeper (#1857)) "github.com/osmosis-labs/osmosis/v10/x/mint/types" poolincentivestypes "github.com/osmosis-labs/osmosis/v10/x/pool-incentives/types" @@ -93,10 +99,10 @@ func (k *Keeper) SetHooks(h types.MintHooks) *Keeper { return k } -// GetLastHalvenEpochNum returns last halven epoch number. -func (k Keeper) GetLastHalvenEpochNum(ctx sdk.Context) int64 { +// GetLastReductionEpochNum returns last reduction epoch number. +func (k Keeper) GetLastReductionEpochNum(ctx sdk.Context) int64 { store := ctx.KVStore(k.storeKey) - b := store.Get(types.LastHalvenEpochKey) + b := store.Get(types.LastReductionEpochKey) if b == nil { return 0 } @@ -104,10 +110,10 @@ func (k Keeper) GetLastHalvenEpochNum(ctx sdk.Context) int64 { return int64(sdk.BigEndianToUint64(b)) } -// SetLastHalvenEpochNum set last halven epoch number. -func (k Keeper) SetLastHalvenEpochNum(ctx sdk.Context, epochNum int64) { +// SetLastReductionEpochNum set last reduction epoch number. +func (k Keeper) SetLastReductionEpochNum(ctx sdk.Context, epochNum int64) { store := ctx.KVStore(k.storeKey) - store.Set(types.LastHalvenEpochKey, sdk.Uint64ToBigEndian(uint64(epochNum))) + store.Set(types.LastReductionEpochKey, sdk.Uint64ToBigEndian(uint64(epochNum))) } // get the minter. diff --git a/x/mint/module.go b/x/mint/module.go index 2fbd428c591..017836999ad 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -162,6 +162,9 @@ func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Validato return []abci.ValidatorUpdate{} } +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 1 } + // ___________________________________________________________________________ // AppModuleSimulation functions @@ -190,6 +193,3 @@ func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { return nil } - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } diff --git a/x/mint/simulation/export_test.go b/x/mint/simulation/export_test.go new file mode 100644 index 00000000000..4e7719ebdaf --- /dev/null +++ b/x/mint/simulation/export_test.go @@ -0,0 +1,10 @@ +package simulation + +const ( + ExpectedEpochIdentifier = epochIdentifier +) + +var ( + ExpectedDistributionProportions = distributionProportions + ExpectedDevRewardReceivers = weightedDevRewardReceivers +) diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go index 6dcd1ee89c7..cc6531e906e 100644 --- a/x/mint/simulation/genesis.go +++ b/x/mint/simulation/genesis.go @@ -5,6 +5,7 @@ package simulation import ( "encoding/json" "fmt" + "math/rand" "github.com/osmosis-labs/osmosis/v10/x/mint/types" @@ -12,39 +13,163 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" ) +// Simulation parameter constants. +const ( + epochProvisionsKey = "genesis_epoch_provisions" + epochIdentifierKey = "epoch_identifier" + reductionFactorKey = "reduction_factor" + reductionPeriodInEpochsKey = "reduction_period_in_epochs" + + stakingDistributionProportionKey = "staking_distribution_proportion" + poolIncentivesDistributionProportionKey = "pool_incentives_distribution_proportion" + developerRewardsDistributionProportionKey = "developer_rewards_distribution_proportion" + communityPoolDistributionProportionKey = "community_pool_distribution_proportion" + weightedDevRewardReceiversKey = "weighted_developer_rewards_receivers" + mintingRewardsDistributionStartEpochKey = "minting_rewards_distribution_start_epoch" + + epochIdentifier = "day" + maxInt64 = int(^uint(0) >> 1) +) + +var ( + // Taken from: // https://github.com/osmosis-labs/networks/raw/main/osmosis-1/genesis.json + distributionProportions = types.DistributionProportions{ + Staking: sdk.NewDecWithPrec(25, 2), + PoolIncentives: sdk.NewDecWithPrec(45, 2), + DeveloperRewards: sdk.NewDecWithPrec(25, 2), + CommunityPool: sdk.NewDecWithPrec(05, 2), + } + weightedDevRewardReceivers = []types.WeightedAddress{ + { + Address: "osmo14kjcwdwcqsujkdt8n5qwpd8x8ty2rys5rjrdjj", + Weight: sdk.NewDecWithPrec(2887, 4), + }, + { + Address: "osmo1gw445ta0aqn26suz2rg3tkqfpxnq2hs224d7gq", + Weight: sdk.NewDecWithPrec(229, 3), + }, + { + Address: "osmo13lt0hzc6u3htsk7z5rs6vuurmgg4hh2ecgxqkf", + Weight: sdk.NewDecWithPrec(1625, 4), + }, + { + Address: "osmo1kvc3he93ygc0us3ycslwlv2gdqry4ta73vk9hu", + Weight: sdk.NewDecWithPrec(109, 3), + }, + { + Address: "osmo19qgldlsk7hdv3ddtwwpvzff30pxqe9phq9evxf", + Weight: sdk.NewDecWithPrec(995, 3).Quo(sdk.NewDec(10)), // 0.0995 + }, + { + Address: "osmo19fs55cx4594een7qr8tglrjtt5h9jrxg458htd", + Weight: sdk.NewDecWithPrec(6, 1).Quo(sdk.NewDec(10)), // 0.06 + }, + { + Address: "osmo1ssp6px3fs3kwreles3ft6c07mfvj89a544yj9k", + Weight: sdk.NewDecWithPrec(15, 2).Quo(sdk.NewDec(10)), // 0.015 + }, + { + Address: "osmo1c5yu8498yzqte9cmfv5zcgtl07lhpjrj0skqdx", + Weight: sdk.NewDecWithPrec(1, 1).Quo(sdk.NewDec(10)), // 0.01 + }, + { + Address: "osmo1yhj3r9t9vw7qgeg22cehfzj7enwgklw5k5v7lj", + Weight: sdk.NewDecWithPrec(75, 2).Quo(sdk.NewDec(100)), // 0.0075 + }, + { + Address: "osmo18nzmtyn5vy5y45dmcdnta8askldyvehx66lqgm", + Weight: sdk.NewDecWithPrec(7, 1).Quo(sdk.NewDec(100)), // 0.007 + }, + { + Address: "osmo1z2x9z58cg96ujvhvu6ga07yv9edq2mvkxpgwmc", + Weight: sdk.NewDecWithPrec(5, 1).Quo(sdk.NewDec(100)), // 0.005 + }, + { + Address: "osmo1tvf3373skua8e6480eyy38avv8mw3hnt8jcxg9", + Weight: sdk.NewDecWithPrec(25, 2).Quo(sdk.NewDec(100)), // 0.0025 + }, + { + Address: "osmo1zs0txy03pv5crj2rvty8wemd3zhrka2ne8u05n", + Weight: sdk.NewDecWithPrec(25, 2).Quo(sdk.NewDec(100)), // 0.0025 + }, + { + Address: "osmo1djgf9p53n7m5a55hcn6gg0cm5mue4r5g3fadee", + Weight: sdk.NewDecWithPrec(1, 1).Quo(sdk.NewDec(100)), // 0.001 + }, + { + Address: "osmo1488zldkrn8xcjh3z40v2mexq7d088qkna8ceze", + Weight: sdk.NewDecWithPrec(8, 1).Quo(sdk.NewDec(1000)), // 0.0008 + }, + } +) + // RandomizedGenState generates a random GenesisState for mint. func RandomizedGenState(simState *module.SimulationState) { - // minter + var epochProvisions sdk.Dec + simState.AppParams.GetOrGenerate( + simState.Cdc, epochProvisionsKey, &epochProvisions, simState.Rand, + func(r *rand.Rand) { epochProvisions = genEpochProvisions(r) }, + ) + + var reductionFactor sdk.Dec + simState.AppParams.GetOrGenerate( + simState.Cdc, reductionFactorKey, &reductionFactor, simState.Rand, + func(r *rand.Rand) { reductionFactor = genReductionFactor(r) }, + ) - // var maxRewardPerEpoch sdk.Dec - // simState.AppParams.GetOrGenerate( - // simState.Cdc, MaxRewardPerEpoch, &maxRewardPerEpoch, simState.Rand, - // func(r *rand.Rand) { maxRewardPerEpoch = GenMaxRewardPerEpoch(r) }, - // ) + var reductionPeriodInEpochs int64 + simState.AppParams.GetOrGenerate( + simState.Cdc, reductionPeriodInEpochsKey, &reductionPeriodInEpochs, simState.Rand, + func(r *rand.Rand) { reductionPeriodInEpochs = genReductionPeriodInEpochs(r) }, + ) - // var minRewardPerEpoch sdk.Dec - // simState.AppParams.GetOrGenerate( - // simState.Cdc, MinRewardPerEpoch, &minRewardPerEpoch, simState.Rand, - // func(r *rand.Rand) { minRewardPerEpoch = GenMinRewardPerEpoch(r) }, - // ) - // Leaving as sample code + var mintintRewardsDistributionStartEpoch int64 + simState.AppParams.GetOrGenerate( + simState.Cdc, mintingRewardsDistributionStartEpochKey, &mintintRewardsDistributionStartEpoch, simState.Rand, + func(r *rand.Rand) { mintintRewardsDistributionStartEpoch = genMintintRewardsDistributionStartEpoch(r) }, + ) + + reductionStartedEpoch := genReductionStartedEpoch(simState.Rand) mintDenom := sdk.DefaultBondDenom - epochProvisions := sdk.NewDec(500000) // TODO: Randomize this - params := types.NewParams(mintDenom, epochProvisions, "week", sdk.NewDecWithPrec(5, 1), 156, types.DistributionProportions{ - Staking: sdk.NewDecWithPrec(4, 1), // 0.4 - PoolIncentives: sdk.NewDecWithPrec(3, 1), // 0.3 - DeveloperRewards: sdk.NewDecWithPrec(2, 1), // 0.2 - CommunityPool: sdk.NewDecWithPrec(1, 1), // 0.1 - }, []types.WeightedAddress{}, 0) + params := types.NewParams( + mintDenom, + epochProvisions, + epochIdentifier, + reductionFactor, + reductionPeriodInEpochs, + distributionProportions, + weightedDevRewardReceivers, + mintintRewardsDistributionStartEpoch) + + minter := types.NewMinter(epochProvisions) - mintGenesis := types.NewGenesisState(types.InitialMinter(), params, 0) + mintGenesis := types.NewGenesisState(minter, params, reductionStartedEpoch) bz, err := json.MarshalIndent(&mintGenesis, "", " ") if err != nil { panic(err) } - // TODO: Do some randomization later - fmt.Printf("Selected deterministically generated minting parameters:\n%s\n", bz) + fmt.Printf("Selected pseudo-randomly generated minting parameters:\n%s\n", bz) simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(mintGenesis) } + +func genEpochProvisions(r *rand.Rand) sdk.Dec { + return sdk.NewDec(int64(r.Intn(maxInt64))) +} + +func genReductionFactor(r *rand.Rand) sdk.Dec { + return sdk.NewDecWithPrec(int64(r.Intn(10)), 1) +} + +func genReductionPeriodInEpochs(r *rand.Rand) int64 { + return int64(r.Intn(maxInt64)) +} + +func genMintintRewardsDistributionStartEpoch(r *rand.Rand) int64 { + return int64(r.Intn(maxInt64)) +} + +func genReductionStartedEpoch(r *rand.Rand) int64 { + return int64(r.Intn(maxInt64)) +} diff --git a/x/mint/simulation/genesis_test.go b/x/mint/simulation/genesis_test.go index 544003aabc3..41c9bf358a8 100644 --- a/x/mint/simulation/genesis_test.go +++ b/x/mint/simulation/genesis_test.go @@ -2,6 +2,7 @@ package simulation_test import ( "encoding/json" + "fmt" "math/rand" "testing" @@ -12,17 +13,18 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" ) // TestRandomizedGenState tests the normal scenario of applying RandomizedGenState. -// Abonormal scenarios are not tested here. +// Abnormal scenarios are not tested here. func TestRandomizedGenState(t *testing.T) { interfaceRegistry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(interfaceRegistry) - s := rand.NewSource(1) + s := rand.NewSource(5) r := rand.New(s) simState := module.SimulationState{ @@ -40,14 +42,59 @@ func TestRandomizedGenState(t *testing.T) { var mintGenesis types.GenesisState simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &mintGenesis) - require.Equal(t, "stake", mintGenesis.Params.MintDenom) - require.Equal(t, "0stake", mintGenesis.Minter.EpochProvision(mintGenesis.Params).String()) - require.Equal(t, "0.000000000000000000", mintGenesis.Minter.NextEpochProvisions(mintGenesis.Params).String()) - require.Equal(t, "0.000000000000000000", mintGenesis.Minter.EpochProvisions.String()) + const ( + expectedEpochProvisionsStr = "7913048388940673156" + expectedReductionFactorStr = "0.6" + expectedReductionPeriodInEpochs = int64(9171281239991390334) + + expectedMintintRewardsDistributionStartEpoch = int64(14997548954463330) + + expectedReductionStartedEpoch = int64(6009281777831789783) + + expectedNextEpochProvisionsStr = "3956524194470336578" + expectedDenom = sdk.DefaultBondDenom + ) + + // Epoch provisions from Minter. + epochProvisionsDec, err := sdk.NewDecFromStr(expectedEpochProvisionsStr) + require.NoError(t, err) + require.Equal(t, epochProvisionsDec, mintGenesis.Minter.EpochProvisions) + + // Epoch identifier. + require.Equal(t, simulation.ExpectedEpochIdentifier, mintGenesis.Params.EpochIdentifier) + + // Reduction factor. + reductionFactorDec, err := sdk.NewDecFromStr(expectedReductionFactorStr) + require.NoError(t, err) + require.Equal(t, reductionFactorDec, mintGenesis.Params.ReductionFactor) + + // Reduction perion in epochs. + require.Equal(t, expectedReductionPeriodInEpochs, mintGenesis.Params.ReductionPeriodInEpochs) + + // Distribution proportions. + require.Equal(t, simulation.ExpectedDistributionProportions, mintGenesis.Params.DistributionProportions) + + // Weighted developer rewards receivers. + require.Equal(t, simulation.ExpectedDevRewardReceivers, mintGenesis.Params.WeightedDeveloperRewardsReceivers) + + // Minting rewards distribution start epoch + require.Equal(t, expectedMintintRewardsDistributionStartEpoch, mintGenesis.Params.MintingRewardsDistributionStartEpoch) + + // Reduction started epoch. + require.Equal(t, expectedReductionStartedEpoch, mintGenesis.ReductionStartedEpoch) + + // Next epoch provisions. + nextEpochProvisionsDec := epochProvisionsDec.Mul(reductionFactorDec) + require.NoError(t, err) + require.Equal(t, nextEpochProvisionsDec, mintGenesis.Minter.NextEpochProvisions(mintGenesis.Params)) + + // Denom and Epoch provisions from Params. + require.Equal(t, expectedDenom, mintGenesis.Params.MintDenom) + require.Equal(t, fmt.Sprintf("%s%s", expectedEpochProvisionsStr, expectedDenom), mintGenesis.Minter.EpochProvision(mintGenesis.Params).String()) } -// TestRandomizedGenState tests abnormal scenarios of applying RandomizedGenState. -func TestRandomizedGenState1(t *testing.T) { +// TestRandomizedGenState_Invalid tests abnormal scenarios of applying RandomizedGenState. +func TestRandomizedGenState_Invalid(t *testing.T) { interfaceRegistry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(interfaceRegistry) diff --git a/x/mint/types/events.go b/x/mint/types/events.go index 6ad8f851868..4f1ca5464b6 100644 --- a/x/mint/types/events.go +++ b/x/mint/types/events.go @@ -1,9 +1,11 @@ package types -// Minting module event types. +// Minting module event constants. const ( - EventTypeMint = ModuleName - + // AttributeKeyEpochProvisions is the string representation of the + // epoch provisions event attribute. AttributeKeyEpochProvisions = "epoch_provisions" - AttributeEpochNumber = "epoch_number" + // AttributeEpochNumber is the string representation of the + // epoch number event attribute. + AttributeEpochNumber = "epoch_number" ) diff --git a/x/mint/types/expected_keepers.go b/x/mint/types/expected_keepers.go index c2eb08ffb6e..4db66e45456 100644 --- a/x/mint/types/expected_keepers.go +++ b/x/mint/types/expected_keepers.go @@ -12,7 +12,6 @@ type AccountKeeper interface { GetModuleAddress(name string) sdk.AccAddress HasAccount(ctx sdk.Context, addr sdk.AccAddress) bool - // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 SetModuleAccount(sdk.Context, types.ModuleAccountI) GetModuleAccount(ctx sdk.Context, moduleName string) types.ModuleAccountI } diff --git a/x/mint/types/export_test.go b/x/mint/types/export_test.go new file mode 100644 index 00000000000..103197e146c --- /dev/null +++ b/x/mint/types/export_test.go @@ -0,0 +1,6 @@ +package types + +var ( + ErrNilEpochProvisions = errNilEpochProvisions + ErrNegativeEpochProvisions = errNegativeEpochProvisions +) diff --git a/x/mint/types/genesis.go b/x/mint/types/genesis.go index eae6321d589..17756127b7e 100644 --- a/x/mint/types/genesis.go +++ b/x/mint/types/genesis.go @@ -1,20 +1,20 @@ package types // NewGenesisState creates a new GenesisState object. -func NewGenesisState(minter Minter, params Params, halvenStartedEpoch int64) *GenesisState { +func NewGenesisState(minter Minter, params Params, reductionStartedEpoch int64) *GenesisState { return &GenesisState{ - Minter: minter, - Params: params, - HalvenStartedEpoch: halvenStartedEpoch, + Minter: minter, + Params: params, + ReductionStartedEpoch: reductionStartedEpoch, } } // DefaultGenesisState creates a default GenesisState object. func DefaultGenesisState() *GenesisState { return &GenesisState{ - Minter: DefaultInitialMinter(), - Params: DefaultParams(), - HalvenStartedEpoch: 0, + Minter: DefaultInitialMinter(), + Params: DefaultParams(), + ReductionStartedEpoch: 0, } } @@ -25,5 +25,5 @@ func ValidateGenesis(data GenesisState) error { return err } - return ValidateMinter(data.Minter) + return data.Minter.Validate() } diff --git a/x/mint/types/genesis.pb.go b/x/mint/types/genesis.pb.go index bdff8913fa9..86211fc7c25 100644 --- a/x/mint/types/genesis.pb.go +++ b/x/mint/types/genesis.pb.go @@ -25,12 +25,13 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the mint module's genesis state. type GenesisState struct { - // minter is a space for holding current rewards information. + // minter is an abstraction for holding current rewards information. Minter Minter `protobuf:"bytes,1,opt,name=minter,proto3" json:"minter"` - // params defines all the paramaters of the module. + // params defines all the paramaters of the mint module. Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` - // current halven period start epoch - HalvenStartedEpoch int64 `protobuf:"varint,3,opt,name=halven_started_epoch,json=halvenStartedEpoch,proto3" json:"halven_started_epoch,omitempty" yaml:"halven_started_epoch"` + // reduction_started_epoch is the first epoch in which the reduction of mint + // begins. + ReductionStartedEpoch int64 `protobuf:"varint,3,opt,name=reduction_started_epoch,json=reductionStartedEpoch,proto3" json:"reduction_started_epoch,omitempty" yaml:"reduction_started_epoch"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -80,9 +81,9 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetHalvenStartedEpoch() int64 { +func (m *GenesisState) GetReductionStartedEpoch() int64 { if m != nil { - return m.HalvenStartedEpoch + return m.ReductionStartedEpoch } return 0 } @@ -96,16 +97,17 @@ func init() { } var fileDescriptor_12e6a5511ad3feeb = []byte{ - // 279 bytes of a gzipped FileDescriptorProto + // 282 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xca, 0x2f, 0xce, 0xcd, 0x2f, 0xce, 0x2c, 0xd6, 0xcf, 0xcd, 0xcc, 0x2b, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0xaa, 0xd1, 0x03, 0xa9, 0xd1, 0x83, 0xaa, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, - 0xd0, 0x07, 0xb1, 0x20, 0x6a, 0xa5, 0xe4, 0xb1, 0x9a, 0x07, 0xd6, 0x08, 0x56, 0xa0, 0x74, 0x93, + 0xd0, 0x07, 0xb1, 0x20, 0x6a, 0xa5, 0xe4, 0xb1, 0x9a, 0x07, 0xd6, 0x08, 0x56, 0xa0, 0xf4, 0x88, 0x91, 0x8b, 0xc7, 0x1d, 0x62, 0x7c, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, 0x15, 0x17, 0x1b, 0x48, 0x3a, 0xb5, 0x48, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x46, 0x0f, 0x9b, 0x75, 0x7a, 0xbe, 0x60, 0x35, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0x75, 0x80, 0xf4, 0x16, 0x24, 0x16, 0x25, 0xe6, 0x16, 0x4b, 0x30, 0xe1, 0xd3, 0x1b, 0x00, 0x56, 0x03, 0xd3, 0x0b, 0xd1, 0x21, 0x14, +<<<<<<< HEAD 0xc8, 0x25, 0x92, 0x91, 0x98, 0x53, 0x96, 0x9a, 0x17, 0x5f, 0x5c, 0x92, 0x58, 0x54, 0x92, 0x9a, 0x12, 0x9f, 0x5a, 0x90, 0x9f, 0x9c, 0x21, 0xc1, 0xac, 0xc0, 0xa8, 0xc1, 0xec, 0x24, 0xff, 0xe9, 0x9e, 0xbc, 0x74, 0x65, 0x62, 0x6e, 0x8e, 0x95, 0x12, 0x36, 0x55, 0x4a, 0x41, 0x42, 0x10, 0xe1, @@ -115,6 +117,17 @@ var fileDescriptor_12e6a5511ad3feeb = []byte{ 0xd4, 0xcd, 0x49, 0x4c, 0x2a, 0x86, 0x71, 0xf4, 0xcb, 0x2c, 0xf5, 0x2b, 0x20, 0x61, 0x56, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x2d, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x77, 0x21, 0x19, 0x16, 0xa0, 0x01, 0x00, 0x00, +======= + 0xc5, 0x25, 0x5e, 0x94, 0x9a, 0x52, 0x9a, 0x5c, 0x92, 0x99, 0x9f, 0x17, 0x5f, 0x5c, 0x92, 0x58, + 0x54, 0x92, 0x9a, 0x12, 0x9f, 0x5a, 0x90, 0x9f, 0x9c, 0x21, 0xc1, 0xac, 0xc0, 0xa8, 0xc1, 0xec, + 0xa4, 0xf4, 0xe9, 0x9e, 0xbc, 0x5c, 0x65, 0x62, 0x6e, 0x8e, 0x95, 0x12, 0x0e, 0x85, 0x4a, 0x41, + 0xa2, 0x70, 0x99, 0x60, 0x88, 0x84, 0x2b, 0x48, 0xdc, 0xc9, 0xf3, 0xc4, 0x23, 0x39, 0xc6, 0x0b, + 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, + 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xf4, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, + 0xf5, 0xa1, 0x6e, 0xd5, 0xcd, 0x49, 0x4c, 0x2a, 0x86, 0x71, 0xf4, 0xcb, 0xcc, 0xf5, 0x2b, 0x20, + 0x81, 0x57, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x36, 0x63, 0x40, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xa2, 0xcc, 0xdf, 0xaf, 0xa9, 0x01, 0x00, 0x00, +>>>>>>> ee48cf58 (chore: x/mint docs and clean up, excluding mint keeper (#1857)) } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -137,8 +150,8 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.HalvenStartedEpoch != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.HalvenStartedEpoch)) + if m.ReductionStartedEpoch != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.ReductionStartedEpoch)) i-- dAtA[i] = 0x18 } @@ -186,8 +199,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if m.HalvenStartedEpoch != 0 { - n += 1 + sovGenesis(uint64(m.HalvenStartedEpoch)) + if m.ReductionStartedEpoch != 0 { + n += 1 + sovGenesis(uint64(m.ReductionStartedEpoch)) } return n } @@ -295,9 +308,9 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HalvenStartedEpoch", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ReductionStartedEpoch", wireType) } - m.HalvenStartedEpoch = 0 + m.ReductionStartedEpoch = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenesis @@ -307,7 +320,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.HalvenStartedEpoch |= int64(b&0x7F) << shift + m.ReductionStartedEpoch |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/mint/types/hooks.go b/x/mint/types/hooks.go index ff2b3c3d4d1..1cffa07ccd4 100644 --- a/x/mint/types/hooks.go +++ b/x/mint/types/hooks.go @@ -4,19 +4,24 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +// MintHooks defines an interface for mint module's hooks. type MintHooks interface { AfterDistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) } var _ MintHooks = MultiMintHooks{} -// combine multiple mint hooks, all hook functions are run in array sequence. +// MultiMintHooks is a container for mint hooks. +// All hooks are run in sequence. type MultiMintHooks []MintHooks +// NewMultiMintHooks returns new MultiMintHooks given hooks. func NewMultiMintHooks(hooks ...MintHooks) MultiMintHooks { return hooks } +// AfterDistributeMintedCoin is a hook that runs after minter mints and distributes coins +// at the beginning of each epoch. func (h MultiMintHooks) AfterDistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) { for i := range h { h[i].AfterDistributeMintedCoin(ctx, mintedCoin) diff --git a/x/mint/types/keys.go b/x/mint/types/keys.go index 6812a631889..f2c40c0871d 100644 --- a/x/mint/types/keys.go +++ b/x/mint/types/keys.go @@ -1,15 +1,17 @@ package types -// MinterKey is the key to use for the keeper store. +// MinterKey is the key to use for the keeper store at which +// the Minter and its EpochProvisions are stored. var MinterKey = []byte{0x00} -// LastHalvenEpochKey is the key to use for the keeper store. -var LastHalvenEpochKey = []byte{0x03} +// LastReductionEpochKey is the key to use for the keeper store +// for storing the last epoch at which reduction occurred. +var LastReductionEpochKey = []byte{0x03} const ( - // module name. + // ModuleName is the module name. ModuleName = "mint" - // module acct name for developer vesting. + // DeveloperVestingModuleAcctName is the module acct name for developer vesting. DeveloperVestingModuleAcctName = "developer_vesting_unvested" // StoreKey is the default store key for mint. @@ -18,7 +20,9 @@ const ( // QuerierRoute is the querier route for the minting store. QuerierRoute = StoreKey - // Query endpoints supported by the minting querier. - QueryParameters = "parameters" + // QueryParameters is an endpoint path for querying mint parameters. + QueryParameters = "parameters" + + // QueryEpochProvisions is an endpoint path for querying mint epoch provisions. QueryEpochProvisions = "epoch_provisions" ) diff --git a/x/mint/types/mint.pb.go b/x/mint/types/mint.pb.go index 2e073c2479f..676cbc6faa8 100644 --- a/x/mint/types/mint.pb.go +++ b/x/mint/types/mint.pb.go @@ -29,7 +29,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Minter represents the minting state. type Minter struct { - // current epoch provisions + // epoch_provisions represent rewards for the current epoch. EpochProvisions github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=epoch_provisions,json=epochProvisions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"epoch_provisions" yaml:"epoch_provisions"` } @@ -66,6 +66,9 @@ func (m *Minter) XXX_DiscardUnknown() { var xxx_messageInfo_Minter proto.InternalMessageInfo +// WeightedAddress represents an address with a weight assigned to it. +// The weight is used to determine the proportion of the total minted +// tokens to be minted to the address. type WeightedAddress struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` Weight github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"weight" yaml:"weight"` @@ -111,17 +114,20 @@ func (m *WeightedAddress) GetAddress() string { return "" } +// DistributionProportions defines the distribution proportions of the minted +// denom. In other words, defines which stakeholders will receive the minted +// denoms and how much. type DistributionProportions struct { - // staking defines the proportion of the minted minted_denom that is to be + // staking defines the proportion of the minted mint_denom that is to be // allocated as staking rewards. Staking github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=staking,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"staking" yaml:"staking"` - // pool_incentives defines the proportion of the minted minted_denom that is + // pool_incentives defines the proportion of the minted mint_denom that is // to be allocated as pool incentives. PoolIncentives github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=pool_incentives,json=poolIncentives,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"pool_incentives" yaml:"pool_incentives"` - // developer_rewards defines the proportion of the minted minted_denom that is + // developer_rewards defines the proportion of the minted mint_denom that is // to be allocated to developer rewards address. DeveloperRewards github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=developer_rewards,json=developerRewards,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"developer_rewards" yaml:"developer_rewards"` - // community_pool defines the proportion of the minted minted_denom that is + // community_pool defines the proportion of the minted mint_denom that is // to be allocated to the community pool. CommunityPool github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=community_pool,json=communityPool,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"community_pool" yaml:"community_pool"` } @@ -159,23 +165,31 @@ func (m *DistributionProportions) XXX_DiscardUnknown() { var xxx_messageInfo_DistributionProportions proto.InternalMessageInfo -// Params holds parameters for the mint module. +// Params holds parameters for the x/mint module. type Params struct { - // type of coin to mint + // mint_denom is the denom of the coin to mint. MintDenom string `protobuf:"bytes,1,opt,name=mint_denom,json=mintDenom,proto3" json:"mint_denom,omitempty"` - // epoch provisions from the first epoch + // genesis_epoch_provisions epoch provisions from the first epoch. GenesisEpochProvisions github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=genesis_epoch_provisions,json=genesisEpochProvisions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"genesis_epoch_provisions" yaml:"genesis_epoch_provisions"` - // mint epoch identifier + // epoch_identifier mint epoch identifier e.g. (day, week). EpochIdentifier string `protobuf:"bytes,3,opt,name=epoch_identifier,json=epochIdentifier,proto3" json:"epoch_identifier,omitempty" yaml:"epoch_identifier"` - // number of epochs take to reduce rewards + // reduction_period_in_epochs the number of epochs it takes + // to reduce the rewards. ReductionPeriodInEpochs int64 `protobuf:"varint,4,opt,name=reduction_period_in_epochs,json=reductionPeriodInEpochs,proto3" json:"reduction_period_in_epochs,omitempty" yaml:"reduction_period_in_epochs"` - // reduction multiplier to execute on each period + // reduction_factor is the reduction multiplier to execute + // at the end of each period set by reduction_period_in_epochs. ReductionFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=reduction_factor,json=reductionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reduction_factor" yaml:"reduction_factor"` - // distribution_proportions defines the proportion of the minted denom + // distribution_proportions defines the distribution proportions of the minted + // denom. In other words, defines which stakeholders will receive the minted + // denoms and how much. DistributionProportions DistributionProportions `protobuf:"bytes,6,opt,name=distribution_proportions,json=distributionProportions,proto3" json:"distribution_proportions"` - // address to receive developer rewards + // weighted_developer_rewards_receivers is the address to receive developer + // rewards with weights assignedt to each address. The final amount that each + // address receives is: epoch_provisions * + // distribution_proportions.developer_rewards * Address's Weight. WeightedDeveloperRewardsReceivers []WeightedAddress `protobuf:"bytes,7,rep,name=weighted_developer_rewards_receivers,json=weightedDeveloperRewardsReceivers,proto3" json:"weighted_developer_rewards_receivers" yaml:"developer_rewards_receiver"` - // start epoch to distribute minting rewards + // minting_rewards_distribution_start_epoch start epoch to distribute minting + // rewards MintingRewardsDistributionStartEpoch int64 `protobuf:"varint,8,opt,name=minting_rewards_distribution_start_epoch,json=mintingRewardsDistributionStartEpoch,proto3" json:"minting_rewards_distribution_start_epoch,omitempty" yaml:"minting_rewards_distribution_start_epoch"` } diff --git a/x/mint/types/minter.go b/x/mint/types/minter.go index e9ba2b5d5f3..c4037c71aaa 100644 --- a/x/mint/types/minter.go +++ b/x/mint/types/minter.go @@ -1,9 +1,16 @@ package types import ( + "errors" + sdk "github.com/cosmos/cosmos-sdk/types" ) +var ( + errNilEpochProvisions = errors.New("epoch provisions was nil in genesis") + errNegativeEpochProvisions = errors.New("epoch provisions should be non-negative") +) + // NewMinter returns a new Minter object with the given epoch // provisions values. func NewMinter(epochProvisions sdk.Dec) Minter { @@ -22,8 +29,15 @@ func DefaultInitialMinter() Minter { return InitialMinter() } -// validate minter. -func ValidateMinter(minter Minter) error { +// Validate validates minter. Returns nil on success, error otherewise. +func (m Minter) Validate() error { + if m.EpochProvisions.IsNil() { + return errNilEpochProvisions + } + + if m.EpochProvisions.IsNegative() { + return errNegativeEpochProvisions + } return nil } diff --git a/x/mint/types/minter_test.go b/x/mint/types/minter_test.go index 1865228a274..cb841155a9f 100644 --- a/x/mint/types/minter_test.go +++ b/x/mint/types/minter_test.go @@ -1,10 +1,13 @@ -package types +package types_test import ( "math/rand" "testing" + "github.com/osmosis-labs/osmosis/v7/x/mint/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" ) // Benchmarking :) @@ -15,8 +18,8 @@ import ( // BenchmarkEpochProvision-4 3000000 429 ns/op func BenchmarkEpochProvision(b *testing.B) { b.ReportAllocs() - minter := InitialMinter() - params := DefaultParams() + minter := types.InitialMinter() + params := types.DefaultParams() s1 := rand.NewSource(100) r1 := rand.New(s1) @@ -32,11 +35,50 @@ func BenchmarkEpochProvision(b *testing.B) { // BenchmarkNextEpochProvisions-4 5000000 251 ns/op func BenchmarkNextEpochProvisions(b *testing.B) { b.ReportAllocs() - minter := InitialMinter() - params := DefaultParams() + minter := types.InitialMinter() + params := types.DefaultParams() // run the NextEpochProvisions function b.N times for n := 0; n < b.N; n++ { minter.NextEpochProvisions(params) } } + +func TestMinterValidate(t *testing.T) { + + testcases := []struct { + name string + minter types.Minter + expected error + }{ + { + "valid - success", + types.InitialMinter(), + nil, + }, + { + "negative -errir", + types.Minter{ + EpochProvisions: sdk.NewDec(-1), + }, + types.ErrNegativeEpochProvisions, + }, + { + "nil -error", + types.Minter{}, + types.ErrNilEpochProvisions, + }, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + actual := tc.minter.Validate() + if tc.expected != nil { + require.Error(t, actual) + require.Equal(t, actual, tc.expected) + } else { + require.NoError(t, actual) + } + }) + } +} diff --git a/x/mint/types/params.go b/x/mint/types/params.go index 3a03aed3641..86405e59c79 100644 --- a/x/mint/types/params.go +++ b/x/mint/types/params.go @@ -7,7 +7,11 @@ import ( yaml "gopkg.in/yaml.v2" +<<<<<<< HEAD epochtypes "github.com/osmosis-labs/osmosis/v10/x/epochs/types" +======= + epochtypes "github.com/osmosis-labs/osmosis/v7/x/epochs/types" +>>>>>>> ee48cf58 (chore: x/mint docs and clean up, excluding mint keeper (#1857)) sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -30,6 +34,7 @@ func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } +// NewParams returns new mint module parameters initialized to the given values. func NewParams( mintDenom string, genesisEpochProvisions sdk.Dec, epochIdentifier string, ReductionFactor sdk.Dec, reductionPeriodInEpochs int64, distrProportions DistributionProportions, @@ -47,7 +52,7 @@ func NewParams( } } -// default minting module parameters. +// DefaultParams returns the default minting module parameters. func DefaultParams() Params { return Params{ MintDenom: sdk.DefaultBondDenom, @@ -66,7 +71,8 @@ func DefaultParams() Params { } } -// validate params. +// Validate validates mint module parameters. Returns nil if valid, +// error otherwise func (p Params) Validate() error { if err := validateMintDenom(p.MintDenom); err != nil { return err @@ -193,8 +199,6 @@ func validateDistributionProportions(i interface{}) error { return errors.New("developer rewards distribution ratio should not be negative") } - // TODO: Maybe we should allow this :joy:, lets you burn osmo from community pool - // for new chains if v.CommunityPool.IsNegative() { return errors.New("community pool distribution ratio should not be negative") } diff --git a/x/mint/types/query.pb.go b/x/mint/types/query.pb.go index 8e77b4daeff..6efaf9fda91 100644 --- a/x/mint/types/query.pb.go +++ b/x/mint/types/query.pb.go @@ -243,7 +243,7 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Params returns the total set of minting parameters. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // EpochProvisions current minting epoch provisions value. + // EpochProvisions returns the current minting epoch provisions value. EpochProvisions(ctx context.Context, in *QueryEpochProvisionsRequest, opts ...grpc.CallOption) (*QueryEpochProvisionsResponse, error) } @@ -277,7 +277,7 @@ func (c *queryClient) EpochProvisions(ctx context.Context, in *QueryEpochProvisi type QueryServer interface { // Params returns the total set of minting parameters. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // EpochProvisions current minting epoch provisions value. + // EpochProvisions returns the current minting epoch provisions value. EpochProvisions(context.Context, *QueryEpochProvisionsRequest) (*QueryEpochProvisionsResponse, error) } diff --git a/x/pool-incentives/keeper/hooks.go b/x/pool-incentives/keeper/hooks.go index a2a858d217c..f825f4a4813 100644 --- a/x/pool-incentives/keeper/hooks.go +++ b/x/pool-incentives/keeper/hooks.go @@ -3,7 +3,12 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" +<<<<<<< HEAD gammtypes "github.com/osmosis-labs/osmosis/v10/x/gamm/types" +======= + gammtypes "github.com/osmosis-labs/osmosis/v7/x/gamm/types" + minttypes "github.com/osmosis-labs/osmosis/v7/x/mint/types" +>>>>>>> ee48cf58 (chore: x/mint docs and clean up, excluding mint keeper (#1857)) ) type Hooks struct { @@ -11,6 +16,7 @@ type Hooks struct { } var _ gammtypes.GammHooks = Hooks{} +var _ minttypes.MintHooks = Hooks{} // Create new pool incentives hooks. func (k Keeper) Hooks() Hooks { return Hooks{k} } diff --git a/x/superfluid/types/query.pb.go b/x/superfluid/types/query.pb.go index ca71feac4e6..9ec218a3853 100644 --- a/x/superfluid/types/query.pb.go +++ b/x/superfluid/types/query.pb.go @@ -1268,6 +1268,7 @@ func init() { func init() { proto.RegisterFile("osmosis/superfluid/query.proto", fileDescriptor_e3d9448e4ed3943f) } var fileDescriptor_e3d9448e4ed3943f = []byte{ +<<<<<<< HEAD // 1555 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcd, 0x6f, 0xd4, 0x46, 0x1b, 0xcf, 0x24, 0x90, 0xc0, 0x83, 0x04, 0x61, 0xe0, 0x7d, 0x59, 0x0c, 0x6c, 0xc0, 0x81, 0x64, @@ -1367,6 +1368,113 @@ var fileDescriptor_e3d9448e4ed3943f = []byte{ 0xf9, 0xa8, 0xa5, 0x97, 0x69, 0xe8, 0xc6, 0xea, 0x29, 0xf5, 0x56, 0xdc, 0x17, 0x36, 0x1e, 0x96, 0x07, 0xd9, 0xbf, 0xdc, 0xc7, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x04, 0x59, 0x89, 0x52, 0x3d, 0x18, 0x00, 0x00, +======= + // 1660 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0x4b, 0x6c, 0xd4, 0xc6, + 0x1b, 0xcf, 0x24, 0x21, 0x81, 0x0f, 0x09, 0x92, 0x01, 0xfe, 0x09, 0x06, 0x36, 0xe0, 0x84, 0x24, + 0xff, 0x00, 0x76, 0x09, 0x0d, 0xa4, 0x50, 0x10, 0x1b, 0x02, 0x34, 0x52, 0xd2, 0xd0, 0x25, 0x09, + 0x52, 0x1f, 0xb2, 0x9c, 0xf5, 0xb0, 0x58, 0xf1, 0xda, 0x9b, 0x1d, 0x6f, 0xca, 0x0a, 0xa1, 0x4a, + 0x54, 0x95, 0x8a, 0x7a, 0x68, 0x25, 0x4e, 0x3d, 0xb5, 0x57, 0x7a, 0xe8, 0xb5, 0x97, 0x5e, 0xaa, + 0x5e, 0x90, 0xaa, 0x4a, 0x48, 0xbd, 0x54, 0x3d, 0x40, 0x05, 0x3d, 0xb6, 0x97, 0x1e, 0xdb, 0x4b, + 0xe5, 0x99, 0xf1, 0x63, 0xb3, 0x7e, 0x6c, 0x02, 0x85, 0x9e, 0xb2, 0xf6, 0xf7, 0xfc, 0x7d, 0xaf, + 0x99, 0xcf, 0x81, 0x9c, 0x43, 0xcb, 0x0e, 0x35, 0xa9, 0x4a, 0x6b, 0x15, 0x52, 0xbd, 0x6e, 0xd5, + 0x4c, 0x43, 0x5d, 0xad, 0x91, 0x6a, 0x5d, 0xa9, 0x54, 0x1d, 0xd7, 0xc1, 0x58, 0xd0, 0x95, 0x90, + 0x2e, 0xed, 0x2e, 0x39, 0x25, 0x87, 0x91, 0x55, 0xef, 0x17, 0xe7, 0x94, 0x72, 0x45, 0xc6, 0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, 0xd1, 0xdf, 0x71, 0x10, + 0x8d, 0x76, 0x16, 0xba, 0xd9, 0xf3, 0x8c, 0x81, 0xfb, 0xa1, 0xdb, 0x93, 0x20, 0x94, 0xf6, 0x77, + 0x72, 0x21, 0xf1, 0x28, 0xdf, 0x80, 0x5c, 0xde, 0xb2, 0x62, 0x7c, 0xf0, 0x73, 0xe8, 0xd5, 0x47, + 0x58, 0xff, 0x22, 0x1e, 0xc3, 0x0a, 0x6f, 0x00, 0xc5, 0x6b, 0x16, 0x85, 0xcf, 0x13, 0xd1, 0x03, + 0xca, 0x15, 0xbd, 0xe4, 0x97, 0x61, 0x21, 0x22, 0x29, 0x7f, 0x8f, 0x60, 0x20, 0xd1, 0x94, 0xc8, + 0xc5, 0x35, 0xd8, 0xaa, 0x8b, 0x77, 0xa2, 0x38, 0x26, 0xd2, 0x8b, 0x23, 0x21, 0x78, 0xa2, 0x5c, + 0x02, 0x65, 0xf8, 0x72, 0x03, 0x88, 0x76, 0x06, 0x62, 0x24, 0x13, 0x04, 0xf7, 0xaa, 0x01, 0xc5, + 0x39, 0x18, 0xbc, 0xe0, 0xd8, 0x36, 0x29, 0xba, 0x24, 0xce, 0xb8, 0x1f, 0xb4, 0x3e, 0xe8, 0xf6, + 0x46, 0x8b, 0x97, 0x0a, 0xc4, 0x52, 0xd1, 0xe5, 0x3d, 0xce, 0x18, 0xf2, 0xfb, 0x30, 0x94, 0x2e, + 0x2f, 0x22, 0x31, 0x0f, 0xdd, 0xc2, 0x79, 0x11, 0xf2, 0xcd, 0x05, 0xa2, 0xe0, 0x6b, 0x91, 0x07, + 0xe1, 0xd0, 0x82, 0xe3, 0xea, 0x56, 0x28, 0x32, 0x4d, 0x2c, 0x52, 0xe2, 0x43, 0xda, 0xef, 0xd7, + 0xfb, 0x08, 0xe4, 0x34, 0x2e, 0xe1, 0xdc, 0x1d, 0x04, 0xbd, 0xae, 0xc7, 0xa6, 0x19, 0x21, 0x95, + 0xd7, 0xe9, 0xd4, 0xa2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7, 0xf6, 0xf3, + 0xd3, 0x5c, 0xdb, 0xdb, 0x13, 0x91, 0x1b, 0xb0, 0x30, 0x79, 0xcc, 0xd2, 0x97, 0x69, 0x60, 0x7f, + 0xed, 0x94, 0x7a, 0x33, 0xea, 0x04, 0xbb, 0x14, 0x2f, 0x77, 0xb1, 0x7f, 0x24, 0x9d, 0xf8, 0x27, + 0x00, 0x00, 0xff, 0xff, 0x6f, 0xaa, 0xd8, 0x36, 0xc6, 0x1b, 0x00, 0x00, +>>>>>>> ee48cf58 (chore: x/mint docs and clean up, excluding mint keeper (#1857)) } // Reference imports to suppress errors if they are not otherwise used. @@ -1409,6 +1517,11 @@ type QueryClient interface { // This is labeled an estimate, because the way it calculates the amount can // lead rounding errors from the true delegated amount EstimateSuperfluidDelegatedAmountByValidatorDenom(ctx context.Context, in *EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, opts ...grpc.CallOption) (*EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, error) +<<<<<<< HEAD +======= + // Returns the specified delegations for a specific delegator + TotalDelegationByDelegator(ctx context.Context, in *QueryTotalDelegationByDelegatorRequest, opts ...grpc.CallOption) (*QueryTotalDelegationByDelegatorResponse, error) +>>>>>>> ee48cf58 (chore: x/mint docs and clean up, excluding mint keeper (#1857)) } type queryClient struct { @@ -1557,6 +1670,11 @@ type QueryServer interface { // This is labeled an estimate, because the way it calculates the amount can // lead rounding errors from the true delegated amount EstimateSuperfluidDelegatedAmountByValidatorDenom(context.Context, *EstimateSuperfluidDelegatedAmountByValidatorDenomRequest) (*EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, error) +<<<<<<< HEAD +======= + // Returns the specified delegations for a specific delegator + TotalDelegationByDelegator(context.Context, *QueryTotalDelegationByDelegatorRequest) (*QueryTotalDelegationByDelegatorResponse, error) +>>>>>>> ee48cf58 (chore: x/mint docs and clean up, excluding mint keeper (#1857)) } // UnimplementedQueryServer can be embedded to have forward compatible implementations.