test added; is it possible to breakout for each participant from bond depository if warmup is changed

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2026-05-11 16:06:22 +03:00
parent 17e82c809c
commit b586b07c24
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB

View File

@ -493,4 +493,53 @@ contract GhostBondDepositoryTest is Test {
assertEq(ALICE.balance, amount);
assertEq(IERC20(address(weth)).balanceOf(address(treasury)), 0);
}
function test_forceRedeemWorksBasedOnTheBalanceRemidner() public {
uint256 aliceAmount = _createNativeBond();
uint256 aliceAmountUsed = aliceAmount / 8;
assertEq(ALICE.balance, aliceAmount);
uint256 i;
for (; i < 8; ) {
vm.prank(ALICE);
depository.deposit{value: aliceAmountUsed}(1, aliceAmountUsed, type(uint256).max, ALICE, ALICE);
unchecked { ++i; }
}
vm.startPrank(GOVERNOR);
Gatekeeper gatekeeper = new Gatekeeper(address(staking), 0, 0, 0, 0, 0);
staking.setGatekeeperAddress(address(gatekeeper));
staking.setWarmupPeriod(10);
vm.stopPrank();
uint256 bobAmount = aliceAmount / 2;
uint256 bobAmountUsed = bobAmount / 8;
vm.deal(BOB, bobAmount);
assertEq(BOB.balance, bobAmount);
i = 0;
for (; i < 7; ) {
vm.prank(BOB);
depository.deposit{value: bobAmountUsed}(1, bobAmountUsed, type(uint256).max, BOB, BOB);
unchecked { ++i; }
}
skip(DEPOSIT_INTERVAL);
(, uint256 payout,, bool matured) = staking.warmupInfo(address(depository));
assertEq(ghst.balanceOf(address(depository)) > 0, true);
assertEq(payout > 0, true);
assertEq(matured, true);
vm.prank(BOB);
depository.forceRedeemAll(bytes32(0));
vm.prank(ALICE);
depository.forceRedeemAll(bytes32(0));
(, payout,,) = staking.warmupInfo(address(depository));
assertEq(ghst.balanceOf(address(depository)), 0);
assertEq(payout, 0);
}
}