Skip to content

Commit

Permalink
feat: add token factory to app
Browse files Browse the repository at this point in the history
  • Loading branch information
kienn6034 committed Mar 8, 2024
1 parent fd5a759 commit 27e531f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
31 changes: 26 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ import (
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
"github.com/spf13/cast"

"github.com/osmosis-labs/tokenfactory"
bindings "github.com/osmosis-labs/tokenfactory/bindings"

Check failure on line 43 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

could not import github.com/osmosis-labs/tokenfactory/bindings (-: # github.com/osmosis-labs/tokenfactory/bindings
tokenfactorykeeper "github.com/osmosis-labs/tokenfactory/keeper"
tokenfactorytypes "github.com/osmosis-labs/tokenfactory/types"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
"cosmossdk.io/client/v2/autocli"
Expand Down Expand Up @@ -174,10 +179,11 @@ var maccPerms = map[string][]string{
govtypes.ModuleName: {authtypes.Burner},
nft.ModuleName: nil,
// non sdk modules
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcfeetypes.ModuleName: nil,
icatypes.ModuleName: nil,
wasmtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcfeetypes.ModuleName: nil,
icatypes.ModuleName: nil,
wasmtypes.ModuleName: {authtypes.Burner},
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
}

var (
Expand Down Expand Up @@ -232,6 +238,8 @@ type EveApp struct {
ScopedIBCFeeKeeper capabilitykeeper.ScopedKeeper
ScopedWasmKeeper capabilitykeeper.ScopedKeeper

TokenFactoryKeeper tokenfactorykeeper.Keeper

// the module manager
ModuleManager *module.Manager
BasicModuleManager module.BasicManager
Expand Down Expand Up @@ -323,7 +331,7 @@ func NewEveApp(
// non sdk store keys
capabilitytypes.StoreKey, ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey,
wasmtypes.StoreKey, icahosttypes.StoreKey,
icacontrollertypes.StoreKey,
icacontrollertypes.StoreKey, tokenfactorytypes.StoreKey,
)

tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand All @@ -345,6 +353,8 @@ func NewEveApp(
memKeys: memKeys,
}

govModAddress := authtypes.NewModuleAddress(govtypes.ModuleName).String()

app.ParamsKeeper = initParamsKeeper(
appCodec,
legacyAmino,
Expand Down Expand Up @@ -521,6 +531,16 @@ func NewEveApp(
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.TokenFactoryKeeper = tokenfactorykeeper.NewKeeper(
appCodec,
app.keys[tokenfactorytypes.StoreKey],
app.AccountKeeper,
app.BankKeeper,
app.DistrKeeper,
govModAddress,
)

wasmOpts = append(wasmOpts, bindings.RegisterCustomPlugins(app.BankKeeper, &app.TokenFactoryKeeper)...)
// Register the proposal types
// Deprecated: Avoid adding new handlers, instead use the new proposal flow
// by granting the governance module the right to execute the message.
Expand Down Expand Up @@ -724,6 +744,7 @@ func NewEveApp(
ibctm.AppModule{},
// sdk
crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them
tokenfactory.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(tokenfactorytypes.ModuleName)),
)

// BasicModuleManager defines the module BasicManager is in charge of setting up basic,
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ require (
github.com/cosmos/cosmos-db v1.0.2
github.com/cosmos/ibc-go/modules/capability v1.0.0
github.com/cosmos/ibc-go/v8 v8.1.0
github.com/osmosis-labs/tokenfactory v0.0.0-00010101000000-000000000000
github.com/spf13/viper v1.18.2
)

Expand All @@ -62,6 +63,7 @@ require (
filippo.io/edwards25519 v1.0.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/CosmWasm/wasmvm v1.5.2 // indirect
github.com/DataDog/datadog-go v3.2.0+incompatible // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/aws/aws-sdk-go v1.44.224 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CosmWasm/wasmd v0.51.0-rc.1 h1:ssdBLfXvE4DfoxIW2jKqgjP+AfAGvGUEaGyCyurRQ8Q=
github.com/CosmWasm/wasmd v0.51.0-rc.1/go.mod h1:ZkDuVMftES1z/yRaLBYP1x44t26Lo3BfFrIFGaejC3A=
github.com/CosmWasm/wasmvm v1.5.2 h1:+pKB1Mz9GZVt1vadxB+EDdD1FOz3dMNjIKq/58/lrag=
github.com/CosmWasm/wasmvm v1.5.2/go.mod h1:Q0bSEtlktzh7W2hhEaifrFp1Erx11ckQZmjq8FLCyys=
github.com/CosmWasm/wasmvm/v2 v2.0.0-rc.2 h1:2rAO0MpNmKHKsrX/lsyo7lLjKoGDOWwMk+40hTNVfdE=
github.com/CosmWasm/wasmvm/v2 v2.0.0-rc.2/go.mod h1:su9lg5qLr7adV95eOfzjZWkGiky8WNaNIHDr7Fpu7Ck=
github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4=
Expand Down Expand Up @@ -811,6 +813,8 @@ github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/notional-labs/tokenfactory v0.0.0-20240308104413-c952e09a08f7 h1:V2WP+8QqJTyb2FWsf5YX+8gQuXjAUJLI3UpFi0Zk/c4=
github.com/notional-labs/tokenfactory v0.0.0-20240308104413-c952e09a08f7/go.mod h1:fibryvFhy8vmbHuzwensAD/FBAjvQTont4ixaV9R1h0=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down

0 comments on commit 27e531f

Please sign in to comment.