diff --git a/app/app.go b/app/app.go index 5743898b..24e7907c 100644 --- a/app/app.go +++ b/app/app.go @@ -28,6 +28,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/group" groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" "github.com/cosmos/cosmos-sdk/x/protocolpool" + "github.com/cosmos/gaia/v25/x/liquid" "github.com/cosmos/gogoproto/proto" icacontroller "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller" ibccallbacks "github.com/cosmos/ibc-go/v10/modules/apps/callbacks" @@ -121,6 +122,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + liquidkeeper "github.com/cosmos/gaia/v25/x/liquid/keeper" + liquidtypes "github.com/cosmos/gaia/v25/x/liquid/types" ica "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts" icacontrollerkeeper "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/keeper" icacontrollertypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/types" @@ -254,6 +257,7 @@ type App struct { SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper + LiquidKeeper *liquidkeeper.Keeper GovKeeper govkeeper.Keeper UpgradeKeeper *upgradekeeper.Keeper EvidenceKeeper evidencekeeper.Keeper @@ -283,7 +287,7 @@ type App struct { sm *module.SimulationManager } -// New returns a reference to an initialized App. +// New returns a reference to an initialized Gaia. // NewSimApp returns a reference to an initialized SimApp. func New( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, @@ -345,6 +349,7 @@ func New( icacontrollertypes.StoreKey, paramstypes.StoreKey, CapabilityStoreKey, + liquidtypes.StoreKey, ) tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) memkeys := storetypes.NewMemoryStoreKeys(CapabilityMemStoreKey) @@ -476,6 +481,16 @@ func New( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + app.LiquidKeeper = liquidkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(keys[liquidtypes.StoreKey]), + app.AccountKeeper, + app.BankKeeper, + app.StakingKeeper, + app.DistrKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + app.FeeGrantKeeper = feegrantkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[feegrant.StoreKey]), @@ -488,6 +503,7 @@ func New( stakingtypes.NewMultiStakingHooks( app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks(), + app.LiquidKeeper.Hooks(), ), ) @@ -567,7 +583,7 @@ func New( app.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( - // register the governance hooks + // register the governance hooks ), ) @@ -597,7 +613,7 @@ func New( app.EpochsKeeper.SetHooks( epochstypes.NewMultiEpochHooks( - // insert epoch hooks receivers here + // insert epoch hooks receivers here ), ) @@ -747,6 +763,7 @@ func New( transfer.NewAppModule(app.TransferKeeper), ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), ibctm.NewAppModule(tmLightClientModule), + liquid.NewAppModule(appCodec, app.LiquidKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), ) // BasicModuleManager defines the module BasicManager is in charge of setting up basic, @@ -787,6 +804,7 @@ func New( ibctransfertypes.ModuleName, ibcexported.ModuleName, icatypes.ModuleName, + liquidtypes.ModuleName, wasmtypes.ModuleName, ) @@ -839,6 +857,7 @@ func New( icatypes.ModuleName, // wasm after ibc transfer wasmtypes.ModuleName, + liquidtypes.ModuleName, } exportModuleOrder := []string{ @@ -867,6 +886,7 @@ func New( icatypes.ModuleName, // wasm after ibc transfer wasmtypes.ModuleName, + liquidtypes.ModuleName, } app.mm.SetOrderInitGenesis(genesisModuleOrder...) @@ -1046,7 +1066,7 @@ func (app *App) LegacyAmino() *codec.LegacyAmino { return app.legacyAmino } -// AppCodec returns app codec. +// AppCodec returns Gaia's app codec. // // NOTE: This is solely to be used for testing purposes as it may be desirable // for modules to register their own custom testing types. @@ -1054,7 +1074,7 @@ func (app *App) AppCodec() codec.Codec { return app.appCodec } -// InterfaceRegistry returns InterfaceRegistry +// InterfaceRegistry returns Gaia's InterfaceRegistry func (app *App) InterfaceRegistry() types.InterfaceRegistry { return app.interfaceRegistry } diff --git a/app/upgrades.go b/app/upgrades.go index d16631bd..bcd3e60f 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -8,6 +8,7 @@ import ( "strings" "time" + "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" circuittypes "cosmossdk.io/x/circuit/types" "cosmossdk.io/x/nft" @@ -24,6 +25,8 @@ import ( //minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" protocolpooltypes "github.com/cosmos/cosmos-sdk/x/protocolpool/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + liquidtypes "github.com/cosmos/gaia/v25/x/liquid/types" icacontrollertypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/types" ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types" @@ -45,6 +48,7 @@ var v053StoreUpgrades = storetypes.StoreUpgrades{ group.StoreKey, icacontrollertypes.StoreKey, nft.StoreKey, + liquidtypes.StoreKey, }, Renamed: []storetypes.StoreRename{ // {OldKey: "oldkey", NewKey: "newkey"}, @@ -100,11 +104,39 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) { return nil, err } + /* + // Pre-seed legacy x/params for mint + if ss, ok := app.ParamsKeeper.GetSubspace(minttypes.ModuleName); ok { + if !ss.Has(sdkCtx, minttypes.KeyInflationRateChange) { + p := minttypes.DefaultParams() + p.MintDenom = "afet" + // TODO: if your chain had custom values, set them here: + ss.SetParamSet(sdkCtx, &p) + } + } + */ + err = migrateConsensusParamsFromParamsStore(app, sdkCtx) if err != nil { return nil, err } + // Bootstrap liquid staking + err = app.StakingKeeper.IterateValidators(ctx, func(_ int64, v stakingtypes.ValidatorI) (stop bool) { + lv := liquidtypes.LiquidValidator{ + OperatorAddress: v.GetOperator(), + LiquidShares: math.LegacyZeroDec(), + } + err := app.LiquidKeeper.SetLiquidValidator(ctx, lv) + if err != nil { + return false + } + return false + }) + if err != nil { + return nil, err + } + // If you must pin any module "from" versions, adjust fromVM here. return app.mm.RunMigrations(ctx, cfg, fromVM) }, diff --git a/go.mod b/go.mod index f6b8e519..af36d47f 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/CosmWasm/wasmd v0.61.2 github.com/CosmWasm/wasmvm/v3 v3.0.0 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect + github.com/cosmos/gaia/v25 v25.1.1 github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/iavl v1.2.6 // indirect diff --git a/go.sum b/go.sum index 2418915f..e7a531b2 100644 --- a/go.sum +++ b/go.sum @@ -820,8 +820,8 @@ github.com/cometbft/cometbft v0.38.19 h1:vNdtCkvhuwUlrcLPAyigV7lQpmmo+tAq8CsB8gZ github.com/cometbft/cometbft v0.38.19/go.mod h1:UCu8dlHqvkAsmAFmWDRWNZJPlu6ya2fTWZlDrWsivwo= github.com/cometbft/cometbft-db v1.0.4 h1:cezb8yx/ZWcF124wqUtAFjAuDksS1y1yXedvtprUFxs= github.com/cometbft/cometbft-db v1.0.4/go.mod h1:M+BtHAGU2XLrpUxo3Nn1nOCcnVCiLM9yx5OuT0u5SCA= -github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= -github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= +github.com/containerd/continuity v0.4.5 h1:ZRoN1sXq9u7V6QoHMcVWGhOwDFqZ4B9i5H6un1Wh0x4= +github.com/containerd/continuity v0.4.5/go.mod h1:/lNJvtJKUQStBzpVQ1+rasXO1LAWtUQssk28EZvJ3nE= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= @@ -832,6 +832,8 @@ github.com/cosmos/cosmos-db v1.1.3 h1:7QNT77+vkefostcKkhrzDK9uoIEryzFrU9eoMeaQOP github.com/cosmos/cosmos-db v1.1.3/go.mod h1:kN+wGsnwUJZYn8Sy5Q2O0vCYA99MJllkKASbs6Unb9U= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= +github.com/cosmos/gaia/v25 v25.1.1 h1:PVfU1tY/ImLv387SxS7aLUejWhKpCXxy92FYwxHFGsc= +github.com/cosmos/gaia/v25 v25.1.1/go.mod h1:nk61Mb7EUU9hnfblUyYEwO/W5IajYOQQrArz8r0iQAY= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -1337,6 +1339,8 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4 github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo= +github.com/moby/sys/user v0.3.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -1382,10 +1386,10 @@ github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeD github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= -github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= -github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= -github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= +github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= +github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= +github.com/opencontainers/runc v1.2.3 h1:fxE7amCzfZflJO2lHXf4y/y8M1BoAqp+FVmG19oYB80= +github.com/opencontainers/runc v1.2.3/go.mod h1:nSxcWUydXrsBZVYNSkTjoQ/N6rcyTtn+1SD5D4+kRIM= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=