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