Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added latest cheatcodes #31

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/Vm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ pragma solidity >=0.8.0 <0.9.0;
/// @dev This interface can be safely used in scripts running on a live network, so for example you don't accidentally
/// change the block timestamp and use a fake timestamp as a value somewhere.
interface VmSafe {
enum CallerMode {
None,
Broadcast,
RecurrentBroadcast,
Prank,
RecurrentPrank
}

struct DirEntry {
string errorMessage;
string path;
Expand Down Expand Up @@ -93,7 +101,7 @@ interface VmSafe {
pure
returns (uint256 privateKey);

/// @dev Reads environment variables
/// @dev Reads environment variables, (name) => (value)
function envAddress(string calldata name) external view returns (address value);

function envBool(string calldata name) external view returns (bool value);
Expand Down Expand Up @@ -678,6 +686,10 @@ interface Vm is VmSafe {
/// If used on unsupported EVM versions, it will revert.
function prevrandao(bytes32 newPrevrandao) external;

/// @dev Reads the current `msg.sender` and `tx.origin` from state and reports if there is any active caller
/// modification.
function readCallers() external returns (CallerMode callerMode, address msgSender, address txOrigin);

/// @dev Removes a file from the filesystem.
/// This cheatcode will revert in the following situations, but is not limited to just these cases:
/// - `path` points to a directory.
Expand Down Expand Up @@ -727,6 +739,9 @@ interface Vm is VmSafe {
/// @dev Sets the nonce of an account to an arbitrary value.
function setNonceUnsafe(address account, uint64 newNonce) external;

/// @dev Marks a test as skipped. Must be called at the top of the test.
function skip(bool skipTest) external;

/// @dev Snapshot the current state of the EVM.
/// Returns the id of the snapshot that was created.
/// To revert a snapshot use `revertTo`.
Expand Down