foundry_cheatcodes_spec/
vm.rs

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