Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* `x/circuit`
* `x/crisis`
* (crypto) [#24414](https://github.com/cosmos/cosmos-sdk/pull/24414) Remove sr25519 support, since it was removed in CometBFT v1.x (see: CometBFT [#3646](https://github.com/cometbft/cometbft/pull/3646)).
* (x/mint) [#25599](https://github.com/cosmos/cosmos-sdk/pull/25599) Add max supply param.

### Features

Expand Down
111 changes: 94 additions & 17 deletions api/cosmos/mint/v1beta1/mint.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions proto/cosmos/mint/v1beta1/mint.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,10 @@ message Params {
];
// expected blocks per year
uint64 blocks_per_year = 6;
// maximum supply for the token
string max_supply = 7 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
}
2 changes: 1 addition & 1 deletion tests/e2e/mint/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (s *E2ETestSuite) TestQueryGRPC() {
&minttypes.QueryParamsResponse{},
&minttypes.QueryParamsResponse{
Params: minttypes.NewParams("stake", math.LegacyNewDecWithPrec(13, 2), math.LegacyNewDecWithPrec(100, 2),
math.LegacyNewDec(1), math.LegacyNewDecWithPrec(67, 2), (60 * 60 * 8766 / 5)),
math.LegacyNewDec(1), math.LegacyNewDecWithPrec(67, 2), (60 * 60 * 8766 / 5), math.ZeroInt()),
},
},
{
Expand Down
1 change: 1 addition & 0 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ require (

// Below are the long-lived replace for tests.
replace (
cosmossdk.io/api => ../api
// We always want to test against the latest version of the simapp.
cosmossdk.io/simapp => ../simapp
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
Expand Down
2 changes: 2 additions & 0 deletions tools/benchmark/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ Ref: https://keepachangelog.com/en/1.0.0/
## [v0.2.0-rc.1](https://github.com/cosmos/cosmos-sdk/releases/tag/tools/benchmark/v0.2.0-rc.1) - 2024-12-18

* [#22778](https://github.com/cosmos/cosmos-sdk/pull/22778) - Initial commit
* [19896](https://github.com/cosmos/cosmos-sdk/pull/19896) Added a new max supply genesis param to existing params.

31 changes: 20 additions & 11 deletions x/mint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,21 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/mint/v1beta1/

The mint module stores its params in state with the prefix of `0x01`,
it can be updated with governance or the address with authority.
**Note:** With the latest update, the addition of the `MaxSupply` parameter allows controlling the maximum supply of tokens minted by the module.
A value of `0` indicates an unlimited supply.

* Params: `mint/params -> legacy_amino(params)`

```protobuf reference
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/mint/v1beta1/mint.proto#L26-L59
https://github.com/cosmos/cosmos-sdk/blob/7068d0da52d954430054768b2c56aff44666933b/x/mint/proto/cosmos/mint/v1beta1/mint.proto#L26-L68
```

## Begin-Block

Minting parameters are recalculated and inflation paid at the beginning of each block.

The minting logic in the `BeginBlocker` function provides an optional feature for controlling token minting based on the maximum allowable supply (MaxSupply). This feature allows users to adjust the minting process according to their specific requirements and use cases. However, it's important to note that the MaxSupply parameter is independent of the minting process and assumes that any adjustments to the total supply, including burning tokens, are handled by external modules.

### Inflation rate calculation

Inflation rate is calculated using an "inflation calculation function" that's
Expand Down Expand Up @@ -213,15 +217,17 @@ BlockProvision(params Params) sdk.Coin {
## Parameters

The minting module contains the following parameters:
Note: `0` indicates unlimited supply for MaxSupply param

| Key | Type | Example |
|---------------------|-----------------|------------------------|
| MintDenom | string | "uatom" |
| InflationRateChange | string (dec) | "0.130000000000000000" |
| InflationMax | string (dec) | "0.200000000000000000" |
| InflationMin | string (dec) | "0.070000000000000000" |
| GoalBonded | string (dec) | "0.670000000000000000" |
| BlocksPerYear | string (uint64) | "6311520" |
| Key | Type | Example |
|---------------------|------------------|------------------------|
| MintDenom | string | "uatom" |
| InflationRateChange | string (dec) | "0.130000000000000000" |
| InflationMax | string (dec) | "0.200000000000000000" |
| InflationMin | string (dec) | "0.070000000000000000" |
| GoalBonded | string (dec) | "0.670000000000000000" |
| BlocksPerYear | string (uint64) | "6311520" |
| MaxSupply | string (math.Int)| "0" |


## Events
Expand Down Expand Up @@ -309,6 +315,7 @@ inflation_max: "0.200000000000000000"
inflation_min: "0.070000000000000000"
inflation_rate_change: "0.130000000000000000"
mint_denom: stake
max_supply: "0"
```

### gRPC
Expand Down Expand Up @@ -383,7 +390,8 @@ Example Output:
"inflationMax": "200000000000000000",
"inflationMin": "70000000000000000",
"goalBonded": "670000000000000000",
"blocksPerYear": "6311520"
"blocksPerYear": "6311520",
"maxSupply": "0",
}
}
```
Expand Down Expand Up @@ -454,7 +462,8 @@ Example Output:
"inflationMax": "200000000000000000",
"inflationMin": "70000000000000000",
"goalBonded": "670000000000000000",
"blocksPerYear": "6311520"
"blocksPerYear": "6311520",
"maxSupply": "0",
}
}
```
1 change: 1 addition & 0 deletions x/mint/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (s *GenesisTestSuite) TestImportExportGenesis() {
math.LegacyNewDecWithPrec(9, 2),
math.LegacyNewDecWithPrec(69, 2),
uint64(60*60*8766/5),
math.ZeroInt(),
)

s.keeper.InitGenesis(s.sdkCtx, s.accountKeeper, genesisState)
Expand Down
8 changes: 8 additions & 0 deletions x/mint/keeper/migrator.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package keeper

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/mint/exported"
v3 "github.com/cosmos/cosmos-sdk/x/mint/migrations/v3"
)

// Migrator is a struct for handling in-place state migrations.
Expand All @@ -17,3 +19,9 @@ func NewMigrator(k Keeper, ss exported.Subspace) Migrator {
legacySubspace: ss,
}
}

// Migrate2to3 migrates the x/mint module state from the consensus version 2 to
// version 3.
func (m Migrator) Migrate2to3(ctx sdk.Context) error {
return v3.Migrate(ctx, m.keeper.storeService.OpenKVStore(ctx), m.keeper.cdc, m.keeper.Params)
}
Loading
Loading