-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevmSetup.sol
33 lines (27 loc) · 1.1 KB
/
evmSetup.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
pragma solidity ^0.8.4;
// Used when you need to locally deploy/test a non-sourced contract.
contract evmSetup {
address payable public challengeAddress;
constructor() payable {
// gather creation code through .bin file
bytes memory initcode = hex"6080604052000000"; // ..... this is creationCode
address _addr;
assembly {
_addr := create(0, add(initcode, 0x20), mload(initcode))
}
/* version with constructor args:
bytes memory initcode = hex"6080604052000000";
bytes memory args1 = hex"0000000000000000000000000000000000000000000000000000000000000001";
bytes memory args2 = hex"0000000000000000000000000000000000000000000000000000000000000002";
bytes memory initcode_w_args = abi.encodePacked(initcode, args1, args2);
address _addr;
assembly {
_addr := create(0, add(initcode_w_args, 0x20), mload(initcode_w_args))
}
*/
challengeAddress = payable(_addr);
}
function isSolved() public view returns (bool) {
return challengeAddress.balance == 0;
}
}