From 93b18e719d9e3044b5dc03a50b51d60ee2dcb46b Mon Sep 17 00:00:00 2001 From: Uncle Fatso Date: Fri, 27 Mar 2026 16:17:25 +0300 Subject: [PATCH] deploy underlying warmup right inside the staking constructor Signed-off-by: Uncle Fatso --- src/Staking.sol | 10 +++------- test/bonding/BondDepositorty.t.sol | 3 --- test/staking/Staking.t.sol | 3 --- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Staking.sol b/src/Staking.sol index d2fad5a..bc57da7 100644 --- a/src/Staking.sol +++ b/src/Staking.sol @@ -52,6 +52,9 @@ contract GhostStaking is IStaking, GhostAccessControlled { end: _firstEpochTime, distribute: 0 }); + + GhostWarmup newWarmup = new GhostWarmup(_ghst); + warmup = address(newWarmup); } function stake( @@ -180,10 +183,6 @@ contract GhostStaking is IStaking, GhostAccessControlled { function setWarmupPeriod(uint256 _warmupPeriod) external onlyGovernor { // forge-lint: disable-next-line(unsafe-typecast) warmupPeriod = uint48(_warmupPeriod); - if (warmup == address(0)) { - GhostWarmup newWarmup = new GhostWarmup(ghst); - warmup = address(newWarmup); - } emit WarmupSet(_warmupPeriod); } @@ -197,9 +196,6 @@ contract GhostStaking is IStaking, GhostAccessControlled { } function supplyInWarmup() public view override returns (uint256) { - if (warmup == address(0)) { - return 0; - } return IGHST(ghst).balanceFrom(IGhostWarmup(warmup).ghstInWarmup()); } diff --git a/test/bonding/BondDepositorty.t.sol b/test/bonding/BondDepositorty.t.sol index 3042ab7..85a1a2b 100644 --- a/test/bonding/BondDepositorty.t.sol +++ b/test/bonding/BondDepositorty.t.sol @@ -90,9 +90,6 @@ contract GhostBondDepositoryTest is Test { ); vm.stopPrank(); - vm.prank(GOVERNOR); - staking.setWarmupPeriod(0); - _createFirstBond(); } diff --git a/test/staking/Staking.t.sol b/test/staking/Staking.t.sol index 26ca8e7..bd31e4c 100644 --- a/test/staking/Staking.t.sol +++ b/test/staking/Staking.t.sol @@ -76,9 +76,6 @@ contract StakingTest is Test { gatekeeper = new Gatekeeper(address(staking), 0, 0, 0, 0, 0); calculator = new GhostBondingCalculator(address(ftso), 1, 1); vm.stopPrank(); - - vm.prank(GOVERNOR); - staking.setWarmupPeriod(0); } function test_correctAfterConstruction() public view {