-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee00574
commit feee4b3
Showing
14 changed files
with
2,784 additions
and
1,131 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
[submodule "lib/solady"] | ||
path = lib/solady | ||
url = https://github.com/vectorized/solady | ||
[submodule "lib/forge-std"] | ||
path = lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std | ||
[submodule "lib/murky"] | ||
path = lib/murky | ||
url = https://github.com/dmfxyz/murky |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule forge-std
deleted from
ae570f
Submodule murky
deleted from
40de6e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.6.2 <0.9.0; | ||
|
||
pragma experimental ABIEncoderV2; | ||
|
||
abstract contract StdInvariant { | ||
struct FuzzSelector { | ||
address addr; | ||
bytes4[] selectors; | ||
} | ||
|
||
struct FuzzInterface { | ||
address addr; | ||
string[] artifacts; | ||
} | ||
|
||
address[] private _excludedContracts; | ||
address[] private _excludedSenders; | ||
address[] private _targetedContracts; | ||
address[] private _targetedSenders; | ||
|
||
string[] private _excludedArtifacts; | ||
string[] private _targetedArtifacts; | ||
|
||
FuzzSelector[] private _targetedArtifactSelectors; | ||
FuzzSelector[] private _targetedSelectors; | ||
|
||
FuzzInterface[] private _targetedInterfaces; | ||
|
||
// Functions for users: | ||
// These are intended to be called in tests. | ||
|
||
function excludeContract(address newExcludedContract_) internal { | ||
_excludedContracts.push(newExcludedContract_); | ||
} | ||
|
||
function excludeSender(address newExcludedSender_) internal { | ||
_excludedSenders.push(newExcludedSender_); | ||
} | ||
|
||
function excludeArtifact(string memory newExcludedArtifact_) internal { | ||
_excludedArtifacts.push(newExcludedArtifact_); | ||
} | ||
|
||
function targetArtifact(string memory newTargetedArtifact_) internal { | ||
_targetedArtifacts.push(newTargetedArtifact_); | ||
} | ||
|
||
function targetArtifactSelector(FuzzSelector memory newTargetedArtifactSelector_) internal { | ||
_targetedArtifactSelectors.push(newTargetedArtifactSelector_); | ||
} | ||
|
||
function targetContract(address newTargetedContract_) internal { | ||
_targetedContracts.push(newTargetedContract_); | ||
} | ||
|
||
function targetSelector(FuzzSelector memory newTargetedSelector_) internal { | ||
_targetedSelectors.push(newTargetedSelector_); | ||
} | ||
|
||
function targetSender(address newTargetedSender_) internal { | ||
_targetedSenders.push(newTargetedSender_); | ||
} | ||
|
||
function targetInterface(FuzzInterface memory newTargetedInterface_) internal { | ||
_targetedInterfaces.push(newTargetedInterface_); | ||
} | ||
|
||
// Functions for forge: | ||
// These are called by forge to run invariant tests and don't need to be called in tests. | ||
|
||
function excludeArtifacts() public view returns (string[] memory excludedArtifacts_) { | ||
excludedArtifacts_ = _excludedArtifacts; | ||
} | ||
|
||
function excludeContracts() public view returns (address[] memory excludedContracts_) { | ||
excludedContracts_ = _excludedContracts; | ||
} | ||
|
||
function excludeSenders() public view returns (address[] memory excludedSenders_) { | ||
excludedSenders_ = _excludedSenders; | ||
} | ||
|
||
function targetArtifacts() public view returns (string[] memory targetedArtifacts_) { | ||
targetedArtifacts_ = _targetedArtifacts; | ||
} | ||
|
||
function targetArtifactSelectors() | ||
public | ||
view | ||
returns (FuzzSelector[] memory targetedArtifactSelectors_) | ||
{ | ||
targetedArtifactSelectors_ = _targetedArtifactSelectors; | ||
} | ||
|
||
function targetContracts() public view returns (address[] memory targetedContracts_) { | ||
targetedContracts_ = _targetedContracts; | ||
} | ||
|
||
function targetSelectors() public view returns (FuzzSelector[] memory targetedSelectors_) { | ||
targetedSelectors_ = _targetedSelectors; | ||
} | ||
|
||
function targetSenders() public view returns (address[] memory targetedSenders_) { | ||
targetedSenders_ = _targetedSenders; | ||
} | ||
|
||
function targetInterfaces() public view returns (FuzzInterface[] memory targetedInterfaces_) { | ||
targetedInterfaces_ = _targetedInterfaces; | ||
} | ||
} |
Oops, something went wrong.