Skip to content

Commit

Permalink
token factory sdk 50 (#155)
Browse files Browse the repository at this point in the history
* feat: add notinal lab token factory

* chore: import token factory pkg

* chore: retract cosmossdk.io/core to 0.11

* feat: add token factory to app

* feat: set orders begin - end blocks

* bump token factory to use wasmd-rc0.51

* chore: update commit hash token factory

* fix: rebase conflict

* fix lint
  • Loading branch information
duvbell authored Mar 11, 2024
1 parent 6905b9f commit f96264e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 52 deletions.
44 changes: 32 additions & 12 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ import (
ccvdistr "github.com/cosmos/interchain-security/v4/x/ccv/democracy/distribution"
ccvgov "github.com/cosmos/interchain-security/v4/x/ccv/democracy/governance"
ccvstaking "github.com/cosmos/interchain-security/v4/x/ccv/democracy/staking"
"github.com/osmosis-labs/tokenfactory"
"github.com/osmosis-labs/tokenfactory/bindings"
tokenfactorykeeper "github.com/osmosis-labs/tokenfactory/keeper"
tokenfactorytypes "github.com/osmosis-labs/tokenfactory/types"
"github.com/spf13/cast"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
Expand Down Expand Up @@ -181,10 +185,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 @@ -241,6 +246,8 @@ type EveApp struct {
ScopedCCVConsumerKeeper capabilitykeeper.ScopedKeeper
ScopedWasmKeeper capabilitykeeper.ScopedKeeper

TokenFactoryKeeper tokenfactorykeeper.Keeper

// the module manager
ModuleManager *module.Manager
BasicModuleManager module.BasicManager
Expand Down Expand Up @@ -301,13 +308,9 @@ func NewEveApp(
nftkeeper.StoreKey,
group.StoreKey,
// non sdk store keys
capabilitytypes.StoreKey,
ibcexported.StoreKey,
ibctransfertypes.StoreKey,
ibcfeetypes.StoreKey,
wasmtypes.StoreKey,
icahosttypes.StoreKey,
icacontrollertypes.StoreKey,
capabilitytypes.StoreKey, ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey,
wasmtypes.StoreKey, icahosttypes.StoreKey,
icacontrollertypes.StoreKey, tokenfactorytypes.StoreKey,
)

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

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

app.ParamsKeeper = initParamsKeeper(
appCodec,
legacyAmino,
Expand Down Expand Up @@ -497,6 +502,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 @@ -727,8 +742,9 @@ func NewEveApp(
ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper),
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
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,
consumerModule,
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 Expand Up @@ -775,6 +791,7 @@ func NewEveApp(
icatypes.ModuleName,
ibcfeetypes.ModuleName,
wasmtypes.ModuleName,
tokenfactorytypes.ModuleName,
)

app.ModuleManager.SetOrderEndBlockers(
Expand All @@ -792,6 +809,7 @@ func NewEveApp(
icatypes.ModuleName,
ibcfeetypes.ModuleName,
wasmtypes.ModuleName,
tokenfactorytypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -832,6 +850,7 @@ func NewEveApp(
ibcfeetypes.ModuleName,
// wasm after ibc transfer
wasmtypes.ModuleName,
tokenfactorytypes.ModuleName,
}
app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...)
app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...)
Expand Down Expand Up @@ -1217,6 +1236,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable())
paramsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable())
paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable())
paramsKeeper.Subspace(tokenfactorytypes.ModuleName).WithKeyTable(tokenfactorytypes.ParamKeyTable())
paramsKeeper.Subspace(wasmtypes.ModuleName)
paramsKeeper.Subspace(ccvconsumertypes.ModuleName)
return paramsKeeper
Expand Down
20 changes: 14 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ require (
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/grpc v1.62.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect

)

require (
cosmossdk.io/api v0.7.3
cosmossdk.io/client/v2 v2.0.0-beta.1
cosmossdk.io/core v0.11.0
cosmossdk.io/core v0.12.0
cosmossdk.io/errors v1.0.1
cosmossdk.io/log v1.3.1
cosmossdk.io/math v1.3.0
Expand All @@ -50,6 +49,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-20240310155926-981fbeb0fe42
github.com/spf13/viper v1.18.2
)

Expand All @@ -64,6 +64,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 All @@ -72,7 +73,7 @@ require (
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/bits-and-blooms/bitset v1.8.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
Expand Down Expand Up @@ -109,11 +110,11 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gogo/protobuf v1.3.3 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/orderedcode v0.0.1 // indirect
Expand Down Expand Up @@ -207,12 +208,14 @@ require (
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.5.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
nhooyr.io/websocket v1.8.10 // indirect
pgregory.net/rapid v1.1.0 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace (
// core v0.12 was tagged wrong (sdk51)
cosmossdk.io/core => cosmossdk.io/core v0.11.0
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
github.com/cosmos/interchain-security => /Users/hoank/resource/notional/interchain-security

Expand All @@ -223,6 +226,11 @@ replace (
// See: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.8.1

// use cosmos-compatible protobufs
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

github.com/osmosis-labs/tokenfactory => github.com/notional-labs/tokenfactory v0.0.0-20240310155926-981fbeb0fe42

// temporary replace statement to use latest dependencies
// github.com/CosmWasm/wasmd => github.com/faddat/wasmd v0.40.0-rc.1.0.20240303013559-e8c435758c06

Expand Down
Loading

0 comments on commit f96264e

Please sign in to comment.