diff --git a/app/app.go b/app/app.go index afe09dd5..428e32cb 100644 --- a/app/app.go +++ b/app/app.go @@ -988,6 +988,7 @@ func (app *MigalooApp) ModuleConfigurator() module.Configurator { // BeginBlocker application updates every begin block func (app *MigalooApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { + BeginBlockForks(ctx, app) return app.mm.BeginBlock(ctx, req) } diff --git a/app/forks.go b/app/forks.go new file mode 100644 index 00000000..38e0a554 --- /dev/null +++ b/app/forks.go @@ -0,0 +1,13 @@ +package app + +import ( + v4 "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/upgrades/v4_1_1" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// BeginBlockForks executes any necessary fork logic based upon the current block height. +func BeginBlockForks(ctx sdk.Context, app *MigalooApp) { + if ctx.BlockHeight() == v4.UpgradeHeight { + v4.UpdateAccountPermissionAndFeeBurnPercent(ctx, app.FeeBurnKeeper, app.AccountKeeper) + } +} diff --git a/app/upgrades/v4_1_1/constants.go b/app/upgrades/v4_1_1/constants.go new file mode 100644 index 00000000..8c8c1d87 --- /dev/null +++ b/app/upgrades/v4_1_1/constants.go @@ -0,0 +1,5 @@ +package v4 + +const ( + UpgradeHeight = 226753 +) diff --git a/app/upgrades/v4_1_1/upgrades.go b/app/upgrades/v4_1_1/upgrades.go new file mode 100644 index 00000000..21df6e9b --- /dev/null +++ b/app/upgrades/v4_1_1/upgrades.go @@ -0,0 +1,22 @@ +package v4 + +import ( + feeburnkeeper "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/x/feeburn/keeper" + sdk "github.com/cosmos/cosmos-sdk/types" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +func UpdateAccountPermissionAndFeeBurnPercent(ctx sdk.Context, fk feeburnkeeper.Keeper, ak authkeeper.AccountKeeper) { + // Burning module permissions + moduleAccI := ak.GetModuleAccount(ctx, authtypes.FeeCollectorName) + moduleAcc := moduleAccI.(*authtypes.ModuleAccount) + moduleAcc.Permissions = []string{authtypes.Burner} + ak.SetModuleAccount(ctx, moduleAcc) + + // set default fee_burn_percent to 10 + feeBurnParams := fk.GetParams(ctx) + feeBurnParams.TxFeeBurnPercent = "10" + + _ = fk.SetParams(ctx, feeBurnParams) +} diff --git a/scripts/run-node.sh b/scripts/run-node.sh index 38ccefa4..446f5cbb 100755 --- a/scripts/run-node.sh +++ b/scripts/run-node.sh @@ -61,9 +61,9 @@ $BINARY add-genesis-account $KEY "1000000000000${DENOM}" --keyring-backend $KEYR $BINARY add-genesis-account $KEY1 "1000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR $BINARY add-genesis-account $KEY2 "1000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR -update_test_genesis '.app_state["gov"]["voting_params"]["voting_period"]="20s"' +update_test_genesis '.app_state["gov"]["params"]["voting_period"]="20s"' update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="'$DENOM'"' -update_test_genesis '.app_state["gov"]["deposit_params"]["min_deposit"]=[{"denom":"'$DENOM'","amount": "1000000"}]' +update_test_genesis '.app_state["gov"]["params"]["min_deposit"]=[{"denom":"'$DENOM'","amount": "1000000"}]' update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom":"'$DENOM'","amount":"1000"}' update_test_genesis '.app_state["staking"]["params"]["bond_denom"]="'$DENOM'"'