Skip to content

Commit

Permalink
vm: add loadAllocs(string) cheatcode
Browse files Browse the repository at this point in the history
Adds the `loadAllocs(string)` cheatcode to be usable as part of the
`Vm` interface. This was added to foundry in foundry-rs/foundry#6207.
The cheatcode can be used to read a JSON file from disk that sets EVM
state directly.
  • Loading branch information
tynes committed Nov 7, 2023
1 parent 267acd3 commit fd0783a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Vm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,9 @@ interface Vm is VmSafe {
// Stores a value to an address' storage slot.
function store(address target, bytes32 slot, bytes32 value) external;

// Load a genesis JSON file's `allocs` into the in-memory state.
function loadAllocs(string calldata pathToAllocsJson) external;

// -------- Call Manipulation --------
// --- Mocks ---

Expand Down
2 changes: 1 addition & 1 deletion test/Vm.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ contract VmTest is Test {
// added to or removed from Vm or VmSafe.
function test_interfaceId() public {
assertEq(type(VmSafe).interfaceId, bytes4(0x329f5e71), "VmSafe");
assertEq(type(Vm).interfaceId, bytes4(0x82ccbb14), "Vm");
assertEq(type(Vm).interfaceId, bytes4(0x316cedc3), "Vm");
}
}

0 comments on commit fd0783a

Please sign in to comment.