From 8e2caaba0f71b7c4950289670bbd7b617f42c6b5 Mon Sep 17 00:00:00 2001 From: Uncle Fatso Date: Tue, 22 Jul 2025 16:48:01 +0300 Subject: [PATCH] test for events for gatekeeper Signed-off-by: Uncle Fatso --- test/staking/Staking.t.sol | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/staking/Staking.t.sol b/test/staking/Staking.t.sol index e72280a..dc12cf9 100644 --- a/test/staking/Staking.t.sol +++ b/test/staking/Staking.t.sol @@ -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);