deploy underlying warmup right inside the staking constructor

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2026-03-27 16:17:25 +03:00
parent 4fb0b01e3c
commit 93b18e719d
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
3 changed files with 3 additions and 13 deletions

View File

@ -52,6 +52,9 @@ contract GhostStaking is IStaking, GhostAccessControlled {
end: _firstEpochTime, end: _firstEpochTime,
distribute: 0 distribute: 0
}); });
GhostWarmup newWarmup = new GhostWarmup(_ghst);
warmup = address(newWarmup);
} }
function stake( function stake(
@ -180,10 +183,6 @@ contract GhostStaking is IStaking, GhostAccessControlled {
function setWarmupPeriod(uint256 _warmupPeriod) external onlyGovernor { function setWarmupPeriod(uint256 _warmupPeriod) external onlyGovernor {
// forge-lint: disable-next-line(unsafe-typecast) // forge-lint: disable-next-line(unsafe-typecast)
warmupPeriod = uint48(_warmupPeriod); warmupPeriod = uint48(_warmupPeriod);
if (warmup == address(0)) {
GhostWarmup newWarmup = new GhostWarmup(ghst);
warmup = address(newWarmup);
}
emit WarmupSet(_warmupPeriod); emit WarmupSet(_warmupPeriod);
} }
@ -197,9 +196,6 @@ contract GhostStaking is IStaking, GhostAccessControlled {
} }
function supplyInWarmup() public view override returns (uint256) { function supplyInWarmup() public view override returns (uint256) {
if (warmup == address(0)) {
return 0;
}
return IGHST(ghst).balanceFrom(IGhostWarmup(warmup).ghstInWarmup()); return IGHST(ghst).balanceFrom(IGhostWarmup(warmup).ghstInWarmup());
} }

View File

@ -90,9 +90,6 @@ contract GhostBondDepositoryTest is Test {
); );
vm.stopPrank(); vm.stopPrank();
vm.prank(GOVERNOR);
staking.setWarmupPeriod(0);
_createFirstBond(); _createFirstBond();
} }

View File

@ -76,9 +76,6 @@ contract StakingTest is Test {
gatekeeper = new Gatekeeper(address(staking), 0, 0, 0, 0, 0); gatekeeper = new Gatekeeper(address(staking), 0, 0, 0, 0, 0);
calculator = new GhostBondingCalculator(address(ftso), 1, 1); calculator = new GhostBondingCalculator(address(ftso), 1, 1);
vm.stopPrank(); vm.stopPrank();
vm.prank(GOVERNOR);
staking.setWarmupPeriod(0);
} }
function test_correctAfterConstruction() public view { function test_correctAfterConstruction() public view {