-
Notifications
You must be signed in to change notification settings - Fork 73
/
Exploit.t.sol
33 lines (26 loc) · 1019 Bytes
/
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
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;
import {Test, console2} from "forge-std/Test.sol";
import {HuffDeployer} from "foundry-huff/HuffDeployer.sol";
import {Challenge} from "./challenge/Challenge.sol";
import {ISimpleBank} from "./challenge/ISimpleBank.sol";
import {Exploit} from "./Exploit.sol";
contract ExploitTest is Test {
address playerAddr = makeAddr("player");
Challenge challenge;
function setUp() public {
vm.deal(playerAddr, 10 ether);
ISimpleBank bank = ISimpleBank(HuffDeployer.deploy("ParadigmCTF2023/BlackSheep/challenge/SimpleBank"));
payable(address(bank)).transfer(10 ether);
challenge = new Challenge(ISimpleBank(address(bank)));
}
function test() public {
vm.startPrank(playerAddr, playerAddr);
new Exploit().exploit{value: 1}(address(challenge));
assertTrue(challenge.isSolved());
vm.stopPrank();
}
function testGetSignature() public pure {
vm.sign(1, 0);
}
}