Skip to content

Commit 7742caf

Browse files
ruvaagmds1
andauthored
feat: Update Vm.sol with exists, isFile and isDir (#441)
* Update Vm.sol with exists, isFile and isDir * style: add named return params * chore: move cheat to VmSafe and fix shadowing --------- Co-authored-by: Matt Solomon <[email protected]>
1 parent da26c04 commit 7742caf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Vm.sol

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ interface VmSafe {
212212
function readLink(string calldata linkPath) external view returns (string memory targetPath);
213213
// Given a path, query the file system to get information about a file, directory, etc.
214214
function fsMetadata(string calldata path) external view returns (FsMetadata memory metadata);
215+
// Returns true if the given path points to an existing entity, else returns false
216+
function exists(string calldata path) external returns (bool result);
217+
// Returns true if the path exists on disk and is pointing at a regular file, else returns false
218+
function isFile(string calldata path) external returns (bool result);
219+
// Returns true if the path exists on disk and is pointing at a directory, else returns false
220+
function isDir(string calldata path) external returns (bool result);
215221

216222
// Convert values to a string
217223
function toString(address value) external pure returns (string memory stringifiedValue);
@@ -377,6 +383,8 @@ interface VmSafe {
377383
function breakpoint(string calldata char) external;
378384
// Writes a conditional breakpoint to jump to in the debugger
379385
function breakpoint(string calldata char, bool value) external;
386+
// Suspends execution of the main thread for `duration` milliseconds
387+
function sleep(uint256 duration) external;
380388
}
381389

382390
interface Vm is VmSafe {
@@ -539,6 +547,4 @@ interface Vm is VmSafe {
539547
function transact(bytes32 txHash) external;
540548
// Fetches the given transaction from the given fork and executes it on the current state
541549
function transact(uint256 forkId, bytes32 txHash) external;
542-
// Suspends execution of the main thread for `duration` milliseconds
543-
function sleep(uint256 duration) external;
544550
}

0 commit comments

Comments
 (0)