Skip to content

Commit

Permalink
feat: Add fixed fee for creating a new credit class (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruhatch committed Jun 9, 2021
1 parent 5f9d11f commit 4f52a56
Show file tree
Hide file tree
Showing 21 changed files with 1,604 additions and 841 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,6 @@ build/
/proto-tools-stamp
/tools-stamp
dist/

# pre-commit
.pre-commit-config.yaml
16 changes: 9 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import (
ibcmock "github.com/cosmos/ibc-go/testing/mock"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
ecocreditmodule "github.com/regen-network/regen-ledger/x/ecocredit/module"
"github.com/spf13/cast"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
Expand Down Expand Up @@ -130,13 +131,14 @@ var (

// module account permissions
maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ecocreditmodule.Module{}.Name(): {authtypes.Burner},
}
)

Expand Down
12 changes: 10 additions & 2 deletions app/experimental_appconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
moduletypes "github.com/regen-network/regen-ledger/types/module"
"github.com/regen-network/regen-ledger/types/module/server"
data "github.com/regen-network/regen-ledger/x/data/module"
ecocreditkeeper "github.com/regen-network/regen-ledger/x/ecocredit/keeper"
ecocredit "github.com/regen-network/regen-ledger/x/ecocredit/module"
group "github.com/regen-network/regen-ledger/x/group/module"
)
Expand Down Expand Up @@ -51,10 +52,16 @@ func setCustomModules(app *RegenApp, interfaceRegistry types.InterfaceRegistry)
newModuleManager := server.NewManager(app.BaseApp, codec.NewProtoCodec(interfaceRegistry))

// BEGIN HACK: this is a total, ugly hack until x/auth & x/bank supports ADR 033 or we have a suitable alternative
ecocreditKeeper := ecocreditkeeper.NewKeeper(
app.GetSubspace(ecocredit.Module{}.Name()),
app.BankKeeper,
)
ecocreditModule := ecocredit.NewModule(ecocreditKeeper)

groupModule := group.Module{AccountKeeper: app.AccountKeeper, BankKeeper: app.BankKeeper}
// use a separate newModules from the global NewModules here because we need to pass state into the group module
newModules := []moduletypes.Module{
ecocredit.Module{},
ecocreditModule,
data.Module{},
groupModule,
}
Expand Down Expand Up @@ -121,7 +128,7 @@ func (app *RegenApp) setCustomModuleManager() []module.AppModule {
}

func setCustomOrderInitGenesis() []string {
return []string{}
return []string{ecocredit.Module{}.Name()}
}

func (app *RegenApp) setCustomSimulationManager() []module.AppModuleSimulation {
Expand All @@ -135,4 +142,5 @@ func (app *RegenApp) setCustomSimulationManager() []module.AppModuleSimulation {
}

func initCustomParamsKeeper(paramsKeeper *paramskeeper.Keeper) {
paramsKeeper.Subspace(ecocredit.Module{}.Name())
}
Loading

0 comments on commit 4f52a56

Please sign in to comment.