Skip to main content

foundry_cheatcodes_spec/
vm.rs

1// We don't document function parameters individually so we can't enable `missing_docs` for this
2// module. Instead, we emit custom diagnostics in `#[derive(Cheatcode)]`.
3#![allow(missing_docs)]
4
5use super::*;
6use crate::Vm::ForgeContext;
7use alloy_sol_types::sol;
8use foundry_macros::Cheatcode;
9
10sol! {
11// Cheatcodes are marked as view/pure/none using the following rules:
12// 0. A call's observable behaviour includes its return value, logs, reverts and state writes,
13// 1. If you can influence a later call's observable behaviour, you're neither `view` nor `pure`
14//    (you are modifying some state be it the EVM, interpreter, filesystem, etc),
15// 2. Otherwise if you can be influenced by an earlier call, or if reading some state, you're `view`,
16// 3. Otherwise you're `pure`.
17
18/// Foundry cheatcodes interface.
19#[derive(Debug, Cheatcode)] // Keep this list small to avoid unnecessary bloat.
20#[sol(abi)]
21interface Vm {
22    //  ======== Types ========
23
24    /// Error thrown by cheatcodes.
25    error CheatcodeError(string message);
26
27    /// A modification applied to either `msg.sender` or `tx.origin`. Returned by `readCallers`.
28    enum CallerMode {
29        /// No caller modification is currently active.
30        None,
31        /// A one time broadcast triggered by a `vm.broadcast()` call is currently active.
32        Broadcast,
33        /// A recurrent broadcast triggered by a `vm.startBroadcast()` call is currently active.
34        RecurrentBroadcast,
35        /// A one time prank triggered by a `vm.prank()` call is currently active.
36        Prank,
37        /// A recurrent prank triggered by a `vm.startPrank()` call is currently active.
38        RecurrentPrank,
39    }
40
41    /// The kind of account access that occurred.
42    enum AccountAccessKind {
43        /// The account was called.
44        Call,
45        /// The account was called via delegatecall.
46        DelegateCall,
47        /// The account was called via callcode.
48        CallCode,
49        /// The account was called via staticcall.
50        StaticCall,
51        /// The account was created.
52        Create,
53        /// The account was selfdestructed.
54        SelfDestruct,
55        /// Synthetic access indicating the current context has resumed after a previous sub-context (AccountAccess).
56        Resume,
57        /// The account's balance was read.
58        Balance,
59        /// The account's codesize was read.
60        Extcodesize,
61        /// The account's codehash was read.
62        Extcodehash,
63        /// The account's code was copied.
64        Extcodecopy,
65    }
66
67    /// Forge execution contexts.
68    enum ForgeContext {
69        /// Test group execution context (test, coverage or snapshot).
70        TestGroup,
71        /// `forge test` execution context.
72        Test,
73        /// `forge coverage` execution context.
74        Coverage,
75        /// `forge snapshot` execution context.
76        Snapshot,
77        /// Script group execution context (dry run, broadcast or resume).
78        ScriptGroup,
79        /// `forge script` execution context.
80        ScriptDryRun,
81        /// `forge script --broadcast` execution context.
82        ScriptBroadcast,
83        /// `forge script --resume` execution context.
84        ScriptResume,
85        /// Unknown `forge` execution context.
86        Unknown,
87    }
88
89    /// An Ethereum log. Returned by `getRecordedLogs`.
90    struct Log {
91        /// The topics of the log, including the signature, if any.
92        bytes32[] topics;
93        /// The raw data of the log.
94        bytes data;
95        /// The address of the log's emitter.
96        address emitter;
97    }
98
99    /// Gas measured for the last completed call or create frame, from the callee's perspective,
100    /// including nested execution. Isolated transactions include intrinsic gas.
101    /// Regular gas (the EIP's execution gas) and EIP-8037 state gas are reported separately.
102    /// Without EIP-8037, state creation uses the ordinary gas schedule and `gasStateUsed` is zero.
103    /// See <https://eips.ethereum.org/EIPS/eip-8037> and <https://getfoundry.sh/reference/cheatcodes/last-frame-gas>.
104    struct Gas {
105        /// Regular gas available to the frame at entry. Excludes the EIP-8037 state gas reservoir.
106        uint64 gasLimit;
107        /// Regular gas spent by the frame, before refunds. Excludes EIP-8037 state gas; see `gasStateUsed`.
108        /// With isolation, includes intrinsic gas and the regular-gas calldata floor.
109        uint64 gasTotalUsed;
110        /// DEPRECATED: always zero. Memory expansion costs are included in `gasTotalUsed`.
111        /// Ref: <https://github.com/foundry-rs/foundry/pull/7934#pullrequestreview-2069236939>.
112        uint64 gasMemoryUsed;
113        /// Ordinary refund counter before transaction settlement; finalized for an isolated transaction.
114        /// Can be negative in nested frames. State gas refills are already netted into `gasStateUsed`.
115        int64 gasRefunded;
116        /// Regular gas left at frame end. Excludes the EIP-8037 state gas reservoir.
117        /// State charges can draw from this allowance, so `gasLimit - gasRemaining` can include state gas.
118        uint64 gasRemaining;
119        /// Net EIP-8037 state gas: state creation charges minus refills, including nested execution.
120        /// Zero without EIP-8037 or if the frame reverted or halted. Can be negative when the frame
121        /// undoes state created earlier in the same transaction; use signed arithmetic with `gasTotalUsed`.
122        /// Their sum measures net consumption, not the gas limit needed to execute.
123        int64 gasStateUsed;
124    }
125
126    /// An RPC URL and its alias. Returned by `rpcUrlStructs`.
127    struct Rpc {
128        /// The alias of the RPC URL.
129        string key;
130        /// The RPC URL.
131        string url;
132    }
133
134    /// An RPC log object. Returned by `eth_getLogs`.
135    struct EthGetLogs {
136        /// The address of the log's emitter.
137        address emitter;
138        /// The topics of the log, including the signature, if any.
139        bytes32[] topics;
140        /// The raw data of the log.
141        bytes data;
142        /// The block hash.
143        bytes32 blockHash;
144        /// The block number.
145        uint64 blockNumber;
146        /// The transaction hash.
147        bytes32 transactionHash;
148        /// The transaction index in the block.
149        uint64 transactionIndex;
150        /// The log index.
151        uint256 logIndex;
152        /// Whether the log was removed.
153        bool removed;
154    }
155
156    /// A Merkle proof for a single storage slot. Part of `EthGetProof`.
157    struct EthStorageProof {
158        /// The storage slot.
159        bytes32 key;
160        /// The value stored at the slot.
161        uint256 value;
162        /// The RLP-encoded trie nodes from the storage root to the slot, root first.
163        bytes[] proof;
164    }
165
166    /// An EIP-1186 account and storage proof. Returned by `eth_getProof`.
167    struct EthGetProof {
168        /// The address of the account.
169        address account;
170        /// The balance of the account.
171        uint256 balance;
172        /// The hash of the account's code.
173        bytes32 codeHash;
174        /// The nonce of the account.
175        uint64 nonce;
176        /// The root of the account's storage trie.
177        bytes32 storageHash;
178        /// The RLP-encoded trie nodes from the state root to the account, root first.
179        bytes[] accountProof;
180        /// The proofs for the requested storage slots, in the order they were requested.
181        EthStorageProof[] storageProof;
182    }
183
184    /// A single entry in a directory listing. Returned by `readDir`.
185    struct DirEntry {
186        /// The error message, if any.
187        string errorMessage;
188        /// The path of the entry.
189        string path;
190        /// The depth of the entry.
191        uint64 depth;
192        /// Whether the entry is a directory.
193        bool isDir;
194        /// Whether the entry is a symlink.
195        bool isSymlink;
196    }
197
198    /// Metadata information about a file.
199    ///
200    /// This structure is returned from the `fsMetadata` function and represents known
201    /// metadata about a file such as its permissions, size, modification
202    /// times, etc.
203    struct FsMetadata {
204        /// True if this metadata is for a directory.
205        bool isDir;
206        /// True if this metadata is for a symlink.
207        bool isSymlink;
208        /// The size of the file, in bytes, this metadata is for.
209        uint256 length;
210        /// True if this metadata is for a readonly (unwritable) file.
211        bool readOnly;
212        /// The last modification time listed in this metadata.
213        uint256 modified;
214        /// The last access time of this metadata.
215        uint256 accessed;
216        /// The creation time listed in this metadata.
217        uint256 created;
218    }
219
220    /// A wallet with a public and private key.
221    struct Wallet {
222        /// The wallet's address.
223        address addr;
224        /// The wallet's public key `X`.
225        uint256 publicKeyX;
226        /// The wallet's public key `Y`.
227        uint256 publicKeyY;
228        /// The wallet's private key.
229        uint256 privateKey;
230    }
231
232    /// The result of a `tryFfi` call.
233    struct FfiResult {
234        /// The exit code of the call.
235        int32 exitCode;
236        /// The optionally hex-decoded `stdout` data.
237        bytes stdout;
238        /// The `stderr` data.
239        bytes stderr;
240    }
241
242    /// Information on the chain and fork.
243    struct ChainInfo {
244        /// The fork identifier. Set to zero if no fork is active.
245        uint256 forkId;
246        /// The chain ID of the current fork.
247        uint256 chainId;
248    }
249
250    /// Information about a blockchain.
251    struct Chain {
252        /// The chain name.
253        string name;
254        /// The chain's Chain ID.
255        uint256 chainId;
256        /// The chain's alias. (i.e. what gets specified in `foundry.toml`).
257        string chainAlias;
258        /// A default RPC endpoint for this chain.
259        string rpcUrl;
260    }
261
262    /// The storage accessed during an `AccountAccess`.
263    struct StorageAccess {
264        /// The account whose storage was accessed.
265        address account;
266        /// The slot that was accessed.
267        bytes32 slot;
268        /// If the access was a write.
269        bool isWrite;
270        /// The previous value of the slot.
271        bytes32 previousValue;
272        /// The new value of the slot.
273        bytes32 newValue;
274        /// If the access was reverted.
275        bool reverted;
276    }
277
278    /// An EIP-2930 access list item.
279    struct AccessListItem {
280        /// The address to be added in access list.
281        address target;
282        /// The storage keys to be added in access list.
283        bytes32[] storageKeys;
284    }
285
286    /// The result of a `stopAndReturnStateDiff` call.
287    struct AccountAccess {
288        /// The chain and fork the access occurred.
289        ChainInfo chainInfo;
290        /// The kind of account access that determines what the account is.
291        /// If kind is Call, DelegateCall, StaticCall or CallCode, then the account is the callee.
292        /// If kind is Create, then the account is the newly created account.
293        /// If kind is SelfDestruct, then the account is the selfdestruct recipient.
294        /// If kind is a Resume, then account represents a account context that has resumed.
295        AccountAccessKind kind;
296        /// The account that was accessed.
297        /// It's either the account created, callee or a selfdestruct recipient for CREATE, CALL or SELFDESTRUCT.
298        address account;
299        /// What accessed the account.
300        address accessor;
301        /// If the account was initialized or empty prior to the access.
302        /// An account is considered initialized if it has code, a
303        /// non-zero nonce, or a non-zero balance.
304        bool initialized;
305        /// The previous balance of the accessed account.
306        uint256 oldBalance;
307        /// The potential new balance of the accessed account.
308        /// That is, all balance changes are recorded here, even if reverts occurred.
309        uint256 newBalance;
310        /// Code of the account deployed by CREATE.
311        bytes deployedCode;
312        /// Value passed along with the account access
313        uint256 value;
314        /// Input data provided to the CREATE or CALL
315        bytes data;
316        /// If this access reverted in either the current or parent context.
317        bool reverted;
318        /// An ordered list of storage accesses made during an account access operation.
319        StorageAccess[] storageAccesses;
320        /// Call depth traversed during the recording of state differences
321        uint64 depth;
322        /// The previous nonce of the accessed account.
323        uint64 oldNonce;
324        /// The new nonce of the accessed account.
325        uint64 newNonce;
326    }
327
328    /// The result of the `stopDebugTraceRecording` call
329    struct DebugStep {
330        /// The stack before executing the step of the run.
331        /// stack\[0\] represents the top of the stack.
332        /// and only stack data relevant to the opcode execution is contained.
333        uint256[] stack;
334        /// The memory input data before executing the step of the run.
335        /// only input data relevant to the opcode execution is contained.
336        ///
337        /// e.g. for MLOAD, it will have memory\[offset:offset+32\] copied here.
338        /// the offset value can be get by the stack data.
339        bytes memoryInput;
340        /// The opcode that was accessed.
341        uint8 opcode;
342        /// The call depth of the step.
343        uint64 depth;
344        /// Whether the call end up with out of gas error.
345        bool isOutOfGas;
346        /// The contract address where the opcode is running
347        address contractAddr;
348    }
349
350    /// The transaction type (`txType`) of the broadcast.
351    enum BroadcastTxType {
352        /// Represents a CALL broadcast tx.
353        Call,
354        /// Represents a CREATE broadcast tx.
355        Create,
356        /// Represents a CREATE2 broadcast tx.
357        Create2
358    }
359
360    /// Represents a transaction's broadcast details.
361    struct BroadcastTxSummary {
362        /// The hash of the transaction that was broadcasted
363        bytes32 txHash;
364        /// Represent the type of transaction among CALL, CREATE, CREATE2
365        BroadcastTxType txType;
366        /// The address of the contract that was called or created.
367        /// This is address of the contract that is created if the txType is CREATE or CREATE2.
368        address contractAddress;
369        /// The block number the transaction landed in.
370        uint64 blockNumber;
371        /// Status of the transaction, retrieved from the transaction receipt.
372        bool success;
373    }
374
375    /// Holds a signed EIP-7702 authorization for an authority account to delegate to an implementation.
376    struct SignedDelegation {
377        /// The y-parity of the recovered secp256k1 signature (0 or 1).
378        uint8 v;
379        /// First 32 bytes of the signature.
380        bytes32 r;
381        /// Second 32 bytes of the signature.
382        bytes32 s;
383        /// The current nonce of the authority account at signing time.
384        /// Used to ensure signature can't be replayed after account nonce changes.
385        uint64 nonce;
386        /// Address of the contract implementation that will be delegated to.
387        /// Gets encoded into delegation code: 0xef0100 || implementation.
388        address implementation;
389    }
390
391    /// Represents a "potential" revert reason from a single subsequent call when using `vm.assumeNoReverts`.
392    /// Reverts that match will result in a FOUNDRY::ASSUME rejection, whereas unmatched reverts will be surfaced
393    /// as normal.
394    struct PotentialRevert {
395        /// The allowed origin of the revert opcode; address(0) allows reverts from any address
396        address reverter;
397        /// When true, only matches on the first 4 bytes (usually the selector) of the revert data, otherwise, matches on entire revert data
398        bool partialMatch;
399        /// The data to use to match encountered reverts
400        bytes revertData;
401    }
402
403    // ======== EVM ========
404
405    /// Gets the address for a given private key.
406    #[cheatcode(group = Evm, safety = Safe)]
407    function addr(uint256 privateKey) external pure returns (address keyAddr);
408
409    /// Dumps a genesis JSON file's `allocs` to disk. Accounts created in the current transaction
410    /// are ordered by deployment, followed by the remaining accounts in ascending address order.
411    #[cheatcode(group = Evm, safety = Unsafe)]
412    function dumpState(string calldata pathToStateJson) external;
413
414    /// Gets the nonce of an account.
415    #[cheatcode(group = Evm, safety = Safe)]
416    function getNonce(address account) external view returns (uint64 nonce);
417
418    /// Get the nonce of a `Wallet`.
419    #[cheatcode(group = Evm, safety = Safe)]
420    function getNonce(Wallet calldata wallet) external view returns (uint64 nonce);
421
422    /// Loads a storage slot from an address.
423    #[cheatcode(group = Evm, safety = Safe)]
424    function load(address target, bytes32 slot) external view returns (bytes32 data);
425
426    /// Loads a transient storage slot from an address.
427    #[cheatcode(group = Evm, safety = Safe)]
428    function loadTransient(address target, bytes32 slot) external view returns (bytes32 data);
429
430    /// Load a genesis JSON file's `allocs` into the in-memory EVM state.
431    #[cheatcode(group = Evm, safety = Unsafe)]
432    function loadAllocs(string calldata pathToAllocsJson) external;
433
434    // -------- Record Debug Traces --------
435
436    /// Records the debug trace during the run.
437    #[cheatcode(group = Evm, safety = Safe)]
438    function startDebugTraceRecording() external;
439
440    /// Stop debug trace recording and returns the recorded debug trace.
441    #[cheatcode(group = Evm, safety = Safe)]
442    function stopAndReturnDebugTraceRecording() external returns (DebugStep[] memory step);
443
444
445    /// Clones a source account code, state, balance and nonce to a target account and updates in-memory EVM state.
446    #[cheatcode(group = Evm, safety = Unsafe)]
447    function cloneAccount(address source, address target) external;
448
449    // -------- Record Storage --------
450
451    /// Records all storage reads and writes. Use `accesses` to get the recorded data.
452    /// Subsequent calls to `record` will clear the previous data.
453    #[cheatcode(group = Evm, safety = Safe)]
454    function record() external;
455
456    /// Stops recording storage reads and writes.
457    #[cheatcode(group = Evm, safety = Safe)]
458    function stopRecord() external;
459
460    /// Gets all accessed reads and write slot from a `vm.record` session, for a given address.
461    #[cheatcode(group = Evm, safety = Safe)]
462    function accesses(address target) external view returns (bytes32[] memory readSlots, bytes32[] memory writeSlots);
463
464    /// Registers a callback invoked after each SLOAD against `target`'s effective storage account,
465    /// including when its code runs by delegatecall.
466    ///
467    /// The callback must have the signature `function(address,bytes32,bytes32) external`.
468    /// Registering another callback for the same target and access kind replaces it. Registration
469    /// survives EVM reverts, while callback state follows the enclosing EVM context and rolls back
470    /// with it. Callback reverts propagate through the storage operation. Hooks are suppressed in
471    /// the callback and its entire call subtree. The callback must authenticate
472    /// `msg.sender == address(vm)` to prevent external spoofing. Callback execution is hidden from
473    /// mocks, expectations, log recording, and storage-access recording. It does not inherit
474    /// staticness. The callback runs as an ordinary call frame and consumes one of the 1024
475    /// protocol call-depth slots; a load at the maximum legal call depth can have its callback
476    /// rejected as too deep, propagating as a failure of the load.
477    #[cheatcode(group = Evm, safety = Unsafe)]
478    function registerSloadHook(address target, bytes4 callback) external;
479
480    /// Registers a callback invoked after each SSTORE against `target`'s effective storage account,
481    /// including when its code runs by delegatecall.
482    ///
483    /// The callback must have the signature `function(address,bytes32,bytes32,bytes32) external`.
484    /// Registering another callback for the same target and access kind replaces it. Registration
485    /// survives EVM reverts, while callback state follows the enclosing EVM context and rolls back
486    /// with it. Callback reverts propagate through the storage operation. Hooks are suppressed in
487    /// the callback and its entire call subtree. The callback must authenticate
488    /// `msg.sender == address(vm)` to prevent external spoofing. Callback execution is hidden from
489    /// mocks, expectations, log recording, and storage-access recording. It does not inherit
490    /// staticness. The callback runs as an ordinary call frame and consumes one of the 1024
491    /// protocol call-depth slots; a store at the maximum legal call depth can have its callback
492    /// rejected as too deep, propagating as a failure of the store.
493    #[cheatcode(group = Evm, safety = Unsafe)]
494    function registerSstoreHook(address target, bytes4 callback) external;
495
496    /// Registers a callback after exact mapping-element SSTOREs rooted at `rootSlot` in `target`'s effective storage account.
497    ///
498    /// The callback signature is `function(address account, bytes32 computedSlot, bytes32 rootSlot,
499    /// bytes32[] keys, bytes32 oldValue, bytes32 newValue) external`; keys are raw words in
500    /// root-to-leaf order. Only complete 64-byte Keccak chains observed after the latest mapping
501    /// hook registration for `target` in the current top-level execution match; provenance is
502    /// cleared between top-level executions. Resolution follows the complete chain to its terminal
503    /// root and ignores registered intermediate hashes. Offsets, incomplete or unknown chains,
504    /// hashes computed before registration or in an earlier top-level execution, and source layouts
505    /// do not match. The contract that calls this cheatcode receives the callback. Registration
506    /// persists across reverts and replaces the same target/root callback; callback state rolls back
507    /// with its enclosing context, callback reverts propagate, and hooks are suppressed throughout
508    /// callback subtrees. The callback must authenticate `msg.sender == address(vm)` to prevent
509    /// external spoofing. Raw and mapping SSTORE hooks conflict per target, while multiple mapping
510    /// roots may be registered.
511    #[cheatcode(group = Evm, safety = Unsafe)]
512    function registerMappingSstoreHook(address target, bytes32 rootSlot, bytes4 callback) external;
513
514    /// Record all account accesses as part of CREATE, CALL or SELFDESTRUCT opcodes in order,
515    /// along with the context of the calls
516    #[cheatcode(group = Evm, safety = Safe)]
517    function startStateDiffRecording() external;
518
519    /// Returns an ordered array of all account accesses from a `vm.startStateDiffRecording` session.
520    #[cheatcode(group = Evm, safety = Safe)]
521    function stopAndReturnStateDiff() external returns (AccountAccess[] memory accountAccesses);
522
523    /// Returns state diffs from current `vm.startStateDiffRecording` session.
524    #[cheatcode(group = Evm, safety = Safe)]
525    function getStateDiff() external view returns (string memory diff);
526
527    /// Returns state diffs from current `vm.startStateDiffRecording` session, in json format.
528    #[cheatcode(group = Evm, safety = Safe)]
529    function getStateDiffJson() external view returns (string memory diff);
530
531    /// Returns an array of storage slots occupied by the specified variable.
532    #[cheatcode(group = Evm, safety = Safe)]
533    function getStorageSlots(address target, string calldata variableName) external view returns (uint256[] memory slots);
534
535    /// Returns an array of `StorageAccess` from current `vm.stateStateDiffRecording` session
536    #[cheatcode(group = Evm, safety = Safe)]
537    function getStorageAccesses() external view returns (StorageAccess[] memory storageAccesses);
538
539    // -------- Recording Mapping Accesses --------
540
541    /// Starts recording mapping SSTOREs for later retrieval.
542    #[cheatcode(group = Evm, safety = Safe)]
543    function startMappingRecording() external;
544
545    /// Stops recording mapping SSTOREs and clears the recorded data.
546    #[cheatcode(group = Evm, safety = Safe)]
547    function stopMappingRecording() external;
548
549    /// Gets the number of elements in the mapping at the given slot, for a given address.
550    #[cheatcode(group = Evm, safety = Safe)]
551    function getMappingLength(address target, bytes32 mappingSlot) external view returns (uint256 length);
552
553    /// Gets the elements at index idx of the mapping at the given slot, for a given address. The
554    /// index must be less than the length of the mapping (i.e. the number of keys in the mapping).
555    #[cheatcode(group = Evm, safety = Safe)]
556    function getMappingSlotAt(address target, bytes32 mappingSlot, uint256 idx) external view returns (bytes32 value);
557
558    /// Gets the map key and parent of a mapping at a given slot, for a given address.
559    #[cheatcode(group = Evm, safety = Safe)]
560    function getMappingKeyAndParentOf(address target, bytes32 elementSlot)
561        external
562        view
563        returns (bool found, bytes32 key, bytes32 parent);
564
565    // -------- Block and Transaction Properties --------
566
567    /// Gets the current `block.chainid` of the currently selected environment.
568    /// You should use this instead of `block.chainid` if you use `vm.selectFork` or `vm.createSelectFork`, as `block.chainid` could be assumed
569    /// to be constant across a transaction, and as a result will get optimized out by the compiler.
570    /// See https://github.com/foundry-rs/foundry/issues/6180
571    #[cheatcode(group = Evm, safety = Safe)]
572    function getChainId() external view returns (uint256 blockChainId);
573
574    /// Sets `block.chainid`.
575    #[cheatcode(group = Evm, safety = Unsafe)]
576    function chainId(uint256 newChainId) external;
577
578    /// Sets `block.coinbase`.
579    #[cheatcode(group = Evm, safety = Unsafe)]
580    function coinbase(address newCoinbase) external;
581
582    /// Sets `block.difficulty`.
583    /// Not available on EVM versions from Paris onwards. Use `prevrandao` instead.
584    /// Reverts if used on unsupported EVM versions.
585    #[cheatcode(group = Evm, safety = Unsafe)]
586    function difficulty(uint256 newDifficulty) external;
587
588    /// Sets `block.basefee`.
589    #[cheatcode(group = Evm, safety = Unsafe)]
590    function fee(uint256 newBasefee) external;
591
592    /// Sets `block.prevrandao`.
593    /// Not available on EVM versions before Paris. Use `difficulty` instead.
594    /// If used on unsupported EVM versions it will revert.
595    #[cheatcode(group = Evm, safety = Unsafe)]
596    function prevrandao(bytes32 newPrevrandao) external;
597    /// Sets `block.prevrandao`.
598    /// Not available on EVM versions before Paris. Use `difficulty` instead.
599    /// If used on unsupported EVM versions it will revert.
600    #[cheatcode(group = Evm, safety = Unsafe)]
601    function prevrandao(uint256 newPrevrandao) external;
602
603    /// Sets the blobhashes in the transaction.
604    /// Not available on EVM versions before Cancun.
605    /// If used on unsupported EVM versions it will revert.
606    #[cheatcode(group = Evm, safety = Unsafe)]
607    function blobhashes(bytes32[] calldata hashes) external;
608
609    /// Gets the blobhashes from the current transaction.
610    /// Not available on EVM versions before Cancun.
611    /// If used on unsupported EVM versions it will revert.
612    #[cheatcode(group = Evm, safety = Unsafe)]
613    function getBlobhashes() external view returns (bytes32[] memory hashes);
614
615    /// Sets `block.height`.
616    #[cheatcode(group = Evm, safety = Unsafe)]
617    function roll(uint256 newHeight) external;
618
619    /// Gets the current `block.number`.
620    /// You should use this instead of `block.number` if you use `vm.roll`, as `block.number` is assumed to be constant across a transaction,
621    /// and as a result will get optimized out by the compiler.
622    /// See https://github.com/foundry-rs/foundry/issues/6180
623    #[cheatcode(group = Evm, safety = Safe)]
624    function getBlockNumber() external view returns (uint256 height);
625
626    /// Sets `block.slotnum` without changing the block number or timestamp.
627    /// Not available on EVM versions before Amsterdam.
628    /// If used on unsupported EVM versions it will revert.
629    #[cheatcode(group = Evm, safety = Unsafe)]
630    function rollSlot(uint64 newSlotNumber) external;
631
632    /// Gets the current `block.slotnum`.
633    /// Use this instead of `block.slotnum` after `vm.rollSlot`, as the compiler assumes
634    /// `block.slotnum` is constant across a transaction and may optimize repeated reads away.
635    /// Not available on EVM versions before Amsterdam.
636    /// If used on unsupported EVM versions it will revert.
637    #[cheatcode(group = Evm, safety = Safe)]
638    function getSlotNumber() external view returns (uint64 slotNumber);
639
640    /// Sets `tx.gasprice`.
641    #[cheatcode(group = Evm, safety = Unsafe)]
642    function txGasPrice(uint256 newGasPrice) external;
643
644    /// Sets `block.timestamp`.
645    #[cheatcode(group = Evm, safety = Unsafe)]
646    function warp(uint256 newTimestamp) external;
647
648    /// Gets the current `block.timestamp`.
649    /// You should use this instead of `block.timestamp` if you use `vm.warp`, as `block.timestamp` is assumed to be constant across a transaction,
650    /// and as a result will get optimized out by the compiler.
651    /// See https://github.com/foundry-rs/foundry/issues/6180
652    #[cheatcode(group = Evm, safety = Safe)]
653    function getBlockTimestamp() external view returns (uint256 timestamp);
654
655    /// Gets the RLP encoded block header for a given block number.
656    /// Returns the block header in the same format as `cast block <block_number> --raw`.
657    #[cheatcode(group = Evm, safety = Safe)]
658    function getRawBlockHeader(uint256 blockNumber) external view returns (bytes memory rlpHeader);
659
660    /// Sets `block.blobbasefee`
661    #[cheatcode(group = Evm, safety = Unsafe)]
662    function blobBaseFee(uint256 newBlobBaseFee) external;
663
664    /// Gets the current `block.blobbasefee`.
665    /// You should use this instead of `block.blobbasefee` if you use `vm.blobBaseFee`, as `block.blobbasefee` is assumed to be constant across a transaction,
666    /// and as a result will get optimized out by the compiler.
667    /// See https://github.com/foundry-rs/foundry/issues/6180
668    #[cheatcode(group = Evm, safety = Safe)]
669    function getBlobBaseFee() external view returns (uint256 blobBaseFee);
670
671    /// Set blockhash for the current block.
672    /// It only sets the blockhash for blocks where `block.number - 256 <= number < block.number`.
673    #[cheatcode(group = Evm, safety = Unsafe)]
674    function setBlockhash(uint256 blockNumber, bytes32 blockHash) external;
675
676    /// Executes an RLP-encoded signed transaction with full EVM semantics (like `--isolate` mode).
677    /// The transaction is decoded from EIP-2718 format (type byte prefix + RLP payload) or legacy RLP.
678    /// Returns the execution output bytes.
679    ///
680    /// This cheatcode is not allowed in `forge script` contexts.
681    #[cheatcode(group = Evm, safety = Unsafe)]
682    function executeTransaction(bytes calldata rawTx) external returns (bytes memory);
683
684    // -------- Account State --------
685
686    /// Sets an address' balance.
687    #[cheatcode(group = Evm, safety = Unsafe)]
688    function deal(address account, uint256 newBalance) external;
689
690    /// Sets an address' code.
691    #[cheatcode(group = Evm, safety = Unsafe)]
692    function etch(address target, bytes calldata newRuntimeBytecode) external;
693
694    /// Resets the nonce of an account to 0 for EOAs and 1 for contract accounts.
695    #[cheatcode(group = Evm, safety = Unsafe)]
696    function resetNonce(address account) external;
697
698    /// Sets the nonce of an account. Must be higher than the current nonce of the account.
699    #[cheatcode(group = Evm, safety = Unsafe)]
700    function setNonce(address account, uint64 newNonce) external;
701
702    /// Sets the nonce of an account to an arbitrary value.
703    #[cheatcode(group = Evm, safety = Unsafe)]
704    function setNonceUnsafe(address account, uint64 newNonce) external;
705
706    /// Stores a value to an address' storage slot.
707    #[cheatcode(group = Evm, safety = Unsafe)]
708    function store(address target, bytes32 slot, bytes32 value) external;
709
710    /// Stores a value to an address' transient storage slot.
711    /// The value lasts until the end of the current transaction, like a value written with `TSTORE`.
712    /// This writes the journal directly rather than executing `TSTORE`.
713    /// With isolation enabled (the default), each top-level `CALL` from a test runs as its own
714    /// transaction with empty transient storage, so a value the test stored is not visible to that
715    /// call, even though a later `loadTransient` in the test still returns it. For the target to see
716    /// the value, store it and call the target inside the same call, for example through a helper.
717    /// `STATICCALL` and `DELEGATECALL` stay in the surrounding transaction and can see its values;
718    /// `DELEGATECALL` uses the caller's transient storage, not the target's.
719    /// Example usage, where `f` is non-view and `helper.storeAndCall` stores then calls `target.f()`:
720    /// vm.storeTransient(address(target), slot, value);
721    /// target.f(); // With isolation, `f` reads 0 from `slot`.
722    /// helper.storeAndCall(address(target), slot, value); // `f` reads `value`.
723    #[cheatcode(group = Evm, safety = Unsafe)]
724    function storeTransient(address target, bytes32 slot, bytes32 value) external;
725
726    /// Sets a TIP-20 token's logo URI directly in storage.
727    /// This bypasses the token admin check, but still validates the URI against T5 constraints.
728    #[cheatcode(group = Evm, safety = Unsafe)]
729    function setTip20LogoURI(address token, string calldata newLogoURI) external;
730
731    /// Sets a TIP-20 token's logo URI directly in storage.
732    /// This bypasses the token admin check, but still validates the URI against T5 constraints.
733    #[cheatcode(group = Evm, safety = Unsafe)]
734    function setLogoURI(address token, string calldata newLogoURI) external;
735
736    /// Marks the slots of an account and the account address as cold.
737    #[cheatcode(group = Evm, safety = Unsafe)]
738    function cool(address target) external;
739
740    /// Utility cheatcode to set an EIP-2930 access list for all subsequent transactions.
741    #[cheatcode(group = Evm, safety = Unsafe)]
742    function accessList(AccessListItem[] calldata access) external;
743
744    /// Utility cheatcode to remove any EIP-2930 access list set by `accessList` cheatcode.
745    #[cheatcode(group = Evm, safety = Unsafe)]
746    function noAccessList() external;
747
748    /// Utility cheatcode to mark specific storage slot as warm, simulating a prior read.
749    #[cheatcode(group = Evm, safety = Unsafe)]
750    function warmSlot(address target, bytes32 slot) external;
751
752    /// Utility cheatcode to mark specific storage slot as cold, simulating no prior read.
753    #[cheatcode(group = Evm, safety = Unsafe)]
754    function coolSlot(address target, bytes32 slot) external;
755
756    /// Returns true if isolated test execution is enabled.
757    #[cheatcode(group = Evm, safety = Safe)]
758    function isIsolateMode() external view returns (bool result);
759
760    /// Returns the test or script execution evm version.
761    ///
762    /// **Note:** The execution evm version is not the same as the compilation one.
763    #[cheatcode(group = Evm, safety = Safe)]
764    function getEvmVersion() external pure returns (string memory evm);
765
766    /// Selects the test or script execution hardfork, e.g. `berlin`, `cancun`, or `tempo:T7`.
767    /// Uses the active network's version mappings and gas schedule. Does not change the network
768    /// or Solidity compiler target. On Tempo, runtime changes do not rebuild instructions or
769    /// precompiles; configure `hardfork` before execution to select a different revision.
770    ///
771    /// **Note:** The execution evm version is not the same as the compilation one.
772    #[cheatcode(group = Evm, safety = Safe)]
773    function setEvmVersion(string calldata evm) external;
774
775    /// Returns `true` if `spender` is on the active Tempo hardfork's implicit-approval list,
776    /// meaning it can pull TIP-20 tokens from `msg.sender` without a prior `approve()`.
777    /// Returns `false` on non-Tempo networks.
778    #[cheatcode(group = Evm, safety = Safe)]
779    function isImplicitlyApproved(address spender) external view returns (bool implicitlyApproved);
780
781    /// Skips a fuzz/invariant input unless `spender` is implicitly approved.
782    #[cheatcode(group = Testing, safety = Safe)]
783    function assumeImplicitApproval(address spender) external view;
784
785    // -------- Call Manipulation --------
786    // --- Mocks ---
787
788    /// Clears all mocked calls.
789    #[cheatcode(group = Evm, safety = Unsafe)]
790    function clearMockedCalls() external;
791
792    /// Mocks a call to an address, returning specified data.
793    /// Calldata can either be strict or a partial match, e.g. if you only
794    /// pass a Solidity selector to the expected calldata, then the entire Solidity
795    /// function will be mocked.
796    #[cheatcode(group = Evm, safety = Unsafe)]
797    function mockCall(address callee, bytes calldata data, bytes calldata returnData) external;
798
799    /// Mocks a call to an address with a specific `msg.value`, returning specified data.
800    /// Calldata match takes precedence over `msg.value` in case of ambiguity.
801    #[cheatcode(group = Evm, safety = Unsafe)]
802    function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external;
803
804    /// Mocks a call to an address, returning specified data.
805    /// Calldata can either be strict or a partial match, e.g. if you only
806    /// pass a Solidity selector to the expected calldata, then the entire Solidity
807    /// function will be mocked.
808    ///
809    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
810    #[cheatcode(group = Evm, safety = Unsafe)]
811    function mockCall(address callee, bytes4 data, bytes calldata returnData) external;
812
813    /// Mocks a call to an address with a specific `msg.value`, returning specified data.
814    /// Calldata match takes precedence over `msg.value` in case of ambiguity.
815    ///
816    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
817    #[cheatcode(group = Evm, safety = Unsafe)]
818    function mockCall(address callee, uint256 msgValue, bytes4 data, bytes calldata returnData) external;
819
820    /// Mocks a call to an address, returning specified data.
821    /// Calldata can either be strict or a partial match, e.g. if you only
822    /// pass a Solidity selector to the expected calldata, then the entire Solidity
823    /// function will be mocked.
824    ///
825    /// Overload to control whether code is injected into `callee`. The other overloads etch a
826    /// single byte into an empty account to circumvent Solidity's `extcodesize` check, with the
827    /// side effect that unmocked calls to it no longer revert; `injectCode = false` leaves the
828    /// account codeless, so unmocked calls to it revert in the caller. Mocked calls that return
829    /// data still succeed, as Solidity checks `returndatasize()` instead of `extcodesize()` when
830    /// return data is expected, but mocked calls to functions without return values may still
831    /// revert in the caller due to the `extcodesize` check.
832    #[cheatcode(group = Evm, safety = Unsafe)]
833    function mockCall(address callee, bytes calldata data, bytes calldata returnData, bool injectCode) external;
834
835    /// Mocks multiple calls to an address, returning specified data for each call.
836    #[cheatcode(group = Evm, safety = Unsafe)]
837    function mockCalls(address callee, bytes calldata data, bytes[] calldata returnData) external;
838
839    /// Mocks multiple calls to an address with a specific `msg.value`, returning specified data for each call.
840    #[cheatcode(group = Evm, safety = Unsafe)]
841    function mockCalls(address callee, uint256 msgValue, bytes calldata data, bytes[] calldata returnData) external;
842
843    /// Reverts a call to an address with specified revert data.
844    #[cheatcode(group = Evm, safety = Unsafe)]
845    function mockCallRevert(address callee, bytes calldata data, bytes calldata revertData) external;
846
847    /// Reverts a call to an address with a specific `msg.value`, with specified revert data.
848    #[cheatcode(group = Evm, safety = Unsafe)]
849    function mockCallRevert(address callee, uint256 msgValue, bytes calldata data, bytes calldata revertData)
850        external;
851
852    /// Reverts a call to an address with specified revert data.
853    ///
854    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
855    #[cheatcode(group = Evm, safety = Unsafe)]
856    function mockCallRevert(address callee, bytes4 data, bytes calldata revertData) external;
857
858    /// Reverts a call to an address with a specific `msg.value`, with specified revert data.
859    ///
860    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
861    #[cheatcode(group = Evm, safety = Unsafe)]
862    function mockCallRevert(address callee, uint256 msgValue, bytes4 data, bytes calldata revertData)
863        external;
864
865    /// Whenever a call is made to `callee` with calldata `data`, this cheatcode instead calls
866    /// `target` with the same calldata. This functionality is similar to a delegate call made to
867    /// `target` contract from `callee`.
868    /// Can be used to substitute a call to a function with another implementation that captures
869    /// the primary logic of the original function but is easier to reason about.
870    /// If no exact calldata match exists, a mock registered with only the 4-byte selector is
871    /// attempted.
872    #[cheatcode(group = Evm, safety = Unsafe)]
873    function mockFunction(address callee, address target, bytes calldata data) external;
874
875    // --- Impersonation (pranks) ---
876
877    /// Sets the *next* call's `msg.sender` to be the input address.
878    #[cheatcode(group = Evm, safety = Unsafe)]
879    function prank(address msgSender) external;
880
881    /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called.
882    #[cheatcode(group = Evm, safety = Unsafe)]
883    function startPrank(address msgSender) external;
884
885    /// Sets the *next* call's `msg.sender` to be the input address, and the `tx.origin` to be the second input.
886    #[cheatcode(group = Evm, safety = Unsafe)]
887    function prank(address msgSender, address txOrigin) external;
888
889    /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called, and the `tx.origin` to be the second input.
890    #[cheatcode(group = Evm, safety = Unsafe)]
891    function startPrank(address msgSender, address txOrigin) external;
892
893    /// Sets the *next* delegate call's `msg.sender` to be the input address.
894    #[cheatcode(group = Evm, safety = Unsafe)]
895    function prank(address msgSender, bool delegateCall) external;
896
897    /// Sets all subsequent delegate calls' `msg.sender` to be the input address until `stopPrank` is called.
898    #[cheatcode(group = Evm, safety = Unsafe)]
899    function startPrank(address msgSender, bool delegateCall) external;
900
901    /// Sets the *next* delegate call's `msg.sender` to be the input address, and the `tx.origin` to be the second input.
902    #[cheatcode(group = Evm, safety = Unsafe)]
903    function prank(address msgSender, address txOrigin, bool delegateCall) external;
904
905    /// 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.
906    #[cheatcode(group = Evm, safety = Unsafe)]
907    function startPrank(address msgSender, address txOrigin, bool delegateCall) external;
908
909    /// Resets subsequent calls' `msg.sender` to be `address(this)`.
910    #[cheatcode(group = Evm, safety = Unsafe)]
911    function stopPrank() external;
912
913    /// Reads the current `msg.sender` and `tx.origin` from state and reports if there is any active caller modification.
914    #[cheatcode(group = Evm, safety = Unsafe)]
915    function readCallers() external view returns (CallerMode callerMode, address msgSender, address txOrigin);
916
917    // ----- Arbitrary Snapshots -----
918
919    /// Snapshot capture an arbitrary numerical value by name.
920    /// The group name is derived from the contract name.
921    #[cheatcode(group = Evm, safety = Unsafe)]
922    function snapshotValue(string calldata name, uint256 value) external;
923
924    /// Snapshot capture an arbitrary numerical value by name in a group.
925    #[cheatcode(group = Evm, safety = Unsafe)]
926    function snapshotValue(string calldata group, string calldata name, uint256 value) external;
927
928    // -------- Gas Snapshots --------
929
930    /// DEPRECATED: use `snapshotGasLastFrame` instead.
931    /// Snapshot capture the gas usage of the last call by name from the callee perspective.
932    /// Without isolation, measures regular counter consumption, including spillover but excluding reservoir-funded state gas.
933    /// Isolated frames with zero net state gas use receipt gas; see <https://getfoundry.sh/reference/cheatcodes/gas-snapshots>.
934    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `snapshotGasLastFrame`")))]
935    function snapshotGasLastCall(string calldata name) external returns (uint256 gasUsed);
936
937    /// DEPRECATED: use `snapshotGasLastFrame` instead.
938    /// Snapshot capture the gas usage of the last call by name in a group from the callee perspective.
939    /// Without isolation, measures regular counter consumption, including spillover but excluding reservoir-funded state gas.
940    /// Isolated frames with zero net state gas use receipt gas; see <https://getfoundry.sh/reference/cheatcodes/gas-snapshots>.
941    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `snapshotGasLastFrame`")))]
942    function snapshotGasLastCall(string calldata group, string calldata name) external returns (uint256 gasUsed);
943
944    /// Snapshot capture the gas usage of the last call or create by name from the callee perspective.
945    /// Without isolation, measures regular counter consumption, including spillover but excluding reservoir-funded state gas.
946    /// Isolated frames with zero net state gas use receipt gas; see <https://getfoundry.sh/reference/cheatcodes/gas-snapshots>.
947    #[cheatcode(group = Evm, safety = Unsafe)]
948    function snapshotGasLastFrame(string calldata name) external returns (uint256 gasUsed);
949
950    /// Snapshot capture the gas usage of the last call or create by name in a group from the callee perspective.
951    /// Without isolation, measures regular counter consumption, including spillover but excluding reservoir-funded state gas.
952    /// Isolated frames with zero net state gas use receipt gas; see <https://getfoundry.sh/reference/cheatcodes/gas-snapshots>.
953    #[cheatcode(group = Evm, safety = Unsafe)]
954    function snapshotGasLastFrame(string calldata group, string calldata name) external returns (uint256 gasUsed);
955
956    /// Start a snapshot capture of the current gas usage by name.
957    /// The group name is derived from the contract name.
958    /// Measures gas consumed from the regular counter, including state spillover but excluding reservoir-funded state gas.
959    #[cheatcode(group = Evm, safety = Unsafe)]
960    function startSnapshotGas(string calldata name) external;
961
962    /// Start a snapshot capture of the current gas usage by name in a group.
963    /// Measures gas consumed from the regular counter, including state spillover but excluding reservoir-funded state gas.
964    #[cheatcode(group = Evm, safety = Unsafe)]
965    function startSnapshotGas(string calldata group, string calldata name) external;
966
967    /// Stop the snapshot capture of the current gas by latest snapshot name, capturing the gas used since the start.
968    /// Measures gas consumed from the regular counter, including state spillover but excluding reservoir-funded state gas.
969    #[cheatcode(group = Evm, safety = Unsafe)]
970    function stopSnapshotGas() external returns (uint256 gasUsed);
971
972    /// Stop the snapshot capture of the current gas usage by name, capturing the gas used since the start.
973    /// The group name is derived from the contract name.
974    /// Measures gas consumed from the regular counter, including state spillover but excluding reservoir-funded state gas.
975    #[cheatcode(group = Evm, safety = Unsafe)]
976    function stopSnapshotGas(string calldata name) external returns (uint256 gasUsed);
977
978    /// Stop the snapshot capture of the current gas usage by name in a group, capturing the gas used since the start.
979    /// Measures gas consumed from the regular counter, including state spillover but excluding reservoir-funded state gas.
980    #[cheatcode(group = Evm, safety = Unsafe)]
981    function stopSnapshotGas(string calldata group, string calldata name) external returns (uint256 gasUsed);
982
983    // -------- State Snapshots --------
984
985    /// `snapshot` is being deprecated in favor of `snapshotState`. It will be removed in future versions.
986    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `snapshotState`")))]
987    function snapshot() external returns (uint256 snapshotId);
988
989    /// Snapshot the current state of the evm.
990    /// Returns the ID of the snapshot that was created.
991    /// To revert a snapshot use `revertToState`.
992    #[cheatcode(group = Evm, safety = Unsafe)]
993    function snapshotState() external returns (uint256 snapshotId);
994
995    /// `revertTo` is being deprecated in favor of `revertToState`. It will be removed in future versions.
996    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `revertToState`")))]
997    function revertTo(uint256 snapshotId) external returns (bool success);
998
999    /// Revert the state of the EVM to a previous snapshot
1000    /// Takes the snapshot ID to revert to.
1001    ///
1002    /// Returns `true` if the snapshot was successfully reverted.
1003    /// Returns `false` if the snapshot does not exist.
1004    ///
1005    /// **Note:** This does not automatically delete the snapshot. To delete the snapshot use `deleteStateSnapshot`.
1006    #[cheatcode(group = Evm, safety = Unsafe)]
1007    function revertToState(uint256 snapshotId) external returns (bool success);
1008
1009    /// `revertToAndDelete` is being deprecated in favor of `revertToStateAndDelete`. It will be removed in future versions.
1010    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `revertToStateAndDelete`")))]
1011    function revertToAndDelete(uint256 snapshotId) external returns (bool success);
1012
1013    /// Revert the state of the EVM to a previous snapshot and automatically deletes the snapshots
1014    /// Takes the snapshot ID to revert to.
1015    ///
1016    /// Returns `true` if the snapshot was successfully reverted and deleted.
1017    /// Returns `false` if the snapshot does not exist.
1018    #[cheatcode(group = Evm, safety = Unsafe)]
1019    function revertToStateAndDelete(uint256 snapshotId) external returns (bool success);
1020
1021    /// `deleteSnapshot` is being deprecated in favor of `deleteStateSnapshot`. It will be removed in future versions.
1022    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `deleteStateSnapshot`")))]
1023    function deleteSnapshot(uint256 snapshotId) external returns (bool success);
1024
1025    /// Removes the snapshot with the given ID created by `snapshot`.
1026    /// Takes the snapshot ID to delete.
1027    ///
1028    /// Returns `true` if the snapshot was successfully deleted.
1029    /// Returns `false` if the snapshot does not exist.
1030    #[cheatcode(group = Evm, safety = Unsafe)]
1031    function deleteStateSnapshot(uint256 snapshotId) external returns (bool success);
1032
1033    /// `deleteSnapshots` is being deprecated in favor of `deleteStateSnapshots`. It will be removed in future versions.
1034    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `deleteStateSnapshots`")))]
1035    function deleteSnapshots() external;
1036
1037    /// Removes _all_ snapshots previously created by `snapshot`.
1038    #[cheatcode(group = Evm, safety = Unsafe)]
1039    function deleteStateSnapshots() external;
1040
1041    // -------- Forking --------
1042    // --- Creation and Selection ---
1043
1044    /// Returns the identifier of the currently active fork. Reverts if no fork is currently active.
1045    #[cheatcode(group = Evm, safety = Unsafe)]
1046    function activeFork() external view returns (uint256 forkId);
1047
1048    /// Creates a new fork with the given endpoint and the _latest_ block and returns the identifier of the fork.
1049    #[cheatcode(group = Evm, safety = Unsafe)]
1050    function createFork(string calldata urlOrAlias) external returns (uint256 forkId);
1051    /// Creates a new fork with the given endpoint and block and returns the identifier of the fork.
1052    #[cheatcode(group = Evm, safety = Unsafe)]
1053    function createFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);
1054    /// Creates a new fork with the given endpoint and at the block the given transaction was mined in,
1055    /// replays all transaction mined in the block before the transaction, and returns the identifier of the fork.
1056    #[cheatcode(group = Evm, safety = Unsafe)]
1057    function createFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);
1058
1059    /// Creates and also selects a new fork with the given endpoint and the latest block and returns the identifier of the fork.
1060    #[cheatcode(group = Evm, safety = Unsafe)]
1061    function createSelectFork(string calldata urlOrAlias) external returns (uint256 forkId);
1062    /// Creates and also selects a new fork with the given endpoint and block and returns the identifier of the fork.
1063    #[cheatcode(group = Evm, safety = Unsafe)]
1064    function createSelectFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);
1065    /// Creates and also selects new fork with the given endpoint and at the block the given transaction was mined in,
1066    /// replays all transaction mined in the block before the transaction, returns the identifier of the fork.
1067    #[cheatcode(group = Evm, safety = Unsafe)]
1068    function createSelectFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);
1069
1070    /// Updates the currently active fork to given block number
1071    /// This is similar to `roll` but for the currently active fork.
1072    #[cheatcode(group = Evm, safety = Unsafe)]
1073    function rollFork(uint256 blockNumber) external;
1074    /// Updates the currently active fork to given transaction. This will `rollFork` with the number
1075    /// of the block the transaction was mined in and replays all transaction mined before it in the block.
1076    #[cheatcode(group = Evm, safety = Unsafe)]
1077    function rollFork(bytes32 txHash) external;
1078    /// Updates the given fork to given block number.
1079    #[cheatcode(group = Evm, safety = Unsafe)]
1080    function rollFork(uint256 forkId, uint256 blockNumber) external;
1081    /// Updates the given fork to block number of the given transaction and replays all transaction mined before it in the block.
1082    #[cheatcode(group = Evm, safety = Unsafe)]
1083    function rollFork(uint256 forkId, bytes32 txHash) external;
1084
1085    /// Takes a fork identifier created by `createFork` and sets the corresponding forked state as active.
1086    #[cheatcode(group = Evm, safety = Unsafe)]
1087    function selectFork(uint256 forkId) external;
1088
1089    /// Fetches the given transaction from the active fork and executes it on the current state.
1090    #[cheatcode(group = Evm, safety = Unsafe)]
1091    function transact(bytes32 txHash) external;
1092    /// Fetches the given transaction from the given fork and executes it on the current state.
1093    #[cheatcode(group = Evm, safety = Unsafe)]
1094    function transact(uint256 forkId, bytes32 txHash) external;
1095
1096    /// Performs an Ethereum JSON-RPC request to the current fork URL.
1097    #[cheatcode(group = Evm, safety = Safe)]
1098    function rpc(string calldata method, string calldata params) external returns (bytes memory data);
1099
1100    /// Performs an Ethereum JSON-RPC request to the given endpoint.
1101    #[cheatcode(group = Evm, safety = Safe)]
1102    function rpc(string calldata urlOrAlias, string calldata method, string calldata params)
1103        external
1104        returns (bytes memory data);
1105
1106    /// Performs an Ethereum JSON-RPC request to the current fork URL and returns the JSON result.
1107    #[cheatcode(group = Evm, safety = Safe)]
1108    function rpcJson(string calldata method, string calldata params) external returns (string memory data);
1109
1110    /// Performs an Ethereum JSON-RPC request to the given endpoint and returns the JSON result.
1111    #[cheatcode(group = Evm, safety = Safe)]
1112    function rpcJson(string calldata urlOrAlias, string calldata method, string calldata params)
1113        external
1114        returns (string memory data);
1115
1116    /// Gets all the logs according to specified filter.
1117    #[cheatcode(group = Evm, safety = Safe)]
1118    function eth_getLogs(uint256 fromBlock, uint256 toBlock, address target, bytes32[] calldata topics)
1119        external
1120        view
1121        returns (EthGetLogs[] memory logs);
1122
1123    /// Gets the EIP-1186 account and storage proof of `target` at `blockNumber` from the active fork.
1124    /// The proof is fetched from the fork's RPC endpoint and does not reflect local state changes.
1125    #[cheatcode(group = Evm, safety = Safe)]
1126    function eth_getProof(address target, bytes32[] calldata slots, uint256 blockNumber)
1127        external
1128        view
1129        returns (EthGetProof memory proof);
1130
1131    // --- Behavior ---
1132
1133    /// In forking mode, explicitly grant the given address cheatcode access.
1134    #[cheatcode(group = Evm, safety = Unsafe)]
1135    function allowCheatcodes(address account) external;
1136
1137    /// Marks that the account(s) should use persistent storage across fork swaps in a multifork setup
1138    /// Meaning, changes made to the state of this account will be kept when switching forks.
1139    #[cheatcode(group = Evm, safety = Unsafe)]
1140    function makePersistent(address account) external;
1141    /// See `makePersistent(address)`.
1142    #[cheatcode(group = Evm, safety = Unsafe)]
1143    function makePersistent(address account0, address account1) external;
1144    /// See `makePersistent(address)`.
1145    #[cheatcode(group = Evm, safety = Unsafe)]
1146    function makePersistent(address account0, address account1, address account2) external;
1147    /// See `makePersistent(address)`.
1148    #[cheatcode(group = Evm, safety = Unsafe)]
1149    function makePersistent(address[] calldata accounts) external;
1150
1151    /// Revokes persistent status from the address, previously added via `makePersistent`.
1152    #[cheatcode(group = Evm, safety = Unsafe)]
1153    function revokePersistent(address account) external;
1154    /// See `revokePersistent(address)`.
1155    #[cheatcode(group = Evm, safety = Unsafe)]
1156    function revokePersistent(address[] calldata accounts) external;
1157
1158    /// Returns true if the account is marked as persistent.
1159    #[cheatcode(group = Evm, safety = Unsafe)]
1160    function isPersistent(address account) external view returns (bool persistent);
1161
1162    // -------- Record Logs --------
1163
1164    /// Record all the transaction logs.
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}