diff --git a/app/app.go b/app/app.go index c2c7e92e2..37e064616 100644 --- a/app/app.go +++ b/app/app.go @@ -95,9 +95,6 @@ import ( router "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward" routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types" - alliancemodule "github.com/terra-money/alliance/x/alliance" - alliancemoduleclient "github.com/terra-money/alliance/x/alliance/client" - alliancemoduletypes "github.com/terra-money/alliance/x/alliance/types" custombankmodule "github.com/notional-labs/composable/v6/custom/bank" @@ -176,9 +173,6 @@ func getGovProposalHandlers() []govclient.ProposalHandler { upgradeclient.LegacyCancelProposalHandler, ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler, - alliancemoduleclient.CreateAllianceProposalHandler, - alliancemoduleclient.UpdateAllianceProposalHandler, - alliancemoduleclient.DeleteAllianceProposalHandler, // this line is used by starport scaffolding # stargate/app/govProposalHandler ) @@ -223,7 +217,6 @@ var ( txBoundary.AppModuleBasic{}, ratelimitmodule.AppModuleBasic{}, consensus.AppModuleBasic{}, - alliancemodule.AppModuleBasic{}, // this line is used by starport scaffolding # stargate/app/moduleBasic ) @@ -232,15 +225,13 @@ var ( authtypes.FeeCollectorName: nil, distrtypes.ModuleName: nil, // mint module needs burn access to remove excess validator tokens (it overallocates, then burns) - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - transfermiddlewaretypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - alliancemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - alliancemoduletypes.RewardsPoolName: nil, - icatypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + transfermiddlewaretypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + icatypes.ModuleName: nil, // this line is used by starport scaffolding # stargate/app/maccPerms } ) @@ -382,7 +373,6 @@ func NewComposableApp( txBoundaryModule, icaModule, ratelimitModule, - alliancemodule.NewAppModule(appCodec, app.AllianceKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), // this line is used by starport scaffolding # stargate/app/appModule ) @@ -420,7 +410,6 @@ func NewComposableApp( wasm08types.ModuleName, icatypes.ModuleName, wasm.ModuleName, - alliancemoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/beginBlockers ) @@ -454,7 +443,6 @@ func NewComposableApp( wasm08types.ModuleName, icatypes.ModuleName, wasm.ModuleName, - alliancemoduletypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -492,7 +480,6 @@ func NewComposableApp( wasm08types.ModuleName, icatypes.ModuleName, wasm.ModuleName, - alliancemoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis ) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 6e504cbd6..b1a36db04 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -73,10 +73,6 @@ import ( routerkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/keeper" routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types" - alliancemodule "github.com/terra-money/alliance/x/alliance" - alliancemodulekeeper "github.com/terra-money/alliance/x/alliance/keeper" - alliancemoduletypes "github.com/terra-money/alliance/x/alliance/types" - transfermiddleware "github.com/notional-labs/composable/v6/x/transfermiddleware" transfermiddlewarekeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper" transfermiddlewaretypes "github.com/notional-labs/composable/v6/x/transfermiddleware/types" @@ -152,7 +148,6 @@ type AppKeepers struct { TxBoundaryKeepper txBoundaryKeeper.Keeper RouterKeeper *routerkeeper.Keeper RatelimitKeeper ratelimitmodulekeeper.Keeper - AllianceKeeper alliancemodulekeeper.Keeper } // InitNormalKeepers initializes all 'normal' keepers. @@ -221,21 +216,11 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, appKeepers.keys[feegrant.StoreKey], appKeepers.AccountKeeper) appKeepers.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, appKeepers.keys[upgradetypes.StoreKey], appCodec, homePath, bApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - appKeepers.AllianceKeeper = alliancemodulekeeper.NewKeeper( - appCodec, - appKeepers.keys[alliancemoduletypes.StoreKey], - appKeepers.GetSubspace(alliancemoduletypes.ModuleName), - appKeepers.AccountKeeper, - appKeepers.BankKeeper, - appKeepers.StakingKeeper, - appKeepers.DistrKeeper, - ) - - appKeepers.BankKeeper.RegisterKeepers(appKeepers.AllianceKeeper, appKeepers.StakingKeeper) + appKeepers.BankKeeper.RegisterKeepers(appKeepers.StakingKeeper) // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks appKeepers.StakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks(appKeepers.DistrKeeper.Hooks(), appKeepers.SlashingKeeper.Hooks(), appKeepers.AllianceKeeper.StakingHooks()), + stakingtypes.NewMultiStakingHooks(appKeepers.DistrKeeper.Hooks(), appKeepers.SlashingKeeper.Hooks()), ) // ... other modules keepers @@ -399,8 +384,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(appKeepers.ParamsKeeper)). // AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(appKeepers.DistrKeeper)). AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(appKeepers.UpgradeKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(appKeepers.IBCKeeper.ClientKeeper)). - AddRoute(alliancemoduletypes.RouterKey, alliancemodule.NewAllianceProposalHandler(appKeepers.AllianceKeeper)) + AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(appKeepers.IBCKeeper.ClientKeeper)) // The gov proposal types can be individually enabled if len(enabledProposals) != 0 { @@ -475,7 +459,6 @@ func (appKeepers *AppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legac paramsKeeper.Subspace(icqtypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) paramsKeeper.Subspace(icahosttypes.SubModuleName) - paramsKeeper.Subspace(alliancemoduletypes.ModuleName) paramsKeeper.Subspace(wasm.ModuleName) paramsKeeper.Subspace(transfermiddlewaretypes.ModuleName) diff --git a/app/keepers/keys.go b/app/keepers/keys.go index 27f5a9e71..605a40955 100644 --- a/app/keepers/keys.go +++ b/app/keepers/keys.go @@ -27,7 +27,6 @@ import ( icqtypes "github.com/strangelove-ventures/async-icq/v7/types" routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types" - alliancemoduletypes "github.com/terra-money/alliance/x/alliance/types" ibchookstypes "github.com/notional-labs/composable/v6/x/ibc-hooks/types" ratelimitmoduletypes "github.com/notional-labs/composable/v6/x/ratelimit/types" @@ -52,7 +51,7 @@ func (appKeepers *AppKeepers) GenerateKeys() { authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icqtypes.StoreKey, capabilitytypes.StoreKey, consensusparamtypes.StoreKey, wasm08types.StoreKey, - crisistypes.StoreKey, routertypes.StoreKey, transfermiddlewaretypes.StoreKey, group.StoreKey, minttypes.StoreKey, alliancemoduletypes.StoreKey, wasm.StoreKey, ibchookstypes.StoreKey, icahosttypes.StoreKey, ratelimitmoduletypes.StoreKey, txBoundaryTypes.StoreKey, + crisistypes.StoreKey, routertypes.StoreKey, transfermiddlewaretypes.StoreKey, group.StoreKey, minttypes.StoreKey, wasm.StoreKey, ibchookstypes.StoreKey, icahosttypes.StoreKey, ratelimitmoduletypes.StoreKey, txBoundaryTypes.StoreKey, authzkeeper.StoreKey, ) diff --git a/custom/bank/keeper/keeper.go b/custom/bank/keeper/keeper.go index a7c312c6d..222ce1a3b 100644 --- a/custom/bank/keeper/keeper.go +++ b/custom/bank/keeper/keeper.go @@ -16,16 +16,12 @@ import ( banktypes "github.com/notional-labs/composable/v6/custom/bank/types" transfermiddlewarekeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper" - - alliancekeeper "github.com/terra-money/alliance/x/alliance/keeper" - alliancetypes "github.com/terra-money/alliance/x/alliance/types" ) type Keeper struct { bankkeeper.BaseKeeper tfmk banktypes.TransferMiddlewareKeeper - ak alliancekeeper.Keeper sk banktypes.StakingKeeper acck accountkeeper.AccountKeeper } @@ -42,7 +38,6 @@ func NewBaseKeeper( ) Keeper { keeper := Keeper{ BaseKeeper: bankkeeper.NewBaseKeeper(cdc, storeKey, ak, blockedAddrs, authority), - ak: alliancekeeper.Keeper{}, sk: stakingkeeper.Keeper{}, tfmk: tfmk, acck: ak, @@ -50,8 +45,7 @@ func NewBaseKeeper( return keeper } -func (k *Keeper) RegisterKeepers(ak alliancekeeper.Keeper, sk banktypes.StakingKeeper) { - k.ak = ak +func (k *Keeper) RegisterKeepers(sk banktypes.StakingKeeper) { k.sk = sk } @@ -68,16 +62,6 @@ func (k Keeper) SupplyOf(c context.Context, req *types.QuerySupplyOfRequest) (*t ctx := sdk.UnwrapSDKContext(c) supply := k.GetSupply(ctx, req.Denom) - if req.Denom == k.sk.BondDenom(ctx) { - assets := k.ak.GetAllAssets(ctx) - totalRewardWeights := sdk.ZeroDec() - for _, asset := range assets { - totalRewardWeights = totalRewardWeights.Add(asset.RewardWeight) - } - allianceBonded := k.ak.GetAllianceBondedAmount(ctx, k.acck.GetModuleAddress(alliancetypes.ModuleName)) - supply.Amount = supply.Amount.Sub(allianceBonded) - } - return &types.QuerySupplyOfResponse{Amount: sdk.NewCoin(req.Denom, supply.Amount)}, nil } @@ -93,11 +77,5 @@ func (k Keeper) TotalSupply(ctx context.Context, req *types.QueryTotalSupplyRequ duplicateCoins := k.tfmk.GetTotalEscrowedToken(sdkCtx) totalSupply = totalSupply.Sub(duplicateCoins...) - allianceBonded := k.ak.GetAllianceBondedAmount(sdkCtx, k.acck.GetModuleAddress(alliancetypes.ModuleName)) - bondDenom := k.sk.BondDenom(sdkCtx) - if totalSupply.AmountOf(bondDenom).IsPositive() { - totalSupply = totalSupply.Sub(sdk.NewCoin(bondDenom, allianceBonded)) - } - return &types.QueryTotalSupplyResponse{Supply: totalSupply, Pagination: pageRes}, nil } diff --git a/custom/bank/module.go b/custom/bank/module.go index 3d88d9612..be7acaa6b 100644 --- a/custom/bank/module.go +++ b/custom/bank/module.go @@ -13,9 +13,7 @@ import ( custombankkeeper "github.com/notional-labs/composable/v6/custom/bank/keeper" ) -// AppModule wraps around the bank module and the bank keeper to return the right total supply ignoring bonded tokens -// that the alliance module minted to rebalance the voting power -// It modifies the TotalSupply and SupplyOf GRPC queries +// AppModule wraps around the bank module and the bank keeper to return the right total supply type AppModule struct { bankmodule.AppModule keeper custombankkeeper.Keeper diff --git a/go.mod b/go.mod index dd9674e7b..622f00df1 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,6 @@ require ( github.com/spf13/cobra v1.7.0 github.com/strangelove-ventures/async-icq/v7 v7.0.0-20230413165143-a3b65ccdc897 github.com/stretchr/testify v1.8.4 - github.com/terra-money/alliance v0.1.1-0.20230419080242-b29b0ec11186 golang.org/x/tools v0.6.0 google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 google.golang.org/grpc v1.56.2 diff --git a/go.sum b/go.sum index 43299994a..214a6f8a1 100644 --- a/go.sum +++ b/go.sum @@ -968,8 +968,6 @@ github.com/nishanths/exhaustive v0.8.3 h1:pw5O09vwg8ZaditDp/nQRqVnrMczSJDxRDJMow github.com/nishanths/exhaustive v0.8.3/go.mod h1:qj+zJJUgJ76tR92+25+03oYUhzF4R7/2Wk7fGTfCHmg= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/notional-labs/alliance v1.0.1-0.20231106184124-5cc1ff759647 h1:vCSokMIO60u0td51l7NB+pikUChJozIwIb4u8UeqTKI= -github.com/notional-labs/alliance v1.0.1-0.20231106184124-5cc1ff759647/go.mod h1:GFQ8TsXDMTpu7kif0Dwddz6rxazy0ZJQHfN38ZmAodI= github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20231027045618-f659894b12d9 h1:4rte3LTbrQnlu0Gnw6gouj2voGwgjweORA1dcgnQxlU= github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20231027045618-f659894b12d9/go.mod h1:3PHOr4UiPNtnZJutT22fm5+pjIefTlDEgtWGoOJg3A0= github.com/notional-labs/ibc-go/v7 v7.2.1-0.20231010040541-6cf43006971f h1:Uw35VHCdLTsQf8B4UGTjHCR6HqcYFF6dwPW8uJzS0f4=