foundry_cheatcodes_spec/
vm.rs

1// We don't document function parameters individually so we can't enable `missing_docs` for this
2// module. Instead, we emit custom diagnostics in `#[derive(Cheatcode)]`.
3#![allow(missing_docs)]
4
5use super::*;
6use crate::Vm::ForgeContext;
7use alloy_sol_types::sol;
8use foundry_macros::Cheatcode;
9
10sol! {
11// Cheatcodes are marked as view/pure/none using the following rules:
12// 0. A call's observable behaviour includes its return value, logs, reverts and state writes,
13// 1. If you can influence a later call's observable behaviour, you're neither `view` nor `pure`
14//    (you are modifying some state be it the EVM, interpreter, filesystem, etc),
15// 2. Otherwise if you can be influenced by an earlier call, or if reading some state, you're `view`,
16// 3. Otherwise you're `pure`.
17
18/// Foundry cheatcodes interface.
19#[derive(Debug, Cheatcode)] // Keep this list small to avoid unnecessary bloat.
20#[sol(abi)]
21interface Vm {
22    //  ======== Types ========
23
24    /// Error thrown by cheatcodes.
25    error CheatcodeError(string message);
26
27    /// A modification applied to either `msg.sender` or `tx.origin`. Returned by `readCallers`.
28    enum CallerMode {
29        /// No caller modification is currently active.
30        None,
31        /// A one time broadcast triggered by a `vm.broadcast()` call is currently active.
32        Broadcast,
33        /// A recurrent broadcast triggered by a `vm.startBroadcast()` call is currently active.
34        RecurrentBroadcast,
35        /// A one time prank triggered by a `vm.prank()` call is currently active.
36        Prank,
37        /// A recurrent prank triggered by a `vm.startPrank()` call is currently active.
38        RecurrentPrank,
39    }
40
41    /// The kind of account access that occurred.
42    enum AccountAccessKind {
43        /// The account was called.
44        Call,
45        /// The account was called via delegatecall.
46        DelegateCall,
47        /// The account was called via callcode.
48        CallCode,
49        /// The account was called via staticcall.
50        StaticCall,
51        /// The account was created.
52        Create,
53        /// The account was selfdestructed.
54        SelfDestruct,
55        /// Synthetic access indicating the current context has resumed after a previous sub-context (AccountAccess).
56        Resume,
57        /// The account's balance was read.
58        Balance,
59        /// The account's codesize was read.
60        Extcodesize,
61        /// The account's codehash was read.
62        Extcodehash,
63        /// The account's code was copied.
64        Extcodecopy,
65    }
66
67    /// Forge execution contexts.
68    enum ForgeContext {
69        /// Test group execution context (test, coverage or snapshot).
70        TestGroup,
71        /// `forge test` execution context.
72        Test,
73        /// `forge coverage` execution context.
74        Coverage,
75        /// `forge snapshot` execution context.
76        Snapshot,
77        /// Script group execution context (dry run, broadcast or resume).
78        ScriptGroup,
79        /// `forge script` execution context.
80        ScriptDryRun,
81        /// `forge script --broadcast` execution context.
82        ScriptBroadcast,
83        /// `forge script --resume` execution context.
84        ScriptResume,
85        /// Unknown `forge` execution context.
86        Unknown,
87    }
88
89    /// An Ethereum log. Returned by `getRecordedLogs`.
90    struct Log {
91        /// The topics of the log, including the signature, if any.
92        bytes32[] topics;
93        /// The raw data of the log.
94        bytes data;
95        /// The address of the log's emitter.
96        address emitter;
97    }
98
99    /// Gas used. Returned by `lastCallGas`.
100    struct Gas {
101        /// The gas limit of the call.
102        uint64 gasLimit;
103        /// The total gas used.
104        uint64 gasTotalUsed;
105        /// DEPRECATED: The amount of gas used for memory expansion. Ref: <https://github.com/foundry-rs/foundry/pull/7934#pullrequestreview-2069236939>
106        uint64 gasMemoryUsed;
107        /// The amount of gas refunded.
108        int64 gasRefunded;
109        /// The amount of gas remaining.
110        uint64 gasRemaining;
111    }
112
113    /// An RPC URL and its alias. Returned by `rpcUrlStructs`.
114    struct Rpc {
115        /// The alias of the RPC URL.
116        string key;
117        /// The RPC URL.
118        string url;
119    }
120
121    /// An RPC log object. Returned by `eth_getLogs`.
122    struct EthGetLogs {
123        /// The address of the log's emitter.
124        address emitter;
125        /// The topics of the log, including the signature, if any.
126        bytes32[] topics;
127        /// The raw data of the log.
128        bytes data;
129        /// The block hash.
130        bytes32 blockHash;
131        /// The block number.
132        uint64 blockNumber;
133        /// The transaction hash.
134        bytes32 transactionHash;
135        /// The transaction index in the block.
136        uint64 transactionIndex;
137        /// The log index.
138        uint256 logIndex;
139        /// Whether the log was removed.
140        bool removed;
141    }
142
143    /// A single entry in a directory listing. Returned by `readDir`.
144    struct DirEntry {
145        /// The error message, if any.
146        string errorMessage;
147        /// The path of the entry.
148        string path;
149        /// The depth of the entry.
150        uint64 depth;
151        /// Whether the entry is a directory.
152        bool isDir;
153        /// Whether the entry is a symlink.
154        bool isSymlink;
155    }
156
157    /// Metadata information about a file.
158    ///
159    /// This structure is returned from the `fsMetadata` function and represents known
160    /// metadata about a file such as its permissions, size, modification
161    /// times, etc.
162    struct FsMetadata {
163        /// True if this metadata is for a directory.
164        bool isDir;
165        /// True if this metadata is for a symlink.
166        bool isSymlink;
167        /// The size of the file, in bytes, this metadata is for.
168        uint256 length;
169        /// True if this metadata is for a readonly (unwritable) file.
170        bool readOnly;
171        /// The last modification time listed in this metadata.
172        uint256 modified;
173        /// The last access time of this metadata.
174        uint256 accessed;
175        /// The creation time listed in this metadata.
176        uint256 created;
177    }
178
179    /// A wallet with a public and private key.
180    struct Wallet {
181        /// The wallet's address.
182        address addr;
183        /// The wallet's public key `X`.
184        uint256 publicKeyX;
185        /// The wallet's public key `Y`.
186        uint256 publicKeyY;
187        /// The wallet's private key.
188        uint256 privateKey;
189    }
190
191    /// The result of a `tryFfi` call.
192    struct FfiResult {
193        /// The exit code of the call.
194        int32 exitCode;
195        /// The optionally hex-decoded `stdout` data.
196        bytes stdout;
197        /// The `stderr` data.
198        bytes stderr;
199    }
200
201    /// Information on the chain and fork.
202    struct ChainInfo {
203        /// The fork identifier. Set to zero if no fork is active.
204        uint256 forkId;
205        /// The chain ID of the current fork.
206        uint256 chainId;
207    }
208
209    /// Information about a blockchain.
210    struct Chain {
211        /// The chain name.
212        string name;
213        /// The chain's Chain ID.
214        uint256 chainId;
215        /// The chain's alias. (i.e. what gets specified in `foundry.toml`).
216        string chainAlias;
217        /// A default RPC endpoint for this chain.
218        string rpcUrl;
219    }
220
221    /// The storage accessed during an `AccountAccess`.
222    struct StorageAccess {
223        /// The account whose storage was accessed.
224        address account;
225        /// The slot that was accessed.
226        bytes32 slot;
227        /// If the access was a write.
228        bool isWrite;
229        /// The previous value of the slot.
230        bytes32 previousValue;
231        /// The new value of the slot.
232        bytes32 newValue;
233        /// If the access was reverted.
234        bool reverted;
235    }
236
237    /// An EIP-2930 access list item.
238    struct AccessListItem {
239        /// The address to be added in access list.
240        address target;
241        /// The storage keys to be added in access list.
242        bytes32[] storageKeys;
243    }
244
245    /// The result of a `stopAndReturnStateDiff` call.
246    struct AccountAccess {
247        /// The chain and fork the access occurred.
248        ChainInfo chainInfo;
249        /// The kind of account access that determines what the account is.
250        /// If kind is Call, DelegateCall, StaticCall or CallCode, then the account is the callee.
251        /// If kind is Create, then the account is the newly created account.
252        /// If kind is SelfDestruct, then the account is the selfdestruct recipient.
253        /// If kind is a Resume, then account represents a account context that has resumed.
254        AccountAccessKind kind;
255        /// The account that was accessed.
256        /// It's either the account created, callee or a selfdestruct recipient for CREATE, CALL or SELFDESTRUCT.
257        address account;
258        /// What accessed the account.
259        address accessor;
260        /// If the account was initialized or empty prior to the access.
261        /// An account is considered initialized if it has code, a
262        /// non-zero nonce, or a non-zero balance.
263        bool initialized;
264        /// The previous balance of the accessed account.
265        uint256 oldBalance;
266        /// The potential new balance of the accessed account.
267        /// That is, all balance changes are recorded here, even if reverts occurred.
268        uint256 newBalance;
269        /// Code of the account deployed by CREATE.
270        bytes deployedCode;
271        /// Value passed along with the account access
272        uint256 value;
273        /// Input data provided to the CREATE or CALL
274        bytes data;
275        /// If this access reverted in either the current or parent context.
276        bool reverted;
277        /// An ordered list of storage accesses made during an account access operation.
278        StorageAccess[] storageAccesses;
279        /// Call depth traversed during the recording of state differences
280        uint64 depth;
281        /// The previous nonce of the accessed account.
282        uint64 oldNonce;
283        /// The new nonce of the accessed account.
284        uint64 newNonce;
285    }
286
287    /// The result of the `stopDebugTraceRecording` call
288    struct DebugStep {
289        /// The stack before executing the step of the run.
290        /// stack\[0\] represents the top of the stack.
291        /// and only stack data relevant to the opcode execution is contained.
292        uint256[] stack;
293        /// The memory input data before executing the step of the run.
294        /// only input data relevant to the opcode execution is contained.
295        ///
296        /// e.g. for MLOAD, it will have memory\[offset:offset+32\] copied here.
297        /// the offset value can be get by the stack data.
298        bytes memoryInput;
299        /// The opcode that was accessed.
300        uint8 opcode;
301        /// The call depth of the step.
302        uint64 depth;
303        /// Whether the call end up with out of gas error.
304        bool isOutOfGas;
305        /// The contract address where the opcode is running
306        address contractAddr;
307    }
308
309    /// The transaction type (`txType`) of the broadcast.
310    enum BroadcastTxType {
311        /// Represents a CALL broadcast tx.
312        Call,
313        /// Represents a CREATE broadcast tx.
314        Create,
315        /// Represents a CREATE2 broadcast tx.
316        Create2
317    }
318
319    /// Represents a transaction's broadcast details.
320    struct BroadcastTxSummary {
321        /// The hash of the transaction that was broadcasted
322        bytes32 txHash;
323        /// Represent the type of transaction among CALL, CREATE, CREATE2
324        BroadcastTxType txType;
325        /// The address of the contract that was called or created.
326        /// This is address of the contract that is created if the txType is CREATE or CREATE2.
327        address contractAddress;
328        /// The block number the transaction landed in.
329        uint64 blockNumber;
330        /// Status of the transaction, retrieved from the transaction receipt.
331        bool success;
332    }
333
334    /// Holds a signed EIP-7702 authorization for an authority account to delegate to an implementation.
335    struct SignedDelegation {
336        /// The y-parity of the recovered secp256k1 signature (0 or 1).
337        uint8 v;
338        /// First 32 bytes of the signature.
339        bytes32 r;
340        /// Second 32 bytes of the signature.
341        bytes32 s;
342        /// The current nonce of the authority account at signing time.
343        /// Used to ensure signature can't be replayed after account nonce changes.
344        uint64 nonce;
345        /// Address of the contract implementation that will be delegated to.
346        /// Gets encoded into delegation code: 0xef0100 || implementation.
347        address implementation;
348    }
349
350    /// Represents a "potential" revert reason from a single subsequent call when using `vm.assumeNoReverts`.
351    /// Reverts that match will result in a FOUNDRY::ASSUME rejection, whereas unmatched reverts will be surfaced
352    /// as normal.
353    struct PotentialRevert {
354        /// The allowed origin of the revert opcode; address(0) allows reverts from any address
355        address reverter;
356        /// When true, only matches on the beginning of the revert data, otherwise, matches on entire revert data
357        bool partialMatch;
358        /// The data to use to match encountered reverts
359        bytes revertData;
360    }
361
362    // ======== EVM ========
363
364    /// Gets the address for a given private key.
365    #[cheatcode(group = Evm, safety = Safe)]
366    function addr(uint256 privateKey) external pure returns (address keyAddr);
367
368    /// Dump a genesis JSON file's `allocs` to disk.
369    #[cheatcode(group = Evm, safety = Unsafe)]
370    function dumpState(string calldata pathToStateJson) external;
371
372    /// Gets the nonce of an account.
373    #[cheatcode(group = Evm, safety = Safe)]
374    function getNonce(address account) external view returns (uint64 nonce);
375
376    /// Get the nonce of a `Wallet`.
377    #[cheatcode(group = Evm, safety = Safe)]
378    function getNonce(Wallet calldata wallet) external view returns (uint64 nonce);
379
380    /// Loads a storage slot from an address.
381    #[cheatcode(group = Evm, safety = Safe)]
382    function load(address target, bytes32 slot) external view returns (bytes32 data);
383
384    /// Load a genesis JSON file's `allocs` into the in-memory EVM state.
385    #[cheatcode(group = Evm, safety = Unsafe)]
386    function loadAllocs(string calldata pathToAllocsJson) external;
387
388    // -------- Record Debug Traces --------
389
390    /// Records the debug trace during the run.
391    #[cheatcode(group = Evm, safety = Safe)]
392    function startDebugTraceRecording() external;
393
394    /// Stop debug trace recording and returns the recorded debug trace.
395    #[cheatcode(group = Evm, safety = Safe)]
396    function stopAndReturnDebugTraceRecording() external returns (DebugStep[] memory step);
397
398
399    /// Clones a source account code, state, balance and nonce to a target account and updates in-memory EVM state.
400    #[cheatcode(group = Evm, safety = Unsafe)]
401    function cloneAccount(address source, address target) external;
402
403    // -------- Record Storage --------
404
405    /// Records all storage reads and writes. Use `accesses` to get the recorded data.
406    /// Subsequent calls to `record` will clear the previous data.
407    #[cheatcode(group = Evm, safety = Safe)]
408    function record() external;
409
410    /// Stops recording storage reads and writes.
411    #[cheatcode(group = Evm, safety = Safe)]
412    function stopRecord() external;
413
414    /// Gets all accessed reads and write slot from a `vm.record` session, for a given address.
415    #[cheatcode(group = Evm, safety = Safe)]
416    function accesses(address target) external view returns (bytes32[] memory readSlots, bytes32[] memory writeSlots);
417
418    /// Record all account accesses as part of CREATE, CALL or SELFDESTRUCT opcodes in order,
419    /// along with the context of the calls
420    #[cheatcode(group = Evm, safety = Safe)]
421    function startStateDiffRecording() external;
422
423    /// Returns an ordered array of all account accesses from a `vm.startStateDiffRecording` session.
424    #[cheatcode(group = Evm, safety = Safe)]
425    function stopAndReturnStateDiff() external returns (AccountAccess[] memory accountAccesses);
426
427    /// Returns state diffs from current `vm.startStateDiffRecording` session.
428    #[cheatcode(group = Evm, safety = Safe)]
429    function getStateDiff() external view returns (string memory diff);
430
431    /// Returns state diffs from current `vm.startStateDiffRecording` session, in json format.
432    #[cheatcode(group = Evm, safety = Safe)]
433    function getStateDiffJson() external view returns (string memory diff);
434
435    /// Returns an array of storage slots occupied by the specified variable.
436    #[cheatcode(group = Evm, safety = Safe)]
437    function getStorageSlots(address target, string calldata variableName) external view returns (uint256[] memory slots);
438
439    /// Returns an array of `StorageAccess` from current `vm.stateStateDiffRecording` session
440    #[cheatcode(group = Evm, safety = Safe)]
441    function getStorageAccesses() external view returns (StorageAccess[] memory storageAccesses);
442
443    // -------- Recording Map Writes --------
444
445    /// Starts recording all map SSTOREs for later retrieval.
446    #[cheatcode(group = Evm, safety = Safe)]
447    function startMappingRecording() external;
448
449    /// Stops recording all map SSTOREs for later retrieval and clears the recorded data.
450    #[cheatcode(group = Evm, safety = Safe)]
451    function stopMappingRecording() external;
452
453    /// Gets the number of elements in the mapping at the given slot, for a given address.
454    #[cheatcode(group = Evm, safety = Safe)]
455    function getMappingLength(address target, bytes32 mappingSlot) external view returns (uint256 length);
456
457    /// Gets the elements at index idx of the mapping at the given slot, for a given address. The
458    /// index must be less than the length of the mapping (i.e. the number of keys in the mapping).
459    #[cheatcode(group = Evm, safety = Safe)]
460    function getMappingSlotAt(address target, bytes32 mappingSlot, uint256 idx) external view returns (bytes32 value);
461
462    /// Gets the map key and parent of a mapping at a given slot, for a given address.
463    #[cheatcode(group = Evm, safety = Safe)]
464    function getMappingKeyAndParentOf(address target, bytes32 elementSlot)
465        external
466        view
467        returns (bool found, bytes32 key, bytes32 parent);
468
469    // -------- Block and Transaction Properties --------
470
471    /// Gets the current `block.chainid` of the currently selected environment.
472    /// You should use this instead of `block.chainid` if you use `vm.selectFork` or `vm.createSelectFork`, as `block.chainid` could be assumed
473    /// to be constant across a transaction, and as a result will get optimized out by the compiler.
474    /// See https://github.com/foundry-rs/foundry/issues/6180
475    #[cheatcode(group = Evm, safety = Safe)]
476    function getChainId() external view returns (uint256 blockChainId);
477
478    /// Sets `block.chainid`.
479    #[cheatcode(group = Evm, safety = Unsafe)]
480    function chainId(uint256 newChainId) external;
481
482    /// Sets `block.coinbase`.
483    #[cheatcode(group = Evm, safety = Unsafe)]
484    function coinbase(address newCoinbase) external;
485
486    /// Sets `block.difficulty`.
487    /// Not available on EVM versions from Paris onwards. Use `prevrandao` instead.
488    /// Reverts if used on unsupported EVM versions.
489    #[cheatcode(group = Evm, safety = Unsafe)]
490    function difficulty(uint256 newDifficulty) external;
491
492    /// Sets `block.basefee`.
493    #[cheatcode(group = Evm, safety = Unsafe)]
494    function fee(uint256 newBasefee) external;
495
496    /// Sets `block.prevrandao`.
497    /// Not available on EVM versions before Paris. Use `difficulty` instead.
498    /// If used on unsupported EVM versions it will revert.
499    #[cheatcode(group = Evm, safety = Unsafe)]
500    function prevrandao(bytes32 newPrevrandao) external;
501    /// Sets `block.prevrandao`.
502    /// Not available on EVM versions before Paris. Use `difficulty` instead.
503    /// If used on unsupported EVM versions it will revert.
504    #[cheatcode(group = Evm, safety = Unsafe)]
505    function prevrandao(uint256 newPrevrandao) external;
506
507    /// Sets the blobhashes in the transaction.
508    /// Not available on EVM versions before Cancun.
509    /// If used on unsupported EVM versions it will revert.
510    #[cheatcode(group = Evm, safety = Unsafe)]
511    function blobhashes(bytes32[] calldata hashes) external;
512
513    /// Gets the blockhashes from the current transaction.
514    /// Not available on EVM versions before Cancun.
515    /// If used on unsupported EVM versions it will revert.
516    #[cheatcode(group = Evm, safety = Unsafe)]
517    function getBlobhashes() external view returns (bytes32[] memory hashes);
518
519    /// Sets `block.height`.
520    #[cheatcode(group = Evm, safety = Unsafe)]
521    function roll(uint256 newHeight) external;
522
523    /// Gets the current `block.number`.
524    /// You should use this instead of `block.number` if you use `vm.roll`, as `block.number` is assumed to be constant across a transaction,
525    /// and as a result will get optimized out by the compiler.
526    /// See https://github.com/foundry-rs/foundry/issues/6180
527    #[cheatcode(group = Evm, safety = Safe)]
528    function getBlockNumber() external view returns (uint256 height);
529
530    /// Sets `tx.gasprice`.
531    #[cheatcode(group = Evm, safety = Unsafe)]
532    function txGasPrice(uint256 newGasPrice) external;
533
534    /// Sets `block.timestamp`.
535    #[cheatcode(group = Evm, safety = Unsafe)]
536    function warp(uint256 newTimestamp) external;
537
538    /// Gets the current `block.timestamp`.
539    /// You should use this instead of `block.timestamp` if you use `vm.warp`, as `block.timestamp` is assumed to be constant across a transaction,
540    /// and as a result will get optimized out by the compiler.
541    /// See https://github.com/foundry-rs/foundry/issues/6180
542    #[cheatcode(group = Evm, safety = Safe)]
543    function getBlockTimestamp() external view returns (uint256 timestamp);
544
545    /// Gets the RLP encoded block header for a given block number.
546    /// Returns the block header in the same format as `cast block <block_number> --raw`.
547    #[cheatcode(group = Evm, safety = Safe)]
548    function getRawBlockHeader(uint256 blockNumber) external view returns (bytes memory rlpHeader);
549
550    /// Sets `block.blobbasefee`
551    #[cheatcode(group = Evm, safety = Unsafe)]
552    function blobBaseFee(uint256 newBlobBaseFee) external;
553
554    /// Gets the current `block.blobbasefee`.
555    /// You should use this instead of `block.blobbasefee` if you use `vm.blobBaseFee`, as `block.blobbasefee` is assumed to be constant across a transaction,
556    /// and as a result will get optimized out by the compiler.
557    /// See https://github.com/foundry-rs/foundry/issues/6180
558    #[cheatcode(group = Evm, safety = Safe)]
559    function getBlobBaseFee() external view returns (uint256 blobBaseFee);
560
561    /// Set blockhash for the current block.
562    /// It only sets the blockhash for blocks where `block.number - 256 <= number < block.number`.
563    #[cheatcode(group = Evm, safety = Unsafe)]
564    function setBlockhash(uint256 blockNumber, bytes32 blockHash) external;
565
566    // -------- Account State --------
567
568    /// Sets an address' balance.
569    #[cheatcode(group = Evm, safety = Unsafe)]
570    function deal(address account, uint256 newBalance) external;
571
572    /// Sets an address' code.
573    #[cheatcode(group = Evm, safety = Unsafe)]
574    function etch(address target, bytes calldata newRuntimeBytecode) external;
575
576    /// Resets the nonce of an account to 0 for EOAs and 1 for contract accounts.
577    #[cheatcode(group = Evm, safety = Unsafe)]
578    function resetNonce(address account) external;
579
580    /// Sets the nonce of an account. Must be higher than the current nonce of the account.
581    #[cheatcode(group = Evm, safety = Unsafe)]
582    function setNonce(address account, uint64 newNonce) external;
583
584    /// Sets the nonce of an account to an arbitrary value.
585    #[cheatcode(group = Evm, safety = Unsafe)]
586    function setNonceUnsafe(address account, uint64 newNonce) external;
587
588    /// Stores a value to an address' storage slot.
589    #[cheatcode(group = Evm, safety = Unsafe)]
590    function store(address target, bytes32 slot, bytes32 value) external;
591
592    /// Marks the slots of an account and the account address as cold.
593    #[cheatcode(group = Evm, safety = Unsafe)]
594    function cool(address target) external;
595
596    /// Utility cheatcode to set an EIP-2930 access list for all subsequent transactions.
597    #[cheatcode(group = Evm, safety = Unsafe)]
598    function accessList(AccessListItem[] calldata access) external;
599
600    /// Utility cheatcode to remove any EIP-2930 access list set by `accessList` cheatcode.
601    #[cheatcode(group = Evm, safety = Unsafe)]
602    function noAccessList() external;
603
604    /// Utility cheatcode to mark specific storage slot as warm, simulating a prior read.
605    #[cheatcode(group = Evm, safety = Unsafe)]
606    function warmSlot(address target, bytes32 slot) external;
607
608    /// Utility cheatcode to mark specific storage slot as cold, simulating no prior read.
609    #[cheatcode(group = Evm, safety = Unsafe)]
610    function coolSlot(address target, bytes32 slot) external;
611
612    /// Returns the test or script execution evm version.
613    ///
614    /// **Note:** The execution evm version is not the same as the compilation one.
615    #[cheatcode(group = Evm, safety = Safe)]
616    function getEvmVersion() external pure returns (string memory evm);
617
618    /// Set the exact test or script execution evm version, e.g. `berlin`, `cancun`.
619    ///
620    /// **Note:** The execution evm version is not the same as the compilation one.
621    #[cheatcode(group = Evm, safety = Safe)]
622    function setEvmVersion(string calldata evm) external;
623
624    // -------- Call Manipulation --------
625    // --- Mocks ---
626
627    /// Clears all mocked calls.
628    #[cheatcode(group = Evm, safety = Unsafe)]
629    function clearMockedCalls() external;
630
631    /// Mocks a call to an address, returning specified data.
632    /// Calldata can either be strict or a partial match, e.g. if you only
633    /// pass a Solidity selector to the expected calldata, then the entire Solidity
634    /// function will be mocked.
635    #[cheatcode(group = Evm, safety = Unsafe)]
636    function mockCall(address callee, bytes calldata data, bytes calldata returnData) external;
637
638    /// Mocks a call to an address with a specific `msg.value`, returning specified data.
639    /// Calldata match takes precedence over `msg.value` in case of ambiguity.
640    #[cheatcode(group = Evm, safety = Unsafe)]
641    function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external;
642
643    /// Mocks a call to an address, returning specified data.
644    /// Calldata can either be strict or a partial match, e.g. if you only
645    /// pass a Solidity selector to the expected calldata, then the entire Solidity
646    /// function will be mocked.
647    ///
648    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
649    #[cheatcode(group = Evm, safety = Unsafe)]
650    function mockCall(address callee, bytes4 data, bytes calldata returnData) external;
651
652    /// Mocks a call to an address with a specific `msg.value`, returning specified data.
653    /// Calldata match takes precedence over `msg.value` in case of ambiguity.
654    ///
655    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
656    #[cheatcode(group = Evm, safety = Unsafe)]
657    function mockCall(address callee, uint256 msgValue, bytes4 data, bytes calldata returnData) external;
658
659    /// Mocks multiple calls to an address, returning specified data for each call.
660    #[cheatcode(group = Evm, safety = Unsafe)]
661    function mockCalls(address callee, bytes calldata data, bytes[] calldata returnData) external;
662
663    /// Mocks multiple calls to an address with a specific `msg.value`, returning specified data for each call.
664    #[cheatcode(group = Evm, safety = Unsafe)]
665    function mockCalls(address callee, uint256 msgValue, bytes calldata data, bytes[] calldata returnData) external;
666
667    /// Reverts a call to an address with specified revert data.
668    #[cheatcode(group = Evm, safety = Unsafe)]
669    function mockCallRevert(address callee, bytes calldata data, bytes calldata revertData) external;
670
671    /// Reverts a call to an address with a specific `msg.value`, with specified revert data.
672    #[cheatcode(group = Evm, safety = Unsafe)]
673    function mockCallRevert(address callee, uint256 msgValue, bytes calldata data, bytes calldata revertData)
674        external;
675
676    /// Reverts a call to an address with specified revert data.
677    ///
678    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
679    #[cheatcode(group = Evm, safety = Unsafe)]
680    function mockCallRevert(address callee, bytes4 data, bytes calldata revertData) external;
681
682    /// Reverts a call to an address with a specific `msg.value`, with specified revert data.
683    ///
684    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
685    #[cheatcode(group = Evm, safety = Unsafe)]
686    function mockCallRevert(address callee, uint256 msgValue, bytes4 data, bytes calldata revertData)
687        external;
688
689    /// Whenever a call is made to `callee` with calldata `data`, this cheatcode instead calls
690    /// `target` with the same calldata. This functionality is similar to a delegate call made to
691    /// `target` contract from `callee`.
692    /// Can be used to substitute a call to a function with another implementation that captures
693    /// the primary logic of the original function but is easier to reason about.
694    /// If calldata is not a strict match then partial match by selector is attempted.
695    #[cheatcode(group = Evm, safety = Unsafe)]
696    function mockFunction(address callee, address target, bytes calldata data) external;
697
698    // --- Impersonation (pranks) ---
699
700    /// Sets the *next* call's `msg.sender` to be the input address.
701    #[cheatcode(group = Evm, safety = Unsafe)]
702    function prank(address msgSender) external;
703
704    /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called.
705    #[cheatcode(group = Evm, safety = Unsafe)]
706    function startPrank(address msgSender) external;
707
708    /// Sets the *next* call's `msg.sender` to be the input address, and the `tx.origin` to be the second input.
709    #[cheatcode(group = Evm, safety = Unsafe)]
710    function prank(address msgSender, address txOrigin) external;
711
712    /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called, and the `tx.origin` to be the second input.
713    #[cheatcode(group = Evm, safety = Unsafe)]
714    function startPrank(address msgSender, address txOrigin) external;
715
716    /// Sets the *next* delegate call's `msg.sender` to be the input address.
717    #[cheatcode(group = Evm, safety = Unsafe)]
718    function prank(address msgSender, bool delegateCall) external;
719
720    /// Sets all subsequent delegate calls' `msg.sender` to be the input address until `stopPrank` is called.
721    #[cheatcode(group = Evm, safety = Unsafe)]
722    function startPrank(address msgSender, bool delegateCall) external;
723
724    /// Sets the *next* delegate call's `msg.sender` to be the input address, and the `tx.origin` to be the second input.
725    #[cheatcode(group = Evm, safety = Unsafe)]
726    function prank(address msgSender, address txOrigin, bool delegateCall) external;
727
728    /// Sets all subsequent delegate calls' `msg.sender` to be the input address until `stopPrank` is called, and the `tx.origin` to be the second input.
729    #[cheatcode(group = Evm, safety = Unsafe)]
730    function startPrank(address msgSender, address txOrigin, bool delegateCall) external;
731
732    /// Resets subsequent calls' `msg.sender` to be `address(this)`.
733    #[cheatcode(group = Evm, safety = Unsafe)]
734    function stopPrank() external;
735
736    /// Reads the current `msg.sender` and `tx.origin` from state and reports if there is any active caller modification.
737    #[cheatcode(group = Evm, safety = Unsafe)]
738    function readCallers() external view returns (CallerMode callerMode, address msgSender, address txOrigin);
739
740    // ----- Arbitrary Snapshots -----
741
742    /// Snapshot capture an arbitrary numerical value by name.
743    /// The group name is derived from the contract name.
744    #[cheatcode(group = Evm, safety = Unsafe)]
745    function snapshotValue(string calldata name, uint256 value) external;
746
747    /// Snapshot capture an arbitrary numerical value by name in a group.
748    #[cheatcode(group = Evm, safety = Unsafe)]
749    function snapshotValue(string calldata group, string calldata name, uint256 value) external;
750
751    // -------- Gas Snapshots --------
752
753    /// Snapshot capture the gas usage of the last call by name from the callee perspective.
754    #[cheatcode(group = Evm, safety = Unsafe)]
755    function snapshotGasLastCall(string calldata name) external returns (uint256 gasUsed);
756
757    /// Snapshot capture the gas usage of the last call by name in a group from the callee perspective.
758    #[cheatcode(group = Evm, safety = Unsafe)]
759    function snapshotGasLastCall(string calldata group, string calldata name) external returns (uint256 gasUsed);
760
761    /// Start a snapshot capture of the current gas usage by name.
762    /// The group name is derived from the contract name.
763    #[cheatcode(group = Evm, safety = Unsafe)]
764    function startSnapshotGas(string calldata name) external;
765
766    /// Start a snapshot capture of the current gas usage by name in a group.
767    #[cheatcode(group = Evm, safety = Unsafe)]
768    function startSnapshotGas(string calldata group, string calldata name) external;
769
770    /// Stop the snapshot capture of the current gas by latest snapshot name, capturing the gas used since the start.
771    #[cheatcode(group = Evm, safety = Unsafe)]
772    function stopSnapshotGas() external returns (uint256 gasUsed);
773
774    /// Stop the snapshot capture of the current gas usage by name, capturing the gas used since the start.
775    /// The group name is derived from the contract name.
776    #[cheatcode(group = Evm, safety = Unsafe)]
777    function stopSnapshotGas(string calldata name) external returns (uint256 gasUsed);
778
779    /// Stop the snapshot capture of the current gas usage by name in a group, capturing the gas used since the start.
780    #[cheatcode(group = Evm, safety = Unsafe)]
781    function stopSnapshotGas(string calldata group, string calldata name) external returns (uint256 gasUsed);
782
783    // -------- State Snapshots --------
784
785    /// `snapshot` is being deprecated in favor of `snapshotState`. It will be removed in future versions.
786    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `snapshotState`")))]
787    function snapshot() external returns (uint256 snapshotId);
788
789    /// Snapshot the current state of the evm.
790    /// Returns the ID of the snapshot that was created.
791    /// To revert a snapshot use `revertToState`.
792    #[cheatcode(group = Evm, safety = Unsafe)]
793    function snapshotState() external returns (uint256 snapshotId);
794
795    /// `revertTo` is being deprecated in favor of `revertToState`. It will be removed in future versions.
796    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `revertToState`")))]
797    function revertTo(uint256 snapshotId) external returns (bool success);
798
799    /// Revert the state of the EVM to a previous snapshot
800    /// Takes the snapshot ID to revert to.
801    ///
802    /// Returns `true` if the snapshot was successfully reverted.
803    /// Returns `false` if the snapshot does not exist.
804    ///
805    /// **Note:** This does not automatically delete the snapshot. To delete the snapshot use `deleteStateSnapshot`.
806    #[cheatcode(group = Evm, safety = Unsafe)]
807    function revertToState(uint256 snapshotId) external returns (bool success);
808
809    /// `revertToAndDelete` is being deprecated in favor of `revertToStateAndDelete`. It will be removed in future versions.
810    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `revertToStateAndDelete`")))]
811    function revertToAndDelete(uint256 snapshotId) external returns (bool success);
812
813    /// Revert the state of the EVM to a previous snapshot and automatically deletes the snapshots
814    /// Takes the snapshot ID to revert to.
815    ///
816    /// Returns `true` if the snapshot was successfully reverted and deleted.
817    /// Returns `false` if the snapshot does not exist.
818    #[cheatcode(group = Evm, safety = Unsafe)]
819    function revertToStateAndDelete(uint256 snapshotId) external returns (bool success);
820
821    /// `deleteSnapshot` is being deprecated in favor of `deleteStateSnapshot`. It will be removed in future versions.
822    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `deleteStateSnapshot`")))]
823    function deleteSnapshot(uint256 snapshotId) external returns (bool success);
824
825    /// Removes the snapshot with the given ID created by `snapshot`.
826    /// Takes the snapshot ID to delete.
827    ///
828    /// Returns `true` if the snapshot was successfully deleted.
829    /// Returns `false` if the snapshot does not exist.
830    #[cheatcode(group = Evm, safety = Unsafe)]
831    function deleteStateSnapshot(uint256 snapshotId) external returns (bool success);
832
833    /// `deleteSnapshots` is being deprecated in favor of `deleteStateSnapshots`. It will be removed in future versions.
834    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `deleteStateSnapshots`")))]
835    function deleteSnapshots() external;
836
837    /// Removes _all_ snapshots previously created by `snapshot`.
838    #[cheatcode(group = Evm, safety = Unsafe)]
839    function deleteStateSnapshots() external;
840
841    // -------- Forking --------
842    // --- Creation and Selection ---
843
844    /// Returns the identifier of the currently active fork. Reverts if no fork is currently active.
845    #[cheatcode(group = Evm, safety = Unsafe)]
846    function activeFork() external view returns (uint256 forkId);
847
848    /// Creates a new fork with the given endpoint and the _latest_ block and returns the identifier of the fork.
849    #[cheatcode(group = Evm, safety = Unsafe)]
850    function createFork(string calldata urlOrAlias) external returns (uint256 forkId);
851    /// Creates a new fork with the given endpoint and block and returns the identifier of the fork.
852    #[cheatcode(group = Evm, safety = Unsafe)]
853    function createFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);
854    /// Creates a new fork with the given endpoint and at the block the given transaction was mined in,
855    /// replays all transaction mined in the block before the transaction, and returns the identifier of the fork.
856    #[cheatcode(group = Evm, safety = Unsafe)]
857    function createFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);
858
859    /// Creates and also selects a new fork with the given endpoint and the latest block and returns the identifier of the fork.
860    #[cheatcode(group = Evm, safety = Unsafe)]
861    function createSelectFork(string calldata urlOrAlias) external returns (uint256 forkId);
862    /// Creates and also selects a new fork with the given endpoint and block and returns the identifier of the fork.
863    #[cheatcode(group = Evm, safety = Unsafe)]
864    function createSelectFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);
865    /// Creates and also selects new fork with the given endpoint and at the block the given transaction was mined in,
866    /// replays all transaction mined in the block before the transaction, returns the identifier of the fork.
867    #[cheatcode(group = Evm, safety = Unsafe)]
868    function createSelectFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);
869
870    /// Updates the currently active fork to given block number
871    /// This is similar to `roll` but for the currently active fork.
872    #[cheatcode(group = Evm, safety = Unsafe)]
873    function rollFork(uint256 blockNumber) external;
874    /// Updates the currently active fork to given transaction. This will `rollFork` with the number
875    /// of the block the transaction was mined in and replays all transaction mined before it in the block.
876    #[cheatcode(group = Evm, safety = Unsafe)]
877    function rollFork(bytes32 txHash) external;
878    /// Updates the given fork to given block number.
879    #[cheatcode(group = Evm, safety = Unsafe)]
880    function rollFork(uint256 forkId, uint256 blockNumber) external;
881    /// Updates the given fork to block number of the given transaction and replays all transaction mined before it in the block.
882    #[cheatcode(group = Evm, safety = Unsafe)]
883    function rollFork(uint256 forkId, bytes32 txHash) external;
884
885    /// Takes a fork identifier created by `createFork` and sets the corresponding forked state as active.
886    #[cheatcode(group = Evm, safety = Unsafe)]
887    function selectFork(uint256 forkId) external;
888
889    /// Fetches the given transaction from the active fork and executes it on the current state.
890    #[cheatcode(group = Evm, safety = Unsafe)]
891    function transact(bytes32 txHash) external;
892    /// Fetches the given transaction from the given fork and executes it on the current state.
893    #[cheatcode(group = Evm, safety = Unsafe)]
894    function transact(uint256 forkId, bytes32 txHash) external;
895
896    /// Performs an Ethereum JSON-RPC request to the current fork URL.
897    #[cheatcode(group = Evm, safety = Safe)]
898    function rpc(string calldata method, string calldata params) external returns (bytes memory data);
899
900    /// Performs an Ethereum JSON-RPC request to the given endpoint.
901    #[cheatcode(group = Evm, safety = Safe)]
902    function rpc(string calldata urlOrAlias, string calldata method, string calldata params)
903        external
904        returns (bytes memory data);
905
906    /// Gets all the logs according to specified filter.
907    #[cheatcode(group = Evm, safety = Safe)]
908    function eth_getLogs(uint256 fromBlock, uint256 toBlock, address target, bytes32[] calldata topics)
909        external
910        view
911        returns (EthGetLogs[] memory logs);
912
913    // --- Behavior ---
914
915    /// In forking mode, explicitly grant the given address cheatcode access.
916    #[cheatcode(group = Evm, safety = Unsafe)]
917    function allowCheatcodes(address account) external;
918
919    /// Marks that the account(s) should use persistent storage across fork swaps in a multifork setup
920    /// Meaning, changes made to the state of this account will be kept when switching forks.
921    #[cheatcode(group = Evm, safety = Unsafe)]
922    function makePersistent(address account) external;
923    /// See `makePersistent(address)`.
924    #[cheatcode(group = Evm, safety = Unsafe)]
925    function makePersistent(address account0, address account1) external;
926    /// See `makePersistent(address)`.
927    #[cheatcode(group = Evm, safety = Unsafe)]
928    function makePersistent(address account0, address account1, address account2) external;
929    /// See `makePersistent(address)`.
930    #[cheatcode(group = Evm, safety = Unsafe)]
931    function makePersistent(address[] calldata accounts) external;
932
933    /// Revokes persistent status from the address, previously added via `makePersistent`.
934    #[cheatcode(group = Evm, safety = Unsafe)]
935    function revokePersistent(address account) external;
936    /// See `revokePersistent(address)`.
937    #[cheatcode(group = Evm, safety = Unsafe)]
938    function revokePersistent(address[] calldata accounts) external;
939
940    /// Returns true if the account is marked as persistent.
941    #[cheatcode(group = Evm, safety = Unsafe)]
942    function isPersistent(address account) external view returns (bool persistent);
943
944    // -------- Record Logs --------
945
946    /// Record all the transaction logs.
947    #[cheatcode(group = Evm, safety = Safe)]
948    function recordLogs() external;
949
950    /// Gets all the recorded logs.
951    #[cheatcode(group = Evm, safety = Safe)]
952    function getRecordedLogs() external view returns (Log[] memory logs);
953
954    /// Gets all the recorded logs, in JSON format.
955    #[cheatcode(group = Evm, safety = Safe)]
956    function getRecordedLogsJson() external view returns (string memory logsJson);
957
958    // -------- Gas Metering --------
959
960    // It's recommend to use the `noGasMetering` modifier included with forge-std, instead of
961    // using these functions directly.
962
963    /// Pauses gas metering (i.e. gas usage is not counted). Noop if already paused.
964    #[cheatcode(group = Evm, safety = Safe)]
965    function pauseGasMetering() external;
966
967    /// Resumes gas metering (i.e. gas usage is counted again). Noop if already on.
968    #[cheatcode(group = Evm, safety = Safe)]
969    function resumeGasMetering() external;
970
971    /// Reset gas metering (i.e. gas usage is set to gas limit).
972    #[cheatcode(group = Evm, safety = Safe)]
973    function resetGasMetering() external;
974
975    // -------- Gas Measurement --------
976
977    /// Gets the gas used in the last call from the callee perspective.
978    #[cheatcode(group = Evm, safety = Safe)]
979    function lastCallGas() external view returns (Gas memory gas);
980
981    // ======== Test Assertions and Utilities ========
982
983    /// If the condition is false, discard this run's fuzz inputs and generate new ones.
984    #[cheatcode(group = Testing, safety = Safe)]
985    function assume(bool condition) external pure;
986
987    /// Discard this run's fuzz inputs and generate new ones if next call reverted.
988    #[cheatcode(group = Testing, safety = Safe)]
989    function assumeNoRevert() external pure;
990
991    /// Discard this run's fuzz inputs and generate new ones if next call reverts with the potential revert parameters.
992    #[cheatcode(group = Testing, safety = Safe)]
993    function assumeNoRevert(PotentialRevert calldata potentialRevert) external pure;
994
995    /// Discard this run's fuzz inputs and generate new ones if next call reverts with the any of the potential revert parameters.
996    #[cheatcode(group = Testing, safety = Safe)]
997    function assumeNoRevert(PotentialRevert[] calldata potentialReverts) external pure;
998
999    /// Writes a breakpoint to jump to in the debugger.
1000    #[cheatcode(group = Testing, safety = Safe)]
1001    function breakpoint(string calldata char) external pure;
1002
1003    /// Writes a conditional breakpoint to jump to in the debugger.
1004    #[cheatcode(group = Testing, safety = Safe)]
1005    function breakpoint(string calldata char, bool value) external pure;
1006
1007    /// Returns the Foundry version.
1008    /// Format: <cargo_version>-<tag>+<git_sha_short>.<unix_build_timestamp>.<profile>
1009    /// Sample output: 0.3.0-nightly+3cb96bde9b.1737036656.debug
1010    /// Note: Build timestamps may vary slightly across platforms due to separate CI jobs.
1011    /// For reliable version comparisons, use UNIX format (e.g., >= 1700000000)
1012    /// to compare timestamps while ignoring minor time differences.
1013    #[cheatcode(group = Testing, safety = Safe)]
1014    function getFoundryVersion() external view returns (string memory version);
1015
1016    /// Returns the RPC url for the given alias.
1017    #[cheatcode(group = Testing, safety = Safe)]
1018    function rpcUrl(string calldata rpcAlias) external view returns (string memory json);
1019
1020    /// Returns all rpc urls and their aliases `[alias, url][]`.
1021    #[cheatcode(group = Testing, safety = Safe)]
1022    function rpcUrls() external view returns (string[2][] memory urls);
1023
1024    /// Returns all rpc urls and their aliases as structs.
1025    #[cheatcode(group = Testing, safety = Safe)]
1026    function rpcUrlStructs() external view returns (Rpc[] memory urls);
1027
1028    /// Returns a Chain struct for specific alias
1029    #[cheatcode(group = Testing, safety = Safe)]
1030    function getChain(string calldata chainAlias) external view returns (Chain memory chain);
1031
1032    /// Returns a Chain struct for specific chainId
1033    #[cheatcode(group = Testing, safety = Safe)]
1034    function getChain(uint256 chainId) external view returns (Chain memory chain);
1035
1036    /// Suspends execution of the main thread for `duration` milliseconds.
1037    #[cheatcode(group = Testing, safety = Safe)]
1038    function sleep(uint256 duration) external;
1039
1040    /// Expects a call to an address with the specified calldata.
1041    /// Calldata can either be a strict or a partial match.
1042    #[cheatcode(group = Testing, safety = Unsafe)]
1043    function expectCall(address callee, bytes calldata data) external;
1044
1045    /// Expects given number of calls to an address with the specified calldata.
1046    #[cheatcode(group = Testing, safety = Unsafe)]
1047    function expectCall(address callee, bytes calldata data, uint64 count) external;
1048
1049    /// Expects a call to an address with the specified `msg.value` and calldata.
1050    #[cheatcode(group = Testing, safety = Unsafe)]
1051    function expectCall(address callee, uint256 msgValue, bytes calldata data) external;
1052
1053    /// Expects given number of calls to an address with the specified `msg.value` and calldata.
1054    #[cheatcode(group = Testing, safety = Unsafe)]
1055    function expectCall(address callee, uint256 msgValue, bytes calldata data, uint64 count) external;
1056
1057    /// Expect a call to an address with the specified `msg.value`, gas, and calldata.
1058    #[cheatcode(group = Testing, safety = Unsafe)]
1059    function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data) external;
1060
1061    /// Expects given number of calls to an address with the specified `msg.value`, gas, and calldata.
1062    #[cheatcode(group = Testing, safety = Unsafe)]
1063    function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data, uint64 count) external;
1064
1065    /// Expect a call to an address with the specified `msg.value` and calldata, and a *minimum* amount of gas.
1066    #[cheatcode(group = Testing, safety = Unsafe)]
1067    function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data) external;
1068
1069    /// Expect given number of calls to an address with the specified `msg.value` and calldata, and a *minimum* amount of gas.
1070    #[cheatcode(group = Testing, safety = Unsafe)]
1071    function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data, uint64 count)
1072        external;
1073
1074    /// Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData.).
1075    /// Call this function, then emit an event, then call a function. Internally after the call, we check if
1076    /// logs were emitted in the expected order with the expected topics and data (as specified by the booleans).
1077    #[cheatcode(group = Testing, safety = Unsafe)]
1078    function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external;
1079
1080    /// Same as the previous method, but also checks supplied address against emitting contract.
1081    #[cheatcode(group = Testing, safety = Unsafe)]
1082    function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter)
1083        external;
1084
1085    /// Prepare an expected log with all topic and data checks enabled.
1086    /// Call this function, then emit an event, then call a function. Internally after the call, we check if
1087    /// logs were emitted in the expected order with the expected topics and data.
1088    #[cheatcode(group = Testing, safety = Unsafe)]
1089    function expectEmit() external;
1090
1091    /// Same as the previous method, but also checks supplied address against emitting contract.
1092    #[cheatcode(group = Testing, safety = Unsafe)]
1093    function expectEmit(address emitter) external;
1094
1095    /// Expect a given number of logs with the provided topics.
1096    #[cheatcode(group = Testing, safety = Unsafe)]
1097    function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, uint64 count) external;
1098
1099    /// Expect a given number of logs from a specific emitter with the provided topics.
1100    #[cheatcode(group = Testing, safety = Unsafe)]
1101    function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter, uint64 count)
1102        external;
1103
1104    /// Expect a given number of logs with all topic and data checks enabled.
1105    #[cheatcode(group = Testing, safety = Unsafe)]
1106    function expectEmit(uint64 count) external;
1107
1108    /// Expect a given number of logs from a specific emitter with all topic and data checks enabled.
1109    #[cheatcode(group = Testing, safety = Unsafe)]
1110    function expectEmit(address emitter, uint64 count) external;
1111
1112    /// Prepare an expected anonymous log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData.).
1113    /// Call this function, then emit an anonymous event, then call a function. Internally after the call, we check if
1114    /// logs were emitted in the expected order with the expected topics and data (as specified by the booleans).
1115    #[cheatcode(group = Testing, safety = Unsafe)]
1116    function expectEmitAnonymous(bool checkTopic0, bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external;
1117
1118    /// Same as the previous method, but also checks supplied address against emitting contract.
1119    #[cheatcode(group = Testing, safety = Unsafe)]
1120    function expectEmitAnonymous(bool checkTopic0, bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter)
1121        external;
1122
1123    /// Prepare an expected anonymous log with all topic and data checks enabled.
1124    /// Call this function, then emit an anonymous event, then call a function. Internally after the call, we check if
1125    /// logs were emitted in the expected order with the expected topics and data.
1126    #[cheatcode(group = Testing, safety = Unsafe)]
1127    function expectEmitAnonymous() external;
1128
1129    /// Same as the previous method, but also checks supplied address against emitting contract.
1130    #[cheatcode(group = Testing, safety = Unsafe)]
1131    function expectEmitAnonymous(address emitter) external;
1132
1133    /// Expects the deployment of the specified bytecode by the specified address using the CREATE opcode
1134    #[cheatcode(group = Testing, safety = Unsafe)]
1135    function expectCreate(bytes calldata bytecode, address deployer) external;
1136
1137    /// Expects the deployment of the specified bytecode by the specified address using the CREATE2 opcode
1138    #[cheatcode(group = Testing, safety = Unsafe)]
1139    function expectCreate2(bytes calldata bytecode, address deployer) external;
1140
1141    /// Expects an error on next call with any revert data.
1142    #[cheatcode(group = Testing, safety = Unsafe)]
1143    function expectRevert() external;
1144
1145    /// Expects an error on next call that exactly matches the revert data.
1146    #[cheatcode(group = Testing, safety = Unsafe)]
1147    function expectRevert(bytes4 revertData) external;
1148
1149    /// Expects an error on next call that exactly matches the revert data.
1150    #[cheatcode(group = Testing, safety = Unsafe)]
1151    function expectRevert(bytes calldata revertData) external;
1152
1153    /// Expects an error with any revert data on next call to reverter address.
1154    #[cheatcode(group = Testing, safety = Unsafe)]
1155    function expectRevert(address reverter) external;
1156
1157    /// Expects an error from reverter address on next call, with any revert data.
1158    #[cheatcode(group = Testing, safety = Unsafe)]
1159    function expectRevert(bytes4 revertData, address reverter) external;
1160
1161    /// Expects an error from reverter address on next call, that exactly matches the revert data.
1162    #[cheatcode(group = Testing, safety = Unsafe)]
1163    function expectRevert(bytes calldata revertData, address reverter) external;
1164
1165    /// Expects a `count` number of reverts from the upcoming calls with any revert data or reverter.
1166    #[cheatcode(group = Testing, safety = Unsafe)]
1167    function expectRevert(uint64 count) external;
1168
1169    /// Expects a `count` number of reverts from the upcoming calls that match the revert data.
1170    #[cheatcode(group = Testing, safety = Unsafe)]
1171    function expectRevert(bytes4 revertData, uint64 count) external;
1172
1173    /// Expects a `count` number of reverts from the upcoming calls that exactly match the revert data.
1174    #[cheatcode(group = Testing, safety = Unsafe)]
1175    function expectRevert(bytes calldata revertData, uint64 count) external;
1176
1177    /// Expects a `count` number of reverts from the upcoming calls from the reverter address.
1178    #[cheatcode(group = Testing, safety = Unsafe)]
1179    function expectRevert(address reverter, uint64 count) external;
1180
1181    /// Expects a `count` number of reverts from the upcoming calls from the reverter address that match the revert data.
1182    #[cheatcode(group = Testing, safety = Unsafe)]
1183    function expectRevert(bytes4 revertData, address reverter, uint64 count) external;
1184
1185    /// Expects a `count` number of reverts from the upcoming calls from the reverter address that exactly match the revert data.
1186    #[cheatcode(group = Testing, safety = Unsafe)]
1187    function expectRevert(bytes calldata revertData, address reverter, uint64 count) external;
1188
1189    /// Expects an error on next call that starts with the revert data.
1190    #[cheatcode(group = Testing, safety = Unsafe)]
1191    function expectPartialRevert(bytes4 revertData) external;
1192
1193    /// Expects an error on next call to reverter address, that starts with the revert data.
1194    #[cheatcode(group = Testing, safety = Unsafe)]
1195    function expectPartialRevert(bytes4 revertData, address reverter) external;
1196
1197    /// Expects an error on next cheatcode call with any revert data.
1198    #[cheatcode(group = Testing, safety = Unsafe, status = Internal)]
1199    function _expectCheatcodeRevert() external;
1200
1201    /// Expects an error on next cheatcode call that starts with the revert data.
1202    #[cheatcode(group = Testing, safety = Unsafe, status = Internal)]
1203    function _expectCheatcodeRevert(bytes4 revertData) external;
1204
1205    /// Expects an error on next cheatcode call that exactly matches the revert data.
1206    #[cheatcode(group = Testing, safety = Unsafe, status = Internal)]
1207    function _expectCheatcodeRevert(bytes calldata revertData) external;
1208
1209    /// Only allows memory writes to offsets [0x00, 0x60) ∪ [min, max) in the current subcontext. If any other
1210    /// memory is written to, the test will fail. Can be called multiple times to add more ranges to the set.
1211    #[cheatcode(group = Testing, safety = Unsafe)]
1212    function expectSafeMemory(uint64 min, uint64 max) external;
1213
1214    /// Stops all safe memory expectation in the current subcontext.
1215    #[cheatcode(group = Testing, safety = Unsafe)]
1216    function stopExpectSafeMemory() external;
1217
1218    /// Only allows memory writes to offsets [0x00, 0x60) ∪ [min, max) in the next created subcontext.
1219    /// If any other memory is written to, the test will fail. Can be called multiple times to add more ranges
1220    /// to the set.
1221    #[cheatcode(group = Testing, safety = Unsafe)]
1222    function expectSafeMemoryCall(uint64 min, uint64 max) external;
1223
1224    /// Marks a test as skipped. Must be called at the top level of a test.
1225    #[cheatcode(group = Testing, safety = Unsafe)]
1226    function skip(bool skipTest) external;
1227
1228    /// Marks a test as skipped with a reason. Must be called at the top level of a test.
1229    #[cheatcode(group = Testing, safety = Unsafe)]
1230    function skip(bool skipTest, string calldata reason) external;
1231
1232    /// Asserts that the given condition is true.
1233    #[cheatcode(group = Testing, safety = Safe)]
1234    function assertTrue(bool condition) external pure;
1235
1236    /// Asserts that the given condition is true and includes error message into revert string on failure.
1237    #[cheatcode(group = Testing, safety = Safe)]
1238    function assertTrue(bool condition, string calldata error) external pure;
1239
1240    /// Asserts that the given condition is false.
1241    #[cheatcode(group = Testing, safety = Safe)]
1242    function assertFalse(bool condition) external pure;
1243
1244    /// Asserts that the given condition is false and includes error message into revert string on failure.
1245    #[cheatcode(group = Testing, safety = Safe)]
1246    function assertFalse(bool condition, string calldata error) external pure;
1247
1248    /// Asserts that two `bool` values are equal.
1249    #[cheatcode(group = Testing, safety = Safe)]
1250    function assertEq(bool left, bool right) external pure;
1251
1252    /// Asserts that two `bool` values are equal and includes error message into revert string on failure.
1253    #[cheatcode(group = Testing, safety = Safe)]
1254    function assertEq(bool left, bool right, string calldata error) external pure;
1255
1256    /// Asserts that two `uint256` values are equal.
1257    #[cheatcode(group = Testing, safety = Safe)]
1258    function assertEq(uint256 left, uint256 right) external pure;
1259
1260    /// Asserts that two `uint256` values are equal and includes error message into revert string on failure.
1261    #[cheatcode(group = Testing, safety = Safe)]
1262    function assertEq(uint256 left, uint256 right, string calldata error) external pure;
1263
1264    /// Asserts that two `int256` values are equal.
1265    #[cheatcode(group = Testing, safety = Safe)]
1266    function assertEq(int256 left, int256 right) external pure;
1267
1268    /// Asserts that two `int256` values are equal and includes error message into revert string on failure.
1269    #[cheatcode(group = Testing, safety = Safe)]
1270    function assertEq(int256 left, int256 right, string calldata error) external pure;
1271
1272    /// Asserts that two `address` values are equal.
1273    #[cheatcode(group = Testing, safety = Safe)]
1274    function assertEq(address left, address right) external pure;
1275
1276    /// Asserts that two `address` values are equal and includes error message into revert string on failure.
1277    #[cheatcode(group = Testing, safety = Safe)]
1278    function assertEq(address left, address right, string calldata error) external pure;
1279
1280    /// Asserts that two `bytes32` values are equal.
1281    #[cheatcode(group = Testing, safety = Safe)]
1282    function assertEq(bytes32 left, bytes32 right) external pure;
1283
1284    /// Asserts that two `bytes32` values are equal and includes error message into revert string on failure.
1285    #[cheatcode(group = Testing, safety = Safe)]
1286    function assertEq(bytes32 left, bytes32 right, string calldata error) external pure;
1287
1288    /// Asserts that two `string` values are equal.
1289    #[cheatcode(group = Testing, safety = Safe)]
1290    function assertEq(string calldata left, string calldata right) external pure;
1291
1292    /// Asserts that two `string` values are equal and includes error message into revert string on failure.
1293    #[cheatcode(group = Testing, safety = Safe)]
1294    function assertEq(string calldata left, string calldata right, string calldata error) external pure;
1295
1296    /// Asserts that two `bytes` values are equal.
1297    #[cheatcode(group = Testing, safety = Safe)]
1298    function assertEq(bytes calldata left, bytes calldata right) external pure;
1299
1300    /// Asserts that two `bytes` values are equal and includes error message into revert string on failure.
1301    #[cheatcode(group = Testing, safety = Safe)]
1302    function assertEq(bytes calldata left, bytes calldata right, string calldata error) external pure;
1303
1304    /// Asserts that two arrays of `bool` values are equal.
1305    #[cheatcode(group = Testing, safety = Safe)]
1306    function assertEq(bool[] calldata left, bool[] calldata right) external pure;
1307
1308    /// Asserts that two arrays of `bool` values are equal and includes error message into revert string on failure.
1309    #[cheatcode(group = Testing, safety = Safe)]
1310    function assertEq(bool[] calldata left, bool[] calldata right, string calldata error) external pure;
1311
1312    /// Asserts that two arrays of `uint256 values are equal.
1313    #[cheatcode(group = Testing, safety = Safe)]
1314    function assertEq(uint256[] calldata left, uint256[] calldata right) external pure;
1315
1316    /// Asserts that two arrays of `uint256` values are equal and includes error message into revert string on failure.
1317    #[cheatcode(group = Testing, safety = Safe)]
1318    function assertEq(uint256[] calldata left, uint256[] calldata right, string calldata error) external pure;
1319
1320    /// Asserts that two arrays of `int256` values are equal.
1321    #[cheatcode(group = Testing, safety = Safe)]
1322    function assertEq(int256[] calldata left, int256[] calldata right) external pure;
1323
1324    /// Asserts that two arrays of `int256` values are equal and includes error message into revert string on failure.
1325    #[cheatcode(group = Testing, safety = Safe)]
1326    function assertEq(int256[] calldata left, int256[] calldata right, string calldata error) external pure;
1327
1328    /// Asserts that two arrays of `address` values are equal.
1329    #[cheatcode(group = Testing, safety = Safe)]
1330    function assertEq(address[] calldata left, address[] calldata right) external pure;
1331
1332    /// Asserts that two arrays of `address` values are equal and includes error message into revert string on failure.
1333    #[cheatcode(group = Testing, safety = Safe)]
1334    function assertEq(address[] calldata left, address[] calldata right, string calldata error) external pure;
1335
1336    /// Asserts that two arrays of `bytes32` values are equal.
1337    #[cheatcode(group = Testing, safety = Safe)]
1338    function assertEq(bytes32[] calldata left, bytes32[] calldata right) external pure;
1339
1340    /// Asserts that two arrays of `bytes32` values are equal and includes error message into revert string on failure.
1341    #[cheatcode(group = Testing, safety = Safe)]
1342    function assertEq(bytes32[] calldata left, bytes32[] calldata right, string calldata error) external pure;
1343
1344    /// Asserts that two arrays of `string` values are equal.
1345    #[cheatcode(group = Testing, safety = Safe)]
1346    function assertEq(string[] calldata left, string[] calldata right) external pure;
1347
1348    /// Asserts that two arrays of `string` values are equal and includes error message into revert string on failure.
1349    #[cheatcode(group = Testing, safety = Safe)]
1350    function assertEq(string[] calldata left, string[] calldata right, string calldata error) external pure;
1351
1352    /// Asserts that two arrays of `bytes` values are equal.
1353    #[cheatcode(group = Testing, safety = Safe)]
1354    function assertEq(bytes[] calldata left, bytes[] calldata right) external pure;
1355
1356    /// Asserts that two arrays of `bytes` values are equal and includes error message into revert string on failure.
1357    #[cheatcode(group = Testing, safety = Safe)]
1358    function assertEq(bytes[] calldata left, bytes[] calldata right, string calldata error) external pure;
1359
1360    /// Asserts that two `uint256` values are equal, formatting them with decimals in failure message.
1361    #[cheatcode(group = Testing, safety = Safe)]
1362    function assertEqDecimal(uint256 left, uint256 right, uint256 decimals) external pure;
1363
1364    /// Asserts that two `uint256` values are equal, formatting them with decimals in failure message.
1365    /// Includes error message into revert string on failure.
1366    #[cheatcode(group = Testing, safety = Safe)]
1367    function assertEqDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure;
1368
1369    /// Asserts that two `int256` values are equal, formatting them with decimals in failure message.
1370    #[cheatcode(group = Testing, safety = Safe)]
1371    function assertEqDecimal(int256 left, int256 right, uint256 decimals) external pure;
1372
1373    /// Asserts that two `int256` values are equal, formatting them with decimals in failure message.
1374    /// Includes error message into revert string on failure.
1375    #[cheatcode(group = Testing, safety = Safe)]
1376    function assertEqDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure;
1377
1378    /// Asserts that two `bool` values are not equal.
1379    #[cheatcode(group = Testing, safety = Safe)]
1380    function assertNotEq(bool left, bool right) external pure;
1381
1382    /// Asserts that two `bool` values are not equal and includes error message into revert string on failure.
1383    #[cheatcode(group = Testing, safety = Safe)]
1384    function assertNotEq(bool left, bool right, string calldata error) external pure;
1385
1386    /// Asserts that two `uint256` values are not equal.
1387    #[cheatcode(group = Testing, safety = Safe)]
1388    function assertNotEq(uint256 left, uint256 right) external pure;
1389
1390    /// Asserts that two `uint256` values are not equal and includes error message into revert string on failure.
1391    #[cheatcode(group = Testing, safety = Safe)]
1392    function assertNotEq(uint256 left, uint256 right, string calldata error) external pure;
1393
1394    /// Asserts that two `int256` values are not equal.
1395    #[cheatcode(group = Testing, safety = Safe)]
1396    function assertNotEq(int256 left, int256 right) external pure;
1397
1398    /// Asserts that two `int256` values are not equal and includes error message into revert string on failure.
1399    #[cheatcode(group = Testing, safety = Safe)]
1400    function assertNotEq(int256 left, int256 right, string calldata error) external pure;
1401
1402    /// Asserts that two `address` values are not equal.
1403    #[cheatcode(group = Testing, safety = Safe)]
1404    function assertNotEq(address left, address right) external pure;
1405
1406    /// Asserts that two `address` values are not equal and includes error message into revert string on failure.
1407    #[cheatcode(group = Testing, safety = Safe)]
1408    function assertNotEq(address left, address right, string calldata error) external pure;
1409
1410    /// Asserts that two `bytes32` values are not equal.
1411    #[cheatcode(group = Testing, safety = Safe)]
1412    function assertNotEq(bytes32 left, bytes32 right) external pure;
1413
1414    /// Asserts that two `bytes32` values are not equal and includes error message into revert string on failure.
1415    #[cheatcode(group = Testing, safety = Safe)]
1416    function assertNotEq(bytes32 left, bytes32 right, string calldata error) external pure;
1417
1418    /// Asserts that two `string` values are not equal.
1419    #[cheatcode(group = Testing, safety = Safe)]
1420    function assertNotEq(string calldata left, string calldata right) external pure;
1421
1422    /// Asserts that two `string` values are not equal and includes error message into revert string on failure.
1423    #[cheatcode(group = Testing, safety = Safe)]
1424    function assertNotEq(string calldata left, string calldata right, string calldata error) external pure;
1425
1426    /// Asserts that two `bytes` values are not equal.
1427    #[cheatcode(group = Testing, safety = Safe)]
1428    function assertNotEq(bytes calldata left, bytes calldata right) external pure;
1429
1430    /// Asserts that two `bytes` values are not equal and includes error message into revert string on failure.
1431    #[cheatcode(group = Testing, safety = Safe)]
1432    function assertNotEq(bytes calldata left, bytes calldata right, string calldata error) external pure;
1433
1434    /// Asserts that two arrays of `bool` values are not equal.
1435    #[cheatcode(group = Testing, safety = Safe)]
1436    function assertNotEq(bool[] calldata left, bool[] calldata right) external pure;
1437
1438    /// Asserts that two arrays of `bool` values are not equal and includes error message into revert string on failure.
1439    #[cheatcode(group = Testing, safety = Safe)]
1440    function assertNotEq(bool[] calldata left, bool[] calldata right, string calldata error) external pure;
1441
1442    /// Asserts that two arrays of `uint256` values are not equal.
1443    #[cheatcode(group = Testing, safety = Safe)]
1444    function assertNotEq(uint256[] calldata left, uint256[] calldata right) external pure;
1445
1446    /// Asserts that two arrays of `uint256` values are not equal and includes error message into revert string on failure.
1447    #[cheatcode(group = Testing, safety = Safe)]
1448    function assertNotEq(uint256[] calldata left, uint256[] calldata right, string calldata error) external pure;
1449
1450    /// Asserts that two arrays of `int256` values are not equal.
1451    #[cheatcode(group = Testing, safety = Safe)]
1452    function assertNotEq(int256[] calldata left, int256[] calldata right) external pure;
1453
1454    /// Asserts that two arrays of `int256` values are not equal and includes error message into revert string on failure.
1455    #[cheatcode(group = Testing, safety = Safe)]
1456    function assertNotEq(int256[] calldata left, int256[] calldata right, string calldata error) external pure;
1457
1458    /// Asserts that two arrays of `address` values are not equal.
1459    #[cheatcode(group = Testing, safety = Safe)]
1460    function assertNotEq(address[] calldata left, address[] calldata right) external pure;
1461
1462    /// Asserts that two arrays of `address` values are not equal and includes error message into revert string on failure.
1463    #[cheatcode(group = Testing, safety = Safe)]
1464    function assertNotEq(address[] calldata left, address[] calldata right, string calldata error) external pure;
1465
1466    /// Asserts that two arrays of `bytes32` values are not equal.
1467    #[cheatcode(group = Testing, safety = Safe)]
1468    function assertNotEq(bytes32[] calldata left, bytes32[] calldata right) external pure;
1469
1470    /// Asserts that two arrays of `bytes32` values are not equal and includes error message into revert string on failure.
1471    #[cheatcode(group = Testing, safety = Safe)]
1472    function assertNotEq(bytes32[] calldata left, bytes32[] calldata right, string calldata error) external pure;
1473
1474    /// Asserts that two arrays of `string` values are not equal.
1475    #[cheatcode(group = Testing, safety = Safe)]
1476    function assertNotEq(string[] calldata left, string[] calldata right) external pure;
1477
1478    /// Asserts that two arrays of `string` values are not equal and includes error message into revert string on failure.
1479    #[cheatcode(group = Testing, safety = Safe)]
1480    function assertNotEq(string[] calldata left, string[] calldata right, string calldata error) external pure;
1481
1482    /// Asserts that two arrays of `bytes` values are not equal.
1483    #[cheatcode(group = Testing, safety = Safe)]
1484    function assertNotEq(bytes[] calldata left, bytes[] calldata right) external pure;
1485
1486    /// Asserts that two arrays of `bytes` values are not equal and includes error message into revert string on failure.
1487    #[cheatcode(group = Testing, safety = Safe)]
1488    function assertNotEq(bytes[] calldata left, bytes[] calldata right, string calldata error) external pure;
1489
1490    /// Asserts that two `uint256` values are not equal, formatting them with decimals in failure message.
1491    #[cheatcode(group = Testing, safety = Safe)]
1492    function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals) external pure;
1493
1494    /// Asserts that two `uint256` values are not equal, formatting them with decimals in failure message.
1495    /// Includes error message into revert string on failure.
1496    #[cheatcode(group = Testing, safety = Safe)]
1497    function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure;
1498
1499    /// Asserts that two `int256` values are not equal, formatting them with decimals in failure message.
1500    #[cheatcode(group = Testing, safety = Safe)]
1501    function assertNotEqDecimal(int256 left, int256 right, uint256 decimals) external pure;
1502
1503    /// Asserts that two `int256` values are not equal, formatting them with decimals in failure message.
1504    /// Includes error message into revert string on failure.
1505    #[cheatcode(group = Testing, safety = Safe)]
1506    function assertNotEqDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure;
1507
1508    /// Compares two `uint256` values. Expects first value to be greater than second.
1509    #[cheatcode(group = Testing, safety = Safe)]
1510    function assertGt(uint256 left, uint256 right) external pure;
1511
1512    /// Compares two `uint256` values. Expects first value to be greater than second.
1513    /// Includes error message into revert string on failure.
1514    #[cheatcode(group = Testing, safety = Safe)]
1515    function assertGt(uint256 left, uint256 right, string calldata error) external pure;
1516
1517    /// Compares two `int256` values. Expects first value to be greater than second.
1518    #[cheatcode(group = Testing, safety = Safe)]
1519    function assertGt(int256 left, int256 right) external pure;
1520
1521    /// Compares two `int256` values. Expects first value to be greater than second.
1522    /// Includes error message into revert string on failure.
1523    #[cheatcode(group = Testing, safety = Safe)]
1524    function assertGt(int256 left, int256 right, string calldata error) external pure;
1525
1526    /// Compares two `uint256` values. Expects first value to be greater than second.
1527    /// Formats values with decimals in failure message.
1528    #[cheatcode(group = Testing, safety = Safe)]
1529    function assertGtDecimal(uint256 left, uint256 right, uint256 decimals) external pure;
1530
1531    /// Compares two `uint256` values. Expects first value to be greater than second.
1532    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1533    #[cheatcode(group = Testing, safety = Safe)]
1534    function assertGtDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure;
1535
1536    /// Compares two `int256` values. Expects first value to be greater than second.
1537    /// Formats values with decimals in failure message.
1538    #[cheatcode(group = Testing, safety = Safe)]
1539    function assertGtDecimal(int256 left, int256 right, uint256 decimals) external pure;
1540
1541    /// Compares two `int256` values. Expects first value to be greater than second.
1542    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1543    #[cheatcode(group = Testing, safety = Safe)]
1544    function assertGtDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure;
1545
1546    /// Compares two `uint256` values. Expects first value to be greater than or equal to second.
1547    #[cheatcode(group = Testing, safety = Safe)]
1548    function assertGe(uint256 left, uint256 right) external pure;
1549
1550    /// Compares two `uint256` values. Expects first value to be greater than or equal to second.
1551    /// Includes error message into revert string on failure.
1552    #[cheatcode(group = Testing, safety = Safe)]
1553    function assertGe(uint256 left, uint256 right, string calldata error) external pure;
1554
1555    /// Compares two `int256` values. Expects first value to be greater than or equal to second.
1556    #[cheatcode(group = Testing, safety = Safe)]
1557    function assertGe(int256 left, int256 right) external pure;
1558
1559    /// Compares two `int256` values. Expects first value to be greater than or equal to second.
1560    /// Includes error message into revert string on failure.
1561    #[cheatcode(group = Testing, safety = Safe)]
1562    function assertGe(int256 left, int256 right, string calldata error) external pure;
1563
1564    /// Compares two `uint256` values. Expects first value to be greater than or equal to second.
1565    /// Formats values with decimals in failure message.
1566    #[cheatcode(group = Testing, safety = Safe)]
1567    function assertGeDecimal(uint256 left, uint256 right, uint256 decimals) external pure;
1568
1569    /// Compares two `uint256` values. Expects first value to be greater than or equal to second.
1570    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1571    #[cheatcode(group = Testing, safety = Safe)]
1572    function assertGeDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure;
1573
1574    /// Compares two `int256` values. Expects first value to be greater than or equal to second.
1575    /// Formats values with decimals in failure message.
1576    #[cheatcode(group = Testing, safety = Safe)]
1577    function assertGeDecimal(int256 left, int256 right, uint256 decimals) external pure;
1578
1579    /// Compares two `int256` values. Expects first value to be greater than or equal to second.
1580    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1581    #[cheatcode(group = Testing, safety = Safe)]
1582    function assertGeDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure;
1583
1584    /// Compares two `uint256` values. Expects first value to be less than second.
1585    #[cheatcode(group = Testing, safety = Safe)]
1586    function assertLt(uint256 left, uint256 right) external pure;
1587
1588    /// Compares two `uint256` values. Expects first value to be less than second.
1589    /// Includes error message into revert string on failure.
1590    #[cheatcode(group = Testing, safety = Safe)]
1591    function assertLt(uint256 left, uint256 right, string calldata error) external pure;
1592
1593    /// Compares two `int256` values. Expects first value to be less than second.
1594    #[cheatcode(group = Testing, safety = Safe)]
1595    function assertLt(int256 left, int256 right) external pure;
1596
1597    /// Compares two `int256` values. Expects first value to be less than second.
1598    /// Includes error message into revert string on failure.
1599    #[cheatcode(group = Testing, safety = Safe)]
1600    function assertLt(int256 left, int256 right, string calldata error) external pure;
1601
1602    /// Compares two `uint256` values. Expects first value to be less than second.
1603    /// Formats values with decimals in failure message.
1604    #[cheatcode(group = Testing, safety = Safe)]
1605    function assertLtDecimal(uint256 left, uint256 right, uint256 decimals) external pure;
1606
1607    /// Compares two `uint256` values. Expects first value to be less than second.
1608    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1609    #[cheatcode(group = Testing, safety = Safe)]
1610    function assertLtDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure;
1611
1612    /// Compares two `int256` values. Expects first value to be less than second.
1613    /// Formats values with decimals in failure message.
1614    #[cheatcode(group = Testing, safety = Safe)]
1615    function assertLtDecimal(int256 left, int256 right, uint256 decimals) external pure;
1616
1617    /// Compares two `int256` values. Expects first value to be less than second.
1618    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1619    #[cheatcode(group = Testing, safety = Safe)]
1620    function assertLtDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure;
1621
1622    /// Compares two `uint256` values. Expects first value to be less than or equal to second.
1623    #[cheatcode(group = Testing, safety = Safe)]
1624    function assertLe(uint256 left, uint256 right) external pure;
1625
1626    /// Compares two `uint256` values. Expects first value to be less than or equal to second.
1627    /// Includes error message into revert string on failure.
1628    #[cheatcode(group = Testing, safety = Safe)]
1629    function assertLe(uint256 left, uint256 right, string calldata error) external pure;
1630
1631    /// Compares two `int256` values. Expects first value to be less than or equal to second.
1632    #[cheatcode(group = Testing, safety = Safe)]
1633    function assertLe(int256 left, int256 right) external pure;
1634
1635    /// Compares two `int256` values. Expects first value to be less than or equal to second.
1636    /// Includes error message into revert string on failure.
1637    #[cheatcode(group = Testing, safety = Safe)]
1638    function assertLe(int256 left, int256 right, string calldata error) external pure;
1639
1640    /// Compares two `uint256` values. Expects first value to be less than or equal to second.
1641    /// Formats values with decimals in failure message.
1642    #[cheatcode(group = Testing, safety = Safe)]
1643    function assertLeDecimal(uint256 left, uint256 right, uint256 decimals) external pure;
1644
1645    /// Compares two `uint256` values. Expects first value to be less than or equal to second.
1646    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1647    #[cheatcode(group = Testing, safety = Safe)]
1648    function assertLeDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure;
1649
1650    /// Compares two `int256` values. Expects first value to be less than or equal to second.
1651    /// Formats values with decimals in failure message.
1652    #[cheatcode(group = Testing, safety = Safe)]
1653    function assertLeDecimal(int256 left, int256 right, uint256 decimals) external pure;
1654
1655    /// Compares two `int256` values. Expects first value to be less than or equal to second.
1656    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1657    #[cheatcode(group = Testing, safety = Safe)]
1658    function assertLeDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure;
1659
1660    /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`.
1661    #[cheatcode(group = Testing, safety = Safe)]
1662    function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta) external pure;
1663
1664    /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`.
1665    /// Includes error message into revert string on failure.
1666    #[cheatcode(group = Testing, safety = Safe)]
1667    function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta, string calldata error) external pure;
1668
1669    /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`.
1670    #[cheatcode(group = Testing, safety = Safe)]
1671    function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta) external pure;
1672
1673    /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`.
1674    /// Includes error message into revert string on failure.
1675    #[cheatcode(group = Testing, safety = Safe)]
1676    function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta, string calldata error) external pure;
1677
1678    /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`.
1679    /// Formats values with decimals in failure message.
1680    #[cheatcode(group = Testing, safety = Safe)]
1681    function assertApproxEqAbsDecimal(uint256 left, uint256 right, uint256 maxDelta, uint256 decimals) external pure;
1682
1683    /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`.
1684    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1685    #[cheatcode(group = Testing, safety = Safe)]
1686    function assertApproxEqAbsDecimal(
1687        uint256 left,
1688        uint256 right,
1689        uint256 maxDelta,
1690        uint256 decimals,
1691        string calldata error
1692    ) external pure;
1693
1694    /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`.
1695    /// Formats values with decimals in failure message.
1696    #[cheatcode(group = Testing, safety = Safe)]
1697    function assertApproxEqAbsDecimal(int256 left, int256 right, uint256 maxDelta, uint256 decimals) external pure;
1698
1699    /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`.
1700    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1701    #[cheatcode(group = Testing, safety = Safe)]
1702    function assertApproxEqAbsDecimal(
1703        int256 left,
1704        int256 right,
1705        uint256 maxDelta,
1706        uint256 decimals,
1707        string calldata error
1708    ) external pure;
1709
1710    /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1711    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1712    #[cheatcode(group = Testing, safety = Safe)]
1713    function assertApproxEqRel(uint256 left, uint256 right, uint256 maxPercentDelta) external pure;
1714
1715    /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1716    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1717    /// Includes error message into revert string on failure.
1718    #[cheatcode(group = Testing, safety = Safe)]
1719    function assertApproxEqRel(uint256 left, uint256 right, uint256 maxPercentDelta, string calldata error) external pure;
1720
1721    /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1722    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1723    #[cheatcode(group = Testing, safety = Safe)]
1724    function assertApproxEqRel(int256 left, int256 right, uint256 maxPercentDelta) external pure;
1725
1726    /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1727    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1728    /// Includes error message into revert string on failure.
1729    #[cheatcode(group = Testing, safety = Safe)]
1730    function assertApproxEqRel(int256 left, int256 right, uint256 maxPercentDelta, string calldata error) external pure;
1731
1732    /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1733    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1734    /// Formats values with decimals in failure message.
1735    #[cheatcode(group = Testing, safety = Safe)]
1736    function assertApproxEqRelDecimal(
1737        uint256 left,
1738        uint256 right,
1739        uint256 maxPercentDelta,
1740        uint256 decimals
1741    ) external pure;
1742
1743    /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1744    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1745    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1746    #[cheatcode(group = Testing, safety = Safe)]
1747    function assertApproxEqRelDecimal(
1748        uint256 left,
1749        uint256 right,
1750        uint256 maxPercentDelta,
1751        uint256 decimals,
1752        string calldata error
1753    ) external pure;
1754
1755    /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1756    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1757    /// Formats values with decimals in failure message.
1758    #[cheatcode(group = Testing, safety = Safe)]
1759    function assertApproxEqRelDecimal(
1760        int256 left,
1761        int256 right,
1762        uint256 maxPercentDelta,
1763        uint256 decimals
1764    ) external pure;
1765
1766    /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1767    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1768    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1769    #[cheatcode(group = Testing, safety = Safe)]
1770    function assertApproxEqRelDecimal(
1771        int256 left,
1772        int256 right,
1773        uint256 maxPercentDelta,
1774        uint256 decimals,
1775        string calldata error
1776    ) external pure;
1777
1778    /// Returns true if the current Foundry version is greater than or equal to the given version.
1779    /// The given version string must be in the format `major.minor.patch`.
1780    ///
1781    /// This is equivalent to `foundryVersionCmp(version) >= 0`.
1782    #[cheatcode(group = Testing, safety = Safe)]
1783    function foundryVersionAtLeast(string calldata version) external view returns (bool);
1784
1785    /// Compares the current Foundry version with the given version string.
1786    /// The given version string must be in the format `major.minor.patch`.
1787    ///
1788    /// Returns:
1789    /// -1 if current Foundry version is less than the given version
1790    /// 0 if current Foundry version equals the given version
1791    /// 1 if current Foundry version is greater than the given version
1792    ///
1793    /// This result can then be used with a comparison operator against `0`.
1794    /// For example, to check if the current Foundry version is greater than or equal to `1.0.0`:
1795    /// `if (foundryVersionCmp("1.0.0") >= 0) { ... }`
1796    #[cheatcode(group = Testing, safety = Safe)]
1797    function foundryVersionCmp(string calldata version) external view returns (int256);
1798
1799    // ======== OS and Filesystem ========
1800
1801    // -------- Metadata --------
1802
1803    /// Returns true if the given path points to an existing entity, else returns false.
1804    #[cheatcode(group = Filesystem)]
1805    function exists(string calldata path) external view returns (bool result);
1806
1807    /// Given a path, query the file system to get information about a file, directory, etc.
1808    #[cheatcode(group = Filesystem)]
1809    function fsMetadata(string calldata path) external view returns (FsMetadata memory metadata);
1810
1811    /// Returns true if the path exists on disk and is pointing at a directory, else returns false.
1812    #[cheatcode(group = Filesystem)]
1813    function isDir(string calldata path) external view returns (bool result);
1814
1815    /// Returns true if the path exists on disk and is pointing at a regular file, else returns false.
1816    #[cheatcode(group = Filesystem)]
1817    function isFile(string calldata path) external view returns (bool result);
1818
1819    /// Get the path of the current project root.
1820    #[cheatcode(group = Filesystem)]
1821    function projectRoot() external view returns (string memory path);
1822
1823    /// Returns the time since unix epoch in milliseconds.
1824    #[cheatcode(group = Filesystem)]
1825    function unixTime() external view returns (uint256 milliseconds);
1826
1827    // -------- Reading and writing --------
1828
1829    /// Closes file for reading, resetting the offset and allowing to read it from beginning with readLine.
1830    /// `path` is relative to the project root.
1831    #[cheatcode(group = Filesystem)]
1832    function closeFile(string calldata path) external;
1833
1834    /// Copies the contents of one file to another. This function will **overwrite** the contents of `to`.
1835    /// On success, the total number of bytes copied is returned and it is equal to the length of the `to` file as reported by `metadata`.
1836    /// Both `from` and `to` are relative to the project root.
1837    #[cheatcode(group = Filesystem)]
1838    function copyFile(string calldata from, string calldata to) external returns (uint64 copied);
1839
1840    /// Creates a new, empty directory at the provided path.
1841    /// This cheatcode will revert in the following situations, but is not limited to just these cases:
1842    /// - User lacks permissions to modify `path`.
1843    /// - A parent of the given path doesn't exist and `recursive` is false.
1844    /// - `path` already exists and `recursive` is false.
1845    /// `path` is relative to the project root.
1846    #[cheatcode(group = Filesystem)]
1847    function createDir(string calldata path, bool recursive) external;
1848
1849    /// Reads the directory at the given path recursively, up to `maxDepth`.
1850    /// `maxDepth` defaults to 1, meaning only the direct children of the given directory will be returned.
1851    /// Follows symbolic links if `followLinks` is true.
1852    #[cheatcode(group = Filesystem)]
1853    function readDir(string calldata path) external view returns (DirEntry[] memory entries);
1854    /// See `readDir(string)`.
1855    #[cheatcode(group = Filesystem)]
1856    function readDir(string calldata path, uint64 maxDepth) external view returns (DirEntry[] memory entries);
1857    /// See `readDir(string)`.
1858    #[cheatcode(group = Filesystem)]
1859    function readDir(string calldata path, uint64 maxDepth, bool followLinks)
1860        external
1861        view
1862        returns (DirEntry[] memory entries);
1863
1864    /// Reads the entire content of file to string. `path` is relative to the project root.
1865    #[cheatcode(group = Filesystem)]
1866    function readFile(string calldata path) external view returns (string memory data);
1867
1868    /// Reads the entire content of file as binary. `path` is relative to the project root.
1869    #[cheatcode(group = Filesystem)]
1870    function readFileBinary(string calldata path) external view returns (bytes memory data);
1871
1872    /// Reads next line of file to string.
1873    #[cheatcode(group = Filesystem)]
1874    function readLine(string calldata path) external view returns (string memory line);
1875
1876    /// Reads a symbolic link, returning the path that the link points to.
1877    /// This cheatcode will revert in the following situations, but is not limited to just these cases:
1878    /// - `path` is not a symbolic link.
1879    /// - `path` does not exist.
1880    #[cheatcode(group = Filesystem)]
1881    function readLink(string calldata linkPath) external view returns (string memory targetPath);
1882
1883    /// Removes a directory at the provided path.
1884    /// This cheatcode will revert in the following situations, but is not limited to just these cases:
1885    /// - `path` doesn't exist.
1886    /// - `path` isn't a directory.
1887    /// - User lacks permissions to modify `path`.
1888    /// - The directory is not empty and `recursive` is false.
1889    /// `path` is relative to the project root.
1890    #[cheatcode(group = Filesystem)]
1891    function removeDir(string calldata path, bool recursive) external;
1892
1893    /// Removes a file from the filesystem.
1894    /// This cheatcode will revert in the following situations, but is not limited to just these cases:
1895    /// - `path` points to a directory.
1896    /// - The file doesn't exist.
1897    /// - The user lacks permissions to remove the file.
1898    /// `path` is relative to the project root.
1899    #[cheatcode(group = Filesystem)]
1900    function removeFile(string calldata path) external;
1901
1902    /// Writes data to file, creating a file if it does not exist, and entirely replacing its contents if it does.
1903    /// `path` is relative to the project root.
1904    #[cheatcode(group = Filesystem)]
1905    function writeFile(string calldata path, string calldata data) external;
1906
1907    /// Writes binary data to a file, creating a file if it does not exist, and entirely replacing its contents if it does.
1908    /// `path` is relative to the project root.
1909    #[cheatcode(group = Filesystem)]
1910    function writeFileBinary(string calldata path, bytes calldata data) external;
1911
1912    /// Writes line to file, creating a file if it does not exist.
1913    /// `path` is relative to the project root.
1914    #[cheatcode(group = Filesystem)]
1915    function writeLine(string calldata path, string calldata data) external;
1916
1917    /// Gets the artifact path from code (aka. creation code).
1918    #[cheatcode(group = Filesystem)]
1919    function getArtifactPathByCode(bytes calldata code) external view returns (string memory path);
1920
1921    /// Gets the artifact path from deployed code (aka. runtime code).
1922    #[cheatcode(group = Filesystem)]
1923    function getArtifactPathByDeployedCode(bytes calldata deployedCode) external view returns (string memory path);
1924
1925    /// Gets the creation bytecode from an artifact file. Takes in the relative path to the json file or the path to the
1926    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1927    #[cheatcode(group = Filesystem)]
1928    function getCode(string calldata artifactPath) external view returns (bytes memory creationBytecode);
1929
1930    /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the
1931    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1932    /// Reverts if the target artifact contains unlinked library placeholders.
1933    #[cheatcode(group = Filesystem)]
1934    function deployCode(string calldata artifactPath) external returns (address deployedAddress);
1935
1936    /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the
1937    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1938    /// Reverts if the target artifact contains unlinked library placeholders.
1939    ///
1940    /// Additionally accepts abi-encoded constructor arguments.
1941    #[cheatcode(group = Filesystem)]
1942    function deployCode(string calldata artifactPath, bytes calldata constructorArgs) external returns (address deployedAddress);
1943
1944    /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the
1945    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1946    /// Reverts if the target artifact contains unlinked library placeholders.
1947    ///
1948    /// Additionally accepts `msg.value`.
1949    #[cheatcode(group = Filesystem)]
1950    function deployCode(string calldata artifactPath, uint256 value) external returns (address deployedAddress);
1951
1952    /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the
1953    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1954    /// Reverts if the target artifact contains unlinked library placeholders.
1955    ///
1956    /// Additionally accepts abi-encoded constructor arguments and `msg.value`.
1957    #[cheatcode(group = Filesystem)]
1958    function deployCode(string calldata artifactPath, bytes calldata constructorArgs, uint256 value) external returns (address deployedAddress);
1959
1960    /// Deploys a contract from an artifact file, using the CREATE2 salt. Takes in the relative path to the json file or the path to the
1961    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1962    /// Reverts if the target artifact contains unlinked library placeholders.
1963    #[cheatcode(group = Filesystem)]
1964    function deployCode(string calldata artifactPath, bytes32 salt) external returns (address deployedAddress);
1965
1966    /// Deploys a contract from an artifact file, using the CREATE2 salt. Takes in the relative path to the json file or the path to the
1967    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1968    /// Reverts if the target artifact contains unlinked library placeholders.
1969    ///
1970    /// Additionally accepts abi-encoded constructor arguments.
1971    #[cheatcode(group = Filesystem)]
1972    function deployCode(string calldata artifactPath, bytes calldata constructorArgs, bytes32 salt) external returns (address deployedAddress);
1973
1974    /// Deploys a contract from an artifact file, using the CREATE2 salt. Takes in the relative path to the json file or the path to the
1975    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1976    /// Reverts if the target artifact contains unlinked library placeholders.
1977    ///
1978    /// Additionally accepts `msg.value`.
1979    #[cheatcode(group = Filesystem)]
1980    function deployCode(string calldata artifactPath, uint256 value, bytes32 salt) external returns (address deployedAddress);
1981
1982    /// Deploys a contract from an artifact file, using the CREATE2 salt. Takes in the relative path to the json file or the path to the
1983    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1984    /// Reverts if the target artifact contains unlinked library placeholders.
1985    ///
1986    /// Additionally accepts abi-encoded constructor arguments and `msg.value`.
1987    #[cheatcode(group = Filesystem)]
1988    function deployCode(string calldata artifactPath, bytes calldata constructorArgs, uint256 value, bytes32 salt) external returns (address deployedAddress);
1989
1990    /// Gets the deployed bytecode from an artifact file. Takes in the relative path to the json file or the path to the
1991    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1992    #[cheatcode(group = Filesystem)]
1993    function getDeployedCode(string calldata artifactPath) external view returns (bytes memory runtimeBytecode);
1994
1995    /// Returns the most recent broadcast for the given contract on `chainId` matching `txType`.
1996    ///
1997    /// For example:
1998    ///
1999    /// The most recent deployment can be fetched by passing `txType` as `CREATE` or `CREATE2`.
2000    ///
2001    /// The most recent call can be fetched by passing `txType` as `CALL`.
2002    #[cheatcode(group = Filesystem)]
2003    function getBroadcast(string calldata contractName, uint64 chainId, BroadcastTxType txType) external view returns (BroadcastTxSummary memory);
2004
2005    /// Returns all broadcasts for the given contract on `chainId` with the specified `txType`.
2006    ///
2007    /// Sorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber.
2008    #[cheatcode(group = Filesystem)]
2009    function getBroadcasts(string calldata contractName, uint64 chainId, BroadcastTxType txType) external view returns (BroadcastTxSummary[] memory);
2010
2011    /// Returns all broadcasts for the given contract on `chainId`.
2012    ///
2013    /// Sorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber.
2014    #[cheatcode(group = Filesystem)]
2015    function getBroadcasts(string calldata contractName, uint64 chainId) external view returns (BroadcastTxSummary[] memory);
2016
2017    /// Returns the most recent deployment for the current `chainId`.
2018    #[cheatcode(group = Filesystem)]
2019    function getDeployment(string calldata contractName) external view returns (address deployedAddress);
2020
2021    /// Returns the most recent deployment for the given contract on `chainId`
2022    #[cheatcode(group = Filesystem)]
2023    function getDeployment(string calldata contractName, uint64 chainId) external view returns (address deployedAddress);
2024
2025    /// Returns all deployments for the given contract on `chainId`
2026    ///
2027    /// Sorted in descending order of deployment time i.e descending order of BroadcastTxSummary.blockNumber.
2028    ///
2029    /// The most recent deployment is the first element, and the oldest is the last.
2030    #[cheatcode(group = Filesystem)]
2031    function getDeployments(string calldata contractName, uint64 chainId) external view returns (address[] memory deployedAddresses);
2032
2033    // -------- Foreign Function Interface --------
2034
2035    /// Performs a foreign function call via the terminal.
2036    #[cheatcode(group = Filesystem)]
2037    function ffi(string[] calldata commandInput) external returns (bytes memory result);
2038
2039    /// Performs a foreign function call via terminal and returns the exit code, stdout, and stderr.
2040    #[cheatcode(group = Filesystem)]
2041    function tryFfi(string[] calldata commandInput) external returns (FfiResult memory result);
2042
2043    // -------- User Interaction --------
2044
2045    /// Prompts the user for a string value in the terminal.
2046    #[cheatcode(group = Filesystem)]
2047    function prompt(string calldata promptText) external returns (string memory input);
2048
2049    /// Prompts the user for a hidden string value in the terminal.
2050    #[cheatcode(group = Filesystem)]
2051    function promptSecret(string calldata promptText) external returns (string memory input);
2052
2053    /// Prompts the user for hidden uint256 in the terminal (usually pk).
2054    #[cheatcode(group = Filesystem)]
2055    function promptSecretUint(string calldata promptText) external returns (uint256);
2056
2057    /// Prompts the user for an address in the terminal.
2058    #[cheatcode(group = Filesystem)]
2059    function promptAddress(string calldata promptText) external returns (address);
2060
2061    /// Prompts the user for uint256 in the terminal.
2062    #[cheatcode(group = Filesystem)]
2063    function promptUint(string calldata promptText) external returns (uint256);
2064
2065    // ======== Environment Variables ========
2066
2067    /// Resolves the env variable placeholders of a given input string.
2068    #[cheatcode(group = Environment)]
2069    function resolveEnv(string calldata input) external returns (string memory);
2070
2071    /// Sets environment variables.
2072    #[cheatcode(group = Environment)]
2073    function setEnv(string calldata name, string calldata value) external;
2074
2075    /// Gets the environment variable `name` and returns true if it exists, else returns false.
2076    #[cheatcode(group = Environment)]
2077    function envExists(string calldata name) external view returns (bool result);
2078
2079    /// Gets the environment variable `name` and parses it as `bool`.
2080    /// Reverts if the variable was not found or could not be parsed.
2081    #[cheatcode(group = Environment)]
2082    function envBool(string calldata name) external view returns (bool value);
2083    /// Gets the environment variable `name` and parses it as `uint256`.
2084    /// Reverts if the variable was not found or could not be parsed.
2085    #[cheatcode(group = Environment)]
2086    function envUint(string calldata name) external view returns (uint256 value);
2087    /// Gets the environment variable `name` and parses it as `int256`.
2088    /// Reverts if the variable was not found or could not be parsed.
2089    #[cheatcode(group = Environment)]
2090    function envInt(string calldata name) external view returns (int256 value);
2091    /// Gets the environment variable `name` and parses it as `address`.
2092    /// Reverts if the variable was not found or could not be parsed.
2093    #[cheatcode(group = Environment)]
2094    function envAddress(string calldata name) external view returns (address value);
2095    /// Gets the environment variable `name` and parses it as `bytes32`.
2096    /// Reverts if the variable was not found or could not be parsed.
2097    #[cheatcode(group = Environment)]
2098    function envBytes32(string calldata name) external view returns (bytes32 value);
2099    /// Gets the environment variable `name` and parses it as `string`.
2100    /// Reverts if the variable was not found or could not be parsed.
2101    #[cheatcode(group = Environment)]
2102    function envString(string calldata name) external view returns (string memory value);
2103    /// Gets the environment variable `name` and parses it as `bytes`.
2104    /// Reverts if the variable was not found or could not be parsed.
2105    #[cheatcode(group = Environment)]
2106    function envBytes(string calldata name) external view returns (bytes memory value);
2107
2108    /// Gets the environment variable `name` and parses it as an array of `bool`, delimited by `delim`.
2109    /// Reverts if the variable was not found or could not be parsed.
2110    #[cheatcode(group = Environment)]
2111    function envBool(string calldata name, string calldata delim) external view returns (bool[] memory value);
2112    /// Gets the environment variable `name` and parses it as an array of `uint256`, delimited by `delim`.
2113    /// Reverts if the variable was not found or could not be parsed.
2114    #[cheatcode(group = Environment)]
2115    function envUint(string calldata name, string calldata delim) external view returns (uint256[] memory value);
2116    /// Gets the environment variable `name` and parses it as an array of `int256`, delimited by `delim`.
2117    /// Reverts if the variable was not found or could not be parsed.
2118    #[cheatcode(group = Environment)]
2119    function envInt(string calldata name, string calldata delim) external view returns (int256[] memory value);
2120    /// Gets the environment variable `name` and parses it as an array of `address`, delimited by `delim`.
2121    /// Reverts if the variable was not found or could not be parsed.
2122    #[cheatcode(group = Environment)]
2123    function envAddress(string calldata name, string calldata delim) external view returns (address[] memory value);
2124    /// Gets the environment variable `name` and parses it as an array of `bytes32`, delimited by `delim`.
2125    /// Reverts if the variable was not found or could not be parsed.
2126    #[cheatcode(group = Environment)]
2127    function envBytes32(string calldata name, string calldata delim) external view returns (bytes32[] memory value);
2128    /// Gets the environment variable `name` and parses it as an array of `string`, delimited by `delim`.
2129    /// Reverts if the variable was not found or could not be parsed.
2130    #[cheatcode(group = Environment)]
2131    function envString(string calldata name, string calldata delim) external view returns (string[] memory value);
2132    /// Gets the environment variable `name` and parses it as an array of `bytes`, delimited by `delim`.
2133    /// Reverts if the variable was not found or could not be parsed.
2134    #[cheatcode(group = Environment)]
2135    function envBytes(string calldata name, string calldata delim) external view returns (bytes[] memory value);
2136
2137    /// Gets the environment variable `name` and parses it as `bool`.
2138    /// Reverts if the variable could not be parsed.
2139    /// Returns `defaultValue` if the variable was not found.
2140    #[cheatcode(group = Environment)]
2141    function envOr(string calldata name, bool defaultValue) external view returns (bool value);
2142    /// Gets the environment variable `name` and parses it as `uint256`.
2143    /// Reverts if the variable could not be parsed.
2144    /// Returns `defaultValue` if the variable was not found.
2145    #[cheatcode(group = Environment)]
2146    function envOr(string calldata name, uint256 defaultValue) external view returns (uint256 value);
2147    /// Gets the environment variable `name` and parses it as `int256`.
2148    /// Reverts if the variable could not be parsed.
2149    /// Returns `defaultValue` if the variable was not found.
2150    #[cheatcode(group = Environment)]
2151    function envOr(string calldata name, int256 defaultValue) external view returns (int256 value);
2152    /// Gets the environment variable `name` and parses it as `address`.
2153    /// Reverts if the variable could not be parsed.
2154    /// Returns `defaultValue` if the variable was not found.
2155    #[cheatcode(group = Environment)]
2156    function envOr(string calldata name, address defaultValue) external view returns (address value);
2157    /// Gets the environment variable `name` and parses it as `bytes32`.
2158    /// Reverts if the variable could not be parsed.
2159    /// Returns `defaultValue` if the variable was not found.
2160    #[cheatcode(group = Environment)]
2161    function envOr(string calldata name, bytes32 defaultValue) external view returns (bytes32 value);
2162    /// Gets the environment variable `name` and parses it as `string`.
2163    /// Reverts if the variable could not be parsed.
2164    /// Returns `defaultValue` if the variable was not found.
2165    #[cheatcode(group = Environment)]
2166    function envOr(string calldata name, string calldata defaultValue) external view returns (string memory value);
2167    /// Gets the environment variable `name` and parses it as `bytes`.
2168    /// Reverts if the variable could not be parsed.
2169    /// Returns `defaultValue` if the variable was not found.
2170    #[cheatcode(group = Environment)]
2171    function envOr(string calldata name, bytes calldata defaultValue) external view returns (bytes memory value);
2172
2173    /// Gets the environment variable `name` and parses it as an array of `bool`, delimited by `delim`.
2174    /// Reverts if the variable could not be parsed.
2175    /// Returns `defaultValue` if the variable was not found.
2176    #[cheatcode(group = Environment)]
2177    function envOr(string calldata name, string calldata delim, bool[] calldata defaultValue)
2178        external view
2179        returns (bool[] memory value);
2180    /// Gets the environment variable `name` and parses it as an array of `uint256`, delimited by `delim`.
2181    /// Reverts if the variable could not be parsed.
2182    /// Returns `defaultValue` if the variable was not found.
2183    #[cheatcode(group = Environment)]
2184    function envOr(string calldata name, string calldata delim, uint256[] calldata defaultValue)
2185        external view
2186        returns (uint256[] memory value);
2187    /// Gets the environment variable `name` and parses it as an array of `int256`, delimited by `delim`.
2188    /// Reverts if the variable could not be parsed.
2189    /// Returns `defaultValue` if the variable was not found.
2190    #[cheatcode(group = Environment)]
2191    function envOr(string calldata name, string calldata delim, int256[] calldata defaultValue)
2192        external view
2193        returns (int256[] memory value);
2194    /// Gets the environment variable `name` and parses it as an array of `address`, delimited by `delim`.
2195    /// Reverts if the variable could not be parsed.
2196    /// Returns `defaultValue` if the variable was not found.
2197    #[cheatcode(group = Environment)]
2198    function envOr(string calldata name, string calldata delim, address[] calldata defaultValue)
2199        external view
2200        returns (address[] memory value);
2201    /// Gets the environment variable `name` and parses it as an array of `bytes32`, delimited by `delim`.
2202    /// Reverts if the variable could not be parsed.
2203    /// Returns `defaultValue` if the variable was not found.
2204    #[cheatcode(group = Environment)]
2205    function envOr(string calldata name, string calldata delim, bytes32[] calldata defaultValue)
2206        external view
2207        returns (bytes32[] memory value);
2208    /// Gets the environment variable `name` and parses it as an array of `string`, delimited by `delim`.
2209    /// Reverts if the variable could not be parsed.
2210    /// Returns `defaultValue` if the variable was not found.
2211    #[cheatcode(group = Environment)]
2212    function envOr(string calldata name, string calldata delim, string[] calldata defaultValue)
2213        external view
2214        returns (string[] memory value);
2215    /// Gets the environment variable `name` and parses it as an array of `bytes`, delimited by `delim`.
2216    /// Reverts if the variable could not be parsed.
2217    /// Returns `defaultValue` if the variable was not found.
2218    #[cheatcode(group = Environment)]
2219    function envOr(string calldata name, string calldata delim, bytes[] calldata defaultValue)
2220        external view
2221        returns (bytes[] memory value);
2222
2223    /// Returns true if `forge` command was executed in given context.
2224    #[cheatcode(group = Environment)]
2225    function isContext(ForgeContext context) external view returns (bool result);
2226
2227    // ======== Scripts ========
2228    // -------- Broadcasting Transactions --------
2229
2230    /// Has the next call (at this call depth only) create transactions that can later be signed and sent onchain.
2231    ///
2232    /// Broadcasting address is determined by checking the following in order:
2233    /// 1. If `--sender` argument was provided, that address is used.
2234    /// 2. If exactly one signer (e.g. private key, hw wallet, keystore) is set when `forge broadcast` is invoked, that signer is used.
2235    /// 3. Otherwise, default foundry sender (1804c8AB1F12E6bbf3894d4083f33e07309d1f38) is used.
2236    #[cheatcode(group = Scripting)]
2237    function broadcast() external;
2238
2239    /// Has the next call (at this call depth only) create a transaction with the address provided
2240    /// as the sender that can later be signed and sent onchain.
2241    #[cheatcode(group = Scripting)]
2242    function broadcast(address signer) external;
2243
2244    /// Has the next call (at this call depth only) create a transaction with the private key
2245    /// provided as the sender that can later be signed and sent onchain.
2246    #[cheatcode(group = Scripting)]
2247    function broadcast(uint256 privateKey) external;
2248
2249    /// Has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain.
2250    ///
2251    /// Broadcasting address is determined by checking the following in order:
2252    /// 1. If `--sender` argument was provided, that address is used.
2253    /// 2. If exactly one signer (e.g. private key, hw wallet, keystore) is set when `forge broadcast` is invoked, that signer is used.
2254    /// 3. Otherwise, default foundry sender (1804c8AB1F12E6bbf3894d4083f33e07309d1f38) is used.
2255    #[cheatcode(group = Scripting)]
2256    function startBroadcast() external;
2257
2258    /// Has all subsequent calls (at this call depth only) create transactions with the address
2259    /// provided that can later be signed and sent onchain.
2260    #[cheatcode(group = Scripting)]
2261    function startBroadcast(address signer) external;
2262
2263    /// Has all subsequent calls (at this call depth only) create transactions with the private key
2264    /// provided that can later be signed and sent onchain.
2265    #[cheatcode(group = Scripting)]
2266    function startBroadcast(uint256 privateKey) external;
2267
2268    /// Stops collecting onchain transactions.
2269    #[cheatcode(group = Scripting)]
2270    function stopBroadcast() external;
2271
2272    /// Takes a signed transaction and broadcasts it to the network.
2273    #[cheatcode(group = Scripting)]
2274    function broadcastRawTransaction(bytes calldata data) external;
2275
2276    /// Sign an EIP-7702 authorization for delegation
2277    #[cheatcode(group = Scripting)]
2278    function signDelegation(address implementation, uint256 privateKey) external returns (SignedDelegation memory signedDelegation);
2279
2280    /// Sign an EIP-7702 authorization for delegation for specific nonce
2281    #[cheatcode(group = Scripting)]
2282    function signDelegation(address implementation, uint256 privateKey, uint64 nonce) external returns (SignedDelegation memory signedDelegation);
2283
2284    /// Sign an EIP-7702 authorization for delegation, with optional cross-chain validity.
2285    #[cheatcode(group = Scripting)]
2286    function signDelegation(address implementation, uint256 privateKey, bool crossChain) external returns (SignedDelegation memory signedDelegation);
2287
2288    /// Designate the next call as an EIP-7702 transaction
2289    #[cheatcode(group = Scripting)]
2290    function attachDelegation(SignedDelegation calldata signedDelegation) external;
2291
2292    /// Designate the next call as an EIP-7702 transaction, with optional cross-chain validity.
2293    #[cheatcode(group = Scripting)]
2294    function attachDelegation(SignedDelegation calldata signedDelegation, bool crossChain) external;
2295
2296    /// Sign an EIP-7702 authorization and designate the next call as an EIP-7702 transaction
2297    #[cheatcode(group = Scripting)]
2298    function signAndAttachDelegation(address implementation, uint256 privateKey) external returns (SignedDelegation memory signedDelegation);
2299
2300    /// Sign an EIP-7702 authorization and designate the next call as an EIP-7702 transaction for specific nonce
2301    #[cheatcode(group = Scripting)]
2302    function signAndAttachDelegation(address implementation, uint256 privateKey, uint64 nonce) external returns (SignedDelegation memory signedDelegation);
2303
2304    /// Sign an EIP-7702 authorization and designate the next call as an EIP-7702 transaction, with optional cross-chain validity.
2305    #[cheatcode(group = Scripting)]
2306    function signAndAttachDelegation(address implementation, uint256 privateKey, bool crossChain) external returns (SignedDelegation memory signedDelegation);
2307
2308    /// Attach an EIP-4844 blob to the next call
2309    #[cheatcode(group = Scripting)]
2310    function attachBlob(bytes calldata blob) external;
2311
2312    /// Returns addresses of available unlocked wallets in the script environment.
2313    #[cheatcode(group = Scripting)]
2314    function getWallets() external view returns (address[] memory wallets);
2315
2316    // ======== Utilities ========
2317
2318    // -------- Strings --------
2319
2320    /// Converts the given value to a `string`.
2321    #[cheatcode(group = String)]
2322    function toString(address value) external pure returns (string memory stringifiedValue);
2323    /// Converts the given value to a `string`.
2324    #[cheatcode(group = String)]
2325    function toString(bytes calldata value) external pure returns (string memory stringifiedValue);
2326    /// Converts the given value to a `string`.
2327    #[cheatcode(group = String)]
2328    function toString(bytes32 value) external pure returns (string memory stringifiedValue);
2329    /// Converts the given value to a `string`.
2330    #[cheatcode(group = String)]
2331    function toString(bool value) external pure returns (string memory stringifiedValue);
2332    /// Converts the given value to a `string`.
2333    #[cheatcode(group = String)]
2334    function toString(uint256 value) external pure returns (string memory stringifiedValue);
2335    /// Converts the given value to a `string`.
2336    #[cheatcode(group = String)]
2337    function toString(int256 value) external pure returns (string memory stringifiedValue);
2338
2339    /// Parses the given `string` into `bytes`.
2340    #[cheatcode(group = String)]
2341    function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue);
2342    /// Parses the given `string` into an `address`.
2343    #[cheatcode(group = String)]
2344    function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue);
2345    /// Parses the given `string` into a `uint256`.
2346    #[cheatcode(group = String)]
2347    function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue);
2348    /// Parses the given `string` into a `int256`.
2349    #[cheatcode(group = String)]
2350    function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue);
2351    /// Parses the given `string` into a `bytes32`.
2352    #[cheatcode(group = String)]
2353    function parseBytes32(string calldata stringifiedValue) external pure returns (bytes32 parsedValue);
2354    /// Parses the given `string` into a `bool`.
2355    #[cheatcode(group = String)]
2356    function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue);
2357
2358    /// Converts the given `string` value to Lowercase.
2359    #[cheatcode(group = String)]
2360    function toLowercase(string calldata input) external pure returns (string memory output);
2361    /// Converts the given `string` value to Uppercase.
2362    #[cheatcode(group = String)]
2363    function toUppercase(string calldata input) external pure returns (string memory output);
2364    /// Trims leading and trailing whitespace from the given `string` value.
2365    #[cheatcode(group = String)]
2366    function trim(string calldata input) external pure returns (string memory output);
2367    /// Replaces occurrences of `from` in the given `string` with `to`.
2368    #[cheatcode(group = String)]
2369    function replace(string calldata input, string calldata from, string calldata to) external pure returns (string memory output);
2370    /// Splits the given `string` into an array of strings divided by the `delimiter`.
2371    #[cheatcode(group = String)]
2372    function split(string calldata input, string calldata delimiter) external pure returns (string[] memory outputs);
2373    /// Returns the index of the first occurrence of a `key` in an `input` string.
2374    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `key` is not found.
2375    /// Returns 0 in case of an empty `key`.
2376    #[cheatcode(group = String)]
2377    function indexOf(string calldata input, string calldata key) external pure returns (uint256);
2378    /// Returns true if `search` is found in `subject`, false otherwise.
2379    #[cheatcode(group = String)]
2380    function contains(string calldata subject, string calldata search) external pure returns (bool result);
2381
2382    // ======== JSON Parsing and Manipulation ========
2383
2384    // -------- Reading --------
2385
2386    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/parse-json to understand the
2387    // limitations and caveats of the JSON parsing cheats.
2388
2389    /// Checks if `key` exists in a JSON object
2390    /// `keyExists` is being deprecated in favor of `keyExistsJson`. It will be removed in future versions.
2391    #[cheatcode(group = Json, status = Deprecated(Some("replaced by `keyExistsJson`")))]
2392    function keyExists(string calldata json, string calldata key) external view returns (bool);
2393    /// Checks if `key` exists in a JSON object.
2394    #[cheatcode(group = Json)]
2395    function keyExistsJson(string calldata json, string calldata key) external view returns (bool);
2396
2397    /// ABI-encodes a JSON object.
2398    #[cheatcode(group = Json)]
2399    function parseJson(string calldata json) external pure returns (bytes memory abiEncodedData);
2400    /// ABI-encodes a JSON object at `key`.
2401    #[cheatcode(group = Json)]
2402    function parseJson(string calldata json, string calldata key) external pure returns (bytes memory abiEncodedData);
2403
2404    // The following parseJson cheatcodes will do type coercion, for the type that they indicate.
2405    // For example, parseJsonUint will coerce all values to a uint256. That includes stringified numbers '12.'
2406    // and hex numbers '0xEF.'.
2407    // Type coercion works ONLY for discrete values or arrays. That means that the key must return a value or array, not
2408    // a JSON object.
2409
2410    /// Parses a string of JSON data at `key` and coerces it to `uint256`.
2411    #[cheatcode(group = Json)]
2412    function parseJsonUint(string calldata json, string calldata key) external pure returns (uint256);
2413    /// Parses a string of JSON data at `key` and coerces it to `uint256[]`.
2414    #[cheatcode(group = Json)]
2415    function parseJsonUintArray(string calldata json, string calldata key) external pure returns (uint256[] memory);
2416    /// Parses a string of JSON data at `key` and coerces it to `int256`.
2417    #[cheatcode(group = Json)]
2418    function parseJsonInt(string calldata json, string calldata key) external pure returns (int256);
2419    /// Parses a string of JSON data at `key` and coerces it to `int256[]`.
2420    #[cheatcode(group = Json)]
2421    function parseJsonIntArray(string calldata json, string calldata key) external pure returns (int256[] memory);
2422    /// Parses a string of JSON data at `key` and coerces it to `bool`.
2423    #[cheatcode(group = Json)]
2424    function parseJsonBool(string calldata json, string calldata key) external pure returns (bool);
2425    /// Parses a string of JSON data at `key` and coerces it to `bool[]`.
2426    #[cheatcode(group = Json)]
2427    function parseJsonBoolArray(string calldata json, string calldata key) external pure returns (bool[] memory);
2428    /// Parses a string of JSON data at `key` and coerces it to `address`.
2429    #[cheatcode(group = Json)]
2430    function parseJsonAddress(string calldata json, string calldata key) external pure returns (address);
2431    /// Parses a string of JSON data at `key` and coerces it to `address[]`.
2432    #[cheatcode(group = Json)]
2433    function parseJsonAddressArray(string calldata json, string calldata key)
2434        external
2435        pure
2436        returns (address[] memory);
2437    /// Parses a string of JSON data at `key` and coerces it to `string`.
2438    #[cheatcode(group = Json)]
2439    function parseJsonString(string calldata json, string calldata key) external pure returns (string memory);
2440    /// Parses a string of JSON data at `key` and coerces it to `string[]`.
2441    #[cheatcode(group = Json)]
2442    function parseJsonStringArray(string calldata json, string calldata key) external pure returns (string[] memory);
2443    /// Parses a string of JSON data at `key` and coerces it to `bytes`.
2444    #[cheatcode(group = Json)]
2445    function parseJsonBytes(string calldata json, string calldata key) external pure returns (bytes memory);
2446    /// Parses a string of JSON data at `key` and coerces it to `bytes[]`.
2447    #[cheatcode(group = Json)]
2448    function parseJsonBytesArray(string calldata json, string calldata key) external pure returns (bytes[] memory);
2449    /// Parses a string of JSON data at `key` and coerces it to `bytes32`.
2450    #[cheatcode(group = Json)]
2451    function parseJsonBytes32(string calldata json, string calldata key) external pure returns (bytes32);
2452    /// Parses a string of JSON data at `key` and coerces it to `bytes32[]`.
2453    #[cheatcode(group = Json)]
2454    function parseJsonBytes32Array(string calldata json, string calldata key)
2455        external
2456        pure
2457        returns (bytes32[] memory);
2458
2459    /// Parses a string of JSON data and coerces it to type corresponding to `typeDescription`.
2460    #[cheatcode(group = Json)]
2461    function parseJsonType(string calldata json, string calldata typeDescription) external pure returns (bytes memory);
2462    /// Parses a string of JSON data at `key` and coerces it to type corresponding to `typeDescription`.
2463    #[cheatcode(group = Json)]
2464    function parseJsonType(string calldata json, string calldata key, string calldata typeDescription) external pure returns (bytes memory);
2465    /// Parses a string of JSON data at `key` and coerces it to type array corresponding to `typeDescription`.
2466    #[cheatcode(group = Json)]
2467    function parseJsonTypeArray(string calldata json, string calldata key, string calldata typeDescription)
2468        external
2469        pure
2470        returns (bytes memory);
2471
2472    /// Returns an array of all the keys in a JSON object.
2473    #[cheatcode(group = Json)]
2474    function parseJsonKeys(string calldata json, string calldata key) external pure returns (string[] memory keys);
2475
2476    // -------- Writing --------
2477
2478    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/serialize-json to understand how
2479    // to use the serialization cheats.
2480
2481    /// Serializes a key and value to a JSON object stored in-memory that can be later written to a file.
2482    /// Returns the stringified version of the specific JSON file up to that moment.
2483    #[cheatcode(group = Json)]
2484    function serializeJson(string calldata objectKey, string calldata value) external returns (string memory json);
2485
2486    /// See `serializeJson`.
2487    #[cheatcode(group = Json)]
2488    function serializeBool(string calldata objectKey, string calldata valueKey, bool value)
2489        external
2490        returns (string memory json);
2491    /// See `serializeJson`.
2492    #[cheatcode(group = Json)]
2493    function serializeUint(string calldata objectKey, string calldata valueKey, uint256 value)
2494        external
2495        returns (string memory json);
2496    /// See `serializeJson`.
2497    #[cheatcode(group = Json)]
2498    function serializeUintToHex(string calldata objectKey, string calldata valueKey, uint256 value)
2499        external
2500        returns (string memory json);
2501    /// See `serializeJson`.
2502    #[cheatcode(group = Json)]
2503    function serializeInt(string calldata objectKey, string calldata valueKey, int256 value)
2504        external
2505        returns (string memory json);
2506    /// See `serializeJson`.
2507    #[cheatcode(group = Json)]
2508    function serializeAddress(string calldata objectKey, string calldata valueKey, address value)
2509        external
2510        returns (string memory json);
2511    /// See `serializeJson`.
2512    #[cheatcode(group = Json)]
2513    function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32 value)
2514        external
2515        returns (string memory json);
2516    /// See `serializeJson`.
2517    #[cheatcode(group = Json)]
2518    function serializeString(string calldata objectKey, string calldata valueKey, string calldata value)
2519        external
2520        returns (string memory json);
2521    /// See `serializeJson`.
2522    #[cheatcode(group = Json)]
2523    function serializeBytes(string calldata objectKey, string calldata valueKey, bytes calldata value)
2524        external
2525        returns (string memory json);
2526
2527    /// See `serializeJson`.
2528    #[cheatcode(group = Json)]
2529    function serializeBool(string calldata objectKey, string calldata valueKey, bool[] calldata values)
2530        external
2531        returns (string memory json);
2532    /// See `serializeJson`.
2533    #[cheatcode(group = Json)]
2534    function serializeUint(string calldata objectKey, string calldata valueKey, uint256[] calldata values)
2535        external
2536        returns (string memory json);
2537    /// See `serializeJson`.
2538    #[cheatcode(group = Json)]
2539    function serializeInt(string calldata objectKey, string calldata valueKey, int256[] calldata values)
2540        external
2541        returns (string memory json);
2542    /// See `serializeJson`.
2543    #[cheatcode(group = Json)]
2544    function serializeAddress(string calldata objectKey, string calldata valueKey, address[] calldata values)
2545        external
2546        returns (string memory json);
2547    /// See `serializeJson`.
2548    #[cheatcode(group = Json)]
2549    function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32[] calldata values)
2550        external
2551        returns (string memory json);
2552    /// See `serializeJson`.
2553    #[cheatcode(group = Json)]
2554    function serializeString(string calldata objectKey, string calldata valueKey, string[] calldata values)
2555        external
2556        returns (string memory json);
2557    /// See `serializeJson`.
2558    #[cheatcode(group = Json)]
2559    function serializeBytes(string calldata objectKey, string calldata valueKey, bytes[] calldata values)
2560        external
2561        returns (string memory json);
2562    /// See `serializeJson`.
2563    #[cheatcode(group = Json)]
2564    function serializeJsonType(string calldata typeDescription, bytes calldata value)
2565        external
2566        pure
2567        returns (string memory json);
2568    /// See `serializeJson`.
2569    #[cheatcode(group = Json)]
2570    function serializeJsonType(string calldata objectKey, string calldata valueKey, string calldata typeDescription, bytes calldata value)
2571        external
2572        returns (string memory json);
2573
2574    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/write-json to understand how
2575    // to use the JSON writing cheats.
2576
2577    /// Write a serialized JSON object to a file. If the file exists, it will be overwritten.
2578    #[cheatcode(group = Json)]
2579    function writeJson(string calldata json, string calldata path) external;
2580
2581    /// Write a serialized JSON object to an **existing** JSON file, replacing a value with key = <value_key.>
2582    /// This is useful to replace a specific value of a JSON file, without having to parse the entire thing.
2583    /// This cheatcode will create new keys if they didn't previously exist.
2584    #[cheatcode(group = Json)]
2585    function writeJson(string calldata json, string calldata path, string calldata valueKey) external;
2586
2587    // ======== TOML Parsing and Manipulation ========
2588
2589    // -------- Reading --------
2590
2591    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/parse-toml to understand the
2592    // limitations and caveats of the TOML parsing cheat.
2593
2594    /// Checks if `key` exists in a TOML table.
2595    #[cheatcode(group = Toml)]
2596    function keyExistsToml(string calldata toml, string calldata key) external view returns (bool);
2597
2598    /// ABI-encodes a TOML table.
2599    #[cheatcode(group = Toml)]
2600    function parseToml(string calldata toml) external pure returns (bytes memory abiEncodedData);
2601
2602    /// ABI-encodes a TOML table at `key`.
2603    #[cheatcode(group = Toml)]
2604    function parseToml(string calldata toml, string calldata key) external pure returns (bytes memory abiEncodedData);
2605
2606    // The following parseToml cheatcodes will do type coercion, for the type that they indicate.
2607    // For example, parseTomlUint will coerce all values to a uint256. That includes stringified numbers '12.'
2608    // and hex numbers '0xEF.'.
2609    // Type coercion works ONLY for discrete values or arrays. That means that the key must return a value or array, not
2610    // a TOML table.
2611
2612    /// Parses a string of TOML data at `key` and coerces it to `uint256`.
2613    #[cheatcode(group = Toml)]
2614    function parseTomlUint(string calldata toml, string calldata key) external pure returns (uint256);
2615    /// Parses a string of TOML data at `key` and coerces it to `uint256[]`.
2616    #[cheatcode(group = Toml)]
2617    function parseTomlUintArray(string calldata toml, string calldata key) external pure returns (uint256[] memory);
2618    /// Parses a string of TOML data at `key` and coerces it to `int256`.
2619    #[cheatcode(group = Toml)]
2620    function parseTomlInt(string calldata toml, string calldata key) external pure returns (int256);
2621    /// Parses a string of TOML data at `key` and coerces it to `int256[]`.
2622    #[cheatcode(group = Toml)]
2623    function parseTomlIntArray(string calldata toml, string calldata key) external pure returns (int256[] memory);
2624    /// Parses a string of TOML data at `key` and coerces it to `bool`.
2625    #[cheatcode(group = Toml)]
2626    function parseTomlBool(string calldata toml, string calldata key) external pure returns (bool);
2627    /// Parses a string of TOML data at `key` and coerces it to `bool[]`.
2628    #[cheatcode(group = Toml)]
2629    function parseTomlBoolArray(string calldata toml, string calldata key) external pure returns (bool[] memory);
2630    /// Parses a string of TOML data at `key` and coerces it to `address`.
2631    #[cheatcode(group = Toml)]
2632    function parseTomlAddress(string calldata toml, string calldata key) external pure returns (address);
2633    /// Parses a string of TOML data at `key` and coerces it to `address[]`.
2634    #[cheatcode(group = Toml)]
2635    function parseTomlAddressArray(string calldata toml, string calldata key)
2636        external
2637        pure
2638        returns (address[] memory);
2639    /// Parses a string of TOML data at `key` and coerces it to `string`.
2640    #[cheatcode(group = Toml)]
2641    function parseTomlString(string calldata toml, string calldata key) external pure returns (string memory);
2642    /// Parses a string of TOML data at `key` and coerces it to `string[]`.
2643    #[cheatcode(group = Toml)]
2644    function parseTomlStringArray(string calldata toml, string calldata key) external pure returns (string[] memory);
2645    /// Parses a string of TOML data at `key` and coerces it to `bytes`.
2646    #[cheatcode(group = Toml)]
2647    function parseTomlBytes(string calldata toml, string calldata key) external pure returns (bytes memory);
2648    /// Parses a string of TOML data at `key` and coerces it to `bytes[]`.
2649    #[cheatcode(group = Toml)]
2650    function parseTomlBytesArray(string calldata toml, string calldata key) external pure returns (bytes[] memory);
2651    /// Parses a string of TOML data at `key` and coerces it to `bytes32`.
2652    #[cheatcode(group = Toml)]
2653    function parseTomlBytes32(string calldata toml, string calldata key) external pure returns (bytes32);
2654    /// Parses a string of TOML data at `key` and coerces it to `bytes32[]`.
2655    #[cheatcode(group = Toml)]
2656    function parseTomlBytes32Array(string calldata toml, string calldata key)
2657        external
2658        pure
2659        returns (bytes32[] memory);
2660
2661    /// Parses a string of TOML data and coerces it to type corresponding to `typeDescription`.
2662    #[cheatcode(group = Toml)]
2663    function parseTomlType(string calldata toml, string calldata typeDescription) external pure returns (bytes memory);
2664    /// Parses a string of TOML data at `key` and coerces it to type corresponding to `typeDescription`.
2665    #[cheatcode(group = Toml)]
2666    function parseTomlType(string calldata toml, string calldata key, string calldata typeDescription) external pure returns (bytes memory);
2667    /// Parses a string of TOML data at `key` and coerces it to type array corresponding to `typeDescription`.
2668    #[cheatcode(group = Toml)]
2669    function parseTomlTypeArray(string calldata toml, string calldata key, string calldata typeDescription)
2670        external
2671        pure
2672        returns (bytes memory);
2673
2674    /// Returns an array of all the keys in a TOML table.
2675    #[cheatcode(group = Toml)]
2676    function parseTomlKeys(string calldata toml, string calldata key) external pure returns (string[] memory keys);
2677
2678    // -------- Writing --------
2679
2680    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/write-toml to understand how
2681    // to use the TOML writing cheat.
2682
2683    /// Takes serialized JSON, converts to TOML and write a serialized TOML to a file.
2684    #[cheatcode(group = Toml)]
2685    function writeToml(string calldata json, string calldata path) external;
2686
2687    /// Takes serialized JSON, converts to TOML and write a serialized TOML table to an **existing** TOML file, replacing a value with key = <value_key.>
2688    /// This is useful to replace a specific value of a TOML file, without having to parse the entire thing.
2689    /// This cheatcode will create new keys if they didn't previously exist.
2690    #[cheatcode(group = Toml)]
2691    function writeToml(string calldata json, string calldata path, string calldata valueKey) external;
2692
2693    // ======== Cryptography ========
2694
2695    // -------- Key Management --------
2696
2697    /// Derives a private key from the name, labels the account with that name, and returns the wallet.
2698    #[cheatcode(group = Crypto)]
2699    function createWallet(string calldata walletLabel) external returns (Wallet memory wallet);
2700
2701    /// Generates a wallet from the private key and returns the wallet.
2702    #[cheatcode(group = Crypto)]
2703    function createWallet(uint256 privateKey) external returns (Wallet memory wallet);
2704
2705    /// Generates a wallet from the private key, labels the account with that name, and returns the wallet.
2706    #[cheatcode(group = Crypto)]
2707    function createWallet(uint256 privateKey, string calldata walletLabel) external returns (Wallet memory wallet);
2708
2709    /// Signs data with a `Wallet`.
2710    #[cheatcode(group = Crypto)]
2711    function sign(Wallet calldata wallet, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);
2712
2713    /// Signs data with a `Wallet`.
2714    ///
2715    /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the
2716    /// signature's `s` value, and the recovery id `v` in a single bytes32.
2717    /// This format reduces the signature size from 65 to 64 bytes.
2718    #[cheatcode(group = Crypto)]
2719    function signCompact(Wallet calldata wallet, bytes32 digest) external pure returns (bytes32 r, bytes32 vs);
2720
2721    /// Signs `digest` with `privateKey` using the secp256k1 curve.
2722    #[cheatcode(group = Crypto)]
2723    function sign(uint256 privateKey, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);
2724
2725    /// Signs `digest` with `privateKey` on the secp256k1 curve, using the given `nonce`
2726    /// as the raw ephemeral k value in ECDSA (instead of deriving it deterministically).
2727    #[cheatcode(group = Crypto)]
2728    function signWithNonceUnsafe(uint256 privateKey, bytes32 digest, uint256 nonce) external pure returns (uint8 v, bytes32 r, bytes32 s);
2729
2730    /// Signs `digest` with `privateKey` using the secp256k1 curve.
2731    ///
2732    /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the
2733    /// signature's `s` value, and the recovery id `v` in a single bytes32.
2734    /// This format reduces the signature size from 65 to 64 bytes.
2735    #[cheatcode(group = Crypto)]
2736    function signCompact(uint256 privateKey, bytes32 digest) external pure returns (bytes32 r, bytes32 vs);
2737
2738    /// Signs `digest` with signer provided to script using the secp256k1 curve.
2739    ///
2740    /// If `--sender` is provided, the signer with provided address is used, otherwise,
2741    /// if exactly one signer is provided to the script, that signer is used.
2742    ///
2743    /// Raises error if signer passed through `--sender` does not match any unlocked signers or
2744    /// if `--sender` is not provided and not exactly one signer is passed to the script.
2745    #[cheatcode(group = Crypto)]
2746    function sign(bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);
2747
2748    /// Signs `digest` with signer provided to script using the secp256k1 curve.
2749    ///
2750    /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the
2751    /// signature's `s` value, and the recovery id `v` in a single bytes32.
2752    /// This format reduces the signature size from 65 to 64 bytes.
2753    ///
2754    /// If `--sender` is provided, the signer with provided address is used, otherwise,
2755    /// if exactly one signer is provided to the script, that signer is used.
2756    ///
2757    /// Raises error if signer passed through `--sender` does not match any unlocked signers or
2758    /// if `--sender` is not provided and not exactly one signer is passed to the script.
2759    #[cheatcode(group = Crypto)]
2760    function signCompact(bytes32 digest) external pure returns (bytes32 r, bytes32 vs);
2761
2762    /// Signs `digest` with signer provided to script using the secp256k1 curve.
2763    ///
2764    /// Raises error if none of the signers passed into the script have provided address.
2765    #[cheatcode(group = Crypto)]
2766    function sign(address signer, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);
2767
2768    /// Signs `digest` with signer provided to script using the secp256k1 curve.
2769    ///
2770    /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the
2771    /// signature's `s` value, and the recovery id `v` in a single bytes32.
2772    /// This format reduces the signature size from 65 to 64 bytes.
2773    ///
2774    /// Raises error if none of the signers passed into the script have provided address.
2775    #[cheatcode(group = Crypto)]
2776    function signCompact(address signer, bytes32 digest) external pure returns (bytes32 r, bytes32 vs);
2777
2778    /// Signs `digest` with `privateKey` using the secp256r1 curve.
2779    #[cheatcode(group = Crypto)]
2780    function signP256(uint256 privateKey, bytes32 digest) external pure returns (bytes32 r, bytes32 s);
2781
2782    /// Derives secp256r1 public key from the provided `privateKey`.
2783    #[cheatcode(group = Crypto)]
2784    function publicKeyP256(uint256 privateKey) external pure returns (uint256 publicKeyX, uint256 publicKeyY);
2785
2786    /// Derive a private key from a provided mnemonic string (or mnemonic file path)
2787    /// at the derivation path `m/44'/60'/0'/0/{index}`.
2788    #[cheatcode(group = Crypto)]
2789    function deriveKey(string calldata mnemonic, uint32 index) external pure returns (uint256 privateKey);
2790    /// Derive a private key from a provided mnemonic string (or mnemonic file path)
2791    /// at `{derivationPath}{index}`.
2792    #[cheatcode(group = Crypto)]
2793    function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index)
2794        external
2795        pure
2796        returns (uint256 privateKey);
2797    /// Derive a private key from a provided mnemonic string (or mnemonic file path) in the specified language
2798    /// at the derivation path `m/44'/60'/0'/0/{index}`.
2799    #[cheatcode(group = Crypto)]
2800    function deriveKey(string calldata mnemonic, uint32 index, string calldata language)
2801        external
2802        pure
2803        returns (uint256 privateKey);
2804    /// Derive a private key from a provided mnemonic string (or mnemonic file path) in the specified language
2805    /// at `{derivationPath}{index}`.
2806    #[cheatcode(group = Crypto)]
2807    function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index, string calldata language)
2808        external
2809        pure
2810        returns (uint256 privateKey);
2811
2812    /// Adds a private key to the local forge wallet and returns the address.
2813    #[cheatcode(group = Crypto)]
2814    function rememberKey(uint256 privateKey) external returns (address keyAddr);
2815
2816    /// Derive a set number of wallets from a mnemonic at the derivation path `m/44'/60'/0'/0/{0..count}`.
2817    ///
2818    /// The respective private keys are saved to the local forge wallet for later use and their addresses are returned.
2819    #[cheatcode(group = Crypto)]
2820    function rememberKeys(string calldata mnemonic, string calldata derivationPath, uint32 count) external returns (address[] memory keyAddrs);
2821
2822    /// Derive a set number of wallets from a mnemonic in the specified language at the derivation path `m/44'/60'/0'/0/{0..count}`.
2823    ///
2824    /// The respective private keys are saved to the local forge wallet for later use and their addresses are returned.
2825    #[cheatcode(group = Crypto)]
2826    function rememberKeys(string calldata mnemonic, string calldata derivationPath, string calldata language, uint32 count)
2827        external
2828        returns (address[] memory keyAddrs);
2829
2830    // -------- Uncategorized Utilities --------
2831
2832    /// Labels an address in call traces.
2833    #[cheatcode(group = Utilities)]
2834    function label(address account, string calldata newLabel) external;
2835
2836    /// Gets the label for the specified address.
2837    #[cheatcode(group = Utilities)]
2838    function getLabel(address account) external view returns (string memory currentLabel);
2839
2840    /// Compute the address a contract will be deployed at for a given deployer address and nonce.
2841    #[cheatcode(group = Utilities)]
2842    function computeCreateAddress(address deployer, uint256 nonce) external pure returns (address);
2843
2844    /// Compute the address of a contract created with CREATE2 using the given CREATE2 deployer.
2845    #[cheatcode(group = Utilities)]
2846    function computeCreate2Address(bytes32 salt, bytes32 initCodeHash, address deployer) external pure returns (address);
2847
2848    /// Compute the address of a contract created with CREATE2 using the default CREATE2 deployer.
2849    #[cheatcode(group = Utilities)]
2850    function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) external pure returns (address);
2851
2852    /// Encodes a `bytes` value to a base64 string.
2853    #[cheatcode(group = Utilities)]
2854    function toBase64(bytes calldata data) external pure returns (string memory);
2855
2856    /// Encodes a `string` value to a base64 string.
2857    #[cheatcode(group = Utilities)]
2858    function toBase64(string calldata data) external pure returns (string memory);
2859
2860    /// Encodes a `bytes` value to a base64url string.
2861    #[cheatcode(group = Utilities)]
2862    function toBase64URL(bytes calldata data) external pure returns (string memory);
2863
2864    /// Encodes a `string` value to a base64url string.
2865    #[cheatcode(group = Utilities)]
2866    function toBase64URL(string calldata data) external pure returns (string memory);
2867
2868    /// Returns ENS namehash for provided string.
2869    #[cheatcode(group = Utilities)]
2870    function ensNamehash(string calldata name) external pure returns (bytes32);
2871
2872    /// Returns an uint256 value bounded in given range and different from the current one.
2873    #[cheatcode(group = Utilities)]
2874    function bound(uint256 current, uint256 min, uint256 max) external view returns (uint256);
2875
2876    /// Returns a random uint256 value.
2877    #[cheatcode(group = Utilities)]
2878    function randomUint() external view returns (uint256);
2879
2880    /// Returns random uint256 value between the provided range (=min..=max).
2881    #[cheatcode(group = Utilities)]
2882    function randomUint(uint256 min, uint256 max) external view returns (uint256);
2883
2884    /// Returns a random `uint256` value of given bits.
2885    #[cheatcode(group = Utilities)]
2886    function randomUint(uint256 bits) external view returns (uint256);
2887
2888    /// Returns a random `address`.
2889    #[cheatcode(group = Utilities)]
2890    function randomAddress() external view returns (address);
2891
2892    /// Returns an int256 value bounded in given range and different from the current one.
2893    #[cheatcode(group = Utilities)]
2894    function bound(int256 current, int256 min, int256 max) external view returns (int256);
2895
2896    /// Returns a random `int256` value.
2897    #[cheatcode(group = Utilities)]
2898    function randomInt() external view returns (int256);
2899
2900    /// Returns a random `int256` value of given bits.
2901    #[cheatcode(group = Utilities)]
2902    function randomInt(uint256 bits) external view returns (int256);
2903
2904    /// Returns a random `bool`.
2905    #[cheatcode(group = Utilities)]
2906    function randomBool() external view returns (bool);
2907
2908    /// Returns a random byte array value of the given length.
2909    #[cheatcode(group = Utilities)]
2910    function randomBytes(uint256 len) external view returns (bytes memory);
2911
2912    /// Returns a random fixed-size byte array of length 4.
2913    #[cheatcode(group = Utilities)]
2914    function randomBytes4() external view returns (bytes4);
2915
2916    /// Returns a random fixed-size byte array of length 8.
2917    #[cheatcode(group = Utilities)]
2918    function randomBytes8() external view returns (bytes8);
2919
2920    /// Pauses collection of call traces. Useful in cases when you want to skip tracing of
2921    /// complex calls which are not useful for debugging.
2922    #[cheatcode(group = Utilities)]
2923    function pauseTracing() external view;
2924
2925    /// Unpauses collection of call traces.
2926    #[cheatcode(group = Utilities)]
2927    function resumeTracing() external view;
2928
2929    /// Utility cheatcode to copy storage of `from` contract to another `to` contract.
2930    #[cheatcode(group = Utilities)]
2931    function copyStorage(address from, address to) external;
2932
2933    /// Utility cheatcode to set arbitrary storage for given target address.
2934    #[cheatcode(group = Utilities)]
2935    function setArbitraryStorage(address target) external;
2936
2937    /// Utility cheatcode to set arbitrary storage for given target address and overwrite
2938    /// any storage slots that have been previously set.
2939    #[cheatcode(group = Utilities)]
2940    function setArbitraryStorage(address target, bool overwrite) external;
2941
2942    /// Sorts an array in ascending order.
2943    #[cheatcode(group = Utilities)]
2944    function sort(uint256[] calldata array) external returns (uint256[] memory);
2945
2946    /// Randomly shuffles an array.
2947    #[cheatcode(group = Utilities)]
2948    function shuffle(uint256[] calldata array) external returns (uint256[] memory);
2949
2950    /// Set RNG seed.
2951    #[cheatcode(group = Utilities)]
2952    function setSeed(uint256 seed) external;
2953
2954    /// Causes the next contract creation (via new) to fail and return its initcode in the returndata buffer.
2955    /// This allows type-safe access to the initcode payload that would be used for contract creation.
2956    /// Example usage:
2957    /// vm.interceptInitcode();
2958    /// bytes memory initcode;
2959    /// try new MyContract(param1, param2) { assert(false); }
2960    /// catch (bytes memory interceptedInitcode) { initcode = interceptedInitcode; }
2961    #[cheatcode(group = Utilities, safety = Unsafe)]
2962    function interceptInitcode() external;
2963
2964    /// Generates the hash of the canonical EIP-712 type representation.
2965    ///
2966    /// Supports 2 different inputs:
2967    ///  1. Name of the type (i.e. "Transaction"):
2968    ///     * requires previous binding generation with `forge bind-json`.
2969    ///     * bindings will be retrieved from the path configured in `foundry.toml`.
2970    ///
2971    ///  2. String representation of the type (i.e. "Foo(Bar bar) Bar(uint256 baz)").
2972    ///     * Note: the cheatcode will output the canonical type even if the input is malformated
2973    ///             with the wrong order of elements or with extra whitespaces.
2974    #[cheatcode(group = Utilities)]
2975    function eip712HashType(string calldata typeNameOrDefinition) external pure returns (bytes32 typeHash);
2976
2977    /// Generates the hash of the canonical EIP-712 type representation.
2978    /// Requires previous binding generation with `forge bind-json`.
2979    ///
2980    /// Params:
2981    ///  * `bindingsPath`: path where the output of `forge bind-json` is stored.
2982    ///  * `typeName`: Name of the type (i.e. "Transaction").
2983    #[cheatcode(group = Utilities)]
2984    function eip712HashType(string calldata bindingsPath, string calldata typeName) external pure returns (bytes32 typeHash);
2985
2986    /// Generates the struct hash of the canonical EIP-712 type representation and its abi-encoded data.
2987    ///
2988    /// Supports 2 different inputs:
2989    ///  1. Name of the type (i.e. "PermitSingle"):
2990    ///     * requires previous binding generation with `forge bind-json`.
2991    ///     * bindings will be retrieved from the path configured in `foundry.toml`.
2992    ///
2993    ///  2. String representation of the type (i.e. "Foo(Bar bar) Bar(uint256 baz)").
2994    ///     * Note: the cheatcode will use the canonical type even if the input is malformated
2995    ///             with the wrong order of elements or with extra whitespaces.
2996    #[cheatcode(group = Utilities)]
2997    function eip712HashStruct(string calldata typeNameOrDefinition, bytes calldata abiEncodedData) external pure returns (bytes32 typeHash);
2998
2999    /// Generates the struct hash of the canonical EIP-712 type representation and its abi-encoded data.
3000    /// Requires previous binding generation with `forge bind-json`.
3001    ///
3002    /// Params:
3003    ///  * `bindingsPath`: path where the output of `forge bind-json` is stored.
3004    ///  * `typeName`: Name of the type (i.e. "PermitSingle").
3005    ///  * `abiEncodedData`: ABI-encoded data for the struct that is being hashed.
3006    #[cheatcode(group = Utilities)]
3007    function eip712HashStruct(string calldata bindingsPath, string calldata typeName, bytes calldata abiEncodedData) external pure returns (bytes32 typeHash);
3008
3009    /// Generates a ready-to-sign digest of human-readable typed data following the EIP-712 standard.
3010    #[cheatcode(group = Utilities)]
3011    function eip712HashTypedData(string calldata jsonData) external pure returns (bytes32 digest);
3012
3013    /// RLP encodes a list of bytes into an RLP payload.
3014    #[cheatcode(group = Utilities)]
3015    function toRlp(bytes[] calldata data) external pure returns (bytes memory);
3016    /// RLP decodes an RLP payload into a list of bytes.
3017    #[cheatcode(group = Utilities)]
3018    function fromRlp(bytes calldata rlp) external pure returns (bytes[] memory data);
3019}
3020}
3021
3022impl PartialEq for ForgeContext {
3023    // Handles test group case (any of test, coverage or snapshot)
3024    // and script group case (any of dry run, broadcast or resume).
3025    fn eq(&self, other: &Self) -> bool {
3026        match (self, other) {
3027            (_, Self::TestGroup) => {
3028                matches!(self, Self::Test | Self::Snapshot | Self::Coverage)
3029            }
3030            (_, Self::ScriptGroup) => {
3031                matches!(self, Self::ScriptDryRun | Self::ScriptBroadcast | Self::ScriptResume)
3032            }
3033            (Self::Test, Self::Test)
3034            | (Self::Snapshot, Self::Snapshot)
3035            | (Self::Coverage, Self::Coverage)
3036            | (Self::ScriptDryRun, Self::ScriptDryRun)
3037            | (Self::ScriptBroadcast, Self::ScriptBroadcast)
3038            | (Self::ScriptResume, Self::ScriptResume)
3039            | (Self::Unknown, Self::Unknown) => true,
3040            _ => false,
3041        }
3042    }
3043}
3044
3045impl fmt::Display for Vm::CheatcodeError {
3046    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3047        self.message.fmt(f)
3048    }
3049}
3050
3051impl fmt::Display for Vm::VmErrors {
3052    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3053        match self {
3054            Self::CheatcodeError(err) => err.fmt(f),
3055        }
3056    }
3057}
3058
3059#[track_caller]
3060const fn panic_unknown_safety() -> ! {
3061    panic!("cannot determine safety from the group, add a `#[cheatcode(safety = ...)]` attribute")
3062}