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