-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #787 from cybercongress/v5-hardfork
V5 hardfork
- Loading branch information
Showing
6 changed files
with
77 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package app | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
// BeginBlockForks is intended to be ran in a chain upgrade. | ||
func BeginBlockForks(ctx sdk.Context, app *App) { | ||
for _, fork := range Forks { | ||
if ctx.BlockHeight() == fork.UpgradeHeight { | ||
fork.BeginForkLogic(ctx, &app.AppKeepers) | ||
return | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package v5 | ||
|
||
import ( | ||
"github.com/cybercongress/go-cyber/v5/app/upgrades" | ||
) | ||
|
||
const ( | ||
UpgradeName = "v5" | ||
|
||
UpgradeHeight = 15_700_842 | ||
) | ||
|
||
var Fork = upgrades.Fork{ | ||
UpgradeName: UpgradeName, | ||
UpgradeHeight: UpgradeHeight, | ||
BeginForkLogic: RunForkLogic, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package v5 | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cybercongress/go-cyber/v5/app/keepers" | ||
) | ||
|
||
func RunForkLogic(ctx sdk.Context, keepers *keepers.AppKeepers) { | ||
logger := ctx.Logger().With("upgrade", UpgradeName) | ||
|
||
logger.Info("Applying emergency hard fork for v5") | ||
|
||
liquidityParams := keepers.LiquidityKeeper.GetParams(ctx) | ||
liquidityParams.CircuitBreakerEnabled = true | ||
err := keepers.LiquidityKeeper.SetParams(ctx, liquidityParams) | ||
if err != nil { | ||
panic(err) | ||
} | ||
logger.Info("set liquidity circuit breaker enabled, disable dex") | ||
|
||
keepers.BankKeeper.SetSendEnabled(ctx, "millivolt", false) | ||
keepers.BankKeeper.SetSendEnabled(ctx, "milliampere", false) | ||
|
||
logger.Info("set bank send disabled for millivolt and amperes") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters