forked from moonwell-fi/moonwell-contracts-v2
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPostProposalCheck.sol
More file actions
64 lines (53 loc) · 2.06 KB
/
PostProposalCheck.sol
File metadata and controls
64 lines (53 loc) · 2.06 KB
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
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.19;
import {Test} from "@forge-std/Test.sol";
import {Addresses} from "@proposals/Addresses.sol";
import {CreateCode} from "@proposals/utils/CreateCode.sol";
import {StringUtils} from "@proposals/utils/StringUtils.sol";
import {TestProposals} from "@proposals/TestProposals.sol";
contract PostProposalCheck is CreateCode {
using StringUtils for string;
Addresses addresses;
TestProposals proposals;
function setUp() public virtual {
string memory path = getPath();
// Run all pending proposals before doing e2e tests
address[] memory mips = new address[](1);
if (keccak256(bytes(path)) == '""' || bytes(path).length == 0) {
/// empty string on both mac and unix, no proposals to run
mips = new address[](0);
proposals = new TestProposals(mips);
} else if (path.hasChar(",")) {
string[] memory mipPaths = path.split(",");
if (mipPaths.length < 2) {
revert(
"Invalid path(s) provided. If you want to deploy a single mip, do not use a comma."
);
}
mips = new address[](mipPaths.length); /// expand mips size if multiple mips
/// guzzle all of the memory, quadratic cost, but we don't care
for (uint256 i = 0; i < mipPaths.length; i++) {
/// deploy each mip and add it to the array
bytes memory code = getCode(mipPaths[i]);
mips[i] = deployCode(code);
}
proposals = new TestProposals(mips);
} else {
bytes memory code = getCode(path);
mips[0] = deployCode(code);
proposals = new TestProposals(mips);
}
proposals.setUp();
proposals.testProposals(
false, /// do not log debug output
true,
true,
true,
true,
true,
true,
true
);
addresses = proposals.addresses();
}
}