diff --git a/src/IHevm.sol b/src/IHevm.sol index 26f5439..f192c29 100644 --- a/src/IHevm.sol +++ b/src/IHevm.sol @@ -1,32 +1,53 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -// https://github.com/ethereum/hevm/blob/main/doc/src/controlling-the-unit-testing-environment.md#cheat-codes - +/// @author https://github.com/crytic/properties/blob/2526765eedd9bda30c168cd271fa403ac72cb1a9/contracts/util/Hevm.sol interface IHevm { - function warp(uint256 x) external; + // Set block.timestamp to newTimestamp + function warp(uint256 newTimestamp) external; + + // Set block.number to newNumber + function roll(uint256 newNumber) external; + + // Add the condition b to the assumption base for the current branch + // This function is almost identical to require + function assume(bool b) external; + + // Sets the eth balance of usr to amt + function deal(uint256 usr, uint256 amt) external; + + // Loads a storage slot from an address + function load(address where, bytes32 slot) external returns (bytes32); + + // Stores a value to an address' storage slot + function store(address where, bytes32 slot, bytes32 value) external; + + // Signs data (privateKey, digest) => (r, v, s) + function sign( + uint256 privateKey, + bytes32 digest + ) external returns (uint8 r, bytes32 v, bytes32 s); - function roll(uint256 x) external; + // Gets address for a given private key + function addr(uint256 privateKey) external returns (address addr); - function store( - address c, - bytes32 loc, - bytes32 val - ) external; + // Performs a foreign function call via terminal + function ffi( + string[] calldata inputs + ) external returns (bytes memory result); - function load(address c, bytes32 loc) external returns (bytes32 val); + // Performs the next smart contract call with specified `msg.sender` + function prank(address newSender) external; - function sign(uint256 sk, bytes32 digest) - external - returns ( - uint8 v, - bytes32 r, - bytes32 s - ); + // Creates a new fork with the given endpoint and the latest block and returns the identifier of the fork + function createFork(string calldata urlOrAlias) external returns (uint256); - function addr(uint256 sk) external returns (address addr); + // Takes a fork identifier created by createFork and sets the corresponding forked state as active + function selectFork(uint256 forkId) external; - function ffi(string[] calldata) external returns (bytes memory); + // Returns the identifier of the current fork + function activeFork() external returns (uint256); - function prank(address sender) external; + // Labels the address in traces + function label(address addr, string calldata label) external; }