Skip to content

Commit

Permalink
Merge pull request #679 from UnUniFi/v3.2.1-fix-fee-controller
Browse files Browse the repository at this point in the history
v3.2.1 fix FeeCollectorAddress
  • Loading branch information
Senna46 authored Aug 15, 2023
2 parents 4da5b9d + 75cf2f5 commit 3f649a6
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import (
v3 "github.com/UnUniFi/chain/app/upgrades/v3"
v3_1 "github.com/UnUniFi/chain/app/upgrades/v3.1"
v3_2 "github.com/UnUniFi/chain/app/upgrades/v3.2"
v3_2_1 "github.com/UnUniFi/chain/app/upgrades/v3.2.1"
)

const Name = "ununifi"
Expand Down Expand Up @@ -104,7 +105,7 @@ var (
stakeibctypes.ModuleName: true,
}

Upgrades = []upgrades.Upgrade{v3.Upgrade, v3_1.Upgrade, v3_2.Upgrade}
Upgrades = []upgrades.Upgrade{v3.Upgrade, v3_1.Upgrade, v3_2.Upgrade, v3_2_1.Upgrade}
)

var (
Expand Down
22 changes: 22 additions & 0 deletions app/upgrades/v3.2.1/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package v3_2_1

import (
store "github.com/cosmos/cosmos-sdk/store/types"

ibchookstypes "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/types"
buildertypes "github.com/skip-mev/pob/x/builder/types"

"github.com/UnUniFi/chain/app/upgrades"
nftfactorytypes "github.com/UnUniFi/chain/x/nftfactory/types"
)

const UpgradeName string = "v3_2_1"

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{nftfactorytypes.StoreKey, buildertypes.StoreKey, ibchookstypes.StoreKey},
Deleted: []string{},
},
}
48 changes: 48 additions & 0 deletions app/upgrades/v3.2.1/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package v3_2_1

import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"

authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"

"github.com/UnUniFi/chain/app/keepers"
"github.com/UnUniFi/chain/app/upgrades"
yieldaggregatortypes "github.com/UnUniFi/chain/x/yieldaggregator/types"
)

func CreateUpgradeHandler(mm *module.Manager,
configurator module.Configurator,
_ upgrades.BaseAppParamManager,
keepers *keepers.AppKeepers) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info(fmt.Sprintf("update start:%s", UpgradeName))

iyaParams := yieldaggregatortypes.Params{}
paramtypes.NewKeyTable().RegisterParamSet(&yieldaggregatortypes.Params{})
keepers.GetSubspace(yieldaggregatortypes.ModuleName).WithKeyTable(yieldaggregatortypes.ParamKeyTable()).GetParamSet(ctx, &iyaParams)

vm, err := mm.RunMigrations(ctx, configurator, vm)
if err != nil {
return vm, err
}

factoryParam, err := keepers.NftfactoryKeeper.GetParams(ctx)
if err != nil {
return vm, err
}
factoryParam.ClassCreationFee = []sdk.Coin{}
factoryParam.FeeCollectorAddress = ""
_ = keepers.NftfactoryKeeper.SetParams(ctx, factoryParam)

iyaParams.FeeCollectorAddress = keepers.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName).GetAddress().String()
_ = keepers.YieldaggregatorKeeper.SetParams(ctx, &iyaParams)

return vm, nil
}
}

0 comments on commit 3f649a6

Please sign in to comment.