Skip to main content

foundry_cheatcodes_spec/
vm.rs

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