-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #216 from neutron-org/feat/NTRN-430-commission-for…
…-tokenfactory feat: NTRN-430. Add commission for Token Factory
- Loading branch information
Showing
28 changed files
with
2,074 additions
and
2,368 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,15 @@ | ||
package v044 | ||
|
||
import ( | ||
"github.com/neutron-org/neutron/app/upgrades" | ||
) | ||
|
||
const ( | ||
// UpgradeName defines the on-chain upgrades name. | ||
UpgradeName = "v0.4.4" | ||
) | ||
|
||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: UpgradeName, | ||
CreateUpgradeHandler: CreateUpgradeHandler, | ||
} |
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,58 @@ | ||
package v044 | ||
|
||
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" | ||
|
||
feeburnertypes "github.com/neutron-org/neutron/x/feeburner/types" | ||
tokenfactorytypes "github.com/neutron-org/neutron/x/tokenfactory/types" | ||
|
||
"github.com/neutron-org/neutron/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("Migrating SlashingKeeper Params...") | ||
oldSlashingParams := keepers.SlashingKeeper.GetParams(ctx) | ||
oldSlashingParams.SignedBlocksWindow = int64(36000) | ||
|
||
keepers.SlashingKeeper.SetParams(ctx, oldSlashingParams) | ||
|
||
ctx.Logger().Info("Migrating FeeBurner Params...") | ||
s, ok := keepers.ParamsKeeper.GetSubspace(feeburnertypes.ModuleName) | ||
if !ok { | ||
return nil, errors.New("global fee burner params subspace not found") | ||
} | ||
var reserveAddress string | ||
s.Get(ctx, feeburnertypes.KeyReserveAddress, &reserveAddress) | ||
|
||
var neutronDenom string | ||
s.Get(ctx, feeburnertypes.KeyNeutronDenom, &neutronDenom) | ||
|
||
feeburnerDefaultParams := feeburnertypes.DefaultParams() | ||
feeburnerDefaultParams.TreasuryAddress = reserveAddress | ||
feeburnerDefaultParams.NeutronDenom = neutronDenom | ||
keepers.FeeBurnerKeeper.SetParams(ctx, feeburnerDefaultParams) | ||
|
||
ctx.Logger().Info("Migrating TokenFactory Params...") | ||
tokenfactoryDefaultParams := tokenfactorytypes.DefaultParams() | ||
tokenfactoryDefaultParams.FeeCollectorAddress = reserveAddress | ||
keepers.TokenFactoryKeeper.SetParams(ctx, tokenfactoryDefaultParams) | ||
|
||
ctx.Logger().Info("Upgrade complete") | ||
return vm, err | ||
} | ||
} |
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.