// SPDX-License-Identifier: Unlicense pragma solidity >=0.6.0; pragma experimental ABIEncoderV2; interface Vm { // Sets block.timestamp (newTimestamp) function warp(uint256) external; // Sets block.height (newHeight) function roll(uint256) external; // Sets block.basefee (newBasefee) function fee(uint256) external; // Sets block.chainid function chainId(uint256) external; // Loads a storage slot from an address (who, slot) function load(address,bytes32) external returns (bytes32); // Stores a value to an address' storage slot, (who, slot, value) function store(address,bytes32,bytes32) external; // Signs data, (privateKey, digest) => (v, r, s) function sign(uint256,bytes32) external returns (uint8,bytes32,bytes32); // Gets the address for a given private key, (privateKey) => (address) function addr(uint256) external returns (address); // Gets the nonce of an account function getNonce(address) external returns (uint64); // Sets the nonce of an account; must be higher than the current nonce of the account function setNonce(address, uint64) external; // Performs a foreign function call via the terminal, (stringInputs) => (result) function ffi(string[] calldata) external returns (bytes memory); // Sets environment variables, (name, value) function setEnv(string calldata, string calldata) external; // Reads environment variables, (name) => (value) function envBool(string calldata) external returns (bool); function envUint(string calldata) external returns (uint256); function envInt(string calldata) external returns (int256); function envAddress(string calldata) external returns (address); function envBytes32(string calldata) external returns (bytes32); function envString(string calldata) external returns (string memory); function envBytes(string calldata) external returns (bytes memory); // Reads environment variables as arrays, (name, delim) => (value[]) function envBool(string calldata, string calldata) external returns (bool[] memory); function envUint(string calldata, string calldata) external returns (uint256[] memory); function envInt(string calldata, string calldata) external returns (int256[] memory); function envAddress(string calldata, string calldata) external returns (address[] memory); function envBytes32(string calldata, string calldata) external returns (bytes32[] memory); function envString(string calldata, string calldata) external returns (string[] memory); function envBytes(string calldata, string calldata) external returns (bytes[] memory); // Sets the *next* call's msg.sender to be the input address function prank(address) external; // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called function startPrank(address) external; // Sets the *next* call's msg.sender to be the input address, and the tx.origin to be the second input function prank(address,address) external; // Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called, and the tx.origin to be the second input function startPrank(address,address) external; // Resets subsequent calls' msg.sender to be `address(this)` function stopPrank() external; // Sets an address' balance, (who, newBalance) function deal(address, uint256) external; // Sets an address' code, (who, newCode) function etch(address, bytes calldata) external; // Expects an error on next call function expectRevert(bytes calldata) external; function expectRevert(bytes4) external; function expectRevert() external; // Records all storage reads and writes function record() external; // Gets all accessed reads and write slot from a recording session, for a given address function accesses(address) external returns (bytes32[] memory reads, bytes32[] memory writes); // Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData). // Call this function, then emit an event, then call a function. Internally after the call, we check if // logs were emitted in the expected order with the expected topics and data (as specified by the booleans) function expectEmit(bool,bool,bool,bool) external; function expectEmit(bool,bool,bool,bool,address) external; // Mocks a call to an address, returning specified data. // Calldata can either be strict or a partial match, e.g. if you only // pass a Solidity selector to the expected calldata, then the entire Solidity // function will be mocked. function mockCall(address,bytes calldata,bytes calldata) external; // Mocks a call to an address with a specific msg.value, returning specified data. // Calldata match takes precedence over msg.value in case of ambiguity. function mockCall(address,uint256,bytes calldata,bytes calldata) external; // Clears all mocked calls function clearMockedCalls() external; // Expects a call to an address with the specified calldata. // Calldata can either be a strict or a partial match function expectCall(address,bytes calldata) external; // Expects a call to an address with the specified msg.value and calldata function expectCall(address,uint256,bytes calldata) external; // Gets the code from an artifact file. Takes in the relative path to the json file function getCode(string calldata) external returns (bytes memory); // Labels an address in call traces function label(address, string calldata) external; // If the condition is false, discard this run's fuzz inputs and generate new ones function assume(bool) external; // Sets block.coinbase (who) function coinbase(address) external; // Using the address that calls the test contract, has the next call (at this call depth only) create a transaction that can later be signed and sent onchain function broadcast() external; // Has the next call (at this call depth only) create a transaction with the address provided as the sender that can later be signed and sent onchain function broadcast(address) external; // Using the address that calls the test contract, has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain function startBroadcast() external; // Has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain function startBroadcast(address) external; // Stops collecting onchain transactions function stopBroadcast() external; }