-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into mat/add-more-test
- Loading branch information
Showing
14 changed files
with
285 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package app | ||
|
||
import ( | ||
"fmt" | ||
|
||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
|
||
"github.com/NibiruChain/nibiru/app/upgrades" | ||
"github.com/NibiruChain/nibiru/app/upgrades/v1_1_0" | ||
) | ||
|
||
var Upgrades = []upgrades.Upgrade{ | ||
v1_1_0.Upgrade, | ||
} | ||
|
||
func (app *NibiruApp) setupUpgrades() { | ||
app.setUpgradeHandlers() | ||
app.setUpgradeStoreLoaders() | ||
} | ||
|
||
func (app *NibiruApp) setUpgradeHandlers() { | ||
for _, u := range Upgrades { | ||
app.upgradeKeeper.SetUpgradeHandler(u.UpgradeName, u.CreateUpgradeHandler()) | ||
} | ||
} | ||
|
||
func (app *NibiruApp) setUpgradeStoreLoaders() { | ||
upgradeInfo, err := app.upgradeKeeper.ReadUpgradeInfoFromDisk() | ||
if err != nil { | ||
panic(fmt.Sprintf("failed to read upgrade info from disk: %s", err.Error())) | ||
} | ||
|
||
if app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) { | ||
return | ||
} | ||
|
||
for _, u := range Upgrades { | ||
if upgradeInfo.Name == u.UpgradeName { | ||
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &u.StoreUpgrades)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package upgrades | ||
|
||
import ( | ||
store "github.com/cosmos/cosmos-sdk/store/types" | ||
"github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
) | ||
|
||
type Upgrade struct { | ||
UpgradeName string | ||
|
||
CreateUpgradeHandler func() types.UpgradeHandler | ||
|
||
StoreUpgrades store.StoreUpgrades | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package v1_1_0 | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/store/types" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
|
||
"github.com/NibiruChain/nibiru/app/upgrades" | ||
inflationtypes "github.com/NibiruChain/nibiru/x/inflation/types" | ||
) | ||
|
||
const UpgradeName = "v1.1.0" | ||
|
||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: UpgradeName, | ||
CreateUpgradeHandler: func() upgradetypes.UpgradeHandler { | ||
return nil | ||
}, | ||
StoreUpgrades: types.StoreUpgrades{ | ||
Added: []string{inflationtypes.ModuleName}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.