diff --git a/app/app.go b/app/app.go index 17735a958..0cf2dbd9e 100644 --- a/app/app.go +++ b/app/app.go @@ -113,6 +113,7 @@ import ( wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" v4_5 "github.com/notional-labs/centauri/v4/app/upgrades/v4_5" + v4_5_1 "github.com/notional-labs/centauri/v4/app/upgrades/v4_5_1" upgrades "github.com/notional-labs/centauri/v4/app/upgrades" ) @@ -133,7 +134,7 @@ var ( EnableSpecificProposals = "" Upgrades = []upgrades.Upgrade{v4.Upgrade} - Forks = []upgrades.Fork{v4_5.Fork} + Forks = []upgrades.Fork{v4_5.Fork, v4_5_1.Fork} ) // GetEnabledProposals parses the ProposalsEnabled / EnableSpecificProposals values to diff --git a/app/upgrades/v4_5_1/constants.go b/app/upgrades/v4_5_1/constants.go new file mode 100644 index 000000000..1194e342d --- /dev/null +++ b/app/upgrades/v4_5_1/constants.go @@ -0,0 +1,18 @@ +package v4_5_1 + +import "github.com/notional-labs/centauri/v4/app/upgrades" + +const ( + // UpgradeName defines the on-chain upgrade name for the Composable v5 upgrade. + UpgradeName = "v4_5_1" + + // UpgradeHeight defines the block height at which the Composable v6 upgrade is + // triggered. + UpgradeHeight = 1_117_000 +) + +var Fork = upgrades.Fork{ + UpgradeName: UpgradeName, + UpgradeHeight: UpgradeHeight, + BeginForkLogic: RunForkLogic, +} diff --git a/app/upgrades/v4_5_1/fork.go b/app/upgrades/v4_5_1/fork.go new file mode 100644 index 000000000..8298da52b --- /dev/null +++ b/app/upgrades/v4_5_1/fork.go @@ -0,0 +1,26 @@ +package v4_5_1 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/notional-labs/centauri/v4/app/keepers" + rateLimitKeeper "github.com/notional-labs/centauri/v4/x/ratelimit/keeper" +) + +func RunForkLogic(ctx sdk.Context, keepers *keepers.AppKeepers) { + ctx.Logger().Info("Applying v5 upgrade" + + "Remove Rate Limit", + ) +} + +func RemoveRateLimit(ctx sdk.Context, rlKeeper *rateLimitKeeper.Keeper) { + // Get all current rate limit + rateLimits := rlKeeper.GetAllRateLimits(ctx) + // Remove Rate limit + for _, rateLimit := range rateLimits { + err := rlKeeper.RemoveRateLimit(ctx, rateLimit.Path.Denom, rateLimit.Path.ChannelId) + if err != nil { + panic(err) + } + } +}