Skip to content

Commit

Permalink
Adjusted the code block to keep the legacy disable for sync consensus…
Browse files Browse the repository at this point in the history
…, added new block for re-enabling of IBCs
  • Loading branch information
edk208 committed Dec 5, 2022
1 parent 54c0b9c commit 7deb009
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ func (app *TerraApp) Name() string { return app.BaseApp.Name() }

// BeginBlocker application updates every begin block
func (app *TerraApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
if ctx.ChainID() == core.ColumbusChainID && ctx.BlockHeight() == core.SwapEnableForkHeight { // Make min spread to one to disable swap
if ctx.ChainID() == core.ColumbusChainID && ctx.BlockHeight() == core.SwapDisableForkHeight { // Make min spread to one to disable swap
params := app.MarketKeeper.GetParams(ctx)
params.MinStabilitySpread = sdk.OneDec()
app.MarketKeeper.SetParams(ctx, params)
Expand All @@ -604,6 +604,23 @@ func (app *TerraApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) a
panic(fmt.Sprintf("%s not found", channelID))
}

channel.State = ibcchanneltypes.CLOSED
app.IBCKeeper.ChannelKeeper.SetChannel(ctx, ibctransfertypes.PortID, channelID, channel)
}
}
if ctx.ChainID() == core.ColumbusChainID && ctx.BlockHeight() == core.SwapEnableForkHeight { // Re-enable IBCs
// Enable IBC Channels
channelIDs := []string{
"channel-1", // Osmosis
"channel-49", // Crescent
"channel-20", // Juno
}
for _, channelID := range channelIDs {
channel, found := app.IBCKeeper.ChannelKeeper.GetChannel(ctx, ibctransfertypes.PortID, channelID)
if !found {
panic(fmt.Sprintf("%s not found", channelID))
}

channel.State = ibcchanneltypes.OPEN
app.IBCKeeper.ChannelKeeper.SetChannel(ctx, ibctransfertypes.PortID, channelID, channel)
}
Expand Down

0 comments on commit 7deb009

Please sign in to comment.