Skip to content

Commit

Permalink
feat: add MsgSideChainStakeMigration and StakeMigrationApp
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed Jan 6, 2024
1 parent 49902aa commit 4944724
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import (
"github.com/bnb-chain/node/plugins/tokens/swap"
"github.com/bnb-chain/node/plugins/tokens/timelock"
"github.com/bnb-chain/node/wire"
stakeMigration "github.com/cosmos/cosmos-sdk/x/stake/stake_migration"
)

const (
Expand Down Expand Up @@ -623,6 +624,11 @@ func (app *BNBBeaconChain) initStaking() {
newCtx := ctx.WithSideChainKeyPrefix(storePrefix)
app.stakeKeeper.ClearUpSideVoteAddrs(newCtx)
})
upgrade.Mgr.RegisterBeginBlocker(sdk.FirstSunsetFork, func(ctx sdk.Context) {
chainId := sdk.ChainID(ServerContext.BscIbcChainId)
// enable channel but not send cross chain msg
app.scKeeper.SetChannelSendPermission(ctx, chainId, sTypes.StakeMigrationChannelID, sdk.ChannelAllow)
})
app.stakeKeeper.SubscribeParamChange(app.ParamHub)
app.stakeKeeper.SubscribeBCParamChange(app.ParamHub)
app.stakeKeeper = app.stakeKeeper.WithHooks(app.slashKeeper.Hooks())
Expand All @@ -633,6 +639,13 @@ func (app *BNBBeaconChain) initStaking() {
if err != nil {
panic(err)
}

// register stake migration channel
stakeMigrationApp := stakeMigration.NewStakeMigrationApp(app.stakeKeeper)
err = app.scKeeper.RegisterChannel(sTypes.StakeMigrationChannel, sTypes.StakeMigrationChannelID, stakeMigrationApp)
if err != nil {
panic(err)
}
}

func (app *BNBBeaconChain) initGov() {
Expand Down

0 comments on commit 4944724

Please sign in to comment.