-
Notifications
You must be signed in to change notification settings - Fork 35
/
Challenge1.t.sol
47 lines (34 loc) · 1.58 KB
/
Challenge1.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
46
47
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import {MagicETH} from "../src/1_MagicETH/MagicETH.sol";
/*////////////////////////////////////////////////////////////
// DEFINE ANY NECESSARY CONTRACTS HERE //
// If you need a contract for your hack, define it below //
////////////////////////////////////////////////////////////*/
/*////////////////////////////////////////////////////////////
// TEST CONTRACT //
////////////////////////////////////////////////////////////*/
contract Challenge1Test is Test {
MagicETH public mETH;
address public exploiter = makeAddr("exploiter");
address public whitehat = makeAddr("whitehat");
function setUp() public {
mETH = new MagicETH();
mETH.deposit{value: 1000 ether}();
// exploiter is in control of 1000 tokens
mETH.transfer(exploiter, 1000 ether);
}
function testExploit() public {
vm.startPrank(whitehat, whitehat);
/*////////////////////////////////////////////////////
// Add your hack below! //
// //
// terminal command to run the specific test: //
// forge test --match-contract Challenge1Test -vvvv //
////////////////////////////////////////////////////*/
//==================================================//
vm.stopPrank();
assertEq(whitehat.balance, 1000 ether, "whitehat should have 1000 ether");
}
}