Skip to content

Commit

Permalink
feat: add upgrade handler v2.2.0 (#128)
Browse files Browse the repository at this point in the history
* chore: add upgrade handler `v2.2.0`

* fix claim records

* update time

* fix panic

* changes

* add claim records from snapshots

* suggestions

* review changes

* review changes

* Update app/upgrades/v2.2.0/upgrade.go

* fix amount sim bug

* add logs

* log

* log

* Fix airdrop amounts

* fix build

* fix

* review changes

* Update x/claim/keeper/claim.go

* test calc

* small fix

* another handle

* handle more coin errors

* revert

* add snapshot1 data directly

* update data

* sub original claim allocation

* review changes

* Update app/upgrades/v2.2.0/upgrade.go

* update go.mod

---------

Co-authored-by: Anil K <[email protected]>
Co-authored-by: Anil K <[email protected]>
  • Loading branch information
3 people authored Oct 16, 2023
1 parent 480a08a commit 8705735
Show file tree
Hide file tree
Showing 6 changed files with 5,802 additions and 22 deletions.
9 changes: 5 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

appparams "github.com/envadiv/Passage3D/app/params"
"github.com/envadiv/Passage3D/app/upgrades"
v1 "github.com/envadiv/Passage3D/app/upgrades/v1"
"github.com/envadiv/Passage3D/app/upgrades/v2.2.0"

"github.com/envadiv/Passage3D/x/claim"

Expand Down Expand Up @@ -189,7 +189,7 @@ var (
wasm.ModuleName: {authtypes.Burner},
}

Upgrades = []upgrades.Upgrade{v1.Upgrade}
Upgrades = []upgrades.Upgrade{v2.Upgrade}
)

var (
Expand Down Expand Up @@ -639,10 +639,10 @@ func NewPassageApp(
// Register snapshot extensions to enable state-sync for wasm.
if manager := app.SnapshotManager(); manager != nil {
err = manager.RegisterExtensions(
wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.WasmKeeper),
wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.WasmKeeper),
)
if err != nil {
panic("failed to register snapshot extension: " + err.Error())
panic("failed to register snapshot extension: " + err.Error())
}
}

Expand All @@ -665,6 +665,7 @@ func (app *PassageApp) setupUpgradeHandlers() {
app.DistrKeeper,
app.BankKeeper,
app.AccountKeeper,
app.ClaimKeeper,
),
)
}
Expand Down
3 changes: 2 additions & 1 deletion app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
distribution "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
claim "github.com/envadiv/Passage3D/x/claim/keeper"
)

// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal
Expand All @@ -18,7 +19,7 @@ type Upgrade struct {
UpgradeName string

// CreateUpgradeHandler defines the function that creates an upgrade handler
CreateUpgradeHandler func(*module.Manager, module.Configurator, distribution.Keeper, bank.Keeper, auth.AccountKeeper) upgradetypes.UpgradeHandler
CreateUpgradeHandler func(*module.Manager, module.Configurator, distribution.Keeper, bank.Keeper, auth.AccountKeeper, claim.Keeper) upgradetypes.UpgradeHandler

// Store upgrades, should be used for any new modules introduced, new modules deleted, or store names renamed.
StoreUpgrades store.StoreUpgrades
Expand Down
Loading

0 comments on commit 8705735

Please sign in to comment.