diff --git a/app/app.go b/app/app.go index 895fd73e8..75c303da8 100644 --- a/app/app.go +++ b/app/app.go @@ -24,9 +24,9 @@ import ( consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - packetforward "github.com/strangelove-ventures/packet-forward-middleware/v7/router" - packetforwardkeeper "github.com/strangelove-ventures/packet-forward-middleware/v7/router/keeper" - packetforwardtypes "github.com/strangelove-ventures/packet-forward-middleware/v7/router/types" + packetforward "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router" + packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/keeper" + packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types" "github.com/rakyll/statik/fs" @@ -306,6 +306,7 @@ var ( ibcfee.AppModuleBasic{}, liquidationsV2.AppModuleBasic{}, auctionsV2.AppModuleBasic{}, + icq.AppModuleBasic{}, ibchooks.AppModuleBasic{}, packetforward.AppModuleBasic{}, ) @@ -390,10 +391,10 @@ type App struct { // IBC modules // transfer module - Ics20WasmHooks *ibchooks.WasmHooks - HooksICS4Wrapper ibchooks.ICS4Middleware - PacketForwardKeeper *packetforwardkeeper.Keeper - ICQKeeper *icqkeeper.Keeper + Ics20WasmHooks *ibchooks.WasmHooks + HooksICS4Wrapper ibchooks.ICS4Middleware + PacketForwardKeeper *packetforwardkeeper.Keeper + ICQKeeper *icqkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper @@ -888,7 +889,7 @@ func New( app.IbcKeeper.ChannelKeeper, // may be replaced with middleware app.IbcKeeper.ChannelKeeper, &app.IbcKeeper.PortKeeper, - app.ScopedICQKeeper, + scopedICQKeeper, app.GRPCQueryRouter(), // NewQuerierWrapper(baseApp), // in-case of strangelove-ventures icq ) @@ -1454,6 +1455,10 @@ func (a *App) ModuleAccountsPermissions() map[string][]string { } func (a *App) registerUpgradeHandlers() { + a.UpgradeKeeper.SetUpgradeHandler( + tv13.UpgradeName, + tv13.CreateUpgradeHandlerV13(a.mm, a.configurator, a.cdc, a.keys[capabilitytypes.ModuleName], a.CapabilityKeeper, a.WasmKeeper, a.ParamsKeeper, a.ConsensusParamsKeeper, *a.IbcKeeper, a.GovKeeper, *a.StakingKeeper, a.MintKeeper, a.SlashingKeeper, a.BandoracleKeeper), + ) // When a planned update height is reached, the old binary will panic // writing on disk the height and name of the update that triggered it // This will read that value, and execute the preparations for the upgrade. @@ -1462,19 +1467,6 @@ func (a *App) registerUpgradeHandlers() { panic(err) } - switch { - case upgradeInfo.Name == mv12.UpgradeName: - a.UpgradeKeeper.SetUpgradeHandler( - mv12.UpgradeName, - mv12.CreateUpgradeHandlerV12(a.mm, a.configurator, a.ICQKeeper, a.NewliqKeeper, a.NewaucKeeper, a.BankKeeper, a.CollectorKeeper, a.LendKeeper, a.AuctionKeeper, a.LiquidationKeeper, a.AssetKeeper), - ) - case upgradeInfo.Name == tv13.UpgradeName: - a.UpgradeKeeper.SetUpgradeHandler( - tv13.UpgradeName, - tv13.CreateUpgradeHandlerV13(a.mm, a.configurator, a.cdc, a.keys[capabilitytypes.ModuleName], a.CapabilityKeeper, a.WasmKeeper, a.ParamsKeeper, a.ConsensusParamsKeeper, *a.IbcKeeper, a.GovKeeper, *a.StakingKeeper, a.MintKeeper, a.SlashingKeeper, a.BandoracleKeeper), - ) - } - var storeUpgrades *storetypes.StoreUpgrades storeUpgrades = upgradeHandlers(upgradeInfo, a, storeUpgrades) diff --git a/cmd/comdex/migrate.go b/cmd/comdex/migrate.go index 7f6b135a7..540a58460 100644 --- a/cmd/comdex/migrate.go +++ b/cmd/comdex/migrate.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/x/genutil/types" // bump47: uncomment below 1 - packetforwardtypes "github.com/strangelove-ventures/packet-forward-middleware/v7/router/types" + packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types" ) func Migrate(appState types.AppMap, clientCtx client.Context) types.AppMap { diff --git a/go.mod b/go.mod index 68dee2bc5..b7760336b 100644 --- a/go.mod +++ b/go.mod @@ -12,8 +12,8 @@ require ( github.com/cometbft/cometbft-db v0.8.0 github.com/cosmos/cosmos-sdk v0.47.5 github.com/cosmos/gogoproto v1.4.10 - github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0-20230726182236-3a9d46a7c2a4 - github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230726182236-3a9d46a7c2a4 + github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0 + github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79 github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -28,12 +28,12 @@ require ( ) require ( + github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0 github.com/cosmos/ibc-go/v7 v7.2.0 github.com/cosmos/ics23/go v0.10.0 // indirect github.com/golangci/golangci-lint v1.51.2 github.com/rakyll/statik v0.1.7 github.com/spf13/pflag v1.0.5 - github.com/strangelove-ventures/packet-forward-middleware/v7 v7.0.0-20230523193151-73dea436e53f gopkg.in/yaml.v2 v2.4.0 mvdan.cc/gofumpt v0.5.0 ) diff --git a/go.sum b/go.sum index e11b81db1..a48c03ea1 100644 --- a/go.sum +++ b/go.sum @@ -1097,10 +1097,12 @@ github.com/cosmos/iavl v0.19.4/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONAp github.com/cosmos/iavl v0.20.0-alpha4/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= github.com/cosmos/iavl v0.20.0 h1:fTVznVlepH0KK8NyKq8w+U7c2L6jofa27aFX6YGlm38= github.com/cosmos/iavl v0.20.0/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= -github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0-20230726182236-3a9d46a7c2a4 h1:AKzCfYLsVG9DtNzjya12u+OO0sUQpcXlecqnD/2rqGg= -github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0-20230726182236-3a9d46a7c2a4/go.mod h1:/P6l2bWo2AR3rrsfs0DHuFZO3Imzb93sxFD3ihrIgw4= -github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230726182236-3a9d46a7c2a4 h1:NuFmpHnENcTtZDEQf2vZzZluk5rQl3f7J4tqo9FlH/c= -github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230726182236-3a9d46a7c2a4/go.mod h1:JwHFbo1oX/ht4fPpnPvmhZr+dCkYK1Vihw+vZE9umR4= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0 h1:i9esYyZ5ExpZOgxrLMQhY2jDTVYiaD8yUeqXN9QBgbk= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0/go.mod h1:fctjEnz9xaBFOlmYYPdKL8Hs1Y3GUKilSwsJdqBb5QU= +github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0 h1:mMHedP3Q+mz5gpOWNz0P+X8hxPdamylrBKc/P2cFakA= +github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0/go.mod h1:/P6l2bWo2AR3rrsfs0DHuFZO3Imzb93sxFD3ihrIgw4= +github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79 h1:pCxyhIxgWTabAQC5UerkITraHG3SwajdLKKMCFDWCv4= +github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79/go.mod h1:JwHFbo1oX/ht4fPpnPvmhZr+dCkYK1Vihw+vZE9umR4= github.com/cosmos/ibc-go/v7 v7.2.0 h1:dx0DLUl7rxdyZ8NiT6UsrbzKOJx/w7s+BOaewFRH6cg= github.com/cosmos/ibc-go/v7 v7.2.0/go.mod h1:OOcjKIRku/j1Xs1RgKK0yvKRrJ5iFuZYMetR1n3yMlc= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= @@ -2807,8 +2809,6 @@ github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= -github.com/strangelove-ventures/packet-forward-middleware/v7 v7.0.0-20230523193151-73dea436e53f h1:NJdZ+YJ9Vf2t286L20IjFK0SxGpobF1xIp5ZQlxWetk= -github.com/strangelove-ventures/packet-forward-middleware/v7 v7.0.0-20230523193151-73dea436e53f/go.mod h1:DJNSVK8NCYHM+aZHCFkcAqPwjzwHYAjhjSMlhAGtJ3c= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= diff --git a/x/liquidity/keeper/pool.go b/x/liquidity/keeper/pool.go index 4a985efb2..df74a5393 100644 --- a/x/liquidity/keeper/pool.go +++ b/x/liquidity/keeper/pool.go @@ -685,6 +685,10 @@ func (k Keeper) TransferFundsForSwapFeeDistribution(ctx sdk.Context, appID, requ return sdk.Coin{}, types.ErrInvalidPoolID } + if requestedPool.Disabled { + return sdk.Coin{}, types.ErrDisabledPool + } + pair, found := k.GetPair(ctx, appID, requestedPool.PairId) if !found { return sdk.Coin{}, types.ErrInvalidPairID diff --git a/x/liquidity/keeper/rewards.go b/x/liquidity/keeper/rewards.go index 8d297ef05..3054cb7b6 100644 --- a/x/liquidity/keeper/rewards.go +++ b/x/liquidity/keeper/rewards.go @@ -1,6 +1,7 @@ package keeper import ( + "fmt" "math" "strconv" "time" @@ -169,6 +170,10 @@ func (k Keeper) GetFarmingRewardsData(ctx sdk.Context, appID uint64, coinsToDist pair := deserializerKit.Pair pool := deserializerKit.Pool + if pool.Disabled { + return nil, sdkerrors.Wrap(types.ErrDisabledPool, fmt.Sprintf("pool is disabled : %d", pool.Id)) + } + asset, err := k.GetAssetWhoseOraclePriceExists(ctx, pair.QuoteCoinDenom, pair.BaseCoinDenom) if err != nil { return nil, err diff --git a/x/rewards/keeper/gauge.go b/x/rewards/keeper/gauge.go index d36965b82..e0a6f1577 100644 --- a/x/rewards/keeper/gauge.go +++ b/x/rewards/keeper/gauge.go @@ -95,10 +95,13 @@ func (k Keeper) ValidateMsgCreateGaugeLiquidityMetaData(ctx sdk.Context, appID u if poolID == kind.LiquidityMetaData.PoolId { return sdkerrors.Wrap(types.ErrSamePoolID, fmt.Sprintf("pool id : %d", poolID)) } - _, found := k.liquidityKeeper.GetPool(ctx, appID, poolID) + pool, found := k.liquidityKeeper.GetPool(ctx, appID, poolID) if !found { return sdkerrors.Wrap(types.ErrInvalidPoolID, fmt.Sprintf("invalid child pool id : %d", poolID)) } + if pool.Disabled { + return sdkerrors.Wrap(types.ErrDisabledPool, fmt.Sprintf("pool is disabled : %d", poolID)) + } } return nil diff --git a/x/rewards/types/errors.go b/x/rewards/types/errors.go index f8c38526e..93c6d7f09 100644 --- a/x/rewards/types/errors.go +++ b/x/rewards/types/errors.go @@ -27,4 +27,5 @@ var ( ErrInvalidAppID = sdkerrors.Register(ModuleName, 1117, "invalid app id") ErrInternalRewardsNotFound = sdkerrors.Register(ModuleName, 1118, "Internal rewards not found") ErrStablemintVaultFound = sdkerrors.Register(ModuleName, 1119, "Can't give reward to stablemint vault") + ErrDisabledPool = sdkerrors.Register(ModuleName, 1120, "diabled pool") )