Unigrid mint module intended to replace standard Mint module for Unigrid Cosmos-SDK chains. UGDMint implements the Unigrid algorithm for staking rewards instead of the standard algorithm for Cosmos-SDK chains based on inflation and bonded ratio.
This module is designed to work with Cosmos-SDK v0.50.x.
Since this module is currently in a private Github repo, first make sure that you have access permissions. It's easiest to set the $GOPRIVATE
environment variable to tell go mod install
to install it from a private repo. Otherwise it will look at the online public registry of modules and complain that it cannot find it.
> export GOPRIVATE="github.com/unigrid-project/cosmos-ugdmint"
To install this module, we will basically replace the references of the Imports in several files in the /simapp
folder. We will modify the following files:
- cosmos-sdk - simapp - app.go - app_config.go - app_test.go - app_v2.go - sim_test.go - test_helpers.go - upgrades.go
Basically anything that references the Cosmos-SDK Mint module we will now reference our Unigrid UGDMint module instead. First change the following references in Imports where they are found:
Before
import ( ... mintmodulev1 "cosmossdk.io/api/cosmos/mint/module/v1" "github.com/cosmos/cosmos-sdk/x/mint" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" ... )
After
import ( ... mintmodulev1 "github.com/unigrid-project/cosmos-ugdmint/api/cosmos/ugdmint/module/v1" mintmodule "github.com/unigrid-project/cosmos-ugdmint/x/ugdmint" mintkeeper "github.com/unigrid-project/cosmos-ugdmint/x/ugdmint/keeper" minttypes "github.com/unigrid-project/cosmos-ugdmint/x/ugdmint/types" ... )
As I said before, some files will need a little extra changes as well. Change the code in App.go as follows:
ModuleBasics = module.NewBasicManager( ... mintmodule.AppModuleBasic{}, ... )
and
app.ModuleManager = module.NewManager( ... mintmodule.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), ... )
There are two places in the code where it constructs a module versionmap. Change them both as follows:
module.VersionMap{ ... "ugdmint" mintmodule.AppModule{}.ConsensusVersion(), ... }
One change in the code here:
ModuleBasics = module.NewBasicManager( ... mintmodule.AooModuleBasic{}, ... )