BUG: could not do breakout after bond claim

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2026-05-07 16:52:35 +03:00
parent 904e817c30
commit b8a11ee3c1
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB

View File

@ -9,6 +9,7 @@ import {GhostAuthority} from "../../src/GhostAuthority.sol";
import {GhostTreasury} from "../../src/Treasury.sol"; import {GhostTreasury} from "../../src/Treasury.sol";
import {GhostStaking} from "../../src/Staking.sol"; import {GhostStaking} from "../../src/Staking.sol";
import {GhostBondDepository} from "../../src/BondDepository.sol"; import {GhostBondDepository} from "../../src/BondDepository.sol";
import {Gatekeeper} from "../../src/Gatekeeper.sol";
import {ERC20Mock} from "../../src/mocks/ERC20Mock.sol"; import {ERC20Mock} from "../../src/mocks/ERC20Mock.sol";
import {WETH9} from "../../src/mocks/WETH9.sol"; import {WETH9} from "../../src/mocks/WETH9.sol";
import {GhostBondingCalculator} from "../../src/StandardBondingCalculator.sol"; import {GhostBondingCalculator} from "../../src/StandardBondingCalculator.sol";
@ -35,6 +36,7 @@ contract GhostBondDepositoryTest is Test {
address constant POLICY = 0x0000000000000000000000000000000000000005; address constant POLICY = 0x0000000000000000000000000000000000000005;
address constant VAULT = 0x0000000000000000000000000000000000000006; address constant VAULT = 0x0000000000000000000000000000000000000006;
address constant ALICE = 0x0000000000000000000000000000000000000007; address constant ALICE = 0x0000000000000000000000000000000000000007;
address constant BOB = 0x0000000000000000000000000000000000000008;
uint256 public constant VESTING = 100; uint256 public constant VESTING = 100;
uint256 public constant TIME_TO_CONCLUSION = 60 * 60 * 24; uint256 public constant TIME_TO_CONCLUSION = 60 * 60 * 24;
@ -111,6 +113,11 @@ contract GhostBondDepositoryTest is Test {
reserve.approve(address(depository), type(uint256).max); reserve.approve(address(depository), type(uint256).max);
vm.stopPrank(); 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; conclusion = block.timestamp + TIME_TO_CONCLUSION;
vm.prank(POLICY); vm.prank(POLICY);
@ -313,6 +320,30 @@ contract GhostBondDepositoryTest is Test {
assertEq(ftso.balanceOf(ALICE), balance); 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 { function test_shouldRedeemAfterVested() public {
uint256 amount = 10_000 * 1e18; // 10,000 uint256 amount = 10_000 * 1e18; // 10,000
vm.startPrank(ALICE); vm.startPrank(ALICE);