Skip to content

Commit 53331f4

Browse files
author
Lucas Manuel
authored
feat: Update InvariantTest inheritance, add new functions, fix CI [WIP] (#263)
* feat: update to add new functions * fix: run forge fmt
1 parent 34ca687 commit 53331f4

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

src/InvariantTest.sol

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity >=0.6.2 <0.9.0;
33

4-
import {Test} from "./Test.sol";
5-
6-
contract InvariantTest is Test {
4+
pragma experimental ABIEncoderV2;
75

6+
contract InvariantTest {
87
struct FuzzSelector {
98
address addr;
109
bytes4[] selectors;
@@ -15,8 +14,21 @@ contract InvariantTest is Test {
1514
address[] private _targetedContracts;
1615
address[] private _targetedSenders;
1716

17+
string[] private _excludedArtifacts;
18+
string[] private _targetedArtifacts;
19+
20+
FuzzSelector[] internal _targetedArtifactSelectors;
1821
FuzzSelector[] internal _targetedSelectors;
1922

23+
function excludeArtifact(string memory newExcludedArtifact_) internal {
24+
_excludedArtifacts.push(newExcludedArtifact_);
25+
}
26+
27+
function excludeArtifacts() public view returns (string[] memory excludedArtifacts_) {
28+
require(_excludedArtifacts.length != uint256(0), "NO_EXCLUDED_ARTIFACTS");
29+
excludedArtifacts_ = _excludedArtifacts;
30+
}
31+
2032
function excludeContract(address newExcludedContract_) internal {
2133
_excludedContracts.push(newExcludedContract_);
2234
}
@@ -35,6 +47,24 @@ contract InvariantTest is Test {
3547
excludedSenders_ = _excludedSenders;
3648
}
3749

50+
function targetArtifact(string memory newTargetedArtifact_) internal {
51+
_targetedArtifacts.push(newTargetedArtifact_);
52+
}
53+
54+
function targetArtifacts() public view returns (string[] memory targetedArtifacts_) {
55+
require(_targetedArtifacts.length != uint256(0), "NO_TARGETED_ARTIFACTS");
56+
targetedArtifacts_ = _targetedArtifacts;
57+
}
58+
59+
function targetArtifactSelector(FuzzSelector memory newTargetedArtifactSelector_) internal {
60+
_targetedArtifactSelectors.push(newTargetedArtifactSelector_);
61+
}
62+
63+
function targetArtifactSelectors() public view returns (FuzzSelector[] memory targetedArtifactSelectors_) {
64+
require(targetedArtifactSelectors_.length != uint256(0), "NO_TARGETED_ARTIFACT_SELECTORS");
65+
targetedArtifactSelectors_ = _targetedArtifactSelectors;
66+
}
67+
3868
function targetContract(address newTargetedContract_) internal {
3969
_targetedContracts.push(newTargetedContract_);
4070
}
@@ -61,5 +91,4 @@ contract InvariantTest is Test {
6191
require(_targetedSenders.length != uint256(0), "NO_TARGETED_SENDERS");
6292
targetedSenders_ = _targetedSenders;
6393
}
64-
6594
}

0 commit comments

Comments
 (0)