From 566bf34febb372df9f5c92889d8f0db926103168 Mon Sep 17 00:00:00 2001 From: Uncle Fatso Date: Thu, 26 Mar 2026 14:12:39 +0300 Subject: [PATCH] update tests based on new logic; should be marginal changes only Signed-off-by: Uncle Fatso --- test/bonding/BondDepositorty.t.sol | 4 ++++ test/staking/Staking.t.sol | 23 ++++++++++++----------- test/tokens/Stnk.t.sol | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/test/bonding/BondDepositorty.t.sol b/test/bonding/BondDepositorty.t.sol index e982c23..3042ab7 100644 --- a/test/bonding/BondDepositorty.t.sol +++ b/test/bonding/BondDepositorty.t.sol @@ -89,6 +89,10 @@ contract GhostBondDepositoryTest is Test { address(weth) ); vm.stopPrank(); + + vm.prank(GOVERNOR); + staking.setWarmupPeriod(0); + _createFirstBond(); } diff --git a/test/staking/Staking.t.sol b/test/staking/Staking.t.sol index 1cc3010..f2c0526 100644 --- a/test/staking/Staking.t.sol +++ b/test/staking/Staking.t.sol @@ -76,6 +76,9 @@ 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 { @@ -139,13 +142,12 @@ contract StakingTest is Test { vm.prank(ALICE); uint256 rebased = staking.stake(AMOUNT, ALICE, false, false); - assertEq(ftso.balanceOf(ALICE), 0); - assertEq(staking.sharesInWarmup(), stnk.sharesForBalance(rebased)); + assertApproxEqAbs(staking.supplyInWarmup(), rebased, 1); - (uint256 deposit, uint256 shares, uint48 expiry, bool lock) = staking.warmupInfo(ALICE); + (uint256 deposit, uint256 payout, uint48 expiry, bool lock) = staking.warmupInfo(ALICE); assertEq(deposit, AMOUNT); - assertEq(shares, stnk.sharesForBalance(AMOUNT)); + assertEq(payout, ghst.balanceTo(AMOUNT)); assertEq(expiry, 1); assertEq(lock, false); } @@ -179,11 +181,11 @@ contract StakingTest is Test { uint256 rebased = staking.stake(AMOUNT, ALICE, false, true); assertEq(ftso.balanceOf(ALICE), 0); - assertEq(staking.sharesInWarmup(), stnk.sharesForBalance(rebased)); + assertApproxEqAbs(staking.supplyInWarmup(), rebased, 1); - (uint256 deposit, uint256 shares, uint48 expiry, bool lock) = staking.warmupInfo(ALICE); + (uint256 deposit, uint256 payout, uint48 expiry, bool lock) = staking.warmupInfo(ALICE); assertEq(deposit, AMOUNT); - assertEq(shares, stnk.sharesForBalance(AMOUNT)); + assertEq(payout, ghst.balanceTo(AMOUNT)); assertEq(expiry, 2); assertEq(lock, false); } @@ -248,6 +250,7 @@ contract StakingTest is Test { assertEq(ghst.balanceOf(ALICE), 0); vm.prank(BOB); uint256 rebased = staking.claim(ALICE, false); + assertEq(ghst.balanceOf(ALICE), rebased); assertEq(rebased > 0, true); } @@ -278,13 +281,11 @@ contract StakingTest is Test { _prepareAndRoll(ALICE, AMOUNT, false, false); assertEq(ftso.balanceOf(ALICE), 0); - assertEq(staking.sharesInWarmup(), stnk.sharesForBalance(AMOUNT)); - vm.prank(ALICE); uint256 deposit = staking.forfeit(); assertEq(ftso.balanceOf(ALICE), deposit); - assertEq(staking.sharesInWarmup(), 0); + assertEq(staking.supplyInWarmup(), 0); (uint256 depositInWarmup, uint256 shares, uint48 expiry,) = staking.warmupInfo(ALICE); assertEq(depositInWarmup, 0); @@ -297,7 +298,7 @@ contract StakingTest is Test { uint256 deposit = staking.forfeit(); assertEq(deposit, 0); assertEq(ftso.balanceOf(ALICE), 0); - assertEq(staking.sharesInWarmup(), 0); + assertEq(staking.supplyInWarmup(), 0); } function test_unstake_canRedeemStinkyToFatso() public { diff --git a/test/tokens/Stnk.t.sol b/test/tokens/Stnk.t.sol index 04abbfe..7c70394 100644 --- a/test/tokens/Stnk.t.sol +++ b/test/tokens/Stnk.t.sol @@ -150,7 +150,7 @@ contract StinkyTest is Test, ERC20PermitTest, ERC20AllowanceTest, ERC20TransferT staking.stake(AMOUNT, ALICE, true, true); vm.stopPrank(); - assertEq(stnk.circulatingSupply(), AMOUNT); + assertApproxEqAbs(stnk.circulatingSupply(), AMOUNT, 1); assertEq(ftso.totalSupply(), AMOUNT); assertEq(stnk.totalSupply(), TOTAL_INITIAL_SUPPLY); assertEq(stnk.balanceOf(address(staking)), TOTAL_INITIAL_SUPPLY);