Skip to content

Commit

Permalink
fork v4_5_1 remove rate limit: (ComposableFi#225)
Browse files Browse the repository at this point in the history
* fork v5 remove rate limit:

* add to Fork list
  • Loading branch information
GNaD13 authored Aug 18, 2023
1 parent e2b159c commit 6d23a17
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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
Expand Down
18 changes: 18 additions & 0 deletions app/upgrades/v4_5_1/constants.go
Original file line number Diff line number Diff line change
@@ -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,
}
26 changes: 26 additions & 0 deletions app/upgrades/v4_5_1/fork.go
Original file line number Diff line number Diff line change
@@ -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)
}
}
}

0 comments on commit 6d23a17

Please sign in to comment.