Skip to content

Commit

Permalink
modules removed
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsingh33 committed Jun 13, 2024
1 parent 871727b commit e96a76d
Show file tree
Hide file tree
Showing 151 changed files with 89 additions and 37,068 deletions.
7 changes: 1 addition & 6 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/comdex-official/comdex/app/decorators"
"github.com/comdex-official/comdex/x/gasless"
gaslesskeeper "github.com/comdex-official/comdex/x/gasless/keeper"
"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -32,9 +30,6 @@ type HandlerOptions struct {
TxDecoder sdk.TxDecoder
TxEncoder sdk.TxEncoder
auctionkeeperskip auctionkeeperskip.Keeper

GaslessKeeper gaslesskeeper.Keeper
BankKeeper gasless.BankKeeper
}

func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
Expand Down Expand Up @@ -63,7 +58,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
gasless.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker, options.GaslessKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
Expand Down
95 changes: 7 additions & 88 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ import (
collectorkeeper "github.com/comdex-official/comdex/x/collector/keeper"
collectortypes "github.com/comdex-official/comdex/x/collector/types"

"github.com/comdex-official/comdex/x/common"
commonkeeper "github.com/comdex-official/comdex/x/common/keeper"
commontypes "github.com/comdex-official/comdex/x/common/types"

"github.com/comdex-official/comdex/x/esm"
esmkeeper "github.com/comdex-official/comdex/x/esm/keeper"
esmtypes "github.com/comdex-official/comdex/x/esm/types"
Expand Down Expand Up @@ -194,11 +190,6 @@ import (
liquidationsV2keeper "github.com/comdex-official/comdex/x/liquidationsV2/keeper"
liquidationsV2types "github.com/comdex-official/comdex/x/liquidationsV2/types"

"github.com/comdex-official/comdex/x/gasless"
gaslessclient "github.com/comdex-official/comdex/x/gasless/client"
gaslesskeeper "github.com/comdex-official/comdex/x/gasless/keeper"
gaslesstypes "github.com/comdex-official/comdex/x/gasless/types"

"github.com/comdex-official/comdex/x/auctionsV2"
auctionsV2client "github.com/comdex-official/comdex/x/auctionsV2/client"
auctionsV2keeper "github.com/comdex-official/comdex/x/auctionsV2/keeper"
Expand All @@ -215,10 +206,6 @@ import (
auctionkeeperskip "github.com/skip-mev/block-sdk/x/auction/keeper"
auctionmoduleskiptypes "github.com/skip-mev/block-sdk/x/auction/types"

"github.com/comdex-official/comdex/x/tokenfactory"
tokenfactorykeeper "github.com/comdex-official/comdex/x/tokenfactory/keeper"
tokenfactorytypes "github.com/comdex-official/comdex/x/tokenfactory/types"

cwasm "github.com/comdex-official/comdex/app/wasm"

mv13 "github.com/comdex-official/comdex/app/upgrades/mainnet/v13"
Expand Down Expand Up @@ -271,7 +258,6 @@ func GetGovProposalHandlers() []govclient.ProposalHandler {
proposalHandlers = append(proposalHandlers, liquidityclient.LiquidityProposalHandler...)
proposalHandlers = append(proposalHandlers, liquidationsV2client.LiquidationsV2Handler...)
proposalHandlers = append(proposalHandlers, auctionsV2client.AuctionsV2Handler...)
proposalHandlers = append(proposalHandlers, gaslessclient.GaslessProposalHandler...)

return proposalHandlers
}
Expand Down Expand Up @@ -330,9 +316,6 @@ var (
ibcfee.AppModuleBasic{},
liquidationsV2.AppModuleBasic{},
auctionsV2.AppModuleBasic{},
common.AppModuleBasic{},
tokenfactory.AppModuleBasic{},
gasless.AppModuleBasic{},
icq.AppModuleBasic{},
ibchooks.AppModuleBasic{},
packetforward.AppModuleBasic{},
Expand Down Expand Up @@ -417,11 +400,8 @@ type App struct {
Rewardskeeper rewardskeeper.Keeper
NewliqKeeper liquidationsV2keeper.Keeper
NewaucKeeper auctionsV2keeper.Keeper
CommonKeeper commonkeeper.Keeper
// auctionKeeper is the keeper that handles processing auction transactions
AuctionKeeperSkip auctionkeeperskip.Keeper
TokenFactoryKeeper tokenfactorykeeper.Keeper
GaslessKeeper gaslesskeeper.Keeper
AuctionKeeperSkip auctionkeeperskip.Keeper

// IBC modules
// transfer module
Expand Down Expand Up @@ -470,7 +450,7 @@ func New(
markettypes.StoreKey, bandoraclemoduletypes.StoreKey, lockertypes.StoreKey,
wasm.StoreKey, authzkeeper.StoreKey, auctiontypes.StoreKey, tokenminttypes.StoreKey,
rewardstypes.StoreKey, feegrant.StoreKey, liquiditytypes.StoreKey, esmtypes.ModuleName, lendtypes.StoreKey,
liquidationsV2types.StoreKey, auctionsV2types.StoreKey, commontypes.StoreKey, tokenfactorytypes.StoreKey, gaslesstypes.StoreKey,
liquidationsV2types.StoreKey, auctionsV2types.StoreKey,
ibchookstypes.StoreKey, packetforwardtypes.StoreKey, icqtypes.StoreKey, consensusparamtypes.StoreKey, crisistypes.StoreKey, auctionmoduleskiptypes.StoreKey,
)
)
Expand Down Expand Up @@ -527,10 +507,7 @@ func New(
app.ParamsKeeper.Subspace(liquiditytypes.ModuleName)
app.ParamsKeeper.Subspace(rewardstypes.ModuleName)
app.ParamsKeeper.Subspace(liquidationsV2types.ModuleName)
app.ParamsKeeper.Subspace(tokenfactorytypes.ModuleName)
app.ParamsKeeper.Subspace(auctionsV2types.ModuleName)
app.ParamsKeeper.Subspace(commontypes.ModuleName)
app.ParamsKeeper.Subspace(gaslesstypes.ModuleName)
app.ParamsKeeper.Subspace(icqtypes.ModuleName)
app.ParamsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable())

Expand All @@ -551,12 +528,6 @@ func New(
app.mkeys[capabilitytypes.MemStoreKey],
)

var tokenFactoryCapabilities = []string{
tokenfactorytypes.EnableBurnFrom,
tokenfactorytypes.EnableForceTransfer,
tokenfactorytypes.EnableSetMetadata,
}

// grant capabilities for the ibc and ibc-transfer modules
var (
scopedIBCKeeper = app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName)
Expand Down Expand Up @@ -934,26 +905,6 @@ func New(
&app.TokenmintKeeper,
)

app.CommonKeeper = commonkeeper.NewKeeper(
app.cdc,
app.keys[commontypes.StoreKey],
app.keys[commontypes.MemStoreKey],
app.GetSubspace(commontypes.ModuleName),
&app.WasmKeeper,
govModAddress,
)

// Create the TokenFactory Keeper
app.TokenFactoryKeeper = tokenfactorykeeper.NewKeeper(
appCodec,
app.keys[tokenfactorytypes.StoreKey],
app.AccountKeeper,
app.BankKeeper,
app.DistrKeeper,
tokenFactoryCapabilities,
govModAddress,
)

app.AuctionKeeperSkip = auctionkeeperskip.NewKeeper(
appCodec,
keys[auctionmoduleskiptypes.StoreKey],
Expand All @@ -964,17 +915,6 @@ func New(
govModAddress,
)

app.GaslessKeeper = gaslesskeeper.NewKeeper(
app.cdc,
app.keys[gaslesstypes.StoreKey],
app.GetSubspace(gaslesstypes.ModuleName),
app.interfaceRegistry,
app.AccountKeeper,
app.BankKeeper,
&app.WasmKeeper,
govModAddress,
)

// ICQ Keeper
icqKeeper := icqkeeper.NewKeeper(
appCodec,
Expand All @@ -999,9 +939,9 @@ func New(
if err != nil {
panic(fmt.Sprintf("error while reading wasm config: %s", err))
}
supportedFeatures := "iterator,staking,stargate,comdex,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,token_factory"
supportedFeatures := "iterator,staking,stargate,comdex,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3"

wasmOpts = append(cwasm.RegisterCustomPlugins(&app.LockerKeeper, &app.TokenmintKeeper, &app.AssetKeeper, &app.Rewardskeeper, &app.CollectorKeeper, &app.LiquidationKeeper, &app.AuctionKeeper, &app.EsmKeeper, &app.VaultKeeper, &app.LendKeeper, &app.LiquidityKeeper, &app.MarketKeeper, app.BankKeeper, &app.TokenFactoryKeeper, &app.GaslessKeeper), wasmOpts...)
wasmOpts = append(cwasm.RegisterCustomPlugins(&app.LockerKeeper, &app.TokenmintKeeper, &app.AssetKeeper, &app.Rewardskeeper, &app.CollectorKeeper, &app.LiquidationKeeper, &app.AuctionKeeper, &app.EsmKeeper, &app.VaultKeeper, &app.LendKeeper, &app.LiquidityKeeper, &app.MarketKeeper), wasmOpts...)

app.WasmKeeper = wasmkeeper.NewKeeper(
app.cdc,
Expand Down Expand Up @@ -1040,8 +980,7 @@ func New(
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IbcKeeper.ClientKeeper)).
AddRoute(liquiditytypes.RouterKey, liquidity.NewLiquidityProposalHandler(app.LiquidityKeeper)).
AddRoute(liquidationsV2types.RouterKey, liquidationsV2.NewLiquidationsV2Handler(app.NewliqKeeper)).
AddRoute(auctionsV2types.RouterKey, auctionsV2.NewAuctionsV2Handler(app.NewaucKeeper)).
AddRoute(gaslesstypes.RouterKey, gasless.NewGaslessProposalHandler(app.GaslessKeeper))
AddRoute(auctionsV2types.RouterKey, auctionsV2.NewAuctionsV2Handler(app.NewaucKeeper))

if len(wasmEnabledProposals) != 0 {
govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, wasmEnabledProposals))
Expand Down Expand Up @@ -1147,10 +1086,7 @@ func New(
liquidity.NewAppModule(app.cdc, app.LiquidityKeeper, app.AccountKeeper, app.BankKeeper, app.AssetKeeper),
rewards.NewAppModule(app.cdc, app.Rewardskeeper, app.AccountKeeper, app.BankKeeper),
liquidationsV2.NewAppModule(app.cdc, app.NewliqKeeper, app.AccountKeeper, app.BankKeeper),
common.NewAppModule(app.cdc, app.CommonKeeper, app.AccountKeeper, app.BankKeeper, app.WasmKeeper),
auctionsV2.NewAppModule(app.cdc, app.NewaucKeeper, app.BankKeeper),
tokenfactory.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(tokenfactorytypes.ModuleName)),
gasless.NewAppModule(app.cdc, app.GaslessKeeper, app.AccountKeeper, app.BankKeeper),
ibchooks.NewAppModule(app.AccountKeeper),
icq.NewAppModule(*app.ICQKeeper),
packetforward.NewAppModule(app.PacketForwardKeeper, app.GetSubspace(packetforwardtypes.ModuleName)),
Expand Down Expand Up @@ -1197,9 +1133,6 @@ func New(
esmtypes.ModuleName,
liquidationsV2types.ModuleName,
auctionsV2types.ModuleName,
commontypes.ModuleName,
tokenfactorytypes.ModuleName,
gaslesstypes.ModuleName,
ibchookstypes.ModuleName,
icqtypes.ModuleName,
packetforwardtypes.ModuleName,
Expand Down Expand Up @@ -1244,9 +1177,6 @@ func New(
esmtypes.ModuleName,
liquidationsV2types.ModuleName,
auctionsV2types.ModuleName,
commontypes.ModuleName,
tokenfactorytypes.ModuleName,
gaslesstypes.ModuleName,
ibchookstypes.ModuleName,
icqtypes.ModuleName,
packetforwardtypes.ModuleName,
Expand Down Expand Up @@ -1295,9 +1225,6 @@ func New(
crisistypes.ModuleName,
liquidationsV2types.ModuleName,
auctionsV2types.ModuleName,
commontypes.ModuleName,
tokenfactorytypes.ModuleName,
gaslesstypes.ModuleName,
ibchookstypes.ModuleName,
icqtypes.ModuleName,
packetforwardtypes.ModuleName,
Expand Down Expand Up @@ -1360,8 +1287,6 @@ func New(
TxDecoder: encoding.TxConfig.TxDecoder(),
TxEncoder: encoding.TxConfig.TxEncoder(),
auctionkeeperskip: app.AuctionKeeperSkip,
GaslessKeeper: app.GaslessKeeper,
BankKeeper: app.BankKeeper,
},
)
if err != nil {
Expand Down Expand Up @@ -1607,7 +1532,7 @@ func (a *App) RegisterNodeService(clientCtx client.Context) {

func (a *App) ModuleAccountsPermissions() map[string][]string {
return map[string][]string{
authtypes.FeeCollectorName: {authtypes.Burner},
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
Expand Down Expand Up @@ -1638,9 +1563,6 @@ func (a *App) ModuleAccountsPermissions() map[string][]string {
rewardstypes.ModuleName: {authtypes.Minter, authtypes.Burner},
liquidationsV2types.ModuleName: {authtypes.Minter, authtypes.Burner},
auctionsV2types.ModuleName: {authtypes.Minter, authtypes.Burner},
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
commontypes.ModuleName: nil,
gaslesstypes.ModuleName: nil,
icatypes.ModuleName: nil,
ibcfeetypes.ModuleName: nil,
assettypes.ModuleName: nil,
Expand All @@ -1652,7 +1574,7 @@ func (a *App) ModuleAccountsPermissions() map[string][]string {
func (a *App) registerUpgradeHandlers() {
a.UpgradeKeeper.SetUpgradeHandler(
tv14.UpgradeName,
tv14.CreateUpgradeHandlerV14(a.mm, a.configurator, a.CommonKeeper, a.AuctionKeeperSkip, a.LendKeeper, a.TokenFactoryKeeper, a.AccountKeeper),
tv14.CreateUpgradeHandlerV14(a.mm, a.configurator, a.AuctionKeeperSkip, a.LendKeeper),
)
// 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
Expand Down Expand Up @@ -1689,10 +1611,7 @@ func upgradeHandlers(upgradeInfo upgradetypes.Plan, a *App, storeUpgrades *store
case upgradeInfo.Name == tv14.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height):
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{
commontypes.StoreKey,
auctionmoduleskiptypes.StoreKey,
tokenfactorytypes.ModuleName,
gaslesstypes.ModuleName,
},
}
}
Expand Down
5 changes: 2 additions & 3 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ import (
"github.com/cosmos/cosmos-sdk/std"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
"testing"
"time"
// simappparams "cosmossdk.io/simapp/params"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
)

// DefaultConsensusParams defines the default Tendermint consensus params used in
Expand Down Expand Up @@ -52,7 +51,7 @@ func MakeTestEncodingConfig() moduletestutil.TestEncodingConfig {
return encodingConfig
}

func setup(t *testing.T, withGenesis bool) (*App, GenesisState) {
func setup(_ *testing.T, withGenesis bool) (*App, GenesisState) {
db := dbm.NewMemDB()
//encCdc := MakeTestEncodingConfig()
app := New(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5, MakeEncodingConfig(), simtestutil.EmptyAppOptions{}, GetWasmEnabledProposals(), EmptyWasmOpts)
Expand Down
33 changes: 0 additions & 33 deletions app/upgrades/testnet/v14/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,69 +1,36 @@
package v14

import (
"fmt"
commonkeeper "github.com/comdex-official/comdex/x/common/keeper"
commontypes "github.com/comdex-official/comdex/x/common/types"
lendkeeper "github.com/comdex-official/comdex/x/lend/keeper"
tokenfactorykeeper "github.com/comdex-official/comdex/x/tokenfactory/keeper"
tokenfactorytypes "github.com/comdex-official/comdex/x/tokenfactory/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
auctionkeeperskip "github.com/skip-mev/block-sdk/x/auction/keeper"
auctionmoduleskiptypes "github.com/skip-mev/block-sdk/x/auction/types"
"strings"
)

// We now charge 2 million gas * gas price to create a denom.
const NewDenomCreationGasConsume uint64 = 2_000_000

func CreateUpgradeHandlerV14(
mm *module.Manager,
configurator module.Configurator,
commonkeeper commonkeeper.Keeper,
auctionkeeperskip auctionkeeperskip.Keeper,
lendKeeper lendkeeper.Keeper,
tokenfactorykeeper tokenfactorykeeper.Keeper,
accountKeeper authkeeper.AccountKeeper,

) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {

ctx.Logger().Info("Applying test net upgrade - v14.0.0")

vm, err := mm.RunMigrations(ctx, configurator, fromVM)
if err != nil {
return vm, err
}
moduleAccI := accountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName)
moduleAcc := moduleAccI.(*authtypes.ModuleAccount)
moduleAcc.Permissions = []string{authtypes.Burner}
accountKeeper.SetModuleAccount(ctx, moduleAcc)

ctx.Logger().Info("set common module params")
commonkeeper.SetParams(ctx, commontypes.DefaultParams())

ctx.Logger().Info("setting default params for MEV module (x/auction)")
if err = setDefaultMEVParams(ctx, auctionkeeperskip); err != nil {
return nil, err
}

// x/TokenFactory
// Use denom creation gas consumption instead of fee for contract developers
ctx.Logger().Info("setting params for Tokenfactory module (x/tokenfactory)")
updatedTf := tokenfactorytypes.Params{
DenomCreationFee: nil,
DenomCreationGasConsume: NewDenomCreationGasConsume,
}

if err := tokenfactorykeeper.SetParams(ctx, updatedTf); err != nil {
return vm, err
}
ctx.Logger().Info(fmt.Sprintf("updated tokenfactory params to %v", updatedTf))

//TODO: uncomment this before mainnet upgrade
//UpdateLendParams(ctx, lendKeeper)
return vm, err
Expand Down
Loading

0 comments on commit e96a76d

Please sign in to comment.