-
Notifications
You must be signed in to change notification settings - Fork 0
/
upgrades.go
47 lines (39 loc) · 1.77 KB
/
upgrades.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package nextupgrade
import (
"errors"
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/cosmos/gaia/v8/x/globalfee/types"
"github.com/furyahub/furya/app/upgrades"
)
func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
keepers *upgrades.UpgradeKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("Starting module migrations...")
vm, err := mm.RunMigrations(ctx, configurator, vm)
if err != nil {
return vm, err
}
ctx.Logger().Info("Implementing GlobalFee Params...")
if !keepers.GlobalFeeSubspace.Has(ctx, types.ParamStoreKeyMinGasPrices) {
return vm, errors.New("minimum_gas_prices param not found")
}
// global fee is empty set, set global fee to equal to 0.05 USD (for 200k of gas) in appropriate coin
// As of June 22nd, 2023 this is
// 0.9ufury,0.026ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9,0.25ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349
requiredGlobalFees := sdk.DecCoins{
sdk.NewDecCoinFromDec("ufury", sdk.MustNewDecFromStr("0.9")),
sdk.NewDecCoinFromDec("ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9", sdk.MustNewDecFromStr("0.026")),
sdk.NewDecCoinFromDec("ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349", sdk.MustNewDecFromStr("0.25")),
}
requiredGlobalFees = requiredGlobalFees.Sort()
keepers.GlobalFeeSubspace.Set(ctx, types.ParamStoreKeyMinGasPrices, &requiredGlobalFees)
ctx.Logger().Info("Global fees was set successfully")
ctx.Logger().Info("Upgrade complete")
return vm, err
}
}