From b8a11ee3c132af154050e85182721709078c3390 Mon Sep 17 00:00:00 2001 From: Uncle Fatso Date: Thu, 7 May 2026 16:52:35 +0300 Subject: [PATCH] BUG: could not do breakout after bond claim Signed-off-by: Uncle Fatso --- test/bonding/BondDepositorty.t.sol | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/bonding/BondDepositorty.t.sol b/test/bonding/BondDepositorty.t.sol index 85a1a2b..b49a4ce 100644 --- a/test/bonding/BondDepositorty.t.sol +++ b/test/bonding/BondDepositorty.t.sol @@ -9,6 +9,7 @@ import {GhostAuthority} from "../../src/GhostAuthority.sol"; import {GhostTreasury} from "../../src/Treasury.sol"; import {GhostStaking} from "../../src/Staking.sol"; import {GhostBondDepository} from "../../src/BondDepository.sol"; +import {Gatekeeper} from "../../src/Gatekeeper.sol"; import {ERC20Mock} from "../../src/mocks/ERC20Mock.sol"; import {WETH9} from "../../src/mocks/WETH9.sol"; import {GhostBondingCalculator} from "../../src/StandardBondingCalculator.sol"; @@ -35,6 +36,7 @@ contract GhostBondDepositoryTest is Test { address constant POLICY = 0x0000000000000000000000000000000000000005; address constant VAULT = 0x0000000000000000000000000000000000000006; address constant ALICE = 0x0000000000000000000000000000000000000007; + address constant BOB = 0x0000000000000000000000000000000000000008; uint256 public constant VESTING = 100; uint256 public constant TIME_TO_CONCLUSION = 60 * 60 * 24; @@ -111,6 +113,11 @@ contract GhostBondDepositoryTest is Test { reserve.approve(address(depository), type(uint256).max); vm.stopPrank(); + vm.startPrank(BOB); + reserve.mint(BOB, INITIAL_MINT); + reserve.approve(address(depository), type(uint256).max); + vm.stopPrank(); + conclusion = block.timestamp + TIME_TO_CONCLUSION; vm.prank(POLICY); @@ -313,6 +320,30 @@ contract GhostBondDepositoryTest is Test { assertEq(ftso.balanceOf(ALICE), balance); } + function test_shouldBePossibleToBreakoutAfterClaim() public { + uint256 amount = 10_000 * 1e18; // 10,000 + + vm.startPrank(GOVERNOR); + Gatekeeper gatekeeper = new Gatekeeper(address(staking), 0, 0, 0, 0, 0); + staking.setGatekeeperAddress(address(gatekeeper)); + staking.setWarmupPeriod(1); + vm.stopPrank(); + + vm.startPrank(ALICE); + depository.deposit(0, amount, type(uint256).max, ALICE, ALICE); + vm.startPrank(BOB); + depository.deposit(0, amount, type(uint256).max, BOB, BOB); + + skip(DEPOSIT_INTERVAL); + staking.rebase(); + + vm.startPrank(ALICE); + depository.redeemAll(ALICE, true); + + vm.startPrank(BOB); + depository.forceRedeemAll(bytes32(0)); + } + function test_shouldRedeemAfterVested() public { uint256 amount = 10_000 * 1e18; // 10,000 vm.startPrank(ALICE);