Skip to content

Unigrid mint module intended to replace standard Mint module for Unigrid chains

License

Notifications You must be signed in to change notification settings

unigrid-project/cosmos-ugdmint

Repository files navigation

cosmos-ugdmint

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.

Installation

This module is designed to work with Cosmos-SDK v0.50.x.

Private module

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"

Files

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

Imports

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"
    ...
)

App.go

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)),
        ...
    )

App_test.go

There are two places in the code where it constructs a module versionmap. Change them both as follows:

    module.VersionMap{
        ...
        "ugdmint" mintmodule.AppModule{}.ConsensusVersion(),
        ...
    }

App_v2.go

One change in the code here:

    ModuleBasics = module.NewBasicManager(
        ...
        mintmodule.AooModuleBasic{},
        ...
    )

About

Unigrid mint module intended to replace standard Mint module for Unigrid chains

Resources

License

Stars

Watchers

Forks

Packages

No packages published