Skip to content

Commit

Permalink
add store loader
Browse files Browse the repository at this point in the history
  • Loading branch information
GNaD13 committed Jul 19, 2023
1 parent 855e5a2 commit 30c235f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import (
bech32stakingmigration "github.com/notional-labs/centauri/v4/bech32-migration/staking"

"github.com/notional-labs/centauri/v4/app/keepers"
v4 "github.com/notional-labs/centauri/v4/app/upgrades/v4"

// bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/capability"
Expand Down Expand Up @@ -125,7 +127,7 @@ var (
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
EnableSpecificProposals = ""

Upgrades = []upgrades.Upgrade{}
Upgrades = []upgrades.Upgrade{v4.Upgrade}
)

// GetEnabledProposals parses the ProposalsEnabled / EnableSpecificProposals values to
Expand Down
22 changes: 22 additions & 0 deletions app/upgrades/v4/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package v4

import (
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
store "github.com/cosmos/cosmos-sdk/store/types"
"github.com/notional-labs/centauri/v4/app/upgrades"
ibchookstypes "github.com/notional-labs/centauri/v4/x/ibc-hooks/types"
)

const (
// UpgradeName defines the on-chain upgrade name for the Centauri upgrade.
UpgradeName = "v4"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{wasmtypes.StoreKey, ibchookstypes.StoreKey},
Deleted: []string{},
},
}
20 changes: 20 additions & 0 deletions app/upgrades/v4/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package v4

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
"github.com/notional-labs/centauri/v4/app/keepers"
"github.com/notional-labs/centauri/v4/app/upgrades"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
bpm upgrades.BaseAppParamManager,
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return mm.RunMigrations(ctx, configurator, vm)
}
}

0 comments on commit 30c235f

Please sign in to comment.