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