-
Notifications
You must be signed in to change notification settings - Fork 5
/
VaultyTest.t.sol
65 lines (48 loc) · 1.9 KB
/
VaultyTest.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {Test, console2} from "forge-std/Test.sol";
import {VaultyDeployer} from "script/romeroadrian-vaulty/VaultyDeployer.s.sol";
import {IVaulty} from "src/romeroadrian-vaulty/interfaces/IVaulty.sol";
/*///////////////////////////////////////////////
// Import dependencies for your solution here! //
// (if you need any) //
///////////////////////////////////////////////*/
contract VaultyTest is Test, VaultyDeployer {
IVaulty public vaulty;
address player = address(420);
address vaultyowner = makeAddr("owner");
address alice = makeAddr("Alice");
/// @notice Deploy the ExampleCTF and the solution contract
function setUp() public override(VaultyDeployer) {
VaultyDeployer.setUp();
vm.deal(alice, 15 ether);
vm.deal(player, 20 ether);
vm.startPrank(vaultyowner);
vaulty = IVaulty(deployVaulty());
vm.stopPrank();
}
/// @notice Test that the ExampleCTF is unsolved if we don't do anything
function test_vaultyUnsolved() external {
vm.startPrank(alice);
vaulty.deposit{value: 15 ether}();
vm.stopPrank();
assertFalse(vaulty.isSolved());
}
/// @notice Test that the ExampleCTF is solved if we call the solve function
function test_vaultySolved() external {
vm.startPrank(player);
/*//////////////////////////////////////
// Write your solution here //
//////////////////////////////////////*/
vm.stopPrank();
vm.startPrank(alice);
vaulty.deposit{value: 15 ether}();
vm.stopPrank();
vm.startPrank(player);
/*//////////////////////////////////////
// Write your solution here //
//////////////////////////////////////*/
vm.stopPrank();
assertTrue(vaulty.isSolved());
}
}