From 1cdb42dc8a64aad94f06fbe42d2dd55c6bd8fe6a Mon Sep 17 00:00:00 2001 From: MD Aleem <72057206+aleem1314@users.noreply.github.com> Date: Mon, 21 Aug 2023 21:15:02 +0530 Subject: [PATCH] feat: add IBC transfer params hard fork (#122) --- app/app.go | 1 + app/forks.go | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 app/forks.go diff --git a/app/app.go b/app/app.go index 442660d..4a4ba26 100644 --- a/app/app.go +++ b/app/app.go @@ -643,6 +643,7 @@ func (app *PassageApp) Name() string { return app.BaseApp.Name() } // BeginBlocker application updates every begin block func (app *PassageApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { + BeginBlockFork(ctx, app) return app.mm.BeginBlock(ctx, req) } diff --git a/app/forks.go b/app/forks.go new file mode 100644 index 0000000..b4d1cd0 --- /dev/null +++ b/app/forks.go @@ -0,0 +1,19 @@ +package app + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" +) + +const forkHeight = 4426144 + +// BeginBlockFork updates, the IBC Transfer module's SendEnabled and ReceiveEnabled parameters are set to true. +func BeginBlockFork(ctx sdk.Context, app *PassageApp) { + if ctx.BlockHeight() == forkHeight { + ctx.Logger().Info("Applying Passage v2.1 upgrade. Enabling IBC transfers") + app.TransferKeeper.SetParams(ctx, types.Params{ + SendEnabled: true, + ReceiveEnabled: true, + }) + } +}