Skip to content

Commit

Permalink
Merge pull request #643 from UnUniFi/disable-module
Browse files Browse the repository at this point in the history
Upgrade v3.1.0 disable module
  • Loading branch information
Senna46 authored Jul 21, 2023
2 parents a28289b + 17a9f46 commit 3a936bd
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
run: go build -v ./...

- name: Test
run: go test -v `go list ./... | grep -v -E 'deprecated/|x/ecosystemincentive/|x/nftfactory/|x/derivatives/'`
run: go test -v `go list ./... | grep -v -E 'deprecated/|x/ecosystemincentive/|x/nftfactory/|x/nftbackedloan/|x/pricefeed/|x/derivatives/'`
185 changes: 92 additions & 93 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ import (
nftfactorytypes "github.com/UnUniFi/chain/x/nftfactory/types"
"github.com/UnUniFi/chain/x/pricefeed"
pricefeedkeeper "github.com/UnUniFi/chain/x/pricefeed/keeper"
pricefeedtypes "github.com/UnUniFi/chain/x/pricefeed/types"

ecosystemincentive "github.com/UnUniFi/chain/x/ecosystemincentive"
ecosystemincentivekeeper "github.com/UnUniFi/chain/x/ecosystemincentive/keeper"
Expand All @@ -173,7 +172,7 @@ import (
v2_1 "github.com/UnUniFi/chain/app/upgrades/v2.1"
v2_2 "github.com/UnUniFi/chain/app/upgrades/v2.2"
v3 "github.com/UnUniFi/chain/app/upgrades/v3"
v3_1_rc0 "github.com/UnUniFi/chain/app/upgrades/v3.1-rc0"
v3_1 "github.com/UnUniFi/chain/app/upgrades/v3.1"
)

const Name = "ununifi"
Expand Down Expand Up @@ -250,20 +249,19 @@ var (
ibcfee.AppModuleBasic{},

// original modules
pricefeed.AppModuleBasic{},
derivatives.AppModuleBasic{},

nftbackedloan.AppModuleBasic{},
nftfactory.AppModuleBasic{},
ecosystemincentive.AppModuleBasic{},

yieldaggregator.AppModuleBasic{},
stakeibc.AppModuleBasic{},
epochs.AppModuleBasic{},
interchainquery.AppModuleBasic{},
records.AppModuleBasic{},
icacallbacks.AppModuleBasic{},

pricefeed.AppModuleBasic{},
derivatives.AppModuleBasic{},

ecosystemincentive.AppModuleBasic{},
)

// module account permissions
Expand Down Expand Up @@ -302,7 +300,7 @@ var (
stakeibctypes.ModuleName: true,
}

Upgrades = []upgrades.Upgrade{v1_beta3.Upgrade, v2_1.Upgrade, v2_2.Upgrade, v3.Upgrade, v3_1_rc0.Upgrade}
Upgrades = []upgrades.Upgrade{v1_beta3.Upgrade, v2_1.Upgrade, v2_2.Upgrade, v3.Upgrade, v3_1.Upgrade}
)

var (
Expand Down Expand Up @@ -437,20 +435,19 @@ func NewApp(
icacontrollertypes.StoreKey,

// original modules
nftbackedloantypes.StoreKey,
nftfactorytypes.StoreKey,
// derivativestypes.StoreKey,
// pricefeedtypes.StoreKey,

// nftbackedloantypes.StoreKey,
// nftfactorytypes.StoreKey,
// ecosystemincentivetypes.StoreKey,

yieldaggregatortypes.StoreKey,
stakeibctypes.StoreKey,
epochstypes.StoreKey,
interchainquerytypes.StoreKey,
recordstypes.StoreKey,
icacallbackstypes.StoreKey,

derivativestypes.StoreKey,
pricefeedtypes.StoreKey,

ecosystemincentivetypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down Expand Up @@ -714,25 +711,56 @@ func NewApp(
wasmOpts...,
)

app.NftfactoryKeeper = nftfactorykeeper.NewKeeper(
appCodec,
keys[nftfactorytypes.StoreKey],
keys[nftfactorytypes.MemStoreKey],
app.GetSubspace(nftfactorytypes.ModuleName),
app.AccountKeeper,
app.NFTKeeper,
)

nftbackedloanKeeper := nftbackedloankeeper.NewKeeper(
appCodec,
encodingConfig.TxConfig,
keys[nftbackedloantypes.StoreKey],
keys[nftbackedloantypes.MemStoreKey],
app.GetSubspace(nftbackedloantypes.ModuleName),
app.AccountKeeper,
app.BankKeeper,
app.NFTKeeper,
)
// app.PricefeedKeeper = pricefeedkeeper.NewKeeper(
// appCodec,
// keys[pricefeedtypes.StoreKey],
// keys[pricefeedtypes.MemStoreKey],
// app.GetSubspace(pricefeedtypes.ModuleName),
// app.BankKeeper,
// )

// app.DerivativesKeeper = derivativeskeeper.NewKeeper(
// appCodec,
// keys[derivativestypes.StoreKey],
// keys[derivativestypes.MemStoreKey],
// app.GetSubspace(derivativestypes.ModuleName),
// app.BankKeeper,
// app.PricefeedKeeper,
// )

// app.NftfactoryKeeper = nftfactorykeeper.NewKeeper(
// appCodec,
// keys[nftfactorytypes.StoreKey],
// keys[nftfactorytypes.MemStoreKey],
// app.GetSubspace(nftfactorytypes.ModuleName),
// app.AccountKeeper,
// app.NFTKeeper,
// )

// nftbackedloanKeeper := nftbackedloankeeper.NewKeeper(
// appCodec,
// encodingConfig.TxConfig,
// keys[nftbackedloantypes.StoreKey],
// keys[nftbackedloantypes.MemStoreKey],
// app.GetSubspace(nftbackedloantypes.ModuleName),
// app.AccountKeeper,
// app.BankKeeper,
// app.NFTKeeper,
// )

// app.EcosystemincentiveKeeper = ecosystemincentivekeeper.NewKeeper(
// appCodec,
// keys[ecosystemincentivetypes.StoreKey],
// app.GetSubspace(ecosystemincentivetypes.ModuleName),
// app.AccountKeeper,
// app.BankKeeper,
// app.DistrKeeper,
// // same as the feeCollectorName in the distribution module
// authtypes.FeeCollectorName,
// )

// // create Keeper objects which have Hooks
// app.NftbackedloanKeeper = *nftbackedloanKeeper.SetHooks(nftbackedloantypes.NewMultiNftbackedloanHooks(app.EcosystemincentiveKeeper.Hooks()))

scopedIcacallbacksKeeper := app.CapabilityKeeper.ScopeToModule(icacallbackstypes.ModuleName)
app.ScopedIcacallbacksKeeper = scopedIcacallbacksKeeper
Expand Down Expand Up @@ -825,36 +853,6 @@ func NewApp(
app.StakeibcKeeper.Hooks(),
),
)
app.PricefeedKeeper = pricefeedkeeper.NewKeeper(
appCodec,
keys[pricefeedtypes.StoreKey],
keys[pricefeedtypes.MemStoreKey],
app.GetSubspace(pricefeedtypes.ModuleName),
app.BankKeeper,
)

app.DerivativesKeeper = derivativeskeeper.NewKeeper(
appCodec,
keys[derivativestypes.StoreKey],
keys[derivativestypes.MemStoreKey],
app.GetSubspace(derivativestypes.ModuleName),
app.BankKeeper,
app.PricefeedKeeper,
)

app.EcosystemincentiveKeeper = ecosystemincentivekeeper.NewKeeper(
appCodec,
keys[ecosystemincentivetypes.StoreKey],
app.GetSubspace(ecosystemincentivetypes.ModuleName),
app.AccountKeeper,
app.BankKeeper,
app.DistrKeeper,
// same as the feeCollectorName in the distribution module
authtypes.FeeCollectorName,
)

// create Keeper objects which have Hooks
app.NftbackedloanKeeper = *nftbackedloanKeeper.SetHooks(nftbackedloantypes.NewMultiNftbackedloanHooks(app.EcosystemincentiveKeeper.Hooks()))

// Register the proposal types
// Deprecated: Avoid adding new handlers, instead use the new proposal flow
Expand Down Expand Up @@ -961,19 +959,19 @@ func NewApp(
crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)),

// original modules
nftfactory.NewAppModule(appCodec, app.NftfactoryKeeper, app.NFTKeeper),
nftbackedloan.NewAppModule(appCodec, app.NftbackedloanKeeper, app.AccountKeeper, app.BankKeeper),
// pricefeed.NewAppModule(appCodec, app.PricefeedKeeper, app.AccountKeeper),
// derivatives.NewAppModule(appCodec, app.DerivativesKeeper, app.BankKeeper),

// nftfactory.NewAppModule(appCodec, app.NftfactoryKeeper, app.NFTKeeper),
// nftbackedloan.NewAppModule(appCodec, app.NftbackedloanKeeper, app.AccountKeeper, app.BankKeeper),
// ecosystemincentive.NewAppModule(appCodec, app.EcosystemincentiveKeeper, app.BankKeeper),

yieldaggregator.NewAppModule(appCodec, app.YieldaggregatorKeeper, app.AccountKeeper, app.BankKeeper),
stakeibc.NewAppModule(appCodec, app.StakeibcKeeper, app.AccountKeeper, app.BankKeeper),
epochs.NewAppModule(appCodec, app.EpochsKeeper),
interchainquery.NewAppModule(appCodec, app.InterchainqueryKeeper),
records.NewAppModule(appCodec, app.RecordsKeeper, app.AccountKeeper, app.BankKeeper),
icacallbacks.NewAppModule(appCodec, app.IcacallbacksKeeper, app.AccountKeeper, app.BankKeeper),

derivatives.NewAppModule(appCodec, app.DerivativesKeeper, app.BankKeeper),
pricefeed.NewAppModule(appCodec, app.PricefeedKeeper, app.AccountKeeper),
ecosystemincentive.NewAppModule(appCodec, app.EcosystemincentiveKeeper, app.BankKeeper),
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand Down Expand Up @@ -1001,11 +999,12 @@ func NewApp(
vestingtypes.ModuleName,
consensusparamtypes.ModuleName,
// original modules
ecosystemincentivetypes.ModuleName,
pricefeedtypes.ModuleName,
// pricefeedtypes.ModuleName,
// derivativestypes.ModuleName,

nftfactorytypes.ModuleName,
nftbackedloantypes.ModuleName,
// nftfactorytypes.ModuleName,
// nftbackedloantypes.ModuleName,
// ecosystemincentivetypes.ModuleName,

stakeibctypes.ModuleName,
epochstypes.ModuleName,
Expand All @@ -1014,7 +1013,6 @@ func NewApp(
icacallbackstypes.ModuleName,

yieldaggregatortypes.ModuleName,
derivativestypes.ModuleName,

// additional non simd modules
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -1045,19 +1043,20 @@ func NewApp(
vestingtypes.ModuleName,
consensusparamtypes.ModuleName,
// original modules
ecosystemincentivetypes.ModuleName,
pricefeedtypes.ModuleName,
// pricefeedtypes.ModuleName,
// derivativestypes.ModuleName,

// nftfactorytypes.ModuleName,
// nftbackedloantypes.ModuleName,
// ecosystemincentivetypes.ModuleName,

nftfactorytypes.ModuleName,
nftbackedloantypes.ModuleName,
stakeibctypes.ModuleName,
epochstypes.ModuleName,
interchainquerytypes.ModuleName,
recordstypes.ModuleName,
icacallbackstypes.ModuleName,

yieldaggregatortypes.ModuleName,
derivativestypes.ModuleName,

// additional non simd modules
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -1096,10 +1095,11 @@ func NewApp(
consensusparamtypes.ModuleName,

// original modules
pricefeedtypes.ModuleName,
nftfactorytypes.ModuleName,
nftbackedloantypes.ModuleName,
ecosystemincentivetypes.ModuleName,
// pricefeedtypes.ModuleName,
// derivativestypes.ModuleName,
// nftfactorytypes.ModuleName,
// nftbackedloantypes.ModuleName,
// ecosystemincentivetypes.ModuleName,

stakeibctypes.ModuleName,
epochstypes.ModuleName,
Expand All @@ -1108,7 +1108,6 @@ func NewApp(
icacallbackstypes.ModuleName,

yieldaggregatortypes.ModuleName,
derivativestypes.ModuleName,

// additional non simd modules
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -1441,8 +1440,12 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(wasm.ModuleName)

// original modules
paramsKeeper.Subspace(nftbackedloantypes.ModuleName)
paramsKeeper.Subspace(nftfactorytypes.ModuleName)
// paramsKeeper.Subspace(pricefeedtypes.ModuleName)
// paramsKeeper.Subspace(derivativestypes.ModuleName)

// paramsKeeper.Subspace(nftfactorytypes.ModuleName)
// paramsKeeper.Subspace(nftbackedloantypes.ModuleName)
// paramsKeeper.Subspace(ecosystemincentivetypes.ModuleName)

paramsKeeper.Subspace(stakeibctypes.ModuleName)
paramsKeeper.Subspace(epochstypes.ModuleName)
Expand All @@ -1451,10 +1454,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(icacallbackstypes.ModuleName)
paramsKeeper.Subspace(yieldaggregatortypes.ModuleName)

paramsKeeper.Subspace(pricefeedtypes.ModuleName)
paramsKeeper.Subspace(derivativestypes.ModuleName)
paramsKeeper.Subspace(ecosystemincentivetypes.ModuleName)

return paramsKeeper
}

Expand Down Expand Up @@ -1498,6 +1497,6 @@ func (app *App) setupAppkeeper() {
app.AppKeepers.WasmKeeper = &app.WasmKeeper
app.AppKeepers.EpochsKeeper = &app.EpochsKeeper
app.AppKeepers.YieldaggregatorKeeper = &app.YieldaggregatorKeeper
app.AppKeepers.PricefeedKeeper = &app.PricefeedKeeper
app.AppKeepers.DerivativesKeeper = &app.DerivativesKeeper
// app.AppKeepers.PricefeedKeeper = &app.PricefeedKeeper
// app.AppKeepers.DerivativesKeeper = &app.DerivativesKeeper
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package v3_1_rc0
package v3_1

import (
store "github.com/cosmos/cosmos-sdk/store/types"

"github.com/UnUniFi/chain/app/upgrades"
)

const UpgradeName string = "v3.1-rc0"
const UpgradeName string = "v3_1"

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v3_1_rc0
package v3_1

import (
"fmt"
Expand Down

0 comments on commit 3a936bd

Please sign in to comment.