diff --git a/app/app.go b/app/app.go index f05f95905..3b719d227 100644 --- a/app/app.go +++ b/app/app.go @@ -859,7 +859,7 @@ func New( // // example: app.HardForkManager.RegisterHandler(myHandler) app.HardForkManager = upgrades.NewHardForkManager(app.ChainID) - app.HardForkManager.RegisterHandler(v0upgrade.NewHardForkUpgradeHandler(100_000, app.ChainID, app.WasmKeeper)) + app.HardForkManager.RegisterHandler(v0upgrade.NewHardForkUpgradeHandler(100_000, upgrades.ChainIDSeiHardForkTest, app.WasmKeeper)) return app } diff --git a/app/upgrades/fork_manager.go b/app/upgrades/fork_manager.go index a8fc9c15f..6bbd581b9 100644 --- a/app/upgrades/fork_manager.go +++ b/app/upgrades/fork_manager.go @@ -7,6 +7,11 @@ import ( "github.com/sei-protocol/goutils" ) +// Chain-ID constants for use in hard fork handlers. +const ( + ChainIDSeiHardForkTest = "sei-hard-fork-test" +) + type HardForkHandler interface { // a unique identifying name to ensure no duplicate handlers are registered GetName() string diff --git a/app/upgrades/v0/upgrade.go b/app/upgrades/v0/upgrade.go index c897d9d11..396e2ce71 100644 --- a/app/upgrades/v0/upgrade.go +++ b/app/upgrades/v0/upgrade.go @@ -43,7 +43,25 @@ func (h HardForkUpgradeHandler) GetTargetHeight() int64 { func (h HardForkUpgradeHandler) ExecuteHandler(ctx sdk.Context) error { govKeeper := wasmkeeper.NewGovPermissionKeeper(h.WasmKeeper) - _, err := govKeeper.Migrate(ctx, nil, nil, nil, nil) + return h.migrateGringotts(ctx, govKeeper) +} + +func (h HardForkUpgradeHandler) migrateGringotts(ctx sdk.Context, govKeeper *wasmkeeper.PermissionedKeeper) error { + var ( + contractAddr sdk.AccAddress + newCodeID uint64 + msg []byte + ) + + switch h.TargetChainID { + case upgrades.ChainIDSeiHardForkTest: + // TODO: ... + + default: + return fmt.Errorf("unknown chain ID: %s", h.TargetChainID) + } + + _, err := govKeeper.Migrate(ctx, contractAddr, sdk.AccAddress{}, newCodeID, msg) if err != nil { return fmt.Errorf("failed to execute wasm migration: %w", err) }