From 8bda247788ba0ebd862940786b7abc3ee2c80131 Mon Sep 17 00:00:00 2001 From: Anh Minh <1phamminh0811@gmail.com> Date: Tue, 17 Sep 2024 11:21:38 +0700 Subject: [PATCH] Update app for testnet --- app/app.go | 4 ++++ app/upgrades/v8_2/constants.go | 13 +++++++++++++ app/upgrades/v8_2/upgrades.go | 24 ++++++++++++++++++++++++ app/upgrades/v9_1/constants.go | 12 ++++++++++++ app/upgrades/v9_1/upgrades.go | 31 +++++++++++++++++++++++++++++++ 5 files changed, 84 insertions(+) create mode 100644 app/upgrades/v8_2/constants.go create mode 100644 app/upgrades/v8_2/upgrades.go create mode 100644 app/upgrades/v9_1/constants.go create mode 100644 app/upgrades/v9_1/upgrades.go diff --git a/app/app.go b/app/app.go index bed5b17c..2371d4f8 100644 --- a/app/app.go +++ b/app/app.go @@ -56,7 +56,9 @@ import ( v7_1 "github.com/classic-terra/core/v3/app/upgrades/v7_1" v8 "github.com/classic-terra/core/v3/app/upgrades/v8" v8_1 "github.com/classic-terra/core/v3/app/upgrades/v8_1" + v8_2 "github.com/classic-terra/core/v3/app/upgrades/v8_2" v9 "github.com/classic-terra/core/v3/app/upgrades/v9" + v9_1 "github.com/classic-terra/core/v3/app/upgrades/v9_1" customante "github.com/classic-terra/core/v3/custom/auth/ante" custompost "github.com/classic-terra/core/v3/custom/auth/post" @@ -89,6 +91,8 @@ var ( v8.Upgrade, v8_1.Upgrade, v9.Upgrade, + v8_2.Upgrade, + v9_1.Upgrade, } // Forks defines forks to be applied to the network diff --git a/app/upgrades/v8_2/constants.go b/app/upgrades/v8_2/constants.go new file mode 100644 index 00000000..9a373906 --- /dev/null +++ b/app/upgrades/v8_2/constants.go @@ -0,0 +1,13 @@ +//nolint:revive +package v8_2 + +import ( + "github.com/classic-terra/core/v3/app/upgrades" +) + +const UpgradeName = "v8_2" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateV82UpgradeHandler, +} diff --git a/app/upgrades/v8_2/upgrades.go b/app/upgrades/v8_2/upgrades.go new file mode 100644 index 00000000..0e047117 --- /dev/null +++ b/app/upgrades/v8_2/upgrades.go @@ -0,0 +1,24 @@ +//nolint:revive +package v8_2 + +import ( + "github.com/classic-terra/core/v3/app/keepers" + "github.com/classic-terra/core/v3/app/upgrades" + treasurytypes "github.com/classic-terra/core/v3/x/treasury/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func CreateV82UpgradeHandler( + mm *module.Manager, + cfg module.Configurator, + _ upgrades.BaseAppParamManager, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + // set default oracle split + keepers.TreasuryKeeper.SetOracleSplitRate(ctx, treasurytypes.DefaultOracleSplit) + return mm.RunMigrations(ctx, cfg, fromVM) + } +} diff --git a/app/upgrades/v9_1/constants.go b/app/upgrades/v9_1/constants.go new file mode 100644 index 00000000..6b887852 --- /dev/null +++ b/app/upgrades/v9_1/constants.go @@ -0,0 +1,12 @@ +package v91 + +import ( + "github.com/classic-terra/core/v3/app/upgrades" +) + +const UpgradeName = "v9_1" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateV91UpgradeHandler, +} diff --git a/app/upgrades/v9_1/upgrades.go b/app/upgrades/v9_1/upgrades.go new file mode 100644 index 00000000..7872684c --- /dev/null +++ b/app/upgrades/v9_1/upgrades.go @@ -0,0 +1,31 @@ +package v91 + +import ( + "github.com/classic-terra/core/v3/app/keepers" + "github.com/classic-terra/core/v3/app/upgrades" + tax2gastypes "github.com/classic-terra/core/v3/x/tax2gas/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func CreateV91UpgradeHandler( + mm *module.Manager, + cfg module.Configurator, + _ upgrades.BaseAppParamManager, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + // set default oracle split + keepers.TreasuryKeeper.SetTaxRate(ctx, sdk.ZeroDec()) + + tax2gasParams := tax2gastypes.DefaultParams() + tax2gasParams.GasPrices = sdk.NewDecCoins( + sdk.NewDecCoinFromDec("uluna", sdk.NewDecWithPrec(28325, 3)), + sdk.NewDecCoinFromDec("uusd", sdk.NewDecWithPrec(75, 2)), + ) + tax2gasParams.MaxTotalBypassMinFeeMsgGasUsage = 200000 + keepers.Tax2gasKeeper.SetParams(ctx, tax2gasParams) + return mm.RunMigrations(ctx, cfg, fromVM) + } +}