Skip to content
Draft
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
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.

1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ require (

// Below are the long-lived replace of the Cosmos SDK
replace (
cosmossdk.io/api => ./api
// use cosmos fork of keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
// dgrijalva/jwt-go is deprecated and doesn't receive security updates.
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,6 @@ cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoIS
cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vfKf5Af+to4M=
cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT3ujaO/WwSA=
cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw=
cosmossdk.io/api v1.0.0-rc.1 h1:KwZHIMveoeg6YVwvKZxJLp7be5uk6qmnqNAar2tPxVU=
cosmossdk.io/api v1.0.0-rc.1/go.mod h1:8YOT+XjVFb9eZJk62YqjFILOm8MlLhbnkC9/jxIYri8=
cosmossdk.io/collections v1.3.1 h1:09e+DUId2brWsNOQ4nrk+bprVmMUaDH9xvtZkeqIjVw=
cosmossdk.io/collections v1.3.1/go.mod h1:ynvkP0r5ruAjbmedE+vQ07MT6OtJ0ZIDKrtJHK7Q/4c=
cosmossdk.io/core v1.1.0-rc.1 h1:VhF5xd4uJZt/lQzbl8qT1W3Pcrklp4RSnugcWQZyf5M=
Expand Down
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 @@ -219,6 +219,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.

2 changes: 1 addition & 1 deletion x/gov/types/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package types

// Config is a config struct used for initialising the gov module to avoid using globals.
// Config is a config struct used for initializing the gov module to avoid using globals.
type Config struct {
// MaxMetadataLen defines the maximum proposal metadata length.
MaxMetadataLen uint64
Expand Down
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
7 changes: 7 additions & 0 deletions x/mint/keeper/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/mint/exported"
v2 "github.com/cosmos/cosmos-sdk/x/mint/migrations/v2"
v3 "github.com/cosmos/cosmos-sdk/x/mint/migrations/v3"
)

// Migrator is a struct for handling in-place state migrations.
Expand All @@ -27,3 +28,9 @@ func NewMigrator(k Keeper, ss exported.Subspace) Migrator {
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
return v2.Migrate(ctx, m.keeper.storeService.OpenKVStore(ctx), m.legacySubspace, m.keeper.cdc)
}

// 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