Skip to content

Commit 37a37ab

Browse files
tynesmds1
andauthored
feat: add vm.loadAllocs(string) cheatcode (#474)
* vm: add `loadAllocs(string)` cheatcode 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. * chore: keep section alphabetically sorted --------- Co-authored-by: Matt Solomon <[email protected]>
1 parent 267acd3 commit 37a37ab

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Vm.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,9 @@ interface Vm is VmSafe {
540540
// Sets an address' code
541541
function etch(address target, bytes calldata newRuntimeBytecode) external;
542542

543+
// Load a genesis JSON file's `allocs` into the in-memory state.
544+
function loadAllocs(string calldata pathToAllocsJson) external;
545+
543546
// Resets the nonce of an account to 0 for EOAs and 1 for contract accounts
544547
function resetNonce(address account) external;
545548

test/Vm.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ contract VmTest is Test {
1010
// added to or removed from Vm or VmSafe.
1111
function test_interfaceId() public {
1212
assertEq(type(VmSafe).interfaceId, bytes4(0x329f5e71), "VmSafe");
13-
assertEq(type(Vm).interfaceId, bytes4(0x82ccbb14), "Vm");
13+
assertEq(type(Vm).interfaceId, bytes4(0x316cedc3), "Vm");
1414
}
1515
}

0 commit comments

Comments
 (0)