Skip to content

Commit

Permalink
implementation for setting the transition timewindow length
Browse files Browse the repository at this point in the history
  • Loading branch information
SurfingNerd committed Oct 4, 2023
1 parent 04ac429 commit f732503
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions contracts/base/StakingHbbftBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,14 @@ contract StakingHbbftBase is Initializable, OwnableUpgradeable, IStakingHbbft {
_removePool(stakingAddress);
}

function setStakingTransitionTimeframeLength(uint256 _value)
external
onlyOwner {
require(_value > 10, "The transition timeframe must be longer than 10");
require(_value < stakingFixedEpochDuration, "The transition timeframe must be smaller than the epoch duration");

stakingTransitionTimeframeLength = _value;
}
/// @dev Sets the timetamp of the current epoch's last block as the start time of the upcoming staking epoch.
/// Called by the `ValidatorSetHbbft.newValidatorSet` function at the last block of a staking epoch.
/// @param _timestamp The starting time of the very first block in the upcoming staking epoch.
Expand Down
21 changes: 21 additions & 0 deletions scripts/upgrade_contracts2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ethers, upgrades } from "hardhat";


async function upgrade() {

const [deployer] = await ethers.getSigners();

console.log("upgrading with account from: ", deployer.address);

let stakingContract = await ethers.getContractAt("StakingHbbft", "0x1100000000000000000000000000000000000001");

let txResult = await stakingContract.setStakingTransitionTimeframeLength(300);

console.log("Done.", txResult);
}


upgrade().catch((error) => {
console.error(error);
process.exitCode = 1;
});

0 comments on commit f732503

Please sign in to comment.