Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/dev #513

Merged
merged 61 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
5250ec7
Bump github.com/golangci/golangci-lint from 1.49.0 to 1.50.0
dependabot[bot] Oct 4, 2022
08eb58c
Merge pull request #486 from comdex-official/dependabot/go_modules/gi…
dheerajkd30 Oct 10, 2022
a83dbf1
v5 initial checkin
dheerajkd30 Oct 10, 2022
493bdd6
add authz module in store upgrade
dheerajkd30 Oct 10, 2022
b52cb83
state init for asset and apps in upgrade
vishnukumavat Oct 10, 2022
71d3281
Merge branch 'v5-upgrade-dd' of github.com:comdex-official/comdex int…
vishnukumavat Oct 10, 2022
18f5e70
Merge pull request #495 from comdex-official/m_upgrade1
dheerajkd30 Oct 10, 2022
5b9395d
liquidity pair creation
vishnukumavat Oct 10, 2022
dc86025
Merge pull request #496 from comdex-official/m_upgrade2
dheerajkd30 Oct 10, 2022
ec6fba6
resolve all lint issues, gosec issues and refactor
dheerajkd30 Oct 10, 2022
dddb051
Merge pull request #499 from comdex-official/dd-issues10
dheerajkd30 Oct 10, 2022
e435420
Bump github.com/golangci/golangci-lint from 1.49.0 to 1.50.0
dependabot[bot] Oct 10, 2022
32c1fd2
upgrade code added, unused file removed
Oct 11, 2022
5b225c2
Bump github.com/spf13/cobra from 1.5.0 to 1.6.0
dependabot[bot] Oct 11, 2022
006f05a
Merge pull request #501 from comdex-official/cs-upgrade
dheerajkd30 Oct 12, 2022
323b573
Merge pull request #500 from comdex-official/dependabot/go_modules/gi…
dheerajkd30 Oct 12, 2022
1c727f8
Merge pull request #502 from comdex-official/dependabot/go_modules/gi…
dheerajkd30 Oct 12, 2022
0802aec
refactor upgrade code
dheerajkd30 Oct 12, 2022
29f2927
minimum epoch duration, reward refactir
vishnukumavat Oct 12, 2022
11f152c
Merge pull request #503 from comdex-official/refactor_1
dheerajkd30 Oct 12, 2022
3047d10
Bump github.com/spf13/cobra from 1.5.0 to 1.6.0
dependabot[bot] Oct 12, 2022
4598ea5
Bump github.com/golangci/golangci-lint from 1.49.0 to 1.50.0
dependabot[bot] Oct 12, 2022
f7d7898
adding comments, renaming variables and minor refactor
Oct 12, 2022
fb129d5
adding proposal for ext lend rewards
Oct 13, 2022
3267b49
Merge pull request #504 from comdex-official/dependabot/go_modules/gi…
dheerajkd30 Oct 13, 2022
4f85eaa
Merge pull request #505 from comdex-official/dependabot/go_modules/gi…
dheerajkd30 Oct 13, 2022
0238d5e
band integrated
Oct 13, 2022
4bceffd
conflicts removed
Oct 13, 2022
f37bc0f
adding comments
Oct 13, 2022
0e543a1
Merge pull request #507 from comdex-official/lend-final
pratikasr Oct 13, 2022
5d5ffc5
adding comments and minor refactor in Ext Rewards
Oct 13, 2022
d81fd47
adding comments liquidation, auction
Oct 14, 2022
e38ac9d
added comments
Oct 15, 2022
542595e
CheckBorrowersLiquidity fn added
Oct 15, 2022
558e233
added err handling
Oct 15, 2022
38796a8
minor refacor - rewards
Oct 15, 2022
89d7733
minor refactor - Ext Rewards Locker
Oct 15, 2022
45ab4f1
synced with release-main
vishnukumavat Oct 16, 2022
d5a0e99
modules integrated with band changes
Oct 17, 2022
a99d004
redundant check removed
Oct 17, 2022
0f1c85f
formula updated
Oct 17, 2022
42761d5
Merge pull request #511 from comdex-official/drgnbry-intg
dheerajkd30 Oct 17, 2022
375dd07
Merge branch 'feature/dev' into v5-upgrade-dd
dheerajkd30 Oct 17, 2022
b064dfb
Merge pull request #494 from comdex-official/v5-upgrade-dd
dheerajkd30 Oct 17, 2022
bfe5038
removing proposal and adding tx for lend ext rewards
Oct 17, 2022
c5368a6
field modified
Oct 17, 2022
3467e04
Merge branch 'feature/dev' into hbrefactor
pratikasr Oct 17, 2022
565b683
refactor and resolve linting
dheerajkd30 Oct 17, 2022
93ef1f2
more tags corrected
Oct 17, 2022
b39d339
pulled changes
Oct 17, 2022
ae74250
more tags corrected
Oct 17, 2022
1fee289
fix thru fumpt
dheerajkd30 Oct 17, 2022
99dee7f
liquidity modules testcases fix
vishnukumavat Oct 17, 2022
17b9d69
TODO removed
Oct 17, 2022
70907b3
more tags corrected
Oct 17, 2022
fe41525
pulled changes
Oct 17, 2022
ff96d30
remove aliag.go
vishnukumavat Oct 17, 2022
97b4445
correct proto fields and its changes
dheerajkd30 Oct 17, 2022
15ae176
Merge pull request #506 from comdex-official/hbrefactor
dheerajkd30 Oct 17, 2022
a058976
Merge branch 'feature/dev' of github.com:comdex-official/comdex into …
vishnukumavat Oct 17, 2022
4a135c5
Merge pull request #512 from comdex-official/alias_ditch
dheerajkd30 Oct 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ import (

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

mv5 "github.com/comdex-official/comdex/app/upgrades/mainnet/v5"
tv1_0_0 "github.com/comdex-official/comdex/app/upgrades/testnet/v1_0_0"
tv2_0_0 "github.com/comdex-official/comdex/app/upgrades/testnet/v2_0_0"
tv3_0_0 "github.com/comdex-official/comdex/app/upgrades/testnet/v3_0_0"
Expand Down Expand Up @@ -551,7 +552,6 @@ func New(
app.cdc,
app.keys[assettypes.StoreKey],
app.GetSubspace(assettypes.ModuleName),
&app.MarketKeeper,
&app.Rewardskeeper,
&app.VaultKeeper,
&app.BandoracleKeeper,
Expand Down Expand Up @@ -695,7 +695,6 @@ func New(
app.GetSubspace(lockertypes.ModuleName),
app.BankKeeper,
&app.AssetKeeper,
&app.MarketKeeper,
&app.CollectorKeeper,
&app.EsmKeeper,
&app.Rewardskeeper,
Expand Down Expand Up @@ -1223,6 +1222,30 @@ func upgradeHandlers(upgradeInfo storetypes.UpgradeInfo, a *App, storeUpgrades *
storeUpgrades = &storetypes.StoreUpgrades{}
case upgradeInfo.Name == tv4_0_0.UpgradeNameV4_4_0 && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height):
storeUpgrades = &storetypes.StoreUpgrades{}

// prepare store for main net upgrade v5.0.0
case upgradeInfo.Name == mv5.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height):
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{
assettypes.ModuleName,
auctiontypes.ModuleName,
bandoraclemoduletypes.ModuleName,
collectortypes.ModuleName,
esmtypes.ModuleName,
liquidationtypes.ModuleName,
liquiditytypes.ModuleName,
lockertypes.ModuleName,
markettypes.ModuleName,
rewardstypes.ModuleName,
tokenminttypes.ModuleName,
vaulttypes.ModuleName,
feegrant.ModuleName,
icacontrollertypes.StoreKey,
icahosttypes.StoreKey,
authz.ModuleName,
},
}
}

return storeUpgrades
}
15 changes: 15 additions & 0 deletions app/upgrades/mainnet/v5/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package v5

const (
UpgradeName = "v5.0.0"
UpgradeHeight = ""
UpgradeInfo = `'{
"binaries": {
"darwin/arm64":"",
"darwin/x86_64":"",
"linux/arm64":"",
"linux/x86_64":"",
"windows/x86_64":""
}
}'`
)
316 changes: 316 additions & 0 deletions app/upgrades/mainnet/v5/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,316 @@
package v5

import (
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/comdex-official/comdex/app/wasm/bindings"
assetkeeper "github.com/comdex-official/comdex/x/asset/keeper"
assettypes "github.com/comdex-official/comdex/x/asset/types"
auctionkeeper "github.com/comdex-official/comdex/x/auction/keeper"
collectorkeeper "github.com/comdex-official/comdex/x/collector/keeper"
liquidationkeeper "github.com/comdex-official/comdex/x/liquidation/keeper"
liquiditykeeper "github.com/comdex-official/comdex/x/liquidity/keeper"
liquiditytypes "github.com/comdex-official/comdex/x/liquidity/types"
lockerkeeper "github.com/comdex-official/comdex/x/locker/keeper"
lockertypes "github.com/comdex-official/comdex/x/locker/types"
rewardskeeper "github.com/comdex-official/comdex/x/rewards/keeper"
rewardstypes "github.com/comdex-official/comdex/x/rewards/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ica "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts"
icacontrollertypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types"
icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types"
ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
)

func IntializeStates(
ctx sdk.Context,
assetKeeper assetkeeper.Keeper,
liquidityKeeper liquiditykeeper.Keeper,
collectorkeeper collectorkeeper.Keeper,
auctionkeeper auctionkeeper.Keeper,
lockerkeeper lockerkeeper.Keeper,
rewardskeeper rewardskeeper.Keeper,
liquidationkeeper liquidationkeeper.Keeper,
) {
apps := []assettypes.AppData{
{Name: "CSWAP", ShortName: "cswap", MinGovDeposit: sdk.ZeroInt(), GovTimeInSeconds: 0, GenesisToken: []assettypes.MintGenesisToken{}},
{Name: "HARBOR", ShortName: "hbr", MinGovDeposit: sdk.NewInt(10000000), GovTimeInSeconds: 300, GenesisToken: []assettypes.MintGenesisToken{}},
}
for _, app := range apps {
err := assetKeeper.AddAppRecords(ctx, app)
if err != nil {
panic(err)
}
}

assets := []assettypes.Asset{
{Name: "ATOM", Denom: "uatom", Decimals: 1000000, IsOnChain: false, IsOraclePriceRequired: true},
{Name: "CMDX", Denom: "ucmdx", Decimals: 1000000, IsOnChain: false, IsOraclePriceRequired: true},
{Name: "CMST", Denom: "ucmst", Decimals: 1000000, IsOnChain: false, IsOraclePriceRequired: false},
{Name: "OSMO", Denom: "uosmo", Decimals: 1000000, IsOnChain: false, IsOraclePriceRequired: true},
{Name: "cATOM", Denom: "ucatom", Decimals: 1000000, IsOnChain: false, IsOraclePriceRequired: false},
{Name: "cCMDX", Denom: "uccmdx", Decimals: 1000000, IsOnChain: false, IsOraclePriceRequired: false},
{Name: "cCMST", Denom: "uccmst", Decimals: 1000000, IsOnChain: false, IsOraclePriceRequired: false},
{Name: "cOSMO", Denom: "ucosmo", Decimals: 1000000, IsOnChain: false, IsOraclePriceRequired: false},
{Name: "HARBOR", Denom: "uharbor", Decimals: 1000000, IsOnChain: true, IsOraclePriceRequired: false},
}

for _, asset := range assets {
err := assetKeeper.AddAssetRecords(ctx, asset)
if err != nil {
panic(err)
}
}
// add pairs
pairs := []assettypes.Pair{
{AssetIn: 1, AssetOut: 3},
{AssetIn: 2, AssetOut: 3},
{AssetIn: 4, AssetOut: 3},
}

for _, pair := range pairs {
err := assetKeeper.AddPairsRecords(ctx, pair)
if err != nil {
panic(err)
}
}

// add extended pairs
extPairs := []*bindings.MsgAddExtendedPairsVault{
{
AppID: 2, PairID: 2, StabilityFee: sdk.MustNewDecFromStr("0.045"), ClosingFee: sdk.MustNewDecFromStr("0"), LiquidationPenalty: sdk.MustNewDecFromStr("0.15"),
DrawDownFee: sdk.MustNewDecFromStr("0.01"), IsVaultActive: true, DebtCeiling: 100000000000000, DebtFloor: 1000000, IsStableMintVault: false, MinCr: sdk.MustNewDecFromStr("2.0"),
PairName: "CMDX-A", AssetOutOraclePrice: false, AssetOutPrice: 1000000, MinUsdValueLeft: 10000000000,
},
{
AppID: 2, PairID: 2, StabilityFee: sdk.MustNewDecFromStr("0.035"), ClosingFee: sdk.MustNewDecFromStr("0"), LiquidationPenalty: sdk.MustNewDecFromStr("0.15"),
DrawDownFee: sdk.MustNewDecFromStr("0.01"), IsVaultActive: true, DebtCeiling: 100000000000000, DebtFloor: 1000000, IsStableMintVault: false, MinCr: sdk.MustNewDecFromStr("2.4"),
PairName: "CMDX-B", AssetOutOraclePrice: false, AssetOutPrice: 1000000, MinUsdValueLeft: 10000000000,
},
{
AppID: 2, PairID: 2, StabilityFee: sdk.MustNewDecFromStr("0.025"), ClosingFee: sdk.MustNewDecFromStr("0"), LiquidationPenalty: sdk.MustNewDecFromStr("0.15"),
DrawDownFee: sdk.MustNewDecFromStr("0.01"), IsVaultActive: true, DebtCeiling: 100000000000000, DebtFloor: 1000000, IsStableMintVault: false, MinCr: sdk.MustNewDecFromStr("2.8"),
PairName: "CMDX-C", AssetOutOraclePrice: false, AssetOutPrice: 1000000, MinUsdValueLeft: 10000000000,
},
{
AppID: 2, PairID: 3, StabilityFee: sdk.MustNewDecFromStr("0.045"), ClosingFee: sdk.MustNewDecFromStr("0"), LiquidationPenalty: sdk.MustNewDecFromStr("0.15"),
DrawDownFee: sdk.MustNewDecFromStr("0.01"), IsVaultActive: true, DebtCeiling: 100000000000000, DebtFloor: 1000000, IsStableMintVault: false, MinCr: sdk.MustNewDecFromStr("1.6"),
PairName: "OSMO-A", AssetOutOraclePrice: false, AssetOutPrice: 1000000, MinUsdValueLeft: 10000000000,
},
{
AppID: 2, PairID: 3, StabilityFee: sdk.MustNewDecFromStr("0.035"), ClosingFee: sdk.MustNewDecFromStr("0"), LiquidationPenalty: sdk.MustNewDecFromStr("0.15"),
DrawDownFee: sdk.MustNewDecFromStr("0.01"), IsVaultActive: true, DebtCeiling: 100000000000000, DebtFloor: 1000000, IsStableMintVault: false, MinCr: sdk.MustNewDecFromStr("1.9"),
PairName: "OSMO-B", AssetOutOraclePrice: false, AssetOutPrice: 1000000, MinUsdValueLeft: 10000000000,
},
{
AppID: 2, PairID: 3, StabilityFee: sdk.MustNewDecFromStr("0.025"), ClosingFee: sdk.MustNewDecFromStr("0"), LiquidationPenalty: sdk.MustNewDecFromStr("0.15"),
DrawDownFee: sdk.MustNewDecFromStr("0.01"), IsVaultActive: true, DebtCeiling: 100000000000000, DebtFloor: 1000000, IsStableMintVault: false, MinCr: sdk.MustNewDecFromStr("2.2"),
PairName: "OSMO-C", AssetOutOraclePrice: false, AssetOutPrice: 1000000, MinUsdValueLeft: 10000000000,
},
{
AppID: 2, PairID: 1, StabilityFee: sdk.MustNewDecFromStr("0.045"), ClosingFee: sdk.MustNewDecFromStr("0"), LiquidationPenalty: sdk.MustNewDecFromStr("0.15"),
DrawDownFee: sdk.MustNewDecFromStr("0.01"), IsVaultActive: true, DebtCeiling: 100000000000000, DebtFloor: 1000000, IsStableMintVault: false, MinCr: sdk.MustNewDecFromStr("1.4"),
PairName: "ATOM-A", AssetOutOraclePrice: false, AssetOutPrice: 1000000, MinUsdValueLeft: 10000000000,
},
{
AppID: 2, PairID: 1, StabilityFee: sdk.MustNewDecFromStr("0.035"), ClosingFee: sdk.MustNewDecFromStr("0"), LiquidationPenalty: sdk.MustNewDecFromStr("0.15"),
DrawDownFee: sdk.MustNewDecFromStr("0.01"), IsVaultActive: true, DebtCeiling: 100000000000000, DebtFloor: 1000000, IsStableMintVault: false, MinCr: sdk.MustNewDecFromStr("1.7"),
PairName: "ATOM-B", AssetOutOraclePrice: false, AssetOutPrice: 1000000, MinUsdValueLeft: 10000000000,
},
{
AppID: 2, PairID: 1, StabilityFee: sdk.MustNewDecFromStr("0.025"), ClosingFee: sdk.MustNewDecFromStr("0"), LiquidationPenalty: sdk.MustNewDecFromStr("0.15"),
DrawDownFee: sdk.MustNewDecFromStr("0.01"), IsVaultActive: true, DebtCeiling: 100000000000000, DebtFloor: 1000000, IsStableMintVault: false, MinCr: sdk.MustNewDecFromStr("2.0"),
PairName: "ATOM-C", AssetOutOraclePrice: false, AssetOutPrice: 1000000, MinUsdValueLeft: 10000000000,
},
}

for _, extPair := range extPairs {
err := assetKeeper.WasmAddExtendedPairsVaultRecords(ctx, extPair)
if err != nil {
panic(err)
}
}
// add collector params
collector := bindings.MsgSetCollectorLookupTable{
AppID: 2,
CollectorAssetID: 3,
SecondaryAssetID: 9,
SurplusThreshold: 100000000000000,
DebtThreshold: 1000000000,
LockerSavingRate: sdk.MustNewDecFromStr("0.015"),
LotSize: 200000000,
BidFactor: sdk.MustNewDecFromStr("0.01"),
DebtLotSize: 2000000,
}

err := collectorkeeper.WasmSetCollectorLookupTable(ctx, &collector)
if err != nil {
panic(err)
}

// add auction params

auctionParam := bindings.MsgAddAuctionParams{
AppID: 2,
AuctionDurationSeconds: 21600,
BidDurationSeconds: 10800,
Buffer: sdk.MustNewDecFromStr("1.5"),
Cusp: sdk.MustNewDecFromStr("0.85"),
DebtID: 2,
DutchID: 3,
PriceFunctionType: 1,
Step: 360,
SurplusID: 1,
}
err = auctionkeeper.AddAuctionParams(ctx, &auctionParam)
if err != nil {
panic(err)
}
// add auction mapping
auction := bindings.MsgSetAuctionMappingForApp{
AppID: 2,
AssetIDs: 3,
IsSurplusAuctions: false,
IsDebtAuctions: false,
IsDistributor: false,
AssetOutOraclePrices: false,
AssetOutPrices: 1000000,
}

err = collectorkeeper.WasmSetAuctionMappingForApp(ctx, &auction)
if err != nil {
panic(err)
}

// whitlist cmst for locker
locker := lockertypes.MsgAddWhiteListedAssetRequest{
AppId: 2,
AssetId: 3,
}
_, err = lockerkeeper.AddWhiteListedAsset(ctx.Context(), &locker)
if err != nil {
panic(err)
}
// whielist for locker rewards
reward := rewardstypes.WhitelistAsset{
AppMappingId: 2,
AssetId: 3,
}
_, err = rewardskeeper.Whitelist(sdk.WrapSDKContext(ctx), &reward)
if err != nil {
panic(err)
}
// whitlist for vaultInterest
vInterest := rewardstypes.WhitelistAppIdVault{
AppMappingId: 2,
}
_, err = rewardskeeper.WhitelistAppVault(ctx.Context(), &vInterest)
if err != nil {
panic(err)
}

// whitlist for liquidation
err = liquidationkeeper.WasmWhitelistAppIDLiquidation(ctx, 2)
if err != nil {
panic(err)
}

type LiquidityPair struct {
AppID uint64
From string
BaseCoinDenom string
QuoteCoinDenom string
}

liquidityPairs := []LiquidityPair{
{AppID: 1, From: "comdex12gfx7e3p08ljrwhq4lxz0360czcv9jpzajlytv", BaseCoinDenom: "uatom", QuoteCoinDenom: "ucmdx"},
{AppID: 1, From: "comdex12gfx7e3p08ljrwhq4lxz0360czcv9jpzajlytv", BaseCoinDenom: "uosmo", QuoteCoinDenom: "ucmdx"},
}

for _, lpair := range liquidityPairs {
msg := liquiditytypes.NewMsgCreatePair(
lpair.AppID, sdk.MustAccAddressFromBech32(lpair.From), lpair.BaseCoinDenom, lpair.QuoteCoinDenom,
)
_, err := liquidityKeeper.CreatePair(ctx, msg, true)
if err != nil {
panic(err)
}
}
}

// CreateUpgradeHandler creates an SDK upgrade handler for v5
func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
wasmKeeper wasmkeeper.Keeper,
assetKeeper assetkeeper.Keeper,
liquidityKeeper liquiditykeeper.Keeper,
collectorkeeper collectorkeeper.Keeper,
auctionkeeper auctionkeeper.Keeper,
lockerkeeper lockerkeeper.Keeper,
rewardskeeper rewardskeeper.Keeper,
liquidationkeeper liquidationkeeper.Keeper,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// Refs:
// - https://docs.cosmos.network/master/building-modules/upgrade.html#registering-migrations
// - https://docs.cosmos.network/master/migrations/chain-upgrade-guide-044.html#chain-upgrade

// Deleting these modules from the upgrades current state
// Add Interchain Accounts host module
// set the ICS27 consensus version so InitGenesis is not run
fromVM[icatypes.ModuleName] = mm.Modules[icatypes.ModuleName].ConsensusVersion()

// create ICS27 Controller submodule params, controller module not enabled.
controllerParams := icacontrollertypes.Params{}

// create ICS27 Host submodule params

// create ICS27 Host submodule params
hostParams := icahosttypes.Params{
HostEnabled: true,
AllowMessages: []string{
sdk.MsgTypeURL(&ibctransfertypes.MsgTransfer{}),
sdk.MsgTypeURL(&banktypes.MsgSend{}),
sdk.MsgTypeURL(&stakingtypes.MsgDelegate{}),
sdk.MsgTypeURL(&stakingtypes.MsgBeginRedelegate{}),
sdk.MsgTypeURL(&stakingtypes.MsgCreateValidator{}),
sdk.MsgTypeURL(&stakingtypes.MsgEditValidator{}),
sdk.MsgTypeURL(&stakingtypes.MsgUndelegate{}),
sdk.MsgTypeURL(&distrtypes.MsgWithdrawDelegatorReward{}),
sdk.MsgTypeURL(&distrtypes.MsgSetWithdrawAddress{}),
sdk.MsgTypeURL(&distrtypes.MsgWithdrawValidatorCommission{}),
sdk.MsgTypeURL(&distrtypes.MsgFundCommunityPool{}),
sdk.MsgTypeURL(&govtypes.MsgVote{}),
},
}
// No changes in existing module and their states,
// This upgrades adds new modules and new states in the existing store

icamodule, correctTypecast := mm.Modules[icatypes.ModuleName].(ica.AppModule)
if !correctTypecast {
panic("mm.Modules[icatypes.ModuleName] is not of type ica.AppModule")
}
icamodule.InitModule(ctx, controllerParams, hostParams)
newVM, err := mm.RunMigrations(ctx, configurator, fromVM)
if err != nil {
return newVM, err
}

IntializeStates(ctx, assetKeeper, liquidityKeeper, collectorkeeper, auctionkeeper, lockerkeeper, rewardskeeper, liquidationkeeper)

// update wasm to permission
wasmParams := wasmKeeper.GetParams(ctx)
wasmParams.CodeUploadAccess = wasmtypes.AllowNobody
wasmKeeper.SetParams(ctx, wasmParams)

return newVM, err
}
}
2 changes: 1 addition & 1 deletion app/upgrades/testnet/v1_0_0/constants.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1_0_0
package v1_0_0 //nolint:revive,stylecheck

const (
UpgradeName = "v1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/testnet/v1_0_0/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1_0_0
package v1_0_0 //nolint:revive,stylecheck

import (
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
Loading