Skip to main content

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    /// Executes an RLP-encoded signed transaction with full EVM semantics (like `--isolate` mode).
567    /// The transaction is decoded from EIP-2718 format (type byte prefix + RLP payload) or legacy RLP.
568    /// Returns the execution output bytes.
569    ///
570    /// This cheatcode is not allowed in `forge script` contexts.
571    #[cheatcode(group = Evm, safety = Unsafe)]
572    function executeTransaction(bytes calldata rawTx) external returns (bytes memory);
573
574    // -------- Account State --------
575
576    /// Sets an address' balance.
577    #[cheatcode(group = Evm, safety = Unsafe)]
578    function deal(address account, uint256 newBalance) external;
579
580    /// Sets an address' code.
581    #[cheatcode(group = Evm, safety = Unsafe)]
582    function etch(address target, bytes calldata newRuntimeBytecode) external;
583
584    /// Resets the nonce of an account to 0 for EOAs and 1 for contract accounts.
585    #[cheatcode(group = Evm, safety = Unsafe)]
586    function resetNonce(address account) external;
587
588    /// Sets the nonce of an account. Must be higher than the current nonce of the account.
589    #[cheatcode(group = Evm, safety = Unsafe)]
590    function setNonce(address account, uint64 newNonce) external;
591
592    /// Sets the nonce of an account to an arbitrary value.
593    #[cheatcode(group = Evm, safety = Unsafe)]
594    function setNonceUnsafe(address account, uint64 newNonce) external;
595
596    /// Stores a value to an address' storage slot.
597    #[cheatcode(group = Evm, safety = Unsafe)]
598    function store(address target, bytes32 slot, bytes32 value) external;
599
600    /// Marks the slots of an account and the account address as cold.
601    #[cheatcode(group = Evm, safety = Unsafe)]
602    function cool(address target) external;
603
604    /// Utility cheatcode to set an EIP-2930 access list for all subsequent transactions.
605    #[cheatcode(group = Evm, safety = Unsafe)]
606    function accessList(AccessListItem[] calldata access) external;
607
608    /// Utility cheatcode to remove any EIP-2930 access list set by `accessList` cheatcode.
609    #[cheatcode(group = Evm, safety = Unsafe)]
610    function noAccessList() external;
611
612    /// Utility cheatcode to mark specific storage slot as warm, simulating a prior read.
613    #[cheatcode(group = Evm, safety = Unsafe)]
614    function warmSlot(address target, bytes32 slot) external;
615
616    /// Utility cheatcode to mark specific storage slot as cold, simulating no prior read.
617    #[cheatcode(group = Evm, safety = Unsafe)]
618    function coolSlot(address target, bytes32 slot) external;
619
620    /// Returns the test or script execution evm version.
621    ///
622    /// **Note:** The execution evm version is not the same as the compilation one.
623    #[cheatcode(group = Evm, safety = Safe)]
624    function getEvmVersion() external pure returns (string memory evm);
625
626    /// Set the exact test or script execution evm version, e.g. `berlin`, `cancun`.
627    ///
628    /// **Note:** The execution evm version is not the same as the compilation one.
629    #[cheatcode(group = Evm, safety = Safe)]
630    function setEvmVersion(string calldata evm) external;
631
632    // -------- Call Manipulation --------
633    // --- Mocks ---
634
635    /// Clears all mocked calls.
636    #[cheatcode(group = Evm, safety = Unsafe)]
637    function clearMockedCalls() external;
638
639    /// Mocks a call to an address, returning specified data.
640    /// Calldata can either be strict or a partial match, e.g. if you only
641    /// pass a Solidity selector to the expected calldata, then the entire Solidity
642    /// function will be mocked.
643    #[cheatcode(group = Evm, safety = Unsafe)]
644    function mockCall(address callee, bytes calldata data, bytes calldata returnData) external;
645
646    /// Mocks a call to an address with a specific `msg.value`, returning specified data.
647    /// Calldata match takes precedence over `msg.value` in case of ambiguity.
648    #[cheatcode(group = Evm, safety = Unsafe)]
649    function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external;
650
651    /// Mocks a call to an address, returning specified data.
652    /// Calldata can either be strict or a partial match, e.g. if you only
653    /// pass a Solidity selector to the expected calldata, then the entire Solidity
654    /// function will be mocked.
655    ///
656    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
657    #[cheatcode(group = Evm, safety = Unsafe)]
658    function mockCall(address callee, bytes4 data, bytes calldata returnData) external;
659
660    /// Mocks a call to an address with a specific `msg.value`, returning specified data.
661    /// Calldata match takes precedence over `msg.value` in case of ambiguity.
662    ///
663    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
664    #[cheatcode(group = Evm, safety = Unsafe)]
665    function mockCall(address callee, uint256 msgValue, bytes4 data, bytes calldata returnData) external;
666
667    /// Mocks multiple calls to an address, returning specified data for each call.
668    #[cheatcode(group = Evm, safety = Unsafe)]
669    function mockCalls(address callee, bytes calldata data, bytes[] calldata returnData) external;
670
671    /// Mocks multiple calls to an address with a specific `msg.value`, returning specified data for each call.
672    #[cheatcode(group = Evm, safety = Unsafe)]
673    function mockCalls(address callee, uint256 msgValue, bytes calldata data, bytes[] calldata returnData) external;
674
675    /// Reverts a call to an address with specified revert data.
676    #[cheatcode(group = Evm, safety = Unsafe)]
677    function mockCallRevert(address callee, bytes calldata data, bytes calldata revertData) external;
678
679    /// Reverts a call to an address with a specific `msg.value`, with specified revert data.
680    #[cheatcode(group = Evm, safety = Unsafe)]
681    function mockCallRevert(address callee, uint256 msgValue, bytes calldata data, bytes calldata revertData)
682        external;
683
684    /// Reverts a call to an address with specified revert data.
685    ///
686    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
687    #[cheatcode(group = Evm, safety = Unsafe)]
688    function mockCallRevert(address callee, bytes4 data, bytes calldata revertData) external;
689
690    /// Reverts a call to an address with a specific `msg.value`, with specified revert data.
691    ///
692    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
693    #[cheatcode(group = Evm, safety = Unsafe)]
694    function mockCallRevert(address callee, uint256 msgValue, bytes4 data, bytes calldata revertData)
695        external;
696
697    /// Whenever a call is made to `callee` with calldata `data`, this cheatcode instead calls
698    /// `target` with the same calldata. This functionality is similar to a delegate call made to
699    /// `target` contract from `callee`.
700    /// Can be used to substitute a call to a function with another implementation that captures
701    /// the primary logic of the original function but is easier to reason about.
702    /// If calldata is not a strict match then partial match by selector is attempted.
703    #[cheatcode(group = Evm, safety = Unsafe)]
704    function mockFunction(address callee, address target, bytes calldata data) external;
705
706    // --- Impersonation (pranks) ---
707
708    /// Sets the *next* call's `msg.sender` to be the input address.
709    #[cheatcode(group = Evm, safety = Unsafe)]
710    function prank(address msgSender) external;
711
712    /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called.
713    #[cheatcode(group = Evm, safety = Unsafe)]
714    function startPrank(address msgSender) external;
715
716    /// Sets the *next* call's `msg.sender` to be the input address, and the `tx.origin` to be the second input.
717    #[cheatcode(group = Evm, safety = Unsafe)]
718    function prank(address msgSender, address txOrigin) external;
719
720    /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called, and the `tx.origin` to be the second input.
721    #[cheatcode(group = Evm, safety = Unsafe)]
722    function startPrank(address msgSender, address txOrigin) external;
723
724    /// Sets the *next* delegate call's `msg.sender` to be the input address.
725    #[cheatcode(group = Evm, safety = Unsafe)]
726    function prank(address msgSender, bool delegateCall) external;
727
728    /// Sets all subsequent delegate calls' `msg.sender` to be the input address until `stopPrank` is called.
729    #[cheatcode(group = Evm, safety = Unsafe)]
730    function startPrank(address msgSender, bool delegateCall) external;
731
732    /// Sets the *next* delegate call's `msg.sender` to be the input address, and the `tx.origin` to be the second input.
733    #[cheatcode(group = Evm, safety = Unsafe)]
734    function prank(address msgSender, address txOrigin, bool delegateCall) external;
735
736    /// 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.
737    #[cheatcode(group = Evm, safety = Unsafe)]
738    function startPrank(address msgSender, address txOrigin, bool delegateCall) external;
739
740    /// Resets subsequent calls' `msg.sender` to be `address(this)`.
741    #[cheatcode(group = Evm, safety = Unsafe)]
742    function stopPrank() external;
743
744    /// Reads the current `msg.sender` and `tx.origin` from state and reports if there is any active caller modification.
745    #[cheatcode(group = Evm, safety = Unsafe)]
746    function readCallers() external view returns (CallerMode callerMode, address msgSender, address txOrigin);
747
748    // ----- Arbitrary Snapshots -----
749
750    /// Snapshot capture an arbitrary numerical value by name.
751    /// The group name is derived from the contract name.
752    #[cheatcode(group = Evm, safety = Unsafe)]
753    function snapshotValue(string calldata name, uint256 value) external;
754
755    /// Snapshot capture an arbitrary numerical value by name in a group.
756    #[cheatcode(group = Evm, safety = Unsafe)]
757    function snapshotValue(string calldata group, string calldata name, uint256 value) external;
758
759    // -------- Gas Snapshots --------
760
761    /// Snapshot capture the gas usage of the last call by name from the callee perspective.
762    #[cheatcode(group = Evm, safety = Unsafe)]
763    function snapshotGasLastCall(string calldata name) external returns (uint256 gasUsed);
764
765    /// Snapshot capture the gas usage of the last call by name in a group from the callee perspective.
766    #[cheatcode(group = Evm, safety = Unsafe)]
767    function snapshotGasLastCall(string calldata group, string calldata name) external returns (uint256 gasUsed);
768
769    /// Start a snapshot capture of the current gas usage by name.
770    /// The group name is derived from the contract name.
771    #[cheatcode(group = Evm, safety = Unsafe)]
772    function startSnapshotGas(string calldata name) external;
773
774    /// Start a snapshot capture of the current gas usage by name in a group.
775    #[cheatcode(group = Evm, safety = Unsafe)]
776    function startSnapshotGas(string calldata group, string calldata name) external;
777
778    /// Stop the snapshot capture of the current gas by latest snapshot name, capturing the gas used since the start.
779    #[cheatcode(group = Evm, safety = Unsafe)]
780    function stopSnapshotGas() external returns (uint256 gasUsed);
781
782    /// Stop the snapshot capture of the current gas usage by name, capturing the gas used since the start.
783    /// The group name is derived from the contract name.
784    #[cheatcode(group = Evm, safety = Unsafe)]
785    function stopSnapshotGas(string calldata name) external returns (uint256 gasUsed);
786
787    /// Stop the snapshot capture of the current gas usage by name in a group, capturing the gas used since the start.
788    #[cheatcode(group = Evm, safety = Unsafe)]
789    function stopSnapshotGas(string calldata group, string calldata name) external returns (uint256 gasUsed);
790
791    // -------- State Snapshots --------
792
793    /// `snapshot` is being deprecated in favor of `snapshotState`. It will be removed in future versions.
794    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `snapshotState`")))]
795    function snapshot() external returns (uint256 snapshotId);
796
797    /// Snapshot the current state of the evm.
798    /// Returns the ID of the snapshot that was created.
799    /// To revert a snapshot use `revertToState`.
800    #[cheatcode(group = Evm, safety = Unsafe)]
801    function snapshotState() external returns (uint256 snapshotId);
802
803    /// `revertTo` is being deprecated in favor of `revertToState`. It will be removed in future versions.
804    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `revertToState`")))]
805    function revertTo(uint256 snapshotId) external returns (bool success);
806
807    /// Revert the state of the EVM to a previous snapshot
808    /// Takes the snapshot ID to revert to.
809    ///
810    /// Returns `true` if the snapshot was successfully reverted.
811    /// Returns `false` if the snapshot does not exist.
812    ///
813    /// **Note:** This does not automatically delete the snapshot. To delete the snapshot use `deleteStateSnapshot`.
814    #[cheatcode(group = Evm, safety = Unsafe)]
815    function revertToState(uint256 snapshotId) external returns (bool success);
816
817    /// `revertToAndDelete` is being deprecated in favor of `revertToStateAndDelete`. It will be removed in future versions.
818    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `revertToStateAndDelete`")))]
819    function revertToAndDelete(uint256 snapshotId) external returns (bool success);
820
821    /// Revert the state of the EVM to a previous snapshot and automatically deletes the snapshots
822    /// Takes the snapshot ID to revert to.
823    ///
824    /// Returns `true` if the snapshot was successfully reverted and deleted.
825    /// Returns `false` if the snapshot does not exist.
826    #[cheatcode(group = Evm, safety = Unsafe)]
827    function revertToStateAndDelete(uint256 snapshotId) external returns (bool success);
828
829    /// `deleteSnapshot` is being deprecated in favor of `deleteStateSnapshot`. It will be removed in future versions.
830    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `deleteStateSnapshot`")))]
831    function deleteSnapshot(uint256 snapshotId) external returns (bool success);
832
833    /// Removes the snapshot with the given ID created by `snapshot`.
834    /// Takes the snapshot ID to delete.
835    ///
836    /// Returns `true` if the snapshot was successfully deleted.
837    /// Returns `false` if the snapshot does not exist.
838    #[cheatcode(group = Evm, safety = Unsafe)]
839    function deleteStateSnapshot(uint256 snapshotId) external returns (bool success);
840
841    /// `deleteSnapshots` is being deprecated in favor of `deleteStateSnapshots`. It will be removed in future versions.
842    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `deleteStateSnapshots`")))]
843    function deleteSnapshots() external;
844
845    /// Removes _all_ snapshots previously created by `snapshot`.
846    #[cheatcode(group = Evm, safety = Unsafe)]
847    function deleteStateSnapshots() external;
848
849    // -------- Forking --------
850    // --- Creation and Selection ---
851
852    /// Returns the identifier of the currently active fork. Reverts if no fork is currently active.
853    #[cheatcode(group = Evm, safety = Unsafe)]
854    function activeFork() external view returns (uint256 forkId);
855
856    /// Creates a new fork with the given endpoint and the _latest_ block and returns the identifier of the fork.
857    #[cheatcode(group = Evm, safety = Unsafe)]
858    function createFork(string calldata urlOrAlias) external returns (uint256 forkId);
859    /// Creates a new fork with the given endpoint and block and returns the identifier of the fork.
860    #[cheatcode(group = Evm, safety = Unsafe)]
861    function createFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);
862    /// Creates a new fork with the given endpoint and at the block the given transaction was mined in,
863    /// replays all transaction mined in the block before the transaction, and returns the identifier of the fork.
864    #[cheatcode(group = Evm, safety = Unsafe)]
865    function createFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);
866
867    /// Creates and also selects a new fork with the given endpoint and the latest block and returns the identifier of the fork.
868    #[cheatcode(group = Evm, safety = Unsafe)]
869    function createSelectFork(string calldata urlOrAlias) external returns (uint256 forkId);
870    /// Creates and also selects a new fork with the given endpoint and block and returns the identifier of the fork.
871    #[cheatcode(group = Evm, safety = Unsafe)]
872    function createSelectFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);
873    /// Creates and also selects new fork with the given endpoint and at the block the given transaction was mined in,
874    /// replays all transaction mined in the block before the transaction, returns the identifier of the fork.
875    #[cheatcode(group = Evm, safety = Unsafe)]
876    function createSelectFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);
877
878    /// Updates the currently active fork to given block number
879    /// This is similar to `roll` but for the currently active fork.
880    #[cheatcode(group = Evm, safety = Unsafe)]
881    function rollFork(uint256 blockNumber) external;
882    /// Updates the currently active fork to given transaction. This will `rollFork` with the number
883    /// of the block the transaction was mined in and replays all transaction mined before it in the block.
884    #[cheatcode(group = Evm, safety = Unsafe)]
885    function rollFork(bytes32 txHash) external;
886    /// Updates the given fork to given block number.
887    #[cheatcode(group = Evm, safety = Unsafe)]
888    function rollFork(uint256 forkId, uint256 blockNumber) external;
889    /// Updates the given fork to block number of the given transaction and replays all transaction mined before it in the block.
890    #[cheatcode(group = Evm, safety = Unsafe)]
891    function rollFork(uint256 forkId, bytes32 txHash) external;
892
893    /// Takes a fork identifier created by `createFork` and sets the corresponding forked state as active.
894    #[cheatcode(group = Evm, safety = Unsafe)]
895    function selectFork(uint256 forkId) external;
896
897    /// Fetches the given transaction from the active fork and executes it on the current state.
898    #[cheatcode(group = Evm, safety = Unsafe)]
899    function transact(bytes32 txHash) external;
900    /// Fetches the given transaction from the given fork and executes it on the current state.
901    #[cheatcode(group = Evm, safety = Unsafe)]
902    function transact(uint256 forkId, bytes32 txHash) external;
903
904    /// Performs an Ethereum JSON-RPC request to the current fork URL.
905    #[cheatcode(group = Evm, safety = Safe)]
906    function rpc(string calldata method, string calldata params) external returns (bytes memory data);
907
908    /// Performs an Ethereum JSON-RPC request to the given endpoint.
909    #[cheatcode(group = Evm, safety = Safe)]
910    function rpc(string calldata urlOrAlias, string calldata method, string calldata params)
911        external
912        returns (bytes memory data);
913
914    /// Gets all the logs according to specified filter.
915    #[cheatcode(group = Evm, safety = Safe)]
916    function eth_getLogs(uint256 fromBlock, uint256 toBlock, address target, bytes32[] calldata topics)
917        external
918        view
919        returns (EthGetLogs[] memory logs);
920
921    // --- Behavior ---
922
923    /// In forking mode, explicitly grant the given address cheatcode access.
924    #[cheatcode(group = Evm, safety = Unsafe)]
925    function allowCheatcodes(address account) external;
926
927    /// Marks that the account(s) should use persistent storage across fork swaps in a multifork setup
928    /// Meaning, changes made to the state of this account will be kept when switching forks.
929    #[cheatcode(group = Evm, safety = Unsafe)]
930    function makePersistent(address account) external;
931    /// See `makePersistent(address)`.
932    #[cheatcode(group = Evm, safety = Unsafe)]
933    function makePersistent(address account0, address account1) external;
934    /// See `makePersistent(address)`.
935    #[cheatcode(group = Evm, safety = Unsafe)]
936    function makePersistent(address account0, address account1, address account2) external;
937    /// See `makePersistent(address)`.
938    #[cheatcode(group = Evm, safety = Unsafe)]
939    function makePersistent(address[] calldata accounts) external;
940
941    /// Revokes persistent status from the address, previously added via `makePersistent`.
942    #[cheatcode(group = Evm, safety = Unsafe)]
943    function revokePersistent(address account) external;
944    /// See `revokePersistent(address)`.
945    #[cheatcode(group = Evm, safety = Unsafe)]
946    function revokePersistent(address[] calldata accounts) external;
947
948    /// Returns true if the account is marked as persistent.
949    #[cheatcode(group = Evm, safety = Unsafe)]
950    function isPersistent(address account) external view returns (bool persistent);
951
952    // -------- Record Logs --------
953
954    /// Record all the transaction logs.
955    #[cheatcode(group = Evm, safety = Safe)]
956    function recordLogs() external;
957
958    /// Gets all the recorded logs.
959    #[cheatcode(group = Evm, safety = Safe)]
960    function getRecordedLogs() external view returns (Log[] memory logs);
961
962    /// Gets all the recorded logs, in JSON format.
963    #[cheatcode(group = Evm, safety = Safe)]
964    function getRecordedLogsJson() external view returns (string memory logsJson);
965
966    // -------- Gas Metering --------
967
968    // It's recommend to use the `noGasMetering` modifier included with forge-std, instead of
969    // using these functions directly.
970
971    /// Pauses gas metering (i.e. gas usage is not counted). Noop if already paused.
972    #[cheatcode(group = Evm, safety = Safe)]
973    function pauseGasMetering() external;
974
975    /// Resumes gas metering (i.e. gas usage is counted again). Noop if already on.
976    #[cheatcode(group = Evm, safety = Safe)]
977    function resumeGasMetering() external;
978
979    /// Reset gas metering (i.e. gas usage is set to gas limit).
980    #[cheatcode(group = Evm, safety = Safe)]
981    function resetGasMetering() external;
982
983    // -------- Gas Measurement --------
984
985    /// Gets the gas used in the last call from the callee perspective.
986    #[cheatcode(group = Evm, safety = Safe)]
987    function lastCallGas() external view returns (Gas memory gas);
988
989    // ======== Test Assertions and Utilities ========
990
991    /// If the condition is false, discard this run's fuzz inputs and generate new ones.
992    #[cheatcode(group = Testing, safety = Safe)]
993    function assume(bool condition) external pure;
994
995    /// Discard this run's fuzz inputs and generate new ones if next call reverted.
996    #[cheatcode(group = Testing, safety = Safe)]
997    function assumeNoRevert() external pure;
998
999    /// Discard this run's fuzz inputs and generate new ones if next call reverts with the potential revert parameters.
1000    #[cheatcode(group = Testing, safety = Safe)]
1001    function assumeNoRevert(PotentialRevert calldata potentialRevert) external pure;
1002
1003    /// Discard this run's fuzz inputs and generate new ones if next call reverts with the any of the potential revert parameters.
1004    #[cheatcode(group = Testing, safety = Safe)]
1005    function assumeNoRevert(PotentialRevert[] calldata potentialReverts) external pure;
1006
1007    /// Writes a breakpoint to jump to in the debugger.
1008    #[cheatcode(group = Testing, safety = Safe)]
1009    function breakpoint(string calldata char) external pure;
1010
1011    /// Writes a conditional breakpoint to jump to in the debugger.
1012    #[cheatcode(group = Testing, safety = Safe)]
1013    function breakpoint(string calldata char, bool value) external pure;
1014
1015    /// Returns the Foundry version.
1016    /// Format: <cargo_version>-<tag>+<git_sha_short>.<unix_build_timestamp>.<profile>
1017    /// Sample output: 0.3.0-nightly+3cb96bde9b.1737036656.debug
1018    /// Note: Build timestamps may vary slightly across platforms due to separate CI jobs.
1019    /// For reliable version comparisons, use UNIX format (e.g., >= 1700000000)
1020    /// to compare timestamps while ignoring minor time differences.
1021    #[cheatcode(group = Testing, safety = Safe)]
1022    function getFoundryVersion() external view returns (string memory version);
1023
1024    /// Returns the RPC url for the given alias.
1025    #[cheatcode(group = Testing, safety = Safe)]
1026    function rpcUrl(string calldata rpcAlias) external view returns (string memory json);
1027
1028    /// Returns all rpc urls and their aliases `[alias, url][]`.
1029    #[cheatcode(group = Testing, safety = Safe)]
1030    function rpcUrls() external view returns (string[2][] memory urls);
1031
1032    /// Returns all rpc urls and their aliases as structs.
1033    #[cheatcode(group = Testing, safety = Safe)]
1034    function rpcUrlStructs() external view returns (Rpc[] memory urls);
1035
1036    /// Returns a Chain struct for specific alias
1037    #[cheatcode(group = Testing, safety = Safe)]
1038    function getChain(string calldata chainAlias) external view returns (Chain memory chain);
1039
1040    /// Returns a Chain struct for specific chainId
1041    #[cheatcode(group = Testing, safety = Safe)]
1042    function getChain(uint256 chainId) external view returns (Chain memory chain);
1043
1044    /// Suspends execution of the main thread for `duration` milliseconds.
1045    #[cheatcode(group = Testing, safety = Safe)]
1046    function sleep(uint256 duration) external;
1047
1048    /// Expects a call to an address with the specified calldata.
1049    /// Calldata can either be a strict or a partial match.
1050    #[cheatcode(group = Testing, safety = Unsafe)]
1051    function expectCall(address callee, bytes calldata data) external;
1052
1053    /// Expects given number of calls to an address with the specified calldata.
1054    #[cheatcode(group = Testing, safety = Unsafe)]
1055    function expectCall(address callee, bytes calldata data, uint64 count) external;
1056
1057    /// Expects a call to an address with the specified `msg.value` and calldata.
1058    #[cheatcode(group = Testing, safety = Unsafe)]
1059    function expectCall(address callee, uint256 msgValue, bytes calldata data) external;
1060
1061    /// Expects given number of calls to an address with the specified `msg.value` and calldata.
1062    #[cheatcode(group = Testing, safety = Unsafe)]
1063    function expectCall(address callee, uint256 msgValue, bytes calldata data, uint64 count) external;
1064
1065    /// Expect a call to an address with the specified `msg.value`, gas, and calldata.
1066    #[cheatcode(group = Testing, safety = Unsafe)]
1067    function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data) external;
1068
1069    /// Expects given number of calls to an address with the specified `msg.value`, gas, and calldata.
1070    #[cheatcode(group = Testing, safety = Unsafe)]
1071    function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data, uint64 count) external;
1072
1073    /// Expect a call to an address with the specified `msg.value` and calldata, and a *minimum* amount of gas.
1074    #[cheatcode(group = Testing, safety = Unsafe)]
1075    function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data) external;
1076
1077    /// Expect given number of calls to an address with the specified `msg.value` and calldata, and a *minimum* amount of gas.
1078    #[cheatcode(group = Testing, safety = Unsafe)]
1079    function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data, uint64 count)
1080        external;
1081
1082    /// Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData.).
1083    /// Call this function, then emit an event, then call a function. Internally after the call, we check if
1084    /// logs were emitted in the expected order with the expected topics and data (as specified by the booleans).
1085    /// Must be placed immediately before the call you want to assert on. If the next call reverts and the
1086    /// revert is caught by the caller (low-level call or try/catch), the expectation remains active and may
1087    /// be satisfied by a log emitted from a later call.
1088    #[cheatcode(group = Testing, safety = Unsafe)]
1089    function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) 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(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter)
1094        external;
1095
1096    /// Prepare an expected log with all topic and data checks enabled.
1097    /// Call this function, then emit an event, then call a function. Internally after the call, we check if
1098    /// logs were emitted in the expected order with the expected topics and data.
1099    /// Must be placed immediately before the call you want to assert on. If the next call reverts and the
1100    /// revert is caught by the caller (low-level call or try/catch), the expectation remains active and may
1101    /// be satisfied by a log emitted from a later call.
1102    #[cheatcode(group = Testing, safety = Unsafe)]
1103    function expectEmit() external;
1104
1105    /// Same as the previous method, but also checks supplied address against emitting contract.
1106    #[cheatcode(group = Testing, safety = Unsafe)]
1107    function expectEmit(address emitter) external;
1108
1109    /// Expect a given number of logs with the provided topics.
1110    #[cheatcode(group = Testing, safety = Unsafe)]
1111    function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, uint64 count) external;
1112
1113    /// Expect a given number of logs from a specific emitter with the provided topics.
1114    #[cheatcode(group = Testing, safety = Unsafe)]
1115    function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter, uint64 count)
1116        external;
1117
1118    /// Expect a given number of logs with all topic and data checks enabled.
1119    #[cheatcode(group = Testing, safety = Unsafe)]
1120    function expectEmit(uint64 count) external;
1121
1122    /// Expect a given number of logs from a specific emitter with all topic and data checks enabled.
1123    #[cheatcode(group = Testing, safety = Unsafe)]
1124    function expectEmit(address emitter, uint64 count) external;
1125
1126    /// Prepare an expected anonymous log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData.).
1127    /// Call this function, then emit an anonymous event, then call a function. Internally after the call, we check if
1128    /// logs were emitted in the expected order with the expected topics and data (as specified by the booleans).
1129    #[cheatcode(group = Testing, safety = Unsafe)]
1130    function expectEmitAnonymous(bool checkTopic0, bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external;
1131
1132    /// Same as the previous method, but also checks supplied address against emitting contract.
1133    #[cheatcode(group = Testing, safety = Unsafe)]
1134    function expectEmitAnonymous(bool checkTopic0, bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter)
1135        external;
1136
1137    /// Prepare an expected anonymous log with all topic and data checks enabled.
1138    /// Call this function, then emit an anonymous event, then call a function. Internally after the call, we check if
1139    /// logs were emitted in the expected order with the expected topics and data.
1140    #[cheatcode(group = Testing, safety = Unsafe)]
1141    function expectEmitAnonymous() external;
1142
1143    /// Same as the previous method, but also checks supplied address against emitting contract.
1144    #[cheatcode(group = Testing, safety = Unsafe)]
1145    function expectEmitAnonymous(address emitter) external;
1146
1147    /// Expects the deployment of the specified bytecode by the specified address using the CREATE opcode
1148    #[cheatcode(group = Testing, safety = Unsafe)]
1149    function expectCreate(bytes calldata bytecode, address deployer) external;
1150
1151    /// Expects the deployment of the specified bytecode by the specified address using the CREATE2 opcode
1152    #[cheatcode(group = Testing, safety = Unsafe)]
1153    function expectCreate2(bytes calldata bytecode, address deployer) external;
1154
1155    /// Expects an error on next call with any revert data.
1156    #[cheatcode(group = Testing, safety = Unsafe)]
1157    function expectRevert() external;
1158
1159    /// Expects an error on next call that exactly matches the revert data.
1160    #[cheatcode(group = Testing, safety = Unsafe)]
1161    function expectRevert(bytes4 revertData) external;
1162
1163    /// Expects an error on next call that exactly matches the revert data.
1164    #[cheatcode(group = Testing, safety = Unsafe)]
1165    function expectRevert(bytes calldata revertData) external;
1166
1167    /// Expects an error with any revert data on next call to reverter address.
1168    ///
1169    /// The `reverter` argument is matched against the address associated with
1170    /// the frame that produced the revert:
1171    ///   - For a CALL: the address that was called.
1172    ///   - For a CREATE / CREATE2: the would-be deployed address of the failed
1173    ///     deployment (computed from the deployer + nonce, or salt + initcode).
1174    ///
1175    /// For a single expected revert, the innermost reverting frame wins in
1176    /// nested CALL, CREATE, or mixed chains. With `count > 1`, nested
1177    /// CREATE / CREATE2 chains apply the same rule independently to each
1178    /// iteration; nested CALL chains keep their existing
1179    /// outermost-call-per-iteration behavior.
1180    #[cheatcode(group = Testing, safety = Unsafe)]
1181    function expectRevert(address reverter) external;
1182
1183    /// Expects an error from reverter address on next call, with any revert data.
1184    /// See `expectRevert(address)` for `reverter` matching semantics.
1185    #[cheatcode(group = Testing, safety = Unsafe)]
1186    function expectRevert(bytes4 revertData, address reverter) external;
1187
1188    /// Expects an error from reverter address on next call, that exactly matches the revert data.
1189    /// See `expectRevert(address)` for `reverter` matching semantics.
1190    #[cheatcode(group = Testing, safety = Unsafe)]
1191    function expectRevert(bytes calldata revertData, address reverter) external;
1192
1193    /// Expects a `count` number of reverts from the upcoming calls with any revert data or reverter.
1194    #[cheatcode(group = Testing, safety = Unsafe)]
1195    function expectRevert(uint64 count) external;
1196
1197    /// Expects a `count` number of reverts from the upcoming calls that match the revert data.
1198    #[cheatcode(group = Testing, safety = Unsafe)]
1199    function expectRevert(bytes4 revertData, uint64 count) external;
1200
1201    /// Expects a `count` number of reverts from the upcoming calls that exactly match the revert data.
1202    #[cheatcode(group = Testing, safety = Unsafe)]
1203    function expectRevert(bytes calldata revertData, uint64 count) external;
1204
1205    /// Expects a `count` number of reverts from the upcoming calls from the reverter address.
1206    /// See `expectRevert(address)` for `reverter` matching semantics.
1207    #[cheatcode(group = Testing, safety = Unsafe)]
1208    function expectRevert(address reverter, uint64 count) external;
1209
1210    /// Expects a `count` number of reverts from the upcoming calls from the reverter address that match the revert data.
1211    /// See `expectRevert(address)` for `reverter` matching semantics.
1212    #[cheatcode(group = Testing, safety = Unsafe)]
1213    function expectRevert(bytes4 revertData, address reverter, uint64 count) external;
1214
1215    /// Expects a `count` number of reverts from the upcoming calls from the reverter address that exactly match the revert data.
1216    /// See `expectRevert(address)` for `reverter` matching semantics.
1217    #[cheatcode(group = Testing, safety = Unsafe)]
1218    function expectRevert(bytes calldata revertData, address reverter, uint64 count) external;
1219
1220    /// Expects an error on next call that starts with the revert data.
1221    #[cheatcode(group = Testing, safety = Unsafe)]
1222    function expectPartialRevert(bytes4 revertData) external;
1223
1224    /// Expects an error on next call to reverter address, that starts with the revert data.
1225    /// See `expectRevert(address)` for `reverter` matching semantics.
1226    #[cheatcode(group = Testing, safety = Unsafe)]
1227    function expectPartialRevert(bytes4 revertData, address reverter) external;
1228
1229    /// Expects an error on next cheatcode call with any revert data.
1230    #[cheatcode(group = Testing, safety = Unsafe, status = Internal)]
1231    function _expectCheatcodeRevert() external;
1232
1233    /// Expects an error on next cheatcode call that starts with the revert data.
1234    #[cheatcode(group = Testing, safety = Unsafe, status = Internal)]
1235    function _expectCheatcodeRevert(bytes4 revertData) external;
1236
1237    /// Expects an error on next cheatcode call that exactly matches the revert data.
1238    #[cheatcode(group = Testing, safety = Unsafe, status = Internal)]
1239    function _expectCheatcodeRevert(bytes calldata revertData) external;
1240
1241    /// Only allows memory writes to offsets [0x00, 0x60) ∪ [min, max) in the current subcontext. If any other
1242    /// memory is written to, the test will fail. Can be called multiple times to add more ranges to the set.
1243    #[cheatcode(group = Testing, safety = Unsafe)]
1244    function expectSafeMemory(uint64 min, uint64 max) external;
1245
1246    /// Stops all safe memory expectation in the current subcontext.
1247    #[cheatcode(group = Testing, safety = Unsafe)]
1248    function stopExpectSafeMemory() external;
1249
1250    /// Only allows memory writes to offsets [0x00, 0x60) ∪ [min, max) in the next created subcontext.
1251    /// If any other memory is written to, the test will fail. Can be called multiple times to add more ranges
1252    /// to the set.
1253    #[cheatcode(group = Testing, safety = Unsafe)]
1254    function expectSafeMemoryCall(uint64 min, uint64 max) external;
1255
1256    /// Marks a test as skipped. Must be called at the top level of a test.
1257    #[cheatcode(group = Testing, safety = Unsafe)]
1258    function skip(bool skipTest) external;
1259
1260    /// Marks a test as skipped with a reason. Must be called at the top level of a test.
1261    #[cheatcode(group = Testing, safety = Unsafe)]
1262    function skip(bool skipTest, string calldata reason) external;
1263
1264    /// Asserts that the given condition is true.
1265    #[cheatcode(group = Testing, safety = Safe)]
1266    function assertTrue(bool condition) external pure;
1267
1268    /// Asserts that the given condition is true and includes error message into revert string on failure.
1269    #[cheatcode(group = Testing, safety = Safe)]
1270    function assertTrue(bool condition, string calldata err) external pure;
1271
1272    /// Asserts that the given condition is false.
1273    #[cheatcode(group = Testing, safety = Safe)]
1274    function assertFalse(bool condition) external pure;
1275
1276    /// Asserts that the given condition is false and includes error message into revert string on failure.
1277    #[cheatcode(group = Testing, safety = Safe)]
1278    function assertFalse(bool condition, string calldata err) external pure;
1279
1280    /// Asserts that two `bool` values are equal.
1281    #[cheatcode(group = Testing, safety = Safe)]
1282    function assertEq(bool left, bool right) external pure;
1283
1284    /// Asserts that two `bool` values are equal and includes error message into revert string on failure.
1285    #[cheatcode(group = Testing, safety = Safe)]
1286    function assertEq(bool left, bool right, string calldata err) external pure;
1287
1288    /// Asserts that two `uint256` values are equal.
1289    #[cheatcode(group = Testing, safety = Safe)]
1290    function assertEq(uint256 left, uint256 right) external pure;
1291
1292    /// Asserts that two `uint256` values are equal and includes error message into revert string on failure.
1293    #[cheatcode(group = Testing, safety = Safe)]
1294    function assertEq(uint256 left, uint256 right, string calldata err) external pure;
1295
1296    /// Asserts that two `int256` values are equal.
1297    #[cheatcode(group = Testing, safety = Safe)]
1298    function assertEq(int256 left, int256 right) external pure;
1299
1300    /// Asserts that two `int256` values are equal and includes error message into revert string on failure.
1301    #[cheatcode(group = Testing, safety = Safe)]
1302    function assertEq(int256 left, int256 right, string calldata err) external pure;
1303
1304    /// Asserts that two `address` values are equal.
1305    #[cheatcode(group = Testing, safety = Safe)]
1306    function assertEq(address left, address right) external pure;
1307
1308    /// Asserts that two `address` values are equal and includes error message into revert string on failure.
1309    #[cheatcode(group = Testing, safety = Safe)]
1310    function assertEq(address left, address right, string calldata err) external pure;
1311
1312    /// Asserts that two `bytes32` values are equal.
1313    #[cheatcode(group = Testing, safety = Safe)]
1314    function assertEq(bytes32 left, bytes32 right) external pure;
1315
1316    /// Asserts that two `bytes32` values are equal and includes error message into revert string on failure.
1317    #[cheatcode(group = Testing, safety = Safe)]
1318    function assertEq(bytes32 left, bytes32 right, string calldata err) external pure;
1319
1320    /// Asserts that two `string` values are equal.
1321    #[cheatcode(group = Testing, safety = Safe)]
1322    function assertEq(string calldata left, string calldata right) external pure;
1323
1324    /// Asserts that two `string` values are equal and includes error message into revert string on failure.
1325    #[cheatcode(group = Testing, safety = Safe)]
1326    function assertEq(string calldata left, string calldata right, string calldata err) external pure;
1327
1328    /// Asserts that two `bytes` values are equal.
1329    #[cheatcode(group = Testing, safety = Safe)]
1330    function assertEq(bytes calldata left, bytes calldata right) external pure;
1331
1332    /// Asserts that two `bytes` values are equal and includes error message into revert string on failure.
1333    #[cheatcode(group = Testing, safety = Safe)]
1334    function assertEq(bytes calldata left, bytes calldata right, string calldata err) external pure;
1335
1336    /// Asserts that two arrays of `bool` values are equal.
1337    #[cheatcode(group = Testing, safety = Safe)]
1338    function assertEq(bool[] calldata left, bool[] calldata right) external pure;
1339
1340    /// Asserts that two arrays of `bool` values are equal and includes error message into revert string on failure.
1341    #[cheatcode(group = Testing, safety = Safe)]
1342    function assertEq(bool[] calldata left, bool[] calldata right, string calldata err) external pure;
1343
1344    /// Asserts that two arrays of `uint256 values are equal.
1345    #[cheatcode(group = Testing, safety = Safe)]
1346    function assertEq(uint256[] calldata left, uint256[] calldata right) external pure;
1347
1348    /// Asserts that two arrays of `uint256` values are equal and includes error message into revert string on failure.
1349    #[cheatcode(group = Testing, safety = Safe)]
1350    function assertEq(uint256[] calldata left, uint256[] calldata right, string calldata err) external pure;
1351
1352    /// Asserts that two arrays of `int256` values are equal.
1353    #[cheatcode(group = Testing, safety = Safe)]
1354    function assertEq(int256[] calldata left, int256[] calldata right) external pure;
1355
1356    /// Asserts that two arrays of `int256` values are equal and includes error message into revert string on failure.
1357    #[cheatcode(group = Testing, safety = Safe)]
1358    function assertEq(int256[] calldata left, int256[] calldata right, string calldata err) external pure;
1359
1360    /// Asserts that two arrays of `address` values are equal.
1361    #[cheatcode(group = Testing, safety = Safe)]
1362    function assertEq(address[] calldata left, address[] calldata right) external pure;
1363
1364    /// Asserts that two arrays of `address` values are equal and includes error message into revert string on failure.
1365    #[cheatcode(group = Testing, safety = Safe)]
1366    function assertEq(address[] calldata left, address[] calldata right, string calldata err) external pure;
1367
1368    /// Asserts that two arrays of `bytes32` values are equal.
1369    #[cheatcode(group = Testing, safety = Safe)]
1370    function assertEq(bytes32[] calldata left, bytes32[] calldata right) external pure;
1371
1372    /// Asserts that two arrays of `bytes32` values are equal and includes error message into revert string on failure.
1373    #[cheatcode(group = Testing, safety = Safe)]
1374    function assertEq(bytes32[] calldata left, bytes32[] calldata right, string calldata err) external pure;
1375
1376    /// Asserts that two arrays of `string` values are equal.
1377    #[cheatcode(group = Testing, safety = Safe)]
1378    function assertEq(string[] calldata left, string[] calldata right) external pure;
1379
1380    /// Asserts that two arrays of `string` values are equal and includes error message into revert string on failure.
1381    #[cheatcode(group = Testing, safety = Safe)]
1382    function assertEq(string[] calldata left, string[] calldata right, string calldata err) external pure;
1383
1384    /// Asserts that two arrays of `bytes` values are equal.
1385    #[cheatcode(group = Testing, safety = Safe)]
1386    function assertEq(bytes[] calldata left, bytes[] calldata right) external pure;
1387
1388    /// Asserts that two arrays of `bytes` values are equal and includes error message into revert string on failure.
1389    #[cheatcode(group = Testing, safety = Safe)]
1390    function assertEq(bytes[] calldata left, bytes[] calldata right, string calldata err) external pure;
1391
1392    /// Asserts that two `uint256` values are equal, formatting them with decimals in failure message.
1393    #[cheatcode(group = Testing, safety = Safe)]
1394    function assertEqDecimal(uint256 left, uint256 right, uint256 decimals) external pure;
1395
1396    /// Asserts that two `uint256` values are equal, formatting them with decimals in failure message.
1397    /// Includes error message into revert string on failure.
1398    #[cheatcode(group = Testing, safety = Safe)]
1399    function assertEqDecimal(uint256 left, uint256 right, uint256 decimals, string calldata err) external pure;
1400
1401    /// Asserts that two `int256` values are equal, formatting them with decimals in failure message.
1402    #[cheatcode(group = Testing, safety = Safe)]
1403    function assertEqDecimal(int256 left, int256 right, uint256 decimals) external pure;
1404
1405    /// Asserts that two `int256` values are equal, formatting them with decimals in failure message.
1406    /// Includes error message into revert string on failure.
1407    #[cheatcode(group = Testing, safety = Safe)]
1408    function assertEqDecimal(int256 left, int256 right, uint256 decimals, string calldata err) external pure;
1409
1410    /// Asserts that two `bool` values are not equal.
1411    #[cheatcode(group = Testing, safety = Safe)]
1412    function assertNotEq(bool left, bool right) external pure;
1413
1414    /// Asserts that two `bool` values are not equal and includes error message into revert string on failure.
1415    #[cheatcode(group = Testing, safety = Safe)]
1416    function assertNotEq(bool left, bool right, string calldata err) external pure;
1417
1418    /// Asserts that two `uint256` values are not equal.
1419    #[cheatcode(group = Testing, safety = Safe)]
1420    function assertNotEq(uint256 left, uint256 right) external pure;
1421
1422    /// Asserts that two `uint256` values are not equal and includes error message into revert string on failure.
1423    #[cheatcode(group = Testing, safety = Safe)]
1424    function assertNotEq(uint256 left, uint256 right, string calldata err) external pure;
1425
1426    /// Asserts that two `int256` values are not equal.
1427    #[cheatcode(group = Testing, safety = Safe)]
1428    function assertNotEq(int256 left, int256 right) external pure;
1429
1430    /// Asserts that two `int256` values are not equal and includes error message into revert string on failure.
1431    #[cheatcode(group = Testing, safety = Safe)]
1432    function assertNotEq(int256 left, int256 right, string calldata err) external pure;
1433
1434    /// Asserts that two `address` values are not equal.
1435    #[cheatcode(group = Testing, safety = Safe)]
1436    function assertNotEq(address left, address right) external pure;
1437
1438    /// Asserts that two `address` values are not equal and includes error message into revert string on failure.
1439    #[cheatcode(group = Testing, safety = Safe)]
1440    function assertNotEq(address left, address right, string calldata err) external pure;
1441
1442    /// Asserts that two `bytes32` values are not equal.
1443    #[cheatcode(group = Testing, safety = Safe)]
1444    function assertNotEq(bytes32 left, bytes32 right) external pure;
1445
1446    /// Asserts that two `bytes32` values are not equal and includes error message into revert string on failure.
1447    #[cheatcode(group = Testing, safety = Safe)]
1448    function assertNotEq(bytes32 left, bytes32 right, string calldata err) external pure;
1449
1450    /// Asserts that two `string` values are not equal.
1451    #[cheatcode(group = Testing, safety = Safe)]
1452    function assertNotEq(string calldata left, string calldata right) external pure;
1453
1454    /// Asserts that two `string` values are not equal and includes error message into revert string on failure.
1455    #[cheatcode(group = Testing, safety = Safe)]
1456    function assertNotEq(string calldata left, string calldata right, string calldata err) external pure;
1457
1458    /// Asserts that two `bytes` values are not equal.
1459    #[cheatcode(group = Testing, safety = Safe)]
1460    function assertNotEq(bytes calldata left, bytes calldata right) external pure;
1461
1462    /// Asserts that two `bytes` values are not equal and includes error message into revert string on failure.
1463    #[cheatcode(group = Testing, safety = Safe)]
1464    function assertNotEq(bytes calldata left, bytes calldata right, string calldata err) external pure;
1465
1466    /// Asserts that two arrays of `bool` values are not equal.
1467    #[cheatcode(group = Testing, safety = Safe)]
1468    function assertNotEq(bool[] calldata left, bool[] calldata right) external pure;
1469
1470    /// Asserts that two arrays of `bool` values are not equal and includes error message into revert string on failure.
1471    #[cheatcode(group = Testing, safety = Safe)]
1472    function assertNotEq(bool[] calldata left, bool[] calldata right, string calldata err) external pure;
1473
1474    /// Asserts that two arrays of `uint256` values are not equal.
1475    #[cheatcode(group = Testing, safety = Safe)]
1476    function assertNotEq(uint256[] calldata left, uint256[] calldata right) external pure;
1477
1478    /// Asserts that two arrays of `uint256` values are not equal and includes error message into revert string on failure.
1479    #[cheatcode(group = Testing, safety = Safe)]
1480    function assertNotEq(uint256[] calldata left, uint256[] calldata right, string calldata err) external pure;
1481
1482    /// Asserts that two arrays of `int256` values are not equal.
1483    #[cheatcode(group = Testing, safety = Safe)]
1484    function assertNotEq(int256[] calldata left, int256[] calldata right) external pure;
1485
1486    /// Asserts that two arrays of `int256` values are not equal and includes error message into revert string on failure.
1487    #[cheatcode(group = Testing, safety = Safe)]
1488    function assertNotEq(int256[] calldata left, int256[] calldata right, string calldata err) external pure;
1489
1490    /// Asserts that two arrays of `address` values are not equal.
1491    #[cheatcode(group = Testing, safety = Safe)]
1492    function assertNotEq(address[] calldata left, address[] calldata right) external pure;
1493
1494    /// Asserts that two arrays of `address` values are not equal and includes error message into revert string on failure.
1495    #[cheatcode(group = Testing, safety = Safe)]
1496    function assertNotEq(address[] calldata left, address[] calldata right, string calldata err) external pure;
1497
1498    /// Asserts that two arrays of `bytes32` values are not equal.
1499    #[cheatcode(group = Testing, safety = Safe)]
1500    function assertNotEq(bytes32[] calldata left, bytes32[] calldata right) external pure;
1501
1502    /// Asserts that two arrays of `bytes32` values are not equal and includes error message into revert string on failure.
1503    #[cheatcode(group = Testing, safety = Safe)]
1504    function assertNotEq(bytes32[] calldata left, bytes32[] calldata right, string calldata err) external pure;
1505
1506    /// Asserts that two arrays of `string` values are not equal.
1507    #[cheatcode(group = Testing, safety = Safe)]
1508    function assertNotEq(string[] calldata left, string[] calldata right) external pure;
1509
1510    /// Asserts that two arrays of `string` values are not equal and includes error message into revert string on failure.
1511    #[cheatcode(group = Testing, safety = Safe)]
1512    function assertNotEq(string[] calldata left, string[] calldata right, string calldata err) external pure;
1513
1514    /// Asserts that two arrays of `bytes` values are not equal.
1515    #[cheatcode(group = Testing, safety = Safe)]
1516    function assertNotEq(bytes[] calldata left, bytes[] calldata right) external pure;
1517
1518    /// Asserts that two arrays of `bytes` values are not equal and includes error message into revert string on failure.
1519    #[cheatcode(group = Testing, safety = Safe)]
1520    function assertNotEq(bytes[] calldata left, bytes[] calldata right, string calldata err) external pure;
1521
1522    /// Asserts that two `uint256` values are not equal, formatting them with decimals in failure message.
1523    #[cheatcode(group = Testing, safety = Safe)]
1524    function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals) external pure;
1525
1526    /// Asserts that two `uint256` values are not equal, formatting them with decimals in failure message.
1527    /// Includes error message into revert string on failure.
1528    #[cheatcode(group = Testing, safety = Safe)]
1529    function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals, string calldata err) external pure;
1530
1531    /// Asserts that two `int256` values are not equal, formatting them with decimals in failure message.
1532    #[cheatcode(group = Testing, safety = Safe)]
1533    function assertNotEqDecimal(int256 left, int256 right, uint256 decimals) external pure;
1534
1535    /// Asserts that two `int256` values are not equal, formatting them with decimals in failure message.
1536    /// Includes error message into revert string on failure.
1537    #[cheatcode(group = Testing, safety = Safe)]
1538    function assertNotEqDecimal(int256 left, int256 right, uint256 decimals, string calldata err) external pure;
1539
1540    /// Compares two `uint256` values. Expects first value to be greater than second.
1541    #[cheatcode(group = Testing, safety = Safe)]
1542    function assertGt(uint256 left, uint256 right) external pure;
1543
1544    /// Compares two `uint256` values. Expects first value to be greater than second.
1545    /// Includes error message into revert string on failure.
1546    #[cheatcode(group = Testing, safety = Safe)]
1547    function assertGt(uint256 left, uint256 right, string calldata err) external pure;
1548
1549    /// Compares two `int256` values. Expects first value to be greater than second.
1550    #[cheatcode(group = Testing, safety = Safe)]
1551    function assertGt(int256 left, int256 right) external pure;
1552
1553    /// Compares two `int256` values. Expects first value to be greater than second.
1554    /// Includes error message into revert string on failure.
1555    #[cheatcode(group = Testing, safety = Safe)]
1556    function assertGt(int256 left, int256 right, string calldata err) external pure;
1557
1558    /// Compares two `uint256` values. Expects first value to be greater than second.
1559    /// Formats values with decimals in failure message.
1560    #[cheatcode(group = Testing, safety = Safe)]
1561    function assertGtDecimal(uint256 left, uint256 right, uint256 decimals) external pure;
1562
1563    /// Compares two `uint256` values. Expects first value to be greater than second.
1564    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1565    #[cheatcode(group = Testing, safety = Safe)]
1566    function assertGtDecimal(uint256 left, uint256 right, uint256 decimals, string calldata err) external pure;
1567
1568    /// Compares two `int256` values. Expects first value to be greater than second.
1569    /// Formats values with decimals in failure message.
1570    #[cheatcode(group = Testing, safety = Safe)]
1571    function assertGtDecimal(int256 left, int256 right, uint256 decimals) external pure;
1572
1573    /// Compares two `int256` values. Expects first value to be greater than second.
1574    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1575    #[cheatcode(group = Testing, safety = Safe)]
1576    function assertGtDecimal(int256 left, int256 right, uint256 decimals, string calldata err) external pure;
1577
1578    /// Compares two `uint256` values. Expects first value to be greater than or equal to second.
1579    #[cheatcode(group = Testing, safety = Safe)]
1580    function assertGe(uint256 left, uint256 right) external pure;
1581
1582    /// Compares two `uint256` values. Expects first value to be greater than or equal to second.
1583    /// Includes error message into revert string on failure.
1584    #[cheatcode(group = Testing, safety = Safe)]
1585    function assertGe(uint256 left, uint256 right, string calldata err) external pure;
1586
1587    /// Compares two `int256` values. Expects first value to be greater than or equal to second.
1588    #[cheatcode(group = Testing, safety = Safe)]
1589    function assertGe(int256 left, int256 right) external pure;
1590
1591    /// Compares two `int256` values. Expects first value to be greater than or equal to second.
1592    /// Includes error message into revert string on failure.
1593    #[cheatcode(group = Testing, safety = Safe)]
1594    function assertGe(int256 left, int256 right, string calldata err) external pure;
1595
1596    /// Compares two `uint256` values. Expects first value to be greater than or equal to second.
1597    /// Formats values with decimals in failure message.
1598    #[cheatcode(group = Testing, safety = Safe)]
1599    function assertGeDecimal(uint256 left, uint256 right, uint256 decimals) external pure;
1600
1601    /// Compares two `uint256` values. Expects first value to be greater than or equal to second.
1602    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1603    #[cheatcode(group = Testing, safety = Safe)]
1604    function assertGeDecimal(uint256 left, uint256 right, uint256 decimals, string calldata err) external pure;
1605
1606    /// Compares two `int256` values. Expects first value to be greater than or equal to second.
1607    /// Formats values with decimals in failure message.
1608    #[cheatcode(group = Testing, safety = Safe)]
1609    function assertGeDecimal(int256 left, int256 right, uint256 decimals) external pure;
1610
1611    /// Compares two `int256` values. Expects first value to be greater than or equal to second.
1612    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1613    #[cheatcode(group = Testing, safety = Safe)]
1614    function assertGeDecimal(int256 left, int256 right, uint256 decimals, string calldata err) external pure;
1615
1616    /// Compares two `uint256` values. Expects first value to be less than second.
1617    #[cheatcode(group = Testing, safety = Safe)]
1618    function assertLt(uint256 left, uint256 right) external pure;
1619
1620    /// Compares two `uint256` values. Expects first value to be less than second.
1621    /// Includes error message into revert string on failure.
1622    #[cheatcode(group = Testing, safety = Safe)]
1623    function assertLt(uint256 left, uint256 right, string calldata err) external pure;
1624
1625    /// Compares two `int256` values. Expects first value to be less than second.
1626    #[cheatcode(group = Testing, safety = Safe)]
1627    function assertLt(int256 left, int256 right) external pure;
1628
1629    /// Compares two `int256` values. Expects first value to be less than second.
1630    /// Includes error message into revert string on failure.
1631    #[cheatcode(group = Testing, safety = Safe)]
1632    function assertLt(int256 left, int256 right, string calldata err) external pure;
1633
1634    /// Compares two `uint256` values. Expects first value to be less than second.
1635    /// Formats values with decimals in failure message.
1636    #[cheatcode(group = Testing, safety = Safe)]
1637    function assertLtDecimal(uint256 left, uint256 right, uint256 decimals) external pure;
1638
1639    /// Compares two `uint256` values. Expects first value to be less than second.
1640    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1641    #[cheatcode(group = Testing, safety = Safe)]
1642    function assertLtDecimal(uint256 left, uint256 right, uint256 decimals, string calldata err) external pure;
1643
1644    /// Compares two `int256` values. Expects first value to be less than second.
1645    /// Formats values with decimals in failure message.
1646    #[cheatcode(group = Testing, safety = Safe)]
1647    function assertLtDecimal(int256 left, int256 right, uint256 decimals) external pure;
1648
1649    /// Compares two `int256` values. Expects first value to be less than second.
1650    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1651    #[cheatcode(group = Testing, safety = Safe)]
1652    function assertLtDecimal(int256 left, int256 right, uint256 decimals, string calldata err) external pure;
1653
1654    /// Compares two `uint256` values. Expects first value to be less than or equal to second.
1655    #[cheatcode(group = Testing, safety = Safe)]
1656    function assertLe(uint256 left, uint256 right) external pure;
1657
1658    /// Compares two `uint256` values. Expects first value to be less than or equal to second.
1659    /// Includes error message into revert string on failure.
1660    #[cheatcode(group = Testing, safety = Safe)]
1661    function assertLe(uint256 left, uint256 right, string calldata err) external pure;
1662
1663    /// Compares two `int256` values. Expects first value to be less than or equal to second.
1664    #[cheatcode(group = Testing, safety = Safe)]
1665    function assertLe(int256 left, int256 right) external pure;
1666
1667    /// Compares two `int256` values. Expects first value to be less than or equal to second.
1668    /// Includes error message into revert string on failure.
1669    #[cheatcode(group = Testing, safety = Safe)]
1670    function assertLe(int256 left, int256 right, string calldata err) external pure;
1671
1672    /// Compares two `uint256` values. Expects first value to be less than or equal to second.
1673    /// Formats values with decimals in failure message.
1674    #[cheatcode(group = Testing, safety = Safe)]
1675    function assertLeDecimal(uint256 left, uint256 right, uint256 decimals) external pure;
1676
1677    /// Compares two `uint256` values. Expects first value to be less than or equal to second.
1678    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1679    #[cheatcode(group = Testing, safety = Safe)]
1680    function assertLeDecimal(uint256 left, uint256 right, uint256 decimals, string calldata err) external pure;
1681
1682    /// Compares two `int256` values. Expects first value to be less than or equal to second.
1683    /// Formats values with decimals in failure message.
1684    #[cheatcode(group = Testing, safety = Safe)]
1685    function assertLeDecimal(int256 left, int256 right, uint256 decimals) external pure;
1686
1687    /// Compares two `int256` values. Expects first value to be less than or equal to second.
1688    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1689    #[cheatcode(group = Testing, safety = Safe)]
1690    function assertLeDecimal(int256 left, int256 right, uint256 decimals, string calldata err) external pure;
1691
1692    /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`.
1693    #[cheatcode(group = Testing, safety = Safe)]
1694    function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta) external pure;
1695
1696    /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`.
1697    /// Includes error message into revert string on failure.
1698    #[cheatcode(group = Testing, safety = Safe)]
1699    function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta, string calldata err) external pure;
1700
1701    /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`.
1702    #[cheatcode(group = Testing, safety = Safe)]
1703    function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta) external pure;
1704
1705    /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`.
1706    /// Includes error message into revert string on failure.
1707    #[cheatcode(group = Testing, safety = Safe)]
1708    function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta, string calldata err) external pure;
1709
1710    /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`.
1711    /// Formats values with decimals in failure message.
1712    #[cheatcode(group = Testing, safety = Safe)]
1713    function assertApproxEqAbsDecimal(uint256 left, uint256 right, uint256 maxDelta, uint256 decimals) external pure;
1714
1715    /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`.
1716    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1717    #[cheatcode(group = Testing, safety = Safe)]
1718    function assertApproxEqAbsDecimal(
1719        uint256 left,
1720        uint256 right,
1721        uint256 maxDelta,
1722        uint256 decimals,
1723        string calldata err
1724    ) external pure;
1725
1726    /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`.
1727    /// Formats values with decimals in failure message.
1728    #[cheatcode(group = Testing, safety = Safe)]
1729    function assertApproxEqAbsDecimal(int256 left, int256 right, uint256 maxDelta, uint256 decimals) external pure;
1730
1731    /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`.
1732    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1733    #[cheatcode(group = Testing, safety = Safe)]
1734    function assertApproxEqAbsDecimal(
1735        int256 left,
1736        int256 right,
1737        uint256 maxDelta,
1738        uint256 decimals,
1739        string calldata err
1740    ) external pure;
1741
1742    /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1743    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1744    #[cheatcode(group = Testing, safety = Safe)]
1745    function assertApproxEqRel(uint256 left, uint256 right, uint256 maxPercentDelta) external pure;
1746
1747    /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1748    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1749    /// Includes error message into revert string on failure.
1750    #[cheatcode(group = Testing, safety = Safe)]
1751    function assertApproxEqRel(uint256 left, uint256 right, uint256 maxPercentDelta, string calldata err) external pure;
1752
1753    /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1754    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1755    #[cheatcode(group = Testing, safety = Safe)]
1756    function assertApproxEqRel(int256 left, int256 right, uint256 maxPercentDelta) external pure;
1757
1758    /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1759    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1760    /// Includes error message into revert string on failure.
1761    #[cheatcode(group = Testing, safety = Safe)]
1762    function assertApproxEqRel(int256 left, int256 right, uint256 maxPercentDelta, string calldata err) external pure;
1763
1764    /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1765    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1766    /// Formats values with decimals in failure message.
1767    #[cheatcode(group = Testing, safety = Safe)]
1768    function assertApproxEqRelDecimal(
1769        uint256 left,
1770        uint256 right,
1771        uint256 maxPercentDelta,
1772        uint256 decimals
1773    ) external pure;
1774
1775    /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1776    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1777    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1778    #[cheatcode(group = Testing, safety = Safe)]
1779    function assertApproxEqRelDecimal(
1780        uint256 left,
1781        uint256 right,
1782        uint256 maxPercentDelta,
1783        uint256 decimals,
1784        string calldata err
1785    ) external pure;
1786
1787    /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1788    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1789    /// Formats values with decimals in failure message.
1790    #[cheatcode(group = Testing, safety = Safe)]
1791    function assertApproxEqRelDecimal(
1792        int256 left,
1793        int256 right,
1794        uint256 maxPercentDelta,
1795        uint256 decimals
1796    ) external pure;
1797
1798    /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
1799    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
1800    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
1801    #[cheatcode(group = Testing, safety = Safe)]
1802    function assertApproxEqRelDecimal(
1803        int256 left,
1804        int256 right,
1805        uint256 maxPercentDelta,
1806        uint256 decimals,
1807        string calldata err
1808    ) external pure;
1809
1810    /// Returns true if the current Foundry version is greater than or equal to the given version.
1811    /// The given version string must be in the format `major.minor.patch`.
1812    ///
1813    /// This is equivalent to `foundryVersionCmp(version) >= 0`.
1814    #[cheatcode(group = Testing, safety = Safe)]
1815    function foundryVersionAtLeast(string calldata version) external view returns (bool);
1816
1817    /// Compares the current Foundry version with the given version string.
1818    /// The given version string must be in the format `major.minor.patch`.
1819    ///
1820    /// Returns:
1821    /// -1 if current Foundry version is less than the given version
1822    /// 0 if current Foundry version equals the given version
1823    /// 1 if current Foundry version is greater than the given version
1824    ///
1825    /// This result can then be used with a comparison operator against `0`.
1826    /// For example, to check if the current Foundry version is greater than or equal to `1.0.0`:
1827    /// `if (foundryVersionCmp("1.0.0") >= 0) { ... }`
1828    #[cheatcode(group = Testing, safety = Safe)]
1829    function foundryVersionCmp(string calldata version) external view returns (int256);
1830
1831    // ======== OS and Filesystem ========
1832
1833    // -------- Metadata --------
1834
1835    /// Returns true if the given path points to an existing entity, else returns false.
1836    #[cheatcode(group = Filesystem)]
1837    function exists(string calldata path) external view returns (bool result);
1838
1839    /// Given a path, query the file system to get information about a file, directory, etc.
1840    #[cheatcode(group = Filesystem)]
1841    function fsMetadata(string calldata path) external view returns (FsMetadata memory metadata);
1842
1843    /// Returns true if the path exists on disk and is pointing at a directory, else returns false.
1844    #[cheatcode(group = Filesystem)]
1845    function isDir(string calldata path) external view returns (bool result);
1846
1847    /// Returns true if the path exists on disk and is pointing at a regular file, else returns false.
1848    #[cheatcode(group = Filesystem)]
1849    function isFile(string calldata path) external view returns (bool result);
1850
1851    /// Get the path of the current project root.
1852    #[cheatcode(group = Filesystem)]
1853    function projectRoot() external view returns (string memory path);
1854
1855    /// Get the source file path of the currently running test or script contract,
1856    /// relative to the project root.
1857    #[cheatcode(group = Filesystem)]
1858    function currentFilePath() external view returns (string memory path);
1859
1860    /// Returns the time since unix epoch in milliseconds.
1861    #[cheatcode(group = Filesystem)]
1862    function unixTime() external view returns (uint256 milliseconds);
1863
1864    // -------- Reading and writing --------
1865
1866    /// Closes file for reading, resetting the offset and allowing to read it from beginning with readLine.
1867    /// `path` is relative to the project root.
1868    #[cheatcode(group = Filesystem)]
1869    function closeFile(string calldata path) external;
1870
1871    /// Copies the contents of one file to another. This function will **overwrite** the contents of `to`.
1872    /// 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`.
1873    /// Both `from` and `to` are relative to the project root.
1874    #[cheatcode(group = Filesystem)]
1875    function copyFile(string calldata from, string calldata to) external returns (uint64 copied);
1876
1877    /// Creates a new, empty directory at the provided path.
1878    /// This cheatcode will revert in the following situations, but is not limited to just these cases:
1879    /// - User lacks permissions to modify `path`.
1880    /// - A parent of the given path doesn't exist and `recursive` is false.
1881    /// - `path` already exists and `recursive` is false.
1882    /// `path` is relative to the project root.
1883    #[cheatcode(group = Filesystem)]
1884    function createDir(string calldata path, bool recursive) external;
1885
1886    /// Reads the directory at the given path recursively, up to `maxDepth`.
1887    /// `maxDepth` defaults to 1, meaning only the direct children of the given directory will be returned.
1888    /// Follows symbolic links if `followLinks` is true.
1889    #[cheatcode(group = Filesystem)]
1890    function readDir(string calldata path) external view returns (DirEntry[] memory entries);
1891    /// See `readDir(string)`.
1892    #[cheatcode(group = Filesystem)]
1893    function readDir(string calldata path, uint64 maxDepth) external view returns (DirEntry[] memory entries);
1894    /// See `readDir(string)`.
1895    #[cheatcode(group = Filesystem)]
1896    function readDir(string calldata path, uint64 maxDepth, bool followLinks)
1897        external
1898        view
1899        returns (DirEntry[] memory entries);
1900
1901    /// Reads the entire content of file to string. `path` is relative to the project root.
1902    #[cheatcode(group = Filesystem)]
1903    function readFile(string calldata path) external view returns (string memory data);
1904
1905    /// Reads the entire content of file as binary. `path` is relative to the project root.
1906    #[cheatcode(group = Filesystem)]
1907    function readFileBinary(string calldata path) external view returns (bytes memory data);
1908
1909    /// Reads next line of file to string.
1910    #[cheatcode(group = Filesystem)]
1911    function readLine(string calldata path) external view returns (string memory line);
1912
1913    /// Reads a symbolic link, returning the path that the link points to.
1914    /// This cheatcode will revert in the following situations, but is not limited to just these cases:
1915    /// - `path` is not a symbolic link.
1916    /// - `path` does not exist.
1917    #[cheatcode(group = Filesystem)]
1918    function readLink(string calldata linkPath) external view returns (string memory targetPath);
1919
1920    /// Removes a directory at the provided path.
1921    /// This cheatcode will revert in the following situations, but is not limited to just these cases:
1922    /// - `path` doesn't exist.
1923    /// - `path` isn't a directory.
1924    /// - User lacks permissions to modify `path`.
1925    /// - The directory is not empty and `recursive` is false.
1926    /// `path` is relative to the project root.
1927    #[cheatcode(group = Filesystem)]
1928    function removeDir(string calldata path, bool recursive) external;
1929
1930    /// Removes a file from the filesystem.
1931    /// This cheatcode will revert in the following situations, but is not limited to just these cases:
1932    /// - `path` points to a directory.
1933    /// - The file doesn't exist.
1934    /// - The user lacks permissions to remove the file.
1935    /// `path` is relative to the project root.
1936    #[cheatcode(group = Filesystem)]
1937    function removeFile(string calldata path) external;
1938
1939    /// Writes data to file, creating a file if it does not exist, and entirely replacing its contents if it does.
1940    /// `path` is relative to the project root.
1941    #[cheatcode(group = Filesystem)]
1942    function writeFile(string calldata path, string calldata data) external;
1943
1944    /// Writes binary data to a file, creating a file if it does not exist, and entirely replacing its contents if it does.
1945    /// `path` is relative to the project root.
1946    #[cheatcode(group = Filesystem)]
1947    function writeFileBinary(string calldata path, bytes calldata data) external;
1948
1949    /// Writes line to file, creating a file if it does not exist.
1950    /// `path` is relative to the project root.
1951    #[cheatcode(group = Filesystem)]
1952    function writeLine(string calldata path, string calldata data) external;
1953
1954    /// Gets the artifact path from code (aka. creation code).
1955    #[cheatcode(group = Filesystem)]
1956    function getArtifactPathByCode(bytes calldata code) external view returns (string memory path);
1957
1958    /// Gets the artifact path from deployed code (aka. runtime code).
1959    #[cheatcode(group = Filesystem)]
1960    function getArtifactPathByDeployedCode(bytes calldata deployedCode) external view returns (string memory path);
1961
1962    /// Gets the creation bytecode from an artifact file. Takes in the relative path to the json file or the path to the
1963    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1964    #[cheatcode(group = Filesystem)]
1965    function getCode(string calldata artifactPath) external view returns (bytes memory creationBytecode);
1966
1967    /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the
1968    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1969    /// Reverts if the target artifact contains unlinked library placeholders.
1970    #[cheatcode(group = Filesystem)]
1971    function deployCode(string calldata artifactPath) external returns (address deployedAddress);
1972
1973    /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the
1974    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1975    /// Reverts if the target artifact contains unlinked library placeholders.
1976    ///
1977    /// Additionally accepts abi-encoded constructor arguments.
1978    #[cheatcode(group = Filesystem)]
1979    function deployCode(string calldata artifactPath, bytes calldata constructorArgs) external returns (address deployedAddress);
1980
1981    /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the
1982    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1983    /// Reverts if the target artifact contains unlinked library placeholders.
1984    ///
1985    /// Additionally accepts `msg.value`.
1986    #[cheatcode(group = Filesystem)]
1987    function deployCode(string calldata artifactPath, uint256 value) external returns (address deployedAddress);
1988
1989    /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the
1990    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1991    /// Reverts if the target artifact contains unlinked library placeholders.
1992    ///
1993    /// Additionally accepts abi-encoded constructor arguments and `msg.value`.
1994    #[cheatcode(group = Filesystem)]
1995    function deployCode(string calldata artifactPath, bytes calldata constructorArgs, uint256 value) external returns (address deployedAddress);
1996
1997    /// 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
1998    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
1999    /// Reverts if the target artifact contains unlinked library placeholders.
2000    #[cheatcode(group = Filesystem)]
2001    function deployCode(string calldata artifactPath, bytes32 salt) external returns (address deployedAddress);
2002
2003    /// 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
2004    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
2005    /// Reverts if the target artifact contains unlinked library placeholders.
2006    ///
2007    /// Additionally accepts abi-encoded constructor arguments.
2008    #[cheatcode(group = Filesystem)]
2009    function deployCode(string calldata artifactPath, bytes calldata constructorArgs, bytes32 salt) external returns (address deployedAddress);
2010
2011    /// 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
2012    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
2013    /// Reverts if the target artifact contains unlinked library placeholders.
2014    ///
2015    /// Additionally accepts `msg.value`.
2016    #[cheatcode(group = Filesystem)]
2017    function deployCode(string calldata artifactPath, uint256 value, bytes32 salt) external returns (address deployedAddress);
2018
2019    /// 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
2020    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
2021    /// Reverts if the target artifact contains unlinked library placeholders.
2022    ///
2023    /// Additionally accepts abi-encoded constructor arguments and `msg.value`.
2024    #[cheatcode(group = Filesystem)]
2025    function deployCode(string calldata artifactPath, bytes calldata constructorArgs, uint256 value, bytes32 salt) external returns (address deployedAddress);
2026
2027    /// Gets the deployed bytecode from an artifact file. Takes in the relative path to the json file or the path to the
2028    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
2029    #[cheatcode(group = Filesystem)]
2030    function getDeployedCode(string calldata artifactPath) external view returns (bytes memory runtimeBytecode);
2031
2032    /// Returns the most recent broadcast for the given contract on `chainId` matching `txType`.
2033    ///
2034    /// For example:
2035    ///
2036    /// The most recent deployment can be fetched by passing `txType` as `CREATE` or `CREATE2`.
2037    ///
2038    /// The most recent call can be fetched by passing `txType` as `CALL`.
2039    #[cheatcode(group = Filesystem)]
2040    function getBroadcast(string calldata contractName, uint64 chainId, BroadcastTxType txType) external view returns (BroadcastTxSummary memory);
2041
2042    /// Returns all broadcasts for the given contract on `chainId` with the specified `txType`.
2043    ///
2044    /// Sorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber.
2045    #[cheatcode(group = Filesystem)]
2046    function getBroadcasts(string calldata contractName, uint64 chainId, BroadcastTxType txType) external view returns (BroadcastTxSummary[] memory);
2047
2048    /// Returns all broadcasts for the given contract on `chainId`.
2049    ///
2050    /// Sorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber.
2051    #[cheatcode(group = Filesystem)]
2052    function getBroadcasts(string calldata contractName, uint64 chainId) external view returns (BroadcastTxSummary[] memory);
2053
2054    /// Returns the most recent deployment for the current `chainId`.
2055    #[cheatcode(group = Filesystem)]
2056    function getDeployment(string calldata contractName) external view returns (address deployedAddress);
2057
2058    /// Returns the most recent deployment for the given contract on `chainId`
2059    #[cheatcode(group = Filesystem)]
2060    function getDeployment(string calldata contractName, uint64 chainId) external view returns (address deployedAddress);
2061
2062    /// Returns all deployments for the given contract on `chainId`
2063    ///
2064    /// Sorted in descending order of deployment time i.e descending order of BroadcastTxSummary.blockNumber.
2065    ///
2066    /// The most recent deployment is the first element, and the oldest is the last.
2067    #[cheatcode(group = Filesystem)]
2068    function getDeployments(string calldata contractName, uint64 chainId) external view returns (address[] memory deployedAddresses);
2069
2070    // -------- Foreign Function Interface --------
2071
2072    /// Performs a foreign function call via the terminal.
2073    #[cheatcode(group = Filesystem)]
2074    function ffi(string[] calldata commandInput) external returns (bytes memory result);
2075
2076    /// Performs a foreign function call via terminal and returns the exit code, stdout, and stderr.
2077    #[cheatcode(group = Filesystem)]
2078    function tryFfi(string[] calldata commandInput) external returns (FfiResult memory result);
2079
2080    // -------- User Interaction --------
2081
2082    /// Prompts the user for a string value in the terminal.
2083    #[cheatcode(group = Filesystem)]
2084    function prompt(string calldata promptText) external returns (string memory input);
2085
2086    /// Prompts the user for a hidden string value in the terminal.
2087    #[cheatcode(group = Filesystem)]
2088    function promptSecret(string calldata promptText) external returns (string memory input);
2089
2090    /// Prompts the user for hidden uint256 in the terminal (usually pk).
2091    #[cheatcode(group = Filesystem)]
2092    function promptSecretUint(string calldata promptText) external returns (uint256);
2093
2094    /// Prompts the user for an address in the terminal.
2095    #[cheatcode(group = Filesystem)]
2096    function promptAddress(string calldata promptText) external returns (address);
2097
2098    /// Prompts the user for uint256 in the terminal.
2099    #[cheatcode(group = Filesystem)]
2100    function promptUint(string calldata promptText) external returns (uint256);
2101
2102    // ======== Environment Variables ========
2103
2104    /// Resolves the env variable placeholders of a given input string.
2105    #[cheatcode(group = Environment)]
2106    function resolveEnv(string calldata input) external returns (string memory);
2107
2108    /// Sets environment variables.
2109    #[cheatcode(group = Environment)]
2110    function setEnv(string calldata name, string calldata value) external;
2111
2112    /// Gets the environment variable `name` and returns true if it exists, else returns false.
2113    #[cheatcode(group = Environment)]
2114    function envExists(string calldata name) external view returns (bool result);
2115
2116    /// Gets the environment variable `name` and parses it as `bool`.
2117    /// Reverts if the variable was not found or could not be parsed.
2118    #[cheatcode(group = Environment)]
2119    function envBool(string calldata name) external view returns (bool value);
2120    /// Gets the environment variable `name` and parses it as `uint256`.
2121    /// Reverts if the variable was not found or could not be parsed.
2122    #[cheatcode(group = Environment)]
2123    function envUint(string calldata name) external view returns (uint256 value);
2124    /// Gets the environment variable `name` and parses it as `int256`.
2125    /// Reverts if the variable was not found or could not be parsed.
2126    #[cheatcode(group = Environment)]
2127    function envInt(string calldata name) external view returns (int256 value);
2128    /// Gets the environment variable `name` and parses it as `address`.
2129    /// Reverts if the variable was not found or could not be parsed.
2130    #[cheatcode(group = Environment)]
2131    function envAddress(string calldata name) external view returns (address value);
2132    /// Gets the environment variable `name` and parses it as `bytes32`.
2133    /// Reverts if the variable was not found or could not be parsed.
2134    #[cheatcode(group = Environment)]
2135    function envBytes32(string calldata name) external view returns (bytes32 value);
2136    /// Gets the environment variable `name` and parses it as `string`.
2137    /// Reverts if the variable was not found or could not be parsed.
2138    #[cheatcode(group = Environment)]
2139    function envString(string calldata name) external view returns (string memory value);
2140    /// Gets the environment variable `name` and parses it as `bytes`.
2141    /// Reverts if the variable was not found or could not be parsed.
2142    #[cheatcode(group = Environment)]
2143    function envBytes(string calldata name) external view returns (bytes memory value);
2144
2145    /// Gets the environment variable `name` and parses it as an array of `bool`, delimited by `delim`.
2146    /// Reverts if the variable was not found or could not be parsed.
2147    #[cheatcode(group = Environment)]
2148    function envBool(string calldata name, string calldata delim) external view returns (bool[] memory value);
2149    /// Gets the environment variable `name` and parses it as an array of `uint256`, delimited by `delim`.
2150    /// Reverts if the variable was not found or could not be parsed.
2151    #[cheatcode(group = Environment)]
2152    function envUint(string calldata name, string calldata delim) external view returns (uint256[] memory value);
2153    /// Gets the environment variable `name` and parses it as an array of `int256`, delimited by `delim`.
2154    /// Reverts if the variable was not found or could not be parsed.
2155    #[cheatcode(group = Environment)]
2156    function envInt(string calldata name, string calldata delim) external view returns (int256[] memory value);
2157    /// Gets the environment variable `name` and parses it as an array of `address`, delimited by `delim`.
2158    /// Reverts if the variable was not found or could not be parsed.
2159    #[cheatcode(group = Environment)]
2160    function envAddress(string calldata name, string calldata delim) external view returns (address[] memory value);
2161    /// Gets the environment variable `name` and parses it as an array of `bytes32`, delimited by `delim`.
2162    /// Reverts if the variable was not found or could not be parsed.
2163    #[cheatcode(group = Environment)]
2164    function envBytes32(string calldata name, string calldata delim) external view returns (bytes32[] memory value);
2165    /// Gets the environment variable `name` and parses it as an array of `string`, delimited by `delim`.
2166    /// Reverts if the variable was not found or could not be parsed.
2167    #[cheatcode(group = Environment)]
2168    function envString(string calldata name, string calldata delim) external view returns (string[] memory value);
2169    /// Gets the environment variable `name` and parses it as an array of `bytes`, delimited by `delim`.
2170    /// Reverts if the variable was not found or could not be parsed.
2171    #[cheatcode(group = Environment)]
2172    function envBytes(string calldata name, string calldata delim) external view returns (bytes[] memory value);
2173
2174    /// Gets the environment variable `name` and parses it as `bool`.
2175    /// Reverts if the variable could not be parsed.
2176    /// Returns `defaultValue` if the variable was not found.
2177    #[cheatcode(group = Environment)]
2178    function envOr(string calldata name, bool defaultValue) external view returns (bool value);
2179    /// Gets the environment variable `name` and parses it as `uint256`.
2180    /// Reverts if the variable could not be parsed.
2181    /// Returns `defaultValue` if the variable was not found.
2182    #[cheatcode(group = Environment)]
2183    function envOr(string calldata name, uint256 defaultValue) external view returns (uint256 value);
2184    /// Gets the environment variable `name` and parses it as `int256`.
2185    /// Reverts if the variable could not be parsed.
2186    /// Returns `defaultValue` if the variable was not found.
2187    #[cheatcode(group = Environment)]
2188    function envOr(string calldata name, int256 defaultValue) external view returns (int256 value);
2189    /// Gets the environment variable `name` and parses it as `address`.
2190    /// Reverts if the variable could not be parsed.
2191    /// Returns `defaultValue` if the variable was not found.
2192    #[cheatcode(group = Environment)]
2193    function envOr(string calldata name, address defaultValue) external view returns (address value);
2194    /// Gets the environment variable `name` and parses it as `bytes32`.
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, bytes32 defaultValue) external view returns (bytes32 value);
2199    /// Gets the environment variable `name` and parses it as `string`.
2200    /// Reverts if the variable could not be parsed.
2201    /// Returns `defaultValue` if the variable was not found.
2202    #[cheatcode(group = Environment)]
2203    function envOr(string calldata name, string calldata defaultValue) external view returns (string memory value);
2204    /// Gets the environment variable `name` and parses it as `bytes`.
2205    /// Reverts if the variable could not be parsed.
2206    /// Returns `defaultValue` if the variable was not found.
2207    #[cheatcode(group = Environment)]
2208    function envOr(string calldata name, bytes calldata defaultValue) external view returns (bytes memory value);
2209
2210    /// Gets the environment variable `name` and parses it as an array of `bool`, delimited by `delim`.
2211    /// Reverts if the variable could not be parsed.
2212    /// Returns `defaultValue` if the variable was not found.
2213    #[cheatcode(group = Environment)]
2214    function envOr(string calldata name, string calldata delim, bool[] calldata defaultValue)
2215        external view
2216        returns (bool[] memory value);
2217    /// Gets the environment variable `name` and parses it as an array of `uint256`, delimited by `delim`.
2218    /// Reverts if the variable could not be parsed.
2219    /// Returns `defaultValue` if the variable was not found.
2220    #[cheatcode(group = Environment)]
2221    function envOr(string calldata name, string calldata delim, uint256[] calldata defaultValue)
2222        external view
2223        returns (uint256[] memory value);
2224    /// Gets the environment variable `name` and parses it as an array of `int256`, delimited by `delim`.
2225    /// Reverts if the variable could not be parsed.
2226    /// Returns `defaultValue` if the variable was not found.
2227    #[cheatcode(group = Environment)]
2228    function envOr(string calldata name, string calldata delim, int256[] calldata defaultValue)
2229        external view
2230        returns (int256[] memory value);
2231    /// Gets the environment variable `name` and parses it as an array of `address`, delimited by `delim`.
2232    /// Reverts if the variable could not be parsed.
2233    /// Returns `defaultValue` if the variable was not found.
2234    #[cheatcode(group = Environment)]
2235    function envOr(string calldata name, string calldata delim, address[] calldata defaultValue)
2236        external view
2237        returns (address[] memory value);
2238    /// Gets the environment variable `name` and parses it as an array of `bytes32`, delimited by `delim`.
2239    /// Reverts if the variable could not be parsed.
2240    /// Returns `defaultValue` if the variable was not found.
2241    #[cheatcode(group = Environment)]
2242    function envOr(string calldata name, string calldata delim, bytes32[] calldata defaultValue)
2243        external view
2244        returns (bytes32[] memory value);
2245    /// Gets the environment variable `name` and parses it as an array of `string`, delimited by `delim`.
2246    /// Reverts if the variable could not be parsed.
2247    /// Returns `defaultValue` if the variable was not found.
2248    #[cheatcode(group = Environment)]
2249    function envOr(string calldata name, string calldata delim, string[] calldata defaultValue)
2250        external view
2251        returns (string[] memory value);
2252    /// Gets the environment variable `name` and parses it as an array of `bytes`, delimited by `delim`.
2253    /// Reverts if the variable could not be parsed.
2254    /// Returns `defaultValue` if the variable was not found.
2255    #[cheatcode(group = Environment)]
2256    function envOr(string calldata name, string calldata delim, bytes[] calldata defaultValue)
2257        external view
2258        returns (bytes[] memory value);
2259
2260    /// Returns true if `forge` command was executed in given context.
2261    #[cheatcode(group = Environment)]
2262    function isContext(ForgeContext context) external view returns (bool result);
2263
2264    // ======== Scripts ========
2265    // -------- Broadcasting Transactions --------
2266
2267    /// Has the next call (at this call depth only) create transactions that can later be signed and sent onchain.
2268    ///
2269    /// Broadcasting address is determined by checking the following in order:
2270    /// 1. If `--sender` argument was provided, that address is used.
2271    /// 2. If exactly one signer (e.g. private key, hw wallet, keystore) is set when `forge broadcast` is invoked, that signer is used.
2272    /// 3. Otherwise, default foundry sender (1804c8AB1F12E6bbf3894d4083f33e07309d1f38) is used.
2273    #[cheatcode(group = Scripting)]
2274    function broadcast() external;
2275
2276    /// Has the next call (at this call depth only) create a transaction with the address provided
2277    /// as the sender that can later be signed and sent onchain.
2278    #[cheatcode(group = Scripting)]
2279    function broadcast(address signer) external;
2280
2281    /// Has the next call (at this call depth only) create a transaction with the private key
2282    /// provided as the sender that can later be signed and sent onchain.
2283    #[cheatcode(group = Scripting)]
2284    function broadcast(uint256 privateKey) external;
2285
2286    /// Has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain.
2287    ///
2288    /// Broadcasting address is determined by checking the following in order:
2289    /// 1. If `--sender` argument was provided, that address is used.
2290    /// 2. If exactly one signer (e.g. private key, hw wallet, keystore) is set when `forge broadcast` is invoked, that signer is used.
2291    /// 3. Otherwise, default foundry sender (1804c8AB1F12E6bbf3894d4083f33e07309d1f38) is used.
2292    #[cheatcode(group = Scripting)]
2293    function startBroadcast() external;
2294
2295    /// Has all subsequent calls (at this call depth only) create transactions with the address
2296    /// provided that can later be signed and sent onchain.
2297    #[cheatcode(group = Scripting)]
2298    function startBroadcast(address signer) external;
2299
2300    /// Has all subsequent calls (at this call depth only) create transactions with the private key
2301    /// provided that can later be signed and sent onchain.
2302    #[cheatcode(group = Scripting)]
2303    function startBroadcast(uint256 privateKey) external;
2304
2305    /// Stops collecting onchain transactions.
2306    #[cheatcode(group = Scripting)]
2307    function stopBroadcast() external;
2308
2309    /// Takes a signed transaction and broadcasts it to the network.
2310    #[cheatcode(group = Scripting)]
2311    function broadcastRawTransaction(bytes calldata data) external;
2312
2313    /// Sign an EIP-7702 authorization for delegation
2314    #[cheatcode(group = Scripting)]
2315    function signDelegation(address implementation, uint256 privateKey) external returns (SignedDelegation memory signedDelegation);
2316
2317    /// Sign an EIP-7702 authorization for delegation for specific nonce
2318    #[cheatcode(group = Scripting)]
2319    function signDelegation(address implementation, uint256 privateKey, uint64 nonce) external returns (SignedDelegation memory signedDelegation);
2320
2321    /// Sign an EIP-7702 authorization for delegation, with optional cross-chain validity.
2322    #[cheatcode(group = Scripting)]
2323    function signDelegation(address implementation, uint256 privateKey, bool crossChain) external returns (SignedDelegation memory signedDelegation);
2324
2325    /// Designate the next call as an EIP-7702 transaction
2326    #[cheatcode(group = Scripting)]
2327    function attachDelegation(SignedDelegation calldata signedDelegation) external;
2328
2329    /// Designate the next call as an EIP-7702 transaction, with optional cross-chain validity.
2330    #[cheatcode(group = Scripting)]
2331    function attachDelegation(SignedDelegation calldata signedDelegation, bool crossChain) external;
2332
2333    /// Sign an EIP-7702 authorization and designate the next call as an EIP-7702 transaction
2334    #[cheatcode(group = Scripting)]
2335    function signAndAttachDelegation(address implementation, uint256 privateKey) external returns (SignedDelegation memory signedDelegation);
2336
2337    /// Sign an EIP-7702 authorization and designate the next call as an EIP-7702 transaction for specific nonce
2338    #[cheatcode(group = Scripting)]
2339    function signAndAttachDelegation(address implementation, uint256 privateKey, uint64 nonce) external returns (SignedDelegation memory signedDelegation);
2340
2341    /// Sign an EIP-7702 authorization and designate the next call as an EIP-7702 transaction, with optional cross-chain validity.
2342    #[cheatcode(group = Scripting)]
2343    function signAndAttachDelegation(address implementation, uint256 privateKey, bool crossChain) external returns (SignedDelegation memory signedDelegation);
2344
2345    /// Attach an EIP-4844 blob to the next call
2346    #[cheatcode(group = Scripting)]
2347    function attachBlob(bytes calldata blob) external;
2348
2349    /// Returns addresses of available unlocked wallets in the script environment.
2350    #[cheatcode(group = Scripting)]
2351    function getWallets() external view returns (address[] memory wallets);
2352
2353    // ======== Utilities ========
2354
2355    // -------- Strings --------
2356
2357    /// Converts the given value to a `string`.
2358    #[cheatcode(group = String)]
2359    function toString(address value) external pure returns (string memory stringifiedValue);
2360    /// Converts the given value to a `string`.
2361    #[cheatcode(group = String)]
2362    function toString(bytes calldata value) external pure returns (string memory stringifiedValue);
2363    /// Converts the given value to a `string`.
2364    #[cheatcode(group = String)]
2365    function toString(bytes32 value) external pure returns (string memory stringifiedValue);
2366    /// Converts the given value to a `string`.
2367    #[cheatcode(group = String)]
2368    function toString(bool value) external pure returns (string memory stringifiedValue);
2369    /// Converts the given value to a `string`.
2370    #[cheatcode(group = String)]
2371    function toString(uint256 value) external pure returns (string memory stringifiedValue);
2372    /// Converts the given value to a `string`.
2373    #[cheatcode(group = String)]
2374    function toString(int256 value) external pure returns (string memory stringifiedValue);
2375
2376    /// Parses the given `string` into `bytes`.
2377    #[cheatcode(group = String)]
2378    function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue);
2379    /// Parses the given `string` into an `address`.
2380    #[cheatcode(group = String)]
2381    function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue);
2382    /// Parses the given `string` into a `uint256`.
2383    #[cheatcode(group = String)]
2384    function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue);
2385    /// Parses the given `string` into a `int256`.
2386    #[cheatcode(group = String)]
2387    function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue);
2388    /// Parses the given `string` into a `bytes32`.
2389    #[cheatcode(group = String)]
2390    function parseBytes32(string calldata stringifiedValue) external pure returns (bytes32 parsedValue);
2391    /// Parses the given `string` into a `bool`.
2392    #[cheatcode(group = String)]
2393    function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue);
2394
2395    /// Converts the given `string` value to Lowercase.
2396    #[cheatcode(group = String)]
2397    function toLowercase(string calldata input) external pure returns (string memory output);
2398    /// Converts the given `string` value to Uppercase.
2399    #[cheatcode(group = String)]
2400    function toUppercase(string calldata input) external pure returns (string memory output);
2401    /// Trims leading and trailing whitespace from the given `string` value.
2402    #[cheatcode(group = String)]
2403    function trim(string calldata input) external pure returns (string memory output);
2404    /// Replaces occurrences of `from` in the given `string` with `to`.
2405    #[cheatcode(group = String)]
2406    function replace(string calldata input, string calldata from, string calldata to) external pure returns (string memory output);
2407    /// Splits the given `string` into an array of strings divided by the `delimiter`.
2408    #[cheatcode(group = String)]
2409    function split(string calldata input, string calldata delimiter) external pure returns (string[] memory outputs);
2410    /// Returns the index of the first occurrence of a `key` in an `input` string.
2411    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `key` is not found.
2412    /// Returns 0 in case of an empty `key`.
2413    #[cheatcode(group = String)]
2414    function indexOf(string calldata input, string calldata key) external pure returns (uint256);
2415    /// Returns true if `search` is found in `subject`, false otherwise.
2416    #[cheatcode(group = String)]
2417    function contains(string calldata subject, string calldata search) external pure returns (bool result);
2418
2419    // ======== JSON Parsing and Manipulation ========
2420
2421    // -------- Reading --------
2422
2423    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/parse-json to understand the
2424    // limitations and caveats of the JSON parsing cheats.
2425
2426    /// Checks if `key` exists in a JSON object
2427    /// `keyExists` is being deprecated in favor of `keyExistsJson`. It will be removed in future versions.
2428    #[cheatcode(group = Json, status = Deprecated(Some("replaced by `keyExistsJson`")))]
2429    function keyExists(string calldata json, string calldata key) external view returns (bool);
2430    /// Checks if `key` exists in a JSON object.
2431    #[cheatcode(group = Json)]
2432    function keyExistsJson(string calldata json, string calldata key) external view returns (bool);
2433
2434    /// ABI-encodes a JSON object.
2435    #[cheatcode(group = Json)]
2436    function parseJson(string calldata json) external pure returns (bytes memory abiEncodedData);
2437    /// ABI-encodes a JSON object at `key`.
2438    #[cheatcode(group = Json)]
2439    function parseJson(string calldata json, string calldata key) external pure returns (bytes memory abiEncodedData);
2440
2441    // The following parseJson cheatcodes will do type coercion, for the type that they indicate.
2442    // For example, parseJsonUint will coerce all values to a uint256. That includes stringified numbers '12.'
2443    // and hex numbers '0xEF.'.
2444    // Type coercion works ONLY for discrete values or arrays. That means that the key must return a value or array, not
2445    // a JSON object.
2446
2447    /// Parses a string of JSON data at `key` and coerces it to `uint256`.
2448    #[cheatcode(group = Json)]
2449    function parseJsonUint(string calldata json, string calldata key) external pure returns (uint256);
2450    /// Parses a string of JSON data at `key` and coerces it to `uint256[]`.
2451    #[cheatcode(group = Json)]
2452    function parseJsonUintArray(string calldata json, string calldata key) external pure returns (uint256[] memory);
2453    /// Parses a string of JSON data at `key` and coerces it to `int256`.
2454    #[cheatcode(group = Json)]
2455    function parseJsonInt(string calldata json, string calldata key) external pure returns (int256);
2456    /// Parses a string of JSON data at `key` and coerces it to `int256[]`.
2457    #[cheatcode(group = Json)]
2458    function parseJsonIntArray(string calldata json, string calldata key) external pure returns (int256[] memory);
2459    /// Parses a string of JSON data at `key` and coerces it to `bool`.
2460    #[cheatcode(group = Json)]
2461    function parseJsonBool(string calldata json, string calldata key) external pure returns (bool);
2462    /// Parses a string of JSON data at `key` and coerces it to `bool[]`.
2463    #[cheatcode(group = Json)]
2464    function parseJsonBoolArray(string calldata json, string calldata key) external pure returns (bool[] memory);
2465    /// Parses a string of JSON data at `key` and coerces it to `address`.
2466    #[cheatcode(group = Json)]
2467    function parseJsonAddress(string calldata json, string calldata key) external pure returns (address);
2468    /// Parses a string of JSON data at `key` and coerces it to `address[]`.
2469    #[cheatcode(group = Json)]
2470    function parseJsonAddressArray(string calldata json, string calldata key)
2471        external
2472        pure
2473        returns (address[] memory);
2474    /// Parses a string of JSON data at `key` and coerces it to `string`.
2475    #[cheatcode(group = Json)]
2476    function parseJsonString(string calldata json, string calldata key) external pure returns (string memory);
2477    /// Parses a string of JSON data at `key` and coerces it to `string[]`.
2478    #[cheatcode(group = Json)]
2479    function parseJsonStringArray(string calldata json, string calldata key) external pure returns (string[] memory);
2480    /// Parses a string of JSON data at `key` and coerces it to `bytes`.
2481    #[cheatcode(group = Json)]
2482    function parseJsonBytes(string calldata json, string calldata key) external pure returns (bytes memory);
2483    /// Parses a string of JSON data at `key` and coerces it to `bytes[]`.
2484    #[cheatcode(group = Json)]
2485    function parseJsonBytesArray(string calldata json, string calldata key) external pure returns (bytes[] memory);
2486    /// Parses a string of JSON data at `key` and coerces it to `bytes32`.
2487    #[cheatcode(group = Json)]
2488    function parseJsonBytes32(string calldata json, string calldata key) external pure returns (bytes32);
2489    /// Parses a string of JSON data at `key` and coerces it to `bytes32[]`.
2490    #[cheatcode(group = Json)]
2491    function parseJsonBytes32Array(string calldata json, string calldata key)
2492        external
2493        pure
2494        returns (bytes32[] memory);
2495
2496    /// Parses a string of JSON data and coerces it to type corresponding to `typeDescription`.
2497    #[cheatcode(group = Json)]
2498    function parseJsonType(string calldata json, string calldata typeDescription) external pure returns (bytes memory);
2499    /// Parses a string of JSON data at `key` and coerces it to type corresponding to `typeDescription`.
2500    #[cheatcode(group = Json)]
2501    function parseJsonType(string calldata json, string calldata key, string calldata typeDescription) external pure returns (bytes memory);
2502    /// Parses a string of JSON data at `key` and coerces it to type array corresponding to `typeDescription`.
2503    #[cheatcode(group = Json)]
2504    function parseJsonTypeArray(string calldata json, string calldata key, string calldata typeDescription)
2505        external
2506        pure
2507        returns (bytes memory);
2508
2509    /// Returns an array of all the keys in a JSON object.
2510    #[cheatcode(group = Json)]
2511    function parseJsonKeys(string calldata json, string calldata key) external pure returns (string[] memory keys);
2512
2513    // -------- Writing --------
2514
2515    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/serialize-json to understand how
2516    // to use the serialization cheats.
2517
2518    /// Serializes a key and value to a JSON object stored in-memory that can be later written to a file.
2519    /// Returns the stringified version of the specific JSON file up to that moment.
2520    #[cheatcode(group = Json)]
2521    function serializeJson(string calldata objectKey, string calldata value) external returns (string memory json);
2522
2523    /// See `serializeJson`.
2524    #[cheatcode(group = Json)]
2525    function serializeBool(string calldata objectKey, string calldata valueKey, bool value)
2526        external
2527        returns (string memory json);
2528    /// See `serializeJson`.
2529    #[cheatcode(group = Json)]
2530    function serializeUint(string calldata objectKey, string calldata valueKey, uint256 value)
2531        external
2532        returns (string memory json);
2533    /// See `serializeJson`.
2534    #[cheatcode(group = Json)]
2535    function serializeUintToHex(string calldata objectKey, string calldata valueKey, uint256 value)
2536        external
2537        returns (string memory json);
2538    /// See `serializeJson`.
2539    #[cheatcode(group = Json)]
2540    function serializeInt(string calldata objectKey, string calldata valueKey, int256 value)
2541        external
2542        returns (string memory json);
2543    /// See `serializeJson`.
2544    #[cheatcode(group = Json)]
2545    function serializeAddress(string calldata objectKey, string calldata valueKey, address value)
2546        external
2547        returns (string memory json);
2548    /// See `serializeJson`.
2549    #[cheatcode(group = Json)]
2550    function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32 value)
2551        external
2552        returns (string memory json);
2553    /// See `serializeJson`.
2554    #[cheatcode(group = Json)]
2555    function serializeString(string calldata objectKey, string calldata valueKey, string calldata value)
2556        external
2557        returns (string memory json);
2558    /// See `serializeJson`.
2559    #[cheatcode(group = Json)]
2560    function serializeBytes(string calldata objectKey, string calldata valueKey, bytes calldata value)
2561        external
2562        returns (string memory json);
2563
2564    /// See `serializeJson`.
2565    #[cheatcode(group = Json)]
2566    function serializeBool(string calldata objectKey, string calldata valueKey, bool[] calldata values)
2567        external
2568        returns (string memory json);
2569    /// See `serializeJson`.
2570    #[cheatcode(group = Json)]
2571    function serializeUint(string calldata objectKey, string calldata valueKey, uint256[] calldata values)
2572        external
2573        returns (string memory json);
2574    /// See `serializeJson`.
2575    #[cheatcode(group = Json)]
2576    function serializeInt(string calldata objectKey, string calldata valueKey, int256[] calldata values)
2577        external
2578        returns (string memory json);
2579    /// See `serializeJson`.
2580    #[cheatcode(group = Json)]
2581    function serializeAddress(string calldata objectKey, string calldata valueKey, address[] calldata values)
2582        external
2583        returns (string memory json);
2584    /// See `serializeJson`.
2585    #[cheatcode(group = Json)]
2586    function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32[] calldata values)
2587        external
2588        returns (string memory json);
2589    /// See `serializeJson`.
2590    #[cheatcode(group = Json)]
2591    function serializeString(string calldata objectKey, string calldata valueKey, string[] calldata values)
2592        external
2593        returns (string memory json);
2594    /// See `serializeJson`.
2595    #[cheatcode(group = Json)]
2596    function serializeBytes(string calldata objectKey, string calldata valueKey, bytes[] calldata values)
2597        external
2598        returns (string memory json);
2599    /// See `serializeJson`.
2600    #[cheatcode(group = Json)]
2601    function serializeJsonType(string calldata typeDescription, bytes calldata value)
2602        external
2603        pure
2604        returns (string memory json);
2605    /// See `serializeJson`.
2606    #[cheatcode(group = Json)]
2607    function serializeJsonType(string calldata objectKey, string calldata valueKey, string calldata typeDescription, bytes calldata value)
2608        external
2609        returns (string memory json);
2610
2611    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/write-json to understand how
2612    // to use the JSON writing cheats.
2613
2614    /// Write a serialized JSON object to a file. If the file exists, it will be overwritten.
2615    #[cheatcode(group = Json)]
2616    function writeJson(string calldata json, string calldata path) external;
2617
2618    /// Write a serialized JSON object to an **existing** JSON file, replacing a value with key = <value_key.>
2619    /// This is useful to replace a specific value of a JSON file, without having to parse the entire thing.
2620    /// This cheatcode will create new keys if they didn't previously exist.
2621    #[cheatcode(group = Json)]
2622    function writeJson(string calldata json, string calldata path, string calldata valueKey) external;
2623
2624    // ======== TOML Parsing and Manipulation ========
2625
2626    // -------- Reading --------
2627
2628    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/parse-toml to understand the
2629    // limitations and caveats of the TOML parsing cheat.
2630
2631    /// Checks if `key` exists in a TOML table.
2632    #[cheatcode(group = Toml)]
2633    function keyExistsToml(string calldata toml, string calldata key) external view returns (bool);
2634
2635    /// ABI-encodes a TOML table.
2636    #[cheatcode(group = Toml)]
2637    function parseToml(string calldata toml) external pure returns (bytes memory abiEncodedData);
2638
2639    /// ABI-encodes a TOML table at `key`.
2640    #[cheatcode(group = Toml)]
2641    function parseToml(string calldata toml, string calldata key) external pure returns (bytes memory abiEncodedData);
2642
2643    // The following parseToml cheatcodes will do type coercion, for the type that they indicate.
2644    // For example, parseTomlUint will coerce all values to a uint256. That includes stringified numbers '12.'
2645    // and hex numbers '0xEF.'.
2646    // Type coercion works ONLY for discrete values or arrays. That means that the key must return a value or array, not
2647    // a TOML table.
2648
2649    /// Parses a string of TOML data at `key` and coerces it to `uint256`.
2650    #[cheatcode(group = Toml)]
2651    function parseTomlUint(string calldata toml, string calldata key) external pure returns (uint256);
2652    /// Parses a string of TOML data at `key` and coerces it to `uint256[]`.
2653    #[cheatcode(group = Toml)]
2654    function parseTomlUintArray(string calldata toml, string calldata key) external pure returns (uint256[] memory);
2655    /// Parses a string of TOML data at `key` and coerces it to `int256`.
2656    #[cheatcode(group = Toml)]
2657    function parseTomlInt(string calldata toml, string calldata key) external pure returns (int256);
2658    /// Parses a string of TOML data at `key` and coerces it to `int256[]`.
2659    #[cheatcode(group = Toml)]
2660    function parseTomlIntArray(string calldata toml, string calldata key) external pure returns (int256[] memory);
2661    /// Parses a string of TOML data at `key` and coerces it to `bool`.
2662    #[cheatcode(group = Toml)]
2663    function parseTomlBool(string calldata toml, string calldata key) external pure returns (bool);
2664    /// Parses a string of TOML data at `key` and coerces it to `bool[]`.
2665    #[cheatcode(group = Toml)]
2666    function parseTomlBoolArray(string calldata toml, string calldata key) external pure returns (bool[] memory);
2667    /// Parses a string of TOML data at `key` and coerces it to `address`.
2668    #[cheatcode(group = Toml)]
2669    function parseTomlAddress(string calldata toml, string calldata key) external pure returns (address);
2670    /// Parses a string of TOML data at `key` and coerces it to `address[]`.
2671    #[cheatcode(group = Toml)]
2672    function parseTomlAddressArray(string calldata toml, string calldata key)
2673        external
2674        pure
2675        returns (address[] memory);
2676    /// Parses a string of TOML data at `key` and coerces it to `string`.
2677    #[cheatcode(group = Toml)]
2678    function parseTomlString(string calldata toml, string calldata key) external pure returns (string memory);
2679    /// Parses a string of TOML data at `key` and coerces it to `string[]`.
2680    #[cheatcode(group = Toml)]
2681    function parseTomlStringArray(string calldata toml, string calldata key) external pure returns (string[] memory);
2682    /// Parses a string of TOML data at `key` and coerces it to `bytes`.
2683    #[cheatcode(group = Toml)]
2684    function parseTomlBytes(string calldata toml, string calldata key) external pure returns (bytes memory);
2685    /// Parses a string of TOML data at `key` and coerces it to `bytes[]`.
2686    #[cheatcode(group = Toml)]
2687    function parseTomlBytesArray(string calldata toml, string calldata key) external pure returns (bytes[] memory);
2688    /// Parses a string of TOML data at `key` and coerces it to `bytes32`.
2689    #[cheatcode(group = Toml)]
2690    function parseTomlBytes32(string calldata toml, string calldata key) external pure returns (bytes32);
2691    /// Parses a string of TOML data at `key` and coerces it to `bytes32[]`.
2692    #[cheatcode(group = Toml)]
2693    function parseTomlBytes32Array(string calldata toml, string calldata key)
2694        external
2695        pure
2696        returns (bytes32[] memory);
2697
2698    /// Parses a string of TOML data and coerces it to type corresponding to `typeDescription`.
2699    #[cheatcode(group = Toml)]
2700    function parseTomlType(string calldata toml, string calldata typeDescription) external pure returns (bytes memory);
2701    /// Parses a string of TOML data at `key` and coerces it to type corresponding to `typeDescription`.
2702    #[cheatcode(group = Toml)]
2703    function parseTomlType(string calldata toml, string calldata key, string calldata typeDescription) external pure returns (bytes memory);
2704    /// Parses a string of TOML data at `key` and coerces it to type array corresponding to `typeDescription`.
2705    #[cheatcode(group = Toml)]
2706    function parseTomlTypeArray(string calldata toml, string calldata key, string calldata typeDescription)
2707        external
2708        pure
2709        returns (bytes memory);
2710
2711    /// Returns an array of all the keys in a TOML table.
2712    #[cheatcode(group = Toml)]
2713    function parseTomlKeys(string calldata toml, string calldata key) external pure returns (string[] memory keys);
2714
2715    // -------- Writing --------
2716
2717    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/write-toml to understand how
2718    // to use the TOML writing cheat.
2719
2720    /// Takes serialized JSON, converts to TOML and write a serialized TOML to a file.
2721    #[cheatcode(group = Toml)]
2722    function writeToml(string calldata json, string calldata path) external;
2723
2724    /// Takes serialized JSON, converts to TOML and write a serialized TOML table to an **existing** TOML file, replacing a value with key = <value_key.>
2725    /// This is useful to replace a specific value of a TOML file, without having to parse the entire thing.
2726    /// This cheatcode will create new keys if they didn't previously exist.
2727    #[cheatcode(group = Toml)]
2728    function writeToml(string calldata json, string calldata path, string calldata valueKey) external;
2729
2730    // ======== Cryptography ========
2731
2732    // -------- Key Management --------
2733
2734    /// Derives a private key from the name, labels the account with that name, and returns the wallet.
2735    #[cheatcode(group = Crypto)]
2736    function createWallet(string calldata walletLabel) external returns (Wallet memory wallet);
2737
2738    /// Generates a wallet from the private key and returns the wallet.
2739    #[cheatcode(group = Crypto)]
2740    function createWallet(uint256 privateKey) external returns (Wallet memory wallet);
2741
2742    /// Generates a wallet from the private key, labels the account with that name, and returns the wallet.
2743    #[cheatcode(group = Crypto)]
2744    function createWallet(uint256 privateKey, string calldata walletLabel) external returns (Wallet memory wallet);
2745
2746    /// Signs data with a `Wallet`.
2747    #[cheatcode(group = Crypto)]
2748    function sign(Wallet calldata wallet, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);
2749
2750    /// Signs data with a `Wallet`.
2751    ///
2752    /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the
2753    /// signature's `s` value, and the recovery id `v` in a single bytes32.
2754    /// This format reduces the signature size from 65 to 64 bytes.
2755    #[cheatcode(group = Crypto)]
2756    function signCompact(Wallet calldata wallet, bytes32 digest) external pure returns (bytes32 r, bytes32 vs);
2757
2758    /// Signs `digest` with `privateKey` using the secp256k1 curve.
2759    #[cheatcode(group = Crypto)]
2760    function sign(uint256 privateKey, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);
2761
2762    /// Signs `digest` with `privateKey` on the secp256k1 curve, using the given `nonce`
2763    /// as the raw ephemeral k value in ECDSA (instead of deriving it deterministically).
2764    #[cheatcode(group = Crypto)]
2765    function signWithNonceUnsafe(uint256 privateKey, bytes32 digest, uint256 nonce) external pure returns (uint8 v, bytes32 r, bytes32 s);
2766
2767    /// Signs `digest` with `privateKey` using the secp256k1 curve.
2768    ///
2769    /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the
2770    /// signature's `s` value, and the recovery id `v` in a single bytes32.
2771    /// This format reduces the signature size from 65 to 64 bytes.
2772    #[cheatcode(group = Crypto)]
2773    function signCompact(uint256 privateKey, bytes32 digest) external pure returns (bytes32 r, bytes32 vs);
2774
2775    /// Signs `digest` with signer provided to script using the secp256k1 curve.
2776    ///
2777    /// If `--sender` is provided, the signer with provided address is used, otherwise,
2778    /// if exactly one signer is provided to the script, that signer is used.
2779    ///
2780    /// Raises error if signer passed through `--sender` does not match any unlocked signers or
2781    /// if `--sender` is not provided and not exactly one signer is passed to the script.
2782    #[cheatcode(group = Crypto)]
2783    function sign(bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);
2784
2785    /// Signs `digest` with signer provided to script using the secp256k1 curve.
2786    ///
2787    /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the
2788    /// signature's `s` value, and the recovery id `v` in a single bytes32.
2789    /// This format reduces the signature size from 65 to 64 bytes.
2790    ///
2791    /// If `--sender` is provided, the signer with provided address is used, otherwise,
2792    /// if exactly one signer is provided to the script, that signer is used.
2793    ///
2794    /// Raises error if signer passed through `--sender` does not match any unlocked signers or
2795    /// if `--sender` is not provided and not exactly one signer is passed to the script.
2796    #[cheatcode(group = Crypto)]
2797    function signCompact(bytes32 digest) external pure returns (bytes32 r, bytes32 vs);
2798
2799    /// Signs `digest` with signer provided to script using the secp256k1 curve.
2800    ///
2801    /// Raises error if none of the signers passed into the script have provided address.
2802    #[cheatcode(group = Crypto)]
2803    function sign(address signer, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);
2804
2805    /// Signs `digest` with signer provided to script using the secp256k1 curve.
2806    ///
2807    /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the
2808    /// signature's `s` value, and the recovery id `v` in a single bytes32.
2809    /// This format reduces the signature size from 65 to 64 bytes.
2810    ///
2811    /// Raises error if none of the signers passed into the script have provided address.
2812    #[cheatcode(group = Crypto)]
2813    function signCompact(address signer, bytes32 digest) external pure returns (bytes32 r, bytes32 vs);
2814
2815    /// Signs `digest` with `privateKey` using the secp256r1 curve.
2816    #[cheatcode(group = Crypto)]
2817    function signP256(uint256 privateKey, bytes32 digest) external pure returns (bytes32 r, bytes32 s);
2818
2819    /// Derives secp256r1 public key from the provided `privateKey`.
2820    #[cheatcode(group = Crypto)]
2821    function publicKeyP256(uint256 privateKey) external pure returns (uint256 publicKeyX, uint256 publicKeyY);
2822
2823    /// Generates an Ed25519 key pair from a deterministic salt.
2824    /// Returns (publicKey, privateKey) as 32-byte values.
2825    #[cheatcode(group = Crypto, safety = Safe)]
2826    function createEd25519Key(bytes32 salt) external pure returns (bytes32 publicKey, bytes32 privateKey);
2827
2828    /// Derives the Ed25519 public key from a private key.
2829    #[cheatcode(group = Crypto, safety = Safe)]
2830    function publicKeyEd25519(bytes32 privateKey) external pure returns (bytes32 publicKey);
2831
2832    /// Signs a message with namespace using Ed25519.
2833    /// The signature covers namespace || message for domain separation.
2834    /// Returns a 64-byte Ed25519 signature.
2835    #[cheatcode(group = Crypto, safety = Safe)]
2836    function signEd25519(bytes calldata namespace, bytes calldata message, bytes32 privateKey)
2837        external
2838        pure
2839        returns (bytes memory signature);
2840
2841    /// Verifies an Ed25519 signature over namespace || message.
2842    /// Returns true if signature is valid, false otherwise.
2843    #[cheatcode(group = Crypto, safety = Safe)]
2844    function verifyEd25519(
2845        bytes calldata signature,
2846        bytes calldata namespace,
2847        bytes calldata message,
2848        bytes32 publicKey
2849    ) external pure returns (bool valid);
2850
2851    /// Derive a private key from a provided mnemonic string (or mnemonic file path)
2852    /// at the derivation path `m/44'/60'/0'/0/{index}`.
2853    #[cheatcode(group = Crypto)]
2854    function deriveKey(string calldata mnemonic, uint32 index) external pure returns (uint256 privateKey);
2855    /// Derive a private key from a provided mnemonic string (or mnemonic file path)
2856    /// at `{derivationPath}{index}`.
2857    #[cheatcode(group = Crypto)]
2858    function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index)
2859        external
2860        pure
2861        returns (uint256 privateKey);
2862    /// Derive a private key from a provided mnemonic string (or mnemonic file path) in the specified language
2863    /// at the derivation path `m/44'/60'/0'/0/{index}`.
2864    #[cheatcode(group = Crypto)]
2865    function deriveKey(string calldata mnemonic, uint32 index, string calldata language)
2866        external
2867        pure
2868        returns (uint256 privateKey);
2869    /// Derive a private key from a provided mnemonic string (or mnemonic file path) in the specified language
2870    /// at `{derivationPath}{index}`.
2871    #[cheatcode(group = Crypto)]
2872    function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index, string calldata language)
2873        external
2874        pure
2875        returns (uint256 privateKey);
2876
2877    /// Adds a private key to the local forge wallet and returns the address.
2878    #[cheatcode(group = Crypto)]
2879    function rememberKey(uint256 privateKey) external returns (address keyAddr);
2880
2881    /// Derive a set number of wallets from a mnemonic at the derivation path `m/44'/60'/0'/0/{0..count}`.
2882    ///
2883    /// The respective private keys are saved to the local forge wallet for later use and their addresses are returned.
2884    #[cheatcode(group = Crypto)]
2885    function rememberKeys(string calldata mnemonic, string calldata derivationPath, uint32 count) external returns (address[] memory keyAddrs);
2886
2887    /// Derive a set number of wallets from a mnemonic in the specified language at the derivation path `m/44'/60'/0'/0/{0..count}`.
2888    ///
2889    /// The respective private keys are saved to the local forge wallet for later use and their addresses are returned.
2890    #[cheatcode(group = Crypto)]
2891    function rememberKeys(string calldata mnemonic, string calldata derivationPath, string calldata language, uint32 count)
2892        external
2893        returns (address[] memory keyAddrs);
2894
2895    // -------- Uncategorized Utilities --------
2896
2897    /// Labels an address in call traces.
2898    #[cheatcode(group = Utilities)]
2899    function label(address account, string calldata newLabel) external;
2900
2901    /// Gets the label for the specified address.
2902    #[cheatcode(group = Utilities)]
2903    function getLabel(address account) external view returns (string memory currentLabel);
2904
2905    /// Compute the address a contract will be deployed at for a given deployer address and nonce.
2906    #[cheatcode(group = Utilities)]
2907    function computeCreateAddress(address deployer, uint256 nonce) external pure returns (address);
2908
2909    /// Compute the address of a contract created with CREATE2 using the given CREATE2 deployer.
2910    #[cheatcode(group = Utilities)]
2911    function computeCreate2Address(bytes32 salt, bytes32 initCodeHash, address deployer) external pure returns (address);
2912
2913    /// Compute the address of a contract created with CREATE2 using the default CREATE2 deployer.
2914    #[cheatcode(group = Utilities)]
2915    function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) external pure returns (address);
2916
2917    /// Encodes a `bytes` value to a base64 string.
2918    #[cheatcode(group = Utilities)]
2919    function toBase64(bytes calldata data) external pure returns (string memory);
2920
2921    /// Encodes a `string` value to a base64 string.
2922    #[cheatcode(group = Utilities)]
2923    function toBase64(string calldata data) external pure returns (string memory);
2924
2925    /// Encodes a `bytes` value to a base64url string.
2926    #[cheatcode(group = Utilities)]
2927    function toBase64URL(bytes calldata data) external pure returns (string memory);
2928
2929    /// Encodes a `string` value to a base64url string.
2930    #[cheatcode(group = Utilities)]
2931    function toBase64URL(string calldata data) external pure returns (string memory);
2932
2933    /// Returns ENS namehash for provided string.
2934    #[cheatcode(group = Utilities)]
2935    function ensNamehash(string calldata name) external pure returns (bytes32);
2936
2937    /// Returns an uint256 value bounded in given range and different from the current one.
2938    #[cheatcode(group = Utilities)]
2939    function bound(uint256 current, uint256 min, uint256 max) external view returns (uint256);
2940
2941    /// Returns a random uint256 value.
2942    #[cheatcode(group = Utilities)]
2943    function randomUint() external view returns (uint256);
2944
2945    /// Returns random uint256 value between the provided range (=min..=max).
2946    #[cheatcode(group = Utilities)]
2947    function randomUint(uint256 min, uint256 max) external view returns (uint256);
2948
2949    /// Returns a random `uint256` value of given bits.
2950    #[cheatcode(group = Utilities)]
2951    function randomUint(uint256 bits) external view returns (uint256);
2952
2953    /// Returns a random `address`.
2954    #[cheatcode(group = Utilities)]
2955    function randomAddress() external view returns (address);
2956
2957    /// Returns an int256 value bounded in given range and different from the current one.
2958    #[cheatcode(group = Utilities)]
2959    function bound(int256 current, int256 min, int256 max) external view returns (int256);
2960
2961    /// Returns a random `int256` value.
2962    #[cheatcode(group = Utilities)]
2963    function randomInt() external view returns (int256);
2964
2965    /// Returns a random `int256` value of given bits.
2966    #[cheatcode(group = Utilities)]
2967    function randomInt(uint256 bits) external view returns (int256);
2968
2969    /// Returns a random `bool`.
2970    #[cheatcode(group = Utilities)]
2971    function randomBool() external view returns (bool);
2972
2973    /// Returns a random byte array value of the given length.
2974    #[cheatcode(group = Utilities)]
2975    function randomBytes(uint256 len) external view returns (bytes memory);
2976
2977    /// Returns a random fixed-size byte array of length 4.
2978    #[cheatcode(group = Utilities)]
2979    function randomBytes4() external view returns (bytes4);
2980
2981    /// Returns a random fixed-size byte array of length 8.
2982    #[cheatcode(group = Utilities)]
2983    function randomBytes8() external view returns (bytes8);
2984
2985    /// Pauses collection of call traces. Useful in cases when you want to skip tracing of
2986    /// complex calls which are not useful for debugging.
2987    #[cheatcode(group = Utilities)]
2988    function pauseTracing() external view;
2989
2990    /// Unpauses collection of call traces.
2991    #[cheatcode(group = Utilities)]
2992    function resumeTracing() external view;
2993
2994    /// Utility cheatcode to copy storage of `from` contract to another `to` contract.
2995    #[cheatcode(group = Utilities, safety = Unsafe)]
2996    function copyStorage(address from, address to) external;
2997
2998    /// Utility cheatcode to set arbitrary storage for given target address.
2999    #[cheatcode(group = Utilities, safety = Unsafe)]
3000    function setArbitraryStorage(address target) external;
3001
3002    /// Utility cheatcode to set arbitrary storage for given target address and overwrite
3003    /// any storage slots that have been previously set.
3004    #[cheatcode(group = Utilities, safety = Unsafe)]
3005    function setArbitraryStorage(address target, bool overwrite) external;
3006
3007    /// Sorts an array in ascending order.
3008    #[cheatcode(group = Utilities)]
3009    function sort(uint256[] calldata array) external returns (uint256[] memory);
3010
3011    /// Randomly shuffles an array.
3012    #[cheatcode(group = Utilities)]
3013    function shuffle(uint256[] calldata array) external returns (uint256[] memory);
3014
3015    /// Set RNG seed.
3016    #[cheatcode(group = Utilities)]
3017    function setSeed(uint256 seed) external;
3018
3019    /// Causes the next contract creation (via new) to fail and return its initcode in the returndata buffer.
3020    /// This allows type-safe access to the initcode payload that would be used for contract creation.
3021    /// Example usage:
3022    /// vm.interceptInitcode();
3023    /// bytes memory initcode;
3024    /// try new MyContract(param1, param2) { assert(false); }
3025    /// catch (bytes memory interceptedInitcode) { initcode = interceptedInitcode; }
3026    #[cheatcode(group = Utilities, safety = Unsafe)]
3027    function interceptInitcode() external;
3028
3029    /// Generates the hash of the canonical EIP-712 type representation.
3030    ///
3031    /// Supports 2 different inputs:
3032    ///  1. Name of the type (i.e. "Transaction"):
3033    ///     * requires previous binding generation with `forge bind-json`.
3034    ///     * bindings will be retrieved from the path configured in `foundry.toml`.
3035    ///
3036    ///  2. String representation of the type (i.e. "Foo(Bar bar) Bar(uint256 baz)").
3037    ///     * Note: the cheatcode will output the canonical type even if the input is malformated
3038    ///             with the wrong order of elements or with extra whitespaces.
3039    #[cheatcode(group = Utilities)]
3040    function eip712HashType(string calldata typeNameOrDefinition) external pure returns (bytes32 typeHash);
3041
3042    /// Generates the hash of the canonical EIP-712 type representation.
3043    /// Requires previous binding generation with `forge bind-json`.
3044    ///
3045    /// Params:
3046    ///  * `bindingsPath`: path where the output of `forge bind-json` is stored.
3047    ///  * `typeName`: Name of the type (i.e. "Transaction").
3048    #[cheatcode(group = Utilities)]
3049    function eip712HashType(string calldata bindingsPath, string calldata typeName) external pure returns (bytes32 typeHash);
3050
3051    /// Generates the struct hash of the canonical EIP-712 type representation and its abi-encoded data.
3052    ///
3053    /// Supports 2 different inputs:
3054    ///  1. Name of the type (i.e. "PermitSingle"):
3055    ///     * requires previous binding generation with `forge bind-json`.
3056    ///     * bindings will be retrieved from the path configured in `foundry.toml`.
3057    ///
3058    ///  2. String representation of the type (i.e. "Foo(Bar bar) Bar(uint256 baz)").
3059    ///     * Note: the cheatcode will use the canonical type even if the input is malformated
3060    ///             with the wrong order of elements or with extra whitespaces.
3061    #[cheatcode(group = Utilities)]
3062    function eip712HashStruct(string calldata typeNameOrDefinition, bytes calldata abiEncodedData) external pure returns (bytes32 typeHash);
3063
3064    /// Generates the struct hash of the canonical EIP-712 type representation and its abi-encoded data.
3065    /// Requires previous binding generation with `forge bind-json`.
3066    ///
3067    /// Params:
3068    ///  * `bindingsPath`: path where the output of `forge bind-json` is stored.
3069    ///  * `typeName`: Name of the type (i.e. "PermitSingle").
3070    ///  * `abiEncodedData`: ABI-encoded data for the struct that is being hashed.
3071    #[cheatcode(group = Utilities)]
3072    function eip712HashStruct(string calldata bindingsPath, string calldata typeName, bytes calldata abiEncodedData) external pure returns (bytes32 typeHash);
3073
3074    /// Generates a ready-to-sign digest of human-readable typed data following the EIP-712 standard.
3075    #[cheatcode(group = Utilities)]
3076    function eip712HashTypedData(string calldata jsonData) external pure returns (bytes32 digest);
3077
3078    /// RLP encodes a list of bytes into an RLP payload.
3079    #[cheatcode(group = Utilities)]
3080    function toRlp(bytes[] calldata data) external pure returns (bytes memory);
3081    /// RLP decodes an RLP payload into a list of bytes.
3082    #[cheatcode(group = Utilities)]
3083    function fromRlp(bytes calldata rlp) external pure returns (bytes[] memory data);
3084}
3085}
3086
3087impl PartialEq for ForgeContext {
3088    // Handles test group case (any of test, coverage or snapshot)
3089    // and script group case (any of dry run, broadcast or resume).
3090    fn eq(&self, other: &Self) -> bool {
3091        match (self, other) {
3092            (_, Self::TestGroup) => {
3093                matches!(self, Self::Test | Self::Snapshot | Self::Coverage)
3094            }
3095            (_, Self::ScriptGroup) => {
3096                matches!(self, Self::ScriptDryRun | Self::ScriptBroadcast | Self::ScriptResume)
3097            }
3098            (Self::Test, Self::Test)
3099            | (Self::Snapshot, Self::Snapshot)
3100            | (Self::Coverage, Self::Coverage)
3101            | (Self::ScriptDryRun, Self::ScriptDryRun)
3102            | (Self::ScriptBroadcast, Self::ScriptBroadcast)
3103            | (Self::ScriptResume, Self::ScriptResume)
3104            | (Self::Unknown, Self::Unknown) => true,
3105            _ => false,
3106        }
3107    }
3108}
3109
3110impl fmt::Display for Vm::CheatcodeError {
3111    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3112        self.message.fmt(f)
3113    }
3114}
3115
3116impl fmt::Display for Vm::VmErrors {
3117    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3118        match self {
3119            Self::CheatcodeError(err) => err.fmt(f),
3120        }
3121    }
3122}
3123
3124#[track_caller]
3125const fn panic_unknown_safety() -> ! {
3126    panic!("cannot determine safety from the group, add a `#[cheatcode(safety = ...)]` attribute")
3127}