Skip to content

Commit ff089ff

Browse files
⬆️ Update HEVM cheatcodes (#7)
1 parent 13ccf08 commit ff089ff

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/Hevm.sol

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-License-Identifier: MIT
1+
// SPDX-License-Identifier: Unlicense
22
pragma solidity ^0.8.0;
33

44
interface IHevm {
@@ -8,23 +8,47 @@ interface IHevm {
88
// Set block.number to newNumber
99
function roll(uint256 newNumber) external;
1010

11+
// Add the condition b to the assumption base for the current branch
12+
// This function is almost identical to require
13+
function assume(bool b) external;
14+
15+
// Sets the eth balance of usr to amt
16+
function deal(address usr, uint256 amt) external;
17+
1118
// Loads a storage slot from an address
1219
function load(address where, bytes32 slot) external returns (bytes32);
1320

1421
// Stores a value to an address' storage slot
1522
function store(address where, bytes32 slot, bytes32 value) external;
1623

1724
// Signs data (privateKey, digest) => (r, v, s)
18-
function sign(uint256 privateKey, bytes32 digest) external returns (uint8 r, bytes32 v, bytes32 s);
25+
function sign(
26+
uint256 privateKey,
27+
bytes32 digest
28+
) external returns (uint8 r, bytes32 v, bytes32 s);
1929

2030
// Gets address for a given private key
21-
function addr(uint256 privateKey) external returns (address account);
31+
function addr(uint256 privateKey) external returns (address addr);
2232

2333
// Performs a foreign function call via terminal
24-
function ffi(string[] calldata inputs) external returns (bytes memory result);
34+
function ffi(
35+
string[] calldata inputs
36+
) external returns (bytes memory result);
2537

2638
// Performs the next smart contract call with specified `msg.sender`
2739
function prank(address newSender) external;
40+
41+
// Creates a new fork with the given endpoint and the latest block and returns the identifier of the fork
42+
function createFork(string calldata urlOrAlias) external returns (uint256);
43+
44+
// Takes a fork identifier created by createFork and sets the corresponding forked state as active
45+
function selectFork(uint256 forkId) external;
46+
47+
// Returns the identifier of the current fork
48+
function activeFork() external returns (uint256);
49+
50+
// Labels the address in traces
51+
function label(address addr, string calldata label) external;
2852
}
2953

3054
IHevm constant vm = IHevm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);

0 commit comments

Comments
 (0)