Skip to content

Commit

Permalink
Merge pull request #131 from neutron-org/feat/NTRN-332-add-token-factory
Browse files Browse the repository at this point in the history
feat: NTRN-332. Add tokenfactory module
  • Loading branch information
pr0n00gler authored Apr 3, 2023
2 parents d70c208 + 54cde79 commit b112fe5
Show file tree
Hide file tree
Showing 55 changed files with 32,696 additions and 29,785 deletions.
28 changes: 25 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ import (
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"

"github.com/neutron-org/neutron/x/tokenfactory"
tokenfactorykeeper "github.com/neutron-org/neutron/x/tokenfactory/keeper"
tokenfactorytypes "github.com/neutron-org/neutron/x/tokenfactory/types"

adminmodulemodule "github.com/cosmos/admin-module/x/adminmodule"
adminmodulecli "github.com/cosmos/admin-module/x/adminmodule/client/cli"
adminmodulemodulekeeper "github.com/cosmos/admin-module/x/adminmodule/keeper"
Expand Down Expand Up @@ -182,6 +186,7 @@ var (
vesting.AppModuleBasic{},
ccvconsumer.AppModuleBasic{},
wasm.AppModuleBasic{},
tokenfactory.AppModuleBasic{},
interchainqueries.AppModuleBasic{},
interchaintxs.AppModuleBasic{},
feerefunder.AppModuleBasic{},
Expand Down Expand Up @@ -215,6 +220,7 @@ var (
feeburnertypes.ModuleName: nil,
ccvconsumertypes.ConsumerRedistributeName: {authtypes.Burner},
ccvconsumertypes.ConsumerToSendToProviderName: nil,
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
}
)

Expand Down Expand Up @@ -256,7 +262,7 @@ type App struct {
AccountKeeper authkeeper.AccountKeeper
AdminmoduleKeeper adminmodulemodulekeeper.Keeper
AuthzKeeper authzkeeper.Keeper
BankKeeper bankkeeper.Keeper
BankKeeper bankkeeper.BaseKeeper
CapabilityKeeper *capabilitykeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
CrisisKeeper crisiskeeper.Keeper
Expand All @@ -271,6 +277,7 @@ type App struct {
FeeKeeper *feekeeper.Keeper
FeeBurnerKeeper *feeburnerkeeper.Keeper
ConsumerKeeper ccvconsumerkeeper.Keeper
TokenFactoryKeeper *tokenfactorykeeper.Keeper
RouterKeeper *routerkeeper.Keeper

RouterModule router.AppModule
Expand Down Expand Up @@ -325,7 +332,7 @@ func New(
evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey,
icahosttypes.StoreKey, capabilitytypes.StoreKey,
interchainqueriesmoduletypes.StoreKey, contractmanagermoduletypes.StoreKey, interchaintxstypes.StoreKey, wasm.StoreKey, feetypes.StoreKey,
feeburnertypes.StoreKey, adminmodulemoduletypes.StoreKey, ccvconsumertypes.StoreKey, routertypes.StoreKey,
feeburnertypes.StoreKey, adminmodulemoduletypes.StoreKey, ccvconsumertypes.StoreKey, tokenfactorytypes.StoreKey, routertypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, feetypes.MemStoreKey)
Expand Down Expand Up @@ -472,6 +479,15 @@ func New(
app.ConsumerKeeper = *app.ConsumerKeeper.SetHooks(app.SlashingKeeper.Hooks())
consumerModule := ccvconsumer.NewAppModule(app.ConsumerKeeper)

tokenFactoryKeeper := tokenfactorykeeper.NewKeeper(
appCodec,
app.keys[tokenfactorytypes.StoreKey],
app.GetSubspace(tokenfactorytypes.ModuleName),
app.AccountKeeper,
app.BankKeeper.WithMintCoinsRestriction(tokenfactorytypes.NewTokenFactoryDenomMintCoinsRestriction()),
)
app.TokenFactoryKeeper = &tokenFactoryKeeper

wasmDir := filepath.Join(homePath, "wasm")
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
Expand Down Expand Up @@ -522,7 +538,7 @@ func New(
app.FeeKeeper,
)

wasmOpts = append(wasmbinding.RegisterCustomPlugins(&app.InterchainTxsKeeper, &app.InterchainQueriesKeeper, app.TransferKeeper, &app.AdminmoduleKeeper, app.FeeBurnerKeeper, app.FeeKeeper), wasmOpts...)
wasmOpts = append(wasmbinding.RegisterCustomPlugins(&app.InterchainTxsKeeper, &app.InterchainQueriesKeeper, app.TransferKeeper, &app.AdminmoduleKeeper, app.FeeBurnerKeeper, app.FeeKeeper, &app.BankKeeper, app.TokenFactoryKeeper), wasmOpts...)

app.WasmKeeper = wasm.NewKeeper(
appCodec,
Expand Down Expand Up @@ -616,6 +632,7 @@ func New(
feeBurnerModule,
contractManagerModule,
adminModule,
tokenfactory.NewAppModule(appCodec, *app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper),
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand All @@ -637,6 +654,7 @@ func New(
feegrant.ModuleName,
paramstypes.ModuleName,
ccvconsumertypes.ModuleName,
tokenfactorytypes.ModuleName,
icatypes.ModuleName,
interchainqueriesmoduletypes.ModuleName,
interchaintxstypes.ModuleName,
Expand All @@ -663,6 +681,7 @@ func New(
ibchost.ModuleName,
ibctransfertypes.ModuleName,
ccvconsumertypes.ModuleName,
tokenfactorytypes.ModuleName,
icatypes.ModuleName,
interchainqueriesmoduletypes.ModuleName,
interchaintxstypes.ModuleName,
Expand Down Expand Up @@ -694,6 +713,7 @@ func New(
upgradetypes.ModuleName,
feegrant.ModuleName,
ccvconsumertypes.ModuleName,
tokenfactorytypes.ModuleName,
icatypes.ModuleName,
interchainqueriesmoduletypes.ModuleName,
interchaintxstypes.ModuleName,
Expand Down Expand Up @@ -953,6 +973,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(routertypes.ModuleName).WithKeyTable(routertypes.ParamKeyTable())

paramsKeeper.Subspace(ccvconsumertypes.ModuleName)
paramsKeeper.Subspace(tokenfactorytypes.ModuleName)

paramsKeeper.Subspace(interchainqueriesmoduletypes.ModuleName)
paramsKeeper.Subspace(interchaintxstypes.ModuleName)
paramsKeeper.Subspace(wasm.ModuleName)
Expand Down
Loading

0 comments on commit b112fe5

Please sign in to comment.