test for events for gatekeeper

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2025-07-22 16:48:01 +03:00
parent 00a7dea8fb
commit 8e2caaba0f
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB

View File

@ -41,6 +41,7 @@ contract StakingTest is Test {
event DistributorSet(address distributor);
event WarmupSet(uint256 warmup);
event Ghosted(bytes32 indexed receiver, uint256 indexed amount);
function setUp() public {
vm.startPrank(initializer);
@ -579,6 +580,28 @@ contract StakingTest is Test {
assertEq(ghst.totalSupply(), 0);
}
function test_ghostTokensEmitsEvent() public {
assertEq(staking.gatekeeper(), address(0));
vm.prank(governor);
staking.setGatekeeperAddress(address(gatekeeper));
assertEq(staking.gatekeeper(), address(gatekeeper));
_prepareAndRoll(alice, bigAmount, true, true);
uint256 aliceBalance = stnk.balanceOf(alice);
vm.startPrank(alice);
stnk.approve(address(staking), aliceBalance);
uint256 ghstBalance = staking.wrap(alice, aliceBalance);
vm.stopPrank();
bytes32 receiver = bytes32(abi.encodePacked(alice));
vm.expectEmit(true, true, true, false, address(gatekeeper));
emit Ghosted(receiver, ghstBalance);
vm.prank(alice);
staking.ghost(receiver, ghstBalance);
}
function _mintAndApprove(address who, uint256 value) internal {
vm.prank(vault);
ftso.mint(who, value);