Skip to content

Commit

Permalink
Added latest cheatcodes (#31)
Browse files Browse the repository at this point in the history
* Added latest cheatcodes

* refactor: reorder alphabetically

---------

Co-authored-by: Paul Razvan Berg <[email protected]>
  • Loading branch information
ShubhSensei and PaulRBerg authored Jul 31, 2023
1 parent 40a646a commit e643154
Showing 1 changed file with 16 additions and 1 deletion.
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

0 comments on commit e643154

Please sign in to comment.