diff --git a/crates/cheatcodes/assets/cheatcodes.json b/crates/cheatcodes/assets/cheatcodes.json index 4481f89c2ea0b..7fb554eb045eb 100644 --- a/crates/cheatcodes/assets/cheatcodes.json +++ b/crates/cheatcodes/assets/cheatcodes.json @@ -5866,518 +5866,518 @@ }, { "func": { - "id": "forkAddress", - "description": "Gets the value for the key `key` from the currently active fork and parses it as `address`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkAddress(string calldata key) external view returns (address);", + "id": "foundryVersionAtLeast", + "description": "Returns true if the current Foundry version is greater than or equal to the given version.\nThe given version string must be in the format `major.minor.patch`.\nThis is equivalent to `foundryVersionCmp(version) >= 0`.", + "declaration": "function foundryVersionAtLeast(string calldata version) external view returns (bool);", "visibility": "external", "mutability": "view", - "signature": "forkAddress(string)", - "selector": "0x27b1efc0", + "signature": "foundryVersionAtLeast(string)", + "selector": "0x6248be1f", "selectorBytes": [ - 39, - 177, - 239, - 192 + 98, + 72, + 190, + 31 ] }, - "group": "forking", + "group": "testing", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkBool", - "description": "Gets the value for the key `key` from the currently active fork and parses it as `bool`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkBool(string calldata key) external view returns (bool);", + "id": "foundryVersionCmp", + "description": "Compares the current Foundry version with the given version string.\nThe given version string must be in the format `major.minor.patch`.\nReturns:\n-1 if current Foundry version is less than the given version\n0 if current Foundry version equals the given version\n1 if current Foundry version is greater than the given version\nThis result can then be used with a comparison operator against `0`.\nFor example, to check if the current Foundry version is greater than or equal to `1.0.0`:\n`if (foundryVersionCmp(\"1.0.0\") >= 0) { ... }`", + "declaration": "function foundryVersionCmp(string calldata version) external view returns (int256);", "visibility": "external", "mutability": "view", - "signature": "forkBool(string)", - "selector": "0xc06e85dd", + "signature": "foundryVersionCmp(string)", + "selector": "0xca7b0a09", "selectorBytes": [ - 192, - 110, - 133, - 221 + 202, + 123, + 10, + 9 ] }, - "group": "forking", + "group": "testing", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkBytes", - "description": "Gets the value for the key `key` from the currently active fork and parses it as `bytes`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkBytes(string calldata key) external view returns (bytes memory);", + "id": "fsMetadata", + "description": "Given a path, query the file system to get information about a file, directory, etc.", + "declaration": "function fsMetadata(string calldata path) external view returns (FsMetadata memory metadata);", "visibility": "external", "mutability": "view", - "signature": "forkBytes(string)", - "selector": "0x7c055631", + "signature": "fsMetadata(string)", + "selector": "0xaf368a08", "selectorBytes": [ - 124, - 5, - 86, - 49 + 175, + 54, + 138, + 8 ] }, - "group": "forking", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkBytes32", - "description": "Gets the value for the key `key` from the currently active fork and parses it as `bytes32`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkBytes32(string calldata key) external view returns (bytes32);", + "id": "getArtifactPathByCode", + "description": "Gets the artifact path from code (aka. creation code).", + "declaration": "function getArtifactPathByCode(bytes calldata code) external view returns (string memory path);", "visibility": "external", "mutability": "view", - "signature": "forkBytes32(string)", - "selector": "0xa912a3f4", + "signature": "getArtifactPathByCode(bytes)", + "selector": "0xeb74848c", "selectorBytes": [ - 169, - 18, - 163, - 244 + 235, + 116, + 132, + 140 ] }, - "group": "forking", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkChain", - "description": "Returns the chain name of the currently selected fork.", - "declaration": "function forkChain() external view returns (string memory);", + "id": "getArtifactPathByDeployedCode", + "description": "Gets the artifact path from deployed code (aka. runtime code).", + "declaration": "function getArtifactPathByDeployedCode(bytes calldata deployedCode) external view returns (string memory path);", "visibility": "external", "mutability": "view", - "signature": "forkChain()", - "selector": "0xe6075d94", + "signature": "getArtifactPathByDeployedCode(bytes)", + "selector": "0x6d853ba5", "selectorBytes": [ - 230, - 7, - 93, - 148 + 109, + 133, + 59, + 165 ] }, - "group": "forking", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkChainAddress", - "description": "Gets the value for the key `key` from the fork config for chain `chain` and parses it as `address`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkChainAddress(uint256 chain, string calldata key) external view returns (address);", + "id": "getBlobBaseFee", + "description": "Gets the current `block.blobbasefee`.\nYou should use this instead of `block.blobbasefee` if you use `vm.blobBaseFee`, as `block.blobbasefee` is assumed to be constant across a transaction,\nand as a result will get optimized out by the compiler.\nSee https://github.com/foundry-rs/foundry/issues/6180", + "declaration": "function getBlobBaseFee() external view returns (uint256 blobBaseFee);", "visibility": "external", "mutability": "view", - "signature": "forkChainAddress(uint256,string)", - "selector": "0x5dc00a35", + "signature": "getBlobBaseFee()", + "selector": "0x1f6d6ef7", "selectorBytes": [ - 93, - 192, - 10, - 53 + 31, + 109, + 110, + 247 ] }, - "group": "forking", + "group": "evm", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkChainBool", - "description": "Gets the value for the key `key` from the fork config for chain `chain` and parses it as `bool`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkChainBool(uint256 chain, string calldata key) external view returns (bool);", + "id": "getBlobhashes", + "description": "Gets the blockhashes from the current transaction.\nNot available on EVM versions before Cancun.\nIf used on unsupported EVM versions it will revert.", + "declaration": "function getBlobhashes() external view returns (bytes32[] memory hashes);", "visibility": "external", "mutability": "view", - "signature": "forkChainBool(uint256,string)", - "selector": "0x8f947e16", + "signature": "getBlobhashes()", + "selector": "0xf56ff18b", "selectorBytes": [ - 143, - 148, - 126, - 22 + 245, + 111, + 241, + 139 ] }, - "group": "forking", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "forkChainBytes", - "description": "Gets the value for the key `key` from the fork config for chain `chain` and parses it as `bytes`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkChainBytes(uint256 chain, string calldata key) external view returns (bytes memory);", + "id": "getBlockNumber", + "description": "Gets the current `block.number`.\nYou should use this instead of `block.number` if you use `vm.roll`, as `block.number` is assumed to be constant across a transaction,\nand as a result will get optimized out by the compiler.\nSee https://github.com/foundry-rs/foundry/issues/6180", + "declaration": "function getBlockNumber() external view returns (uint256 height);", "visibility": "external", "mutability": "view", - "signature": "forkChainBytes(uint256,string)", - "selector": "0x0e73256d", + "signature": "getBlockNumber()", + "selector": "0x42cbb15c", "selectorBytes": [ - 14, - 115, - 37, - 109 + 66, + 203, + 177, + 92 ] }, - "group": "forking", + "group": "evm", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkChainBytes32", - "description": "Gets the value for the key `key` from the fork config for chain `chain` and parses it as `bytes32`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkChainBytes32(uint256 chain, string calldata key) external view returns (bytes32);", + "id": "getBlockTimestamp", + "description": "Gets the current `block.timestamp`.\nYou should use this instead of `block.timestamp` if you use `vm.warp`, as `block.timestamp` is assumed to be constant across a transaction,\nand as a result will get optimized out by the compiler.\nSee https://github.com/foundry-rs/foundry/issues/6180", + "declaration": "function getBlockTimestamp() external view returns (uint256 timestamp);", "visibility": "external", "mutability": "view", - "signature": "forkChainBytes32(uint256,string)", - "selector": "0x05dd6d07", + "signature": "getBlockTimestamp()", + "selector": "0x796b89b9", "selectorBytes": [ - 5, - 221, - 109, - 7 + 121, + 107, + 137, + 185 ] }, - "group": "forking", + "group": "evm", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkChainId", - "description": "Returns the chain id of the currently selected fork.", - "declaration": "function forkChainId() external view returns (uint256);", + "id": "getBroadcast", + "description": "Returns the most recent broadcast for the given contract on `chainId` matching `txType`.\nFor example:\nThe most recent deployment can be fetched by passing `txType` as `CREATE` or `CREATE2`.\nThe most recent call can be fetched by passing `txType` as `CALL`.", + "declaration": "function getBroadcast(string calldata contractName, uint64 chainId, BroadcastTxType txType) external view returns (BroadcastTxSummary memory);", "visibility": "external", "mutability": "view", - "signature": "forkChainId()", - "selector": "0xe6b661e2", + "signature": "getBroadcast(string,uint64,uint8)", + "selector": "0x3dc90cb3", "selectorBytes": [ - 230, - 182, - 97, - 226 + 61, + 201, + 12, + 179 ] }, - "group": "forking", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkChainIds", - "description": "Returns an array with the ids of all the configured fork chains.\nNote that the configured fork chains are subsections of the `[fork]` section of 'foundry.toml'.", - "declaration": "function forkChainIds() external view returns (uint256[] memory);", + "id": "getBroadcasts_0", + "description": "Returns all broadcasts for the given contract on `chainId` with the specified `txType`.\nSorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber.", + "declaration": "function getBroadcasts(string calldata contractName, uint64 chainId, BroadcastTxType txType) external view returns (BroadcastTxSummary[] memory);", "visibility": "external", "mutability": "view", - "signature": "forkChainIds()", - "selector": "0x04dc8feb", + "signature": "getBroadcasts(string,uint64,uint8)", + "selector": "0xf7afe919", "selectorBytes": [ - 4, - 220, - 143, - 235 + 247, + 175, + 233, + 25 ] }, - "group": "forking", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkChainInt", - "description": "Gets the value for the key `key` from the fork config for chain `chain` and parses it as `int256`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkChainInt(uint256 chain, string calldata key) external view returns (int256);", + "id": "getBroadcasts_1", + "description": "Returns all broadcasts for the given contract on `chainId`.\nSorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber.", + "declaration": "function getBroadcasts(string calldata contractName, uint64 chainId) external view returns (BroadcastTxSummary[] memory);", "visibility": "external", "mutability": "view", - "signature": "forkChainInt(uint256,string)", - "selector": "0xc1ff595f", + "signature": "getBroadcasts(string,uint64)", + "selector": "0xf2fa4a26", "selectorBytes": [ - 193, - 255, - 89, - 95 + 242, + 250, + 74, + 38 ] }, - "group": "forking", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkChainRpcUrl", - "description": "Returns the rpc url of the corresponding chain id.\nBy default, the rpc url of each fork is derived from the `[rpc_endpoints]`, unless\nthe rpc config is specifically informed in the fork config for that specific chain.", - "declaration": "function forkChainRpcUrl(uint256 id) external view returns (string memory);", + "id": "getChain_0", + "description": "Returns a Chain struct for specific alias", + "declaration": "function getChain(string calldata chainAlias) external view returns (Chain memory chain);", "visibility": "external", "mutability": "view", - "signature": "forkChainRpcUrl(uint256)", - "selector": "0xa2c51cca", + "signature": "getChain(string)", + "selector": "0x4cc1c2bb", "selectorBytes": [ - 162, - 197, - 28, - 202 + 76, + 193, + 194, + 187 ] }, - "group": "forking", + "group": "testing", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkChainString", - "description": "Gets the value for the key `key` from the fork config for chain `chain` and parses it as `string`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkChainString(uint256 chain, string calldata key) external view returns (string memory);", + "id": "getChain_1", + "description": "Returns a Chain struct for specific chainId", + "declaration": "function getChain(uint256 chainId) external view returns (Chain memory chain);", "visibility": "external", "mutability": "view", - "signature": "forkChainString(uint256,string)", - "selector": "0x24062881", + "signature": "getChain(uint256)", + "selector": "0xb6791ad4", "selectorBytes": [ - 36, - 6, - 40, - 129 + 182, + 121, + 26, + 212 ] }, - "group": "forking", + "group": "testing", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkChainUint", - "description": "Gets the value for the key `key` from the fork config for chain `chain` and parses it as `uint256`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkChainUint(uint256 chain, string calldata key) external view returns (uint256);", + "id": "getCode", + "description": "Gets the creation bytecode from an artifact file. Takes in the relative path to the json file or the path to the\nartifact in the form of :: where and parts are optional.", + "declaration": "function getCode(string calldata artifactPath) external view returns (bytes memory creationBytecode);", "visibility": "external", "mutability": "view", - "signature": "forkChainUint(uint256,string)", - "selector": "0x2bfffa5c", + "signature": "getCode(string)", + "selector": "0x8d1cc925", "selectorBytes": [ - 43, - 255, - 250, - 92 + 141, + 28, + 201, + 37 ] }, - "group": "forking", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkChains", - "description": "Returns an array with the name of all the configured fork chains.\nNote that the configured fork chains are subsections of the `[fork]` section of 'foundry.toml'.", - "declaration": "function forkChains() external view returns (string[] memory);", + "id": "getDeployedCode", + "description": "Gets the deployed bytecode from an artifact file. Takes in the relative path to the json file or the path to the\nartifact in the form of :: where and parts are optional.", + "declaration": "function getDeployedCode(string calldata artifactPath) external view returns (bytes memory runtimeBytecode);", "visibility": "external", "mutability": "view", - "signature": "forkChains()", - "selector": "0x081f64cd", + "signature": "getDeployedCode(string)", + "selector": "0x3ebf73b4", "selectorBytes": [ - 8, - 31, - 100, - 205 + 62, + 191, + 115, + 180 ] }, - "group": "forking", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkInt", - "description": "Gets the value for the key `key` from the currently active fork and parses it as `int256`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkInt(string calldata key) external view returns (int256);", + "id": "getDeployment_0", + "description": "Returns the most recent deployment for the current `chainId`.", + "declaration": "function getDeployment(string calldata contractName) external view returns (address deployedAddress);", "visibility": "external", "mutability": "view", - "signature": "forkInt(string)", - "selector": "0x4b326af0", + "signature": "getDeployment(string)", + "selector": "0xa8091d97", "selectorBytes": [ - 75, - 50, - 106, - 240 - ] + 168, + 9, + 29, + 151 + ] }, - "group": "forking", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkRpcUrl", - "description": "Returns the rpc url of the currently selected fork.\nBy default, the rpc url of each fork is derived from the `[rpc_endpoints]`, unless\nthe rpc config is specifically informed in the fork config for that specific chain.", - "declaration": "function forkRpcUrl() external view returns (string memory);", + "id": "getDeployment_1", + "description": "Returns the most recent deployment for the given contract on `chainId`", + "declaration": "function getDeployment(string calldata contractName, uint64 chainId) external view returns (address deployedAddress);", "visibility": "external", "mutability": "view", - "signature": "forkRpcUrl()", - "selector": "0x66d48d21", + "signature": "getDeployment(string,uint64)", + "selector": "0x0debd5d6", "selectorBytes": [ - 102, - 212, - 141, - 33 + 13, + 235, + 213, + 214 ] }, - "group": "forking", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkString", - "description": "Gets the value for the key `key` from the currently active fork and parses it as `string`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkString(string calldata key) external view returns (string memory);", + "id": "getDeployments", + "description": "Returns all deployments for the given contract on `chainId`\nSorted in descending order of deployment time i.e descending order of BroadcastTxSummary.blockNumber.\nThe most recent deployment is the first element, and the oldest is the last.", + "declaration": "function getDeployments(string calldata contractName, uint64 chainId) external view returns (address[] memory deployedAddresses);", "visibility": "external", "mutability": "view", - "signature": "forkString(string)", - "selector": "0xd8525752", + "signature": "getDeployments(string,uint64)", + "selector": "0x74e133dd", "selectorBytes": [ - 216, - 82, - 87, - 82 + 116, + 225, + 51, + 221 ] }, - "group": "forking", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "forkUint", - "description": "Gets the value for the key `key` from the currently active fork and parses it as `uint256`.\nReverts if the key was not found or the value could not be parsed.", - "declaration": "function forkUint(string calldata key) external view returns (uint256);", + "id": "getFoundryVersion", + "description": "Returns the Foundry version.\nFormat: -+..\nSample output: 0.3.0-nightly+3cb96bde9b.1737036656.debug\nNote: Build timestamps may vary slightly across platforms due to separate CI jobs.\nFor reliable version comparisons, use UNIX format (e.g., >= 1700000000)\nto compare timestamps while ignoring minor time differences.", + "declaration": "function getFoundryVersion() external view returns (string memory version);", "visibility": "external", "mutability": "view", - "signature": "forkUint(string)", - "selector": "0xbe0fe4a8", + "signature": "getFoundryVersion()", + "selector": "0xea991bb5", "selectorBytes": [ - 190, - 15, - 228, - 168 + 234, + 153, + 27, + 181 ] }, - "group": "forking", + "group": "testing", "status": "stable", "safety": "safe" }, { "func": { - "id": "foundryVersionAtLeast", - "description": "Returns true if the current Foundry version is greater than or equal to the given version.\nThe given version string must be in the format `major.minor.patch`.\nThis is equivalent to `foundryVersionCmp(version) >= 0`.", - "declaration": "function foundryVersionAtLeast(string calldata version) external view returns (bool);", + "id": "getLabel", + "description": "Gets the label for the specified address.", + "declaration": "function getLabel(address account) external view returns (string memory currentLabel);", "visibility": "external", "mutability": "view", - "signature": "foundryVersionAtLeast(string)", - "selector": "0x6248be1f", + "signature": "getLabel(address)", + "selector": "0x28a249b0", "selectorBytes": [ - 98, - 72, - 190, - 31 + 40, + 162, + 73, + 176 ] }, - "group": "testing", + "group": "utilities", "status": "stable", "safety": "safe" }, { "func": { - "id": "foundryVersionCmp", - "description": "Compares the current Foundry version with the given version string.\nThe given version string must be in the format `major.minor.patch`.\nReturns:\n-1 if current Foundry version is less than the given version\n0 if current Foundry version equals the given version\n1 if current Foundry version is greater than the given version\nThis result can then be used with a comparison operator against `0`.\nFor example, to check if the current Foundry version is greater than or equal to `1.0.0`:\n`if (foundryVersionCmp(\"1.0.0\") >= 0) { ... }`", - "declaration": "function foundryVersionCmp(string calldata version) external view returns (int256);", + "id": "getMappingKeyAndParentOf", + "description": "Gets the map key and parent of a mapping at a given slot, for a given address.", + "declaration": "function getMappingKeyAndParentOf(address target, bytes32 elementSlot) external returns (bool found, bytes32 key, bytes32 parent);", "visibility": "external", - "mutability": "view", - "signature": "foundryVersionCmp(string)", - "selector": "0xca7b0a09", + "mutability": "", + "signature": "getMappingKeyAndParentOf(address,bytes32)", + "selector": "0x876e24e6", "selectorBytes": [ - 202, - 123, - 10, - 9 + 135, + 110, + 36, + 230 ] }, - "group": "testing", + "group": "evm", "status": "stable", "safety": "safe" }, { "func": { - "id": "fsMetadata", - "description": "Given a path, query the file system to get information about a file, directory, etc.", - "declaration": "function fsMetadata(string calldata path) external view returns (FsMetadata memory metadata);", + "id": "getMappingLength", + "description": "Gets the number of elements in the mapping at the given slot, for a given address.", + "declaration": "function getMappingLength(address target, bytes32 mappingSlot) external returns (uint256 length);", "visibility": "external", - "mutability": "view", - "signature": "fsMetadata(string)", - "selector": "0xaf368a08", + "mutability": "", + "signature": "getMappingLength(address,bytes32)", + "selector": "0x2f2fd63f", "selectorBytes": [ - 175, - 54, - 138, - 8 + 47, + 47, + 214, + 63 ] }, - "group": "filesystem", + "group": "evm", "status": "stable", "safety": "safe" }, { "func": { - "id": "getArtifactPathByCode", - "description": "Gets the artifact path from code (aka. creation code).", - "declaration": "function getArtifactPathByCode(bytes calldata code) external view returns (string memory path);", + "id": "getMappingSlotAt", + "description": "Gets the elements at index idx of the mapping at the given slot, for a given address. The\nindex must be less than the length of the mapping (i.e. the number of keys in the mapping).", + "declaration": "function getMappingSlotAt(address target, bytes32 mappingSlot, uint256 idx) external returns (bytes32 value);", "visibility": "external", - "mutability": "view", - "signature": "getArtifactPathByCode(bytes)", - "selector": "0xeb74848c", + "mutability": "", + "signature": "getMappingSlotAt(address,bytes32,uint256)", + "selector": "0xebc73ab4", "selectorBytes": [ 235, - 116, - 132, - 140 + 199, + 58, + 180 ] }, - "group": "filesystem", + "group": "evm", "status": "stable", "safety": "safe" }, { "func": { - "id": "getArtifactPathByDeployedCode", - "description": "Gets the artifact path from deployed code (aka. runtime code).", - "declaration": "function getArtifactPathByDeployedCode(bytes calldata deployedCode) external view returns (string memory path);", + "id": "getNonce_0", + "description": "Gets the nonce of an account.", + "declaration": "function getNonce(address account) external view returns (uint64 nonce);", "visibility": "external", "mutability": "view", - "signature": "getArtifactPathByDeployedCode(bytes)", - "selector": "0x6d853ba5", + "signature": "getNonce(address)", + "selector": "0x2d0335ab", "selectorBytes": [ - 109, - 133, - 59, - 165 + 45, + 3, + 53, + 171 ] }, - "group": "filesystem", + "group": "evm", "status": "stable", "safety": "safe" }, { "func": { - "id": "getBlobBaseFee", - "description": "Gets the current `block.blobbasefee`.\nYou should use this instead of `block.blobbasefee` if you use `vm.blobBaseFee`, as `block.blobbasefee` is assumed to be constant across a transaction,\nand as a result will get optimized out by the compiler.\nSee https://github.com/foundry-rs/foundry/issues/6180", - "declaration": "function getBlobBaseFee() external view returns (uint256 blobBaseFee);", + "id": "getNonce_1", + "description": "Get the nonce of a `Wallet`.", + "declaration": "function getNonce(Wallet calldata wallet) external returns (uint64 nonce);", "visibility": "external", - "mutability": "view", - "signature": "getBlobBaseFee()", - "selector": "0x1f6d6ef7", + "mutability": "", + "signature": "getNonce((address,uint256,uint256,uint256))", + "selector": "0xa5748aad", "selectorBytes": [ - 31, - 109, - 110, - 247 + 165, + 116, + 138, + 173 ] }, "group": "evm", @@ -6386,38 +6386,38 @@ }, { "func": { - "id": "getBlobhashes", - "description": "Gets the blockhashes from the current transaction.\nNot available on EVM versions before Cancun.\nIf used on unsupported EVM versions it will revert.", - "declaration": "function getBlobhashes() external view returns (bytes32[] memory hashes);", + "id": "getRawBlockHeader", + "description": "Gets the RLP encoded block header for a given block number.\nReturns the block header in the same format as `cast block --raw`.", + "declaration": "function getRawBlockHeader(uint256 blockNumber) external view returns (bytes memory rlpHeader);", "visibility": "external", "mutability": "view", - "signature": "getBlobhashes()", - "selector": "0xf56ff18b", + "signature": "getRawBlockHeader(uint256)", + "selector": "0x2c667606", "selectorBytes": [ - 245, - 111, - 241, - 139 + 44, + 102, + 118, + 6 ] }, "group": "evm", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "getBlockNumber", - "description": "Gets the current `block.number`.\nYou should use this instead of `block.number` if you use `vm.roll`, as `block.number` is assumed to be constant across a transaction,\nand as a result will get optimized out by the compiler.\nSee https://github.com/foundry-rs/foundry/issues/6180", - "declaration": "function getBlockNumber() external view returns (uint256 height);", + "id": "getRecordedLogs", + "description": "Gets all the recorded logs.", + "declaration": "function getRecordedLogs() external returns (Log[] memory logs);", "visibility": "external", - "mutability": "view", - "signature": "getBlockNumber()", - "selector": "0x42cbb15c", + "mutability": "", + "signature": "getRecordedLogs()", + "selector": "0x191553a4", "selectorBytes": [ - 66, - 203, - 177, - 92 + 25, + 21, + 83, + 164 ] }, "group": "evm", @@ -6426,18 +6426,18 @@ }, { "func": { - "id": "getBlockTimestamp", - "description": "Gets the current `block.timestamp`.\nYou should use this instead of `block.timestamp` if you use `vm.warp`, as `block.timestamp` is assumed to be constant across a transaction,\nand as a result will get optimized out by the compiler.\nSee https://github.com/foundry-rs/foundry/issues/6180", - "declaration": "function getBlockTimestamp() external view returns (uint256 timestamp);", + "id": "getStateDiff", + "description": "Returns state diffs from current `vm.startStateDiffRecording` session.", + "declaration": "function getStateDiff() external view returns (string memory diff);", "visibility": "external", "mutability": "view", - "signature": "getBlockTimestamp()", - "selector": "0x796b89b9", + "signature": "getStateDiff()", + "selector": "0x80df01cc", "selectorBytes": [ - 121, - 107, - 137, - 185 + 128, + 223, + 1, + 204 ] }, "group": "evm", @@ -6446,138 +6446,138 @@ }, { "func": { - "id": "getBroadcast", - "description": "Returns the most recent broadcast for the given contract on `chainId` matching `txType`.\nFor example:\nThe most recent deployment can be fetched by passing `txType` as `CREATE` or `CREATE2`.\nThe most recent call can be fetched by passing `txType` as `CALL`.", - "declaration": "function getBroadcast(string calldata contractName, uint64 chainId, BroadcastTxType txType) external view returns (BroadcastTxSummary memory);", + "id": "getStateDiffJson", + "description": "Returns state diffs from current `vm.startStateDiffRecording` session, in json format.", + "declaration": "function getStateDiffJson() external view returns (string memory diff);", "visibility": "external", "mutability": "view", - "signature": "getBroadcast(string,uint64,uint8)", - "selector": "0x3dc90cb3", + "signature": "getStateDiffJson()", + "selector": "0xf54fe009", "selectorBytes": [ - 61, - 201, - 12, - 179 + 245, + 79, + 224, + 9 ] }, - "group": "filesystem", + "group": "evm", "status": "stable", "safety": "safe" }, { "func": { - "id": "getBroadcasts_0", - "description": "Returns all broadcasts for the given contract on `chainId` with the specified `txType`.\nSorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber.", - "declaration": "function getBroadcasts(string calldata contractName, uint64 chainId, BroadcastTxType txType) external view returns (BroadcastTxSummary[] memory);", + "id": "getStorageAccesses", + "description": "Returns an array of `StorageAccess` from current `vm.stateStateDiffRecording` session", + "declaration": "function getStorageAccesses() external view returns (StorageAccess[] memory accesses);", "visibility": "external", "mutability": "view", - "signature": "getBroadcasts(string,uint64,uint8)", - "selector": "0xf7afe919", + "signature": "getStorageAccesses()", + "selector": "0x2899b1d0", "selectorBytes": [ - 247, - 175, - 233, - 25 + 40, + 153, + 177, + 208 ] }, - "group": "filesystem", + "group": "evm", "status": "stable", "safety": "safe" }, { "func": { - "id": "getBroadcasts_1", - "description": "Returns all broadcasts for the given contract on `chainId`.\nSorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber.", - "declaration": "function getBroadcasts(string calldata contractName, uint64 chainId) external view returns (BroadcastTxSummary[] memory);", + "id": "getWallets", + "description": "Returns addresses of available unlocked wallets in the script environment.", + "declaration": "function getWallets() external returns (address[] memory wallets);", "visibility": "external", - "mutability": "view", - "signature": "getBroadcasts(string,uint64)", - "selector": "0xf2fa4a26", + "mutability": "", + "signature": "getWallets()", + "selector": "0xdb7a4605", "selectorBytes": [ - 242, - 250, - 74, - 38 + 219, + 122, + 70, + 5 ] }, - "group": "filesystem", + "group": "scripting", "status": "stable", "safety": "safe" }, { "func": { - "id": "getChain_0", - "description": "Returns a Chain struct for specific alias", - "declaration": "function getChain(string calldata chainAlias) external view returns (Chain memory chain);", + "id": "indexOf", + "description": "Returns the index of the first occurrence of a `key` in an `input` string.\nReturns `NOT_FOUND` (i.e. `type(uint256).max`) if the `key` is not found.\nReturns 0 in case of an empty `key`.", + "declaration": "function indexOf(string calldata input, string calldata key) external pure returns (uint256);", "visibility": "external", - "mutability": "view", - "signature": "getChain(string)", - "selector": "0x4cc1c2bb", + "mutability": "pure", + "signature": "indexOf(string,string)", + "selector": "0x8a0807b7", "selectorBytes": [ - 76, - 193, - 194, - 187 + 138, + 8, + 7, + 183 ] }, - "group": "testing", + "group": "string", "status": "stable", "safety": "safe" }, { "func": { - "id": "getChain_1", - "description": "Returns a Chain struct for specific chainId", - "declaration": "function getChain(uint256 chainId) external view returns (Chain memory chain);", + "id": "interceptInitcode", + "description": "Causes the next contract creation (via new) to fail and return its initcode in the returndata buffer.\nThis allows type-safe access to the initcode payload that would be used for contract creation.\nExample usage:\nvm.interceptInitcode();\nbytes memory initcode;\ntry new MyContract(param1, param2) { assert(false); }\ncatch (bytes memory interceptedInitcode) { initcode = interceptedInitcode; }", + "declaration": "function interceptInitcode() external;", "visibility": "external", - "mutability": "view", - "signature": "getChain(uint256)", - "selector": "0xb6791ad4", + "mutability": "", + "signature": "interceptInitcode()", + "selector": "0x838653c7", "selectorBytes": [ - 182, - 121, - 26, - 212 + 131, + 134, + 83, + 199 ] }, - "group": "testing", + "group": "utilities", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "getCode", - "description": "Gets the creation bytecode from an artifact file. Takes in the relative path to the json file or the path to the\nartifact in the form of :: where and parts are optional.", - "declaration": "function getCode(string calldata artifactPath) external view returns (bytes memory creationBytecode);", + "id": "isContext", + "description": "Returns true if `forge` command was executed in given context.", + "declaration": "function isContext(ForgeContext context) external view returns (bool result);", "visibility": "external", "mutability": "view", - "signature": "getCode(string)", - "selector": "0x8d1cc925", + "signature": "isContext(uint8)", + "selector": "0x64af255d", "selectorBytes": [ - 141, - 28, - 201, - 37 + 100, + 175, + 37, + 93 ] }, - "group": "filesystem", + "group": "environment", "status": "stable", "safety": "safe" }, { "func": { - "id": "getDeployedCode", - "description": "Gets the deployed bytecode from an artifact file. Takes in the relative path to the json file or the path to the\nartifact in the form of :: where and parts are optional.", - "declaration": "function getDeployedCode(string calldata artifactPath) external view returns (bytes memory runtimeBytecode);", + "id": "isDir", + "description": "Returns true if the path exists on disk and is pointing at a directory, else returns false.", + "declaration": "function isDir(string calldata path) external view returns (bool result);", "visibility": "external", "mutability": "view", - "signature": "getDeployedCode(string)", - "selector": "0x3ebf73b4", + "signature": "isDir(string)", + "selector": "0x7d15d019", "selectorBytes": [ - 62, - 191, - 115, - 180 + 125, + 21, + 208, + 25 ] }, "group": "filesystem", @@ -6586,18 +6586,18 @@ }, { "func": { - "id": "getDeployment_0", - "description": "Returns the most recent deployment for the current `chainId`.", - "declaration": "function getDeployment(string calldata contractName) external view returns (address deployedAddress);", + "id": "isFile", + "description": "Returns true if the path exists on disk and is pointing at a regular file, else returns false.", + "declaration": "function isFile(string calldata path) external view returns (bool result);", "visibility": "external", "mutability": "view", - "signature": "getDeployment(string)", - "selector": "0xa8091d97", + "signature": "isFile(string)", + "selector": "0xe0eb04d4", "selectorBytes": [ - 168, - 9, - 29, - 151 + 224, + 235, + 4, + 212 ] }, "group": "filesystem", @@ -6606,118 +6606,120 @@ }, { "func": { - "id": "getDeployment_1", - "description": "Returns the most recent deployment for the given contract on `chainId`", - "declaration": "function getDeployment(string calldata contractName, uint64 chainId) external view returns (address deployedAddress);", + "id": "isPersistent", + "description": "Returns true if the account is marked as persistent.", + "declaration": "function isPersistent(address account) external view returns (bool persistent);", "visibility": "external", "mutability": "view", - "signature": "getDeployment(string,uint64)", - "selector": "0x0debd5d6", + "signature": "isPersistent(address)", + "selector": "0xd92d8efd", "selectorBytes": [ - 13, - 235, - 213, - 214 + 217, + 45, + 142, + 253 ] }, - "group": "filesystem", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "getDeployments", - "description": "Returns all deployments for the given contract on `chainId`\nSorted in descending order of deployment time i.e descending order of BroadcastTxSummary.blockNumber.\nThe most recent deployment is the first element, and the oldest is the last.", - "declaration": "function getDeployments(string calldata contractName, uint64 chainId) external view returns (address[] memory deployedAddresses);", + "id": "keyExists", + "description": "Checks if `key` exists in a JSON object\n`keyExists` is being deprecated in favor of `keyExistsJson`. It will be removed in future versions.", + "declaration": "function keyExists(string calldata json, string calldata key) external view returns (bool);", "visibility": "external", "mutability": "view", - "signature": "getDeployments(string,uint64)", - "selector": "0x74e133dd", + "signature": "keyExists(string,string)", + "selector": "0x528a683c", "selectorBytes": [ - 116, - 225, - 51, - 221 + 82, + 138, + 104, + 60 ] }, - "group": "filesystem", - "status": "stable", + "group": "json", + "status": { + "deprecated": "replaced by `keyExistsJson`" + }, "safety": "safe" }, { "func": { - "id": "getFoundryVersion", - "description": "Returns the Foundry version.\nFormat: -+..\nSample output: 0.3.0-nightly+3cb96bde9b.1737036656.debug\nNote: Build timestamps may vary slightly across platforms due to separate CI jobs.\nFor reliable version comparisons, use UNIX format (e.g., >= 1700000000)\nto compare timestamps while ignoring minor time differences.", - "declaration": "function getFoundryVersion() external view returns (string memory version);", + "id": "keyExistsJson", + "description": "Checks if `key` exists in a JSON object.", + "declaration": "function keyExistsJson(string calldata json, string calldata key) external view returns (bool);", "visibility": "external", "mutability": "view", - "signature": "getFoundryVersion()", - "selector": "0xea991bb5", + "signature": "keyExistsJson(string,string)", + "selector": "0xdb4235f6", "selectorBytes": [ - 234, - 153, - 27, - 181 + 219, + 66, + 53, + 246 ] }, - "group": "testing", + "group": "json", "status": "stable", "safety": "safe" }, { "func": { - "id": "getLabel", - "description": "Gets the label for the specified address.", - "declaration": "function getLabel(address account) external view returns (string memory currentLabel);", + "id": "keyExistsToml", + "description": "Checks if `key` exists in a TOML table.", + "declaration": "function keyExistsToml(string calldata toml, string calldata key) external view returns (bool);", "visibility": "external", "mutability": "view", - "signature": "getLabel(address)", - "selector": "0x28a249b0", + "signature": "keyExistsToml(string,string)", + "selector": "0x600903ad", "selectorBytes": [ - 40, - 162, - 73, - 176 + 96, + 9, + 3, + 173 ] }, - "group": "utilities", + "group": "toml", "status": "stable", "safety": "safe" }, { "func": { - "id": "getMappingKeyAndParentOf", - "description": "Gets the map key and parent of a mapping at a given slot, for a given address.", - "declaration": "function getMappingKeyAndParentOf(address target, bytes32 elementSlot) external returns (bool found, bytes32 key, bytes32 parent);", + "id": "label", + "description": "Labels an address in call traces.", + "declaration": "function label(address account, string calldata newLabel) external;", "visibility": "external", "mutability": "", - "signature": "getMappingKeyAndParentOf(address,bytes32)", - "selector": "0x876e24e6", + "signature": "label(address,string)", + "selector": "0xc657c718", "selectorBytes": [ - 135, - 110, - 36, - 230 + 198, + 87, + 199, + 24 ] }, - "group": "evm", + "group": "utilities", "status": "stable", "safety": "safe" }, { "func": { - "id": "getMappingLength", - "description": "Gets the number of elements in the mapping at the given slot, for a given address.", - "declaration": "function getMappingLength(address target, bytes32 mappingSlot) external returns (uint256 length);", + "id": "lastCallGas", + "description": "Gets the gas used in the last call from the callee perspective.", + "declaration": "function lastCallGas() external view returns (Gas memory gas);", "visibility": "external", - "mutability": "", - "signature": "getMappingLength(address,bytes32)", - "selector": "0x2f2fd63f", + "mutability": "view", + "signature": "lastCallGas()", + "selector": "0x2b589b28", "selectorBytes": [ - 47, - 47, - 214, - 63 + 43, + 88, + 155, + 40 ] }, "group": "evm", @@ -6726,18 +6728,18 @@ }, { "func": { - "id": "getMappingSlotAt", - "description": "Gets the elements at index idx of the mapping at the given slot, for a given address. The\nindex must be less than the length of the mapping (i.e. the number of keys in the mapping).", - "declaration": "function getMappingSlotAt(address target, bytes32 mappingSlot, uint256 idx) external returns (bytes32 value);", + "id": "load", + "description": "Loads a storage slot from an address.", + "declaration": "function load(address target, bytes32 slot) external view returns (bytes32 data);", "visibility": "external", - "mutability": "", - "signature": "getMappingSlotAt(address,bytes32,uint256)", - "selector": "0xebc73ab4", + "mutability": "view", + "signature": "load(address,bytes32)", + "selector": "0x667f9d70", "selectorBytes": [ - 235, - 199, - 58, - 180 + 102, + 127, + 157, + 112 ] }, "group": "evm", @@ -6746,278 +6748,278 @@ }, { "func": { - "id": "getNonce_0", - "description": "Gets the nonce of an account.", - "declaration": "function getNonce(address account) external view returns (uint64 nonce);", + "id": "loadAllocs", + "description": "Load a genesis JSON file's `allocs` into the in-memory EVM state.", + "declaration": "function loadAllocs(string calldata pathToAllocsJson) external;", "visibility": "external", - "mutability": "view", - "signature": "getNonce(address)", - "selector": "0x2d0335ab", + "mutability": "", + "signature": "loadAllocs(string)", + "selector": "0xb3a056d7", "selectorBytes": [ - 45, - 3, - 53, - 171 + 179, + 160, + 86, + 215 ] }, "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "getNonce_1", - "description": "Get the nonce of a `Wallet`.", - "declaration": "function getNonce(Wallet calldata wallet) external returns (uint64 nonce);", + "id": "makePersistent_0", + "description": "Marks that the account(s) should use persistent storage across fork swaps in a multifork setup\nMeaning, changes made to the state of this account will be kept when switching forks.", + "declaration": "function makePersistent(address account) external;", "visibility": "external", "mutability": "", - "signature": "getNonce((address,uint256,uint256,uint256))", - "selector": "0xa5748aad", + "signature": "makePersistent(address)", + "selector": "0x57e22dde", "selectorBytes": [ - 165, - 116, - 138, - 173 + 87, + 226, + 45, + 222 ] }, "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "getRawBlockHeader", - "description": "Gets the RLP encoded block header for a given block number.\nReturns the block header in the same format as `cast block --raw`.", - "declaration": "function getRawBlockHeader(uint256 blockNumber) external view returns (bytes memory rlpHeader);", + "id": "makePersistent_1", + "description": "See `makePersistent(address)`.", + "declaration": "function makePersistent(address account0, address account1) external;", "visibility": "external", - "mutability": "view", - "signature": "getRawBlockHeader(uint256)", - "selector": "0x2c667606", + "mutability": "", + "signature": "makePersistent(address,address)", + "selector": "0x4074e0a8", "selectorBytes": [ - 44, - 102, - 118, - 6 + 64, + 116, + 224, + 168 ] }, "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "getRecordedLogs", - "description": "Gets all the recorded logs.", - "declaration": "function getRecordedLogs() external returns (Log[] memory logs);", + "id": "makePersistent_2", + "description": "See `makePersistent(address)`.", + "declaration": "function makePersistent(address account0, address account1, address account2) external;", "visibility": "external", "mutability": "", - "signature": "getRecordedLogs()", - "selector": "0x191553a4", + "signature": "makePersistent(address,address,address)", + "selector": "0xefb77a75", "selectorBytes": [ - 25, - 21, - 83, - 164 + 239, + 183, + 122, + 117 ] }, "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "getStateDiff", - "description": "Returns state diffs from current `vm.startStateDiffRecording` session.", - "declaration": "function getStateDiff() external view returns (string memory diff);", + "id": "makePersistent_3", + "description": "See `makePersistent(address)`.", + "declaration": "function makePersistent(address[] calldata accounts) external;", "visibility": "external", - "mutability": "view", - "signature": "getStateDiff()", - "selector": "0x80df01cc", + "mutability": "", + "signature": "makePersistent(address[])", + "selector": "0x1d9e269e", "selectorBytes": [ - 128, - 223, - 1, - 204 + 29, + 158, + 38, + 158 ] }, "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "getStateDiffJson", - "description": "Returns state diffs from current `vm.startStateDiffRecording` session, in json format.", - "declaration": "function getStateDiffJson() external view returns (string memory diff);", + "id": "mockCallRevert_0", + "description": "Reverts a call to an address with specified revert data.", + "declaration": "function mockCallRevert(address callee, bytes calldata data, bytes calldata revertData) external;", "visibility": "external", - "mutability": "view", - "signature": "getStateDiffJson()", - "selector": "0xf54fe009", + "mutability": "", + "signature": "mockCallRevert(address,bytes,bytes)", + "selector": "0xdbaad147", "selectorBytes": [ - 245, - 79, - 224, - 9 + 219, + 170, + 209, + 71 ] }, "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "getStorageAccesses", - "description": "Returns an array of `StorageAccess` from current `vm.stateStateDiffRecording` session", - "declaration": "function getStorageAccesses() external view returns (StorageAccess[] memory accesses);", + "id": "mockCallRevert_1", + "description": "Reverts a call to an address with a specific `msg.value`, with specified revert data.", + "declaration": "function mockCallRevert(address callee, uint256 msgValue, bytes calldata data, bytes calldata revertData) external;", "visibility": "external", - "mutability": "view", - "signature": "getStorageAccesses()", - "selector": "0x2899b1d0", + "mutability": "", + "signature": "mockCallRevert(address,uint256,bytes,bytes)", + "selector": "0xd23cd037", "selectorBytes": [ - 40, - 153, - 177, - 208 + 210, + 60, + 208, + 55 ] }, "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "getWallets", - "description": "Returns addresses of available unlocked wallets in the script environment.", - "declaration": "function getWallets() external returns (address[] memory wallets);", + "id": "mockCallRevert_2", + "description": "Reverts a call to an address with specified revert data.\nOverload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.", + "declaration": "function mockCallRevert(address callee, bytes4 data, bytes calldata revertData) external;", "visibility": "external", "mutability": "", - "signature": "getWallets()", - "selector": "0xdb7a4605", + "signature": "mockCallRevert(address,bytes4,bytes)", + "selector": "0x2dfba5df", "selectorBytes": [ - 219, - 122, - 70, - 5 + 45, + 251, + 165, + 223 ] }, - "group": "scripting", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "indexOf", - "description": "Returns the index of the first occurrence of a `key` in an `input` string.\nReturns `NOT_FOUND` (i.e. `type(uint256).max`) if the `key` is not found.\nReturns 0 in case of an empty `key`.", - "declaration": "function indexOf(string calldata input, string calldata key) external pure returns (uint256);", + "id": "mockCallRevert_3", + "description": "Reverts a call to an address with a specific `msg.value`, with specified revert data.\nOverload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.", + "declaration": "function mockCallRevert(address callee, uint256 msgValue, bytes4 data, bytes calldata revertData) external;", "visibility": "external", - "mutability": "pure", - "signature": "indexOf(string,string)", - "selector": "0x8a0807b7", + "mutability": "", + "signature": "mockCallRevert(address,uint256,bytes4,bytes)", + "selector": "0x596c8f04", "selectorBytes": [ - 138, - 8, - 7, - 183 + 89, + 108, + 143, + 4 ] }, - "group": "string", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "interceptInitcode", - "description": "Causes the next contract creation (via new) to fail and return its initcode in the returndata buffer.\nThis allows type-safe access to the initcode payload that would be used for contract creation.\nExample usage:\nvm.interceptInitcode();\nbytes memory initcode;\ntry new MyContract(param1, param2) { assert(false); }\ncatch (bytes memory interceptedInitcode) { initcode = interceptedInitcode; }", - "declaration": "function interceptInitcode() external;", + "id": "mockCall_0", + "description": "Mocks a call to an address, returning specified data.\nCalldata can either be strict or a partial match, e.g. if you only\npass a Solidity selector to the expected calldata, then the entire Solidity\nfunction will be mocked.", + "declaration": "function mockCall(address callee, bytes calldata data, bytes calldata returnData) external;", "visibility": "external", "mutability": "", - "signature": "interceptInitcode()", - "selector": "0x838653c7", + "signature": "mockCall(address,bytes,bytes)", + "selector": "0xb96213e4", "selectorBytes": [ - 131, - 134, - 83, - 199 + 185, + 98, + 19, + 228 ] }, - "group": "utilities", + "group": "evm", "status": "stable", "safety": "unsafe" }, { "func": { - "id": "isContext", - "description": "Returns true if `forge` command was executed in given context.", - "declaration": "function isContext(ForgeContext context) external view returns (bool result);", + "id": "mockCall_1", + "description": "Mocks a call to an address with a specific `msg.value`, returning specified data.\nCalldata match takes precedence over `msg.value` in case of ambiguity.", + "declaration": "function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external;", "visibility": "external", - "mutability": "view", - "signature": "isContext(uint8)", - "selector": "0x64af255d", + "mutability": "", + "signature": "mockCall(address,uint256,bytes,bytes)", + "selector": "0x81409b91", "selectorBytes": [ - 100, - 175, - 37, - 93 + 129, + 64, + 155, + 145 ] }, - "group": "environment", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "isDir", - "description": "Returns true if the path exists on disk and is pointing at a directory, else returns false.", - "declaration": "function isDir(string calldata path) external view returns (bool result);", + "id": "mockCall_2", + "description": "Mocks a call to an address, returning specified data.\nCalldata can either be strict or a partial match, e.g. if you only\npass a Solidity selector to the expected calldata, then the entire Solidity\nfunction will be mocked.\nOverload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.", + "declaration": "function mockCall(address callee, bytes4 data, bytes calldata returnData) external;", "visibility": "external", - "mutability": "view", - "signature": "isDir(string)", - "selector": "0x7d15d019", + "mutability": "", + "signature": "mockCall(address,bytes4,bytes)", + "selector": "0x08e0c537", "selectorBytes": [ - 125, - 21, - 208, - 25 + 8, + 224, + 197, + 55 ] }, - "group": "filesystem", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "isFile", - "description": "Returns true if the path exists on disk and is pointing at a regular file, else returns false.", - "declaration": "function isFile(string calldata path) external view returns (bool result);", + "id": "mockCall_3", + "description": "Mocks a call to an address with a specific `msg.value`, returning specified data.\nCalldata match takes precedence over `msg.value` in case of ambiguity.\nOverload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.", + "declaration": "function mockCall(address callee, uint256 msgValue, bytes4 data, bytes calldata returnData) external;", "visibility": "external", - "mutability": "view", - "signature": "isFile(string)", - "selector": "0xe0eb04d4", + "mutability": "", + "signature": "mockCall(address,uint256,bytes4,bytes)", + "selector": "0xe7b36a3d", "selectorBytes": [ - 224, - 235, - 4, - 212 + 231, + 179, + 106, + 61 ] }, - "group": "filesystem", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "isPersistent", - "description": "Returns true if the account is marked as persistent.", - "declaration": "function isPersistent(address account) external view returns (bool persistent);", + "id": "mockCalls_0", + "description": "Mocks multiple calls to an address, returning specified data for each call.", + "declaration": "function mockCalls(address callee, bytes calldata data, bytes[] calldata returnData) external;", "visibility": "external", - "mutability": "view", - "signature": "isPersistent(address)", - "selector": "0xd92d8efd", + "mutability": "", + "signature": "mockCalls(address,bytes,bytes[])", + "selector": "0x5c5c3de9", "selectorBytes": [ - 217, - 45, - 142, - 253 + 92, + 92, + 61, + 233 ] }, "group": "evm", @@ -7026,2003 +7028,2281 @@ }, { "func": { - "id": "keyExists", - "description": "Checks if `key` exists in a JSON object\n`keyExists` is being deprecated in favor of `keyExistsJson`. It will be removed in future versions.", - "declaration": "function keyExists(string calldata json, string calldata key) external view returns (bool);", + "id": "mockCalls_1", + "description": "Mocks multiple calls to an address with a specific `msg.value`, returning specified data for each call.", + "declaration": "function mockCalls(address callee, uint256 msgValue, bytes calldata data, bytes[] calldata returnData) external;", "visibility": "external", - "mutability": "view", - "signature": "keyExists(string,string)", - "selector": "0x528a683c", + "mutability": "", + "signature": "mockCalls(address,uint256,bytes,bytes[])", + "selector": "0x08bcbae1", "selectorBytes": [ - 82, - 138, - 104, - 60 + 8, + 188, + 186, + 225 ] }, - "group": "json", - "status": { - "deprecated": "replaced by `keyExistsJson`" - }, - "safety": "safe" + "group": "evm", + "status": "stable", + "safety": "unsafe" }, { "func": { - "id": "keyExistsJson", - "description": "Checks if `key` exists in a JSON object.", - "declaration": "function keyExistsJson(string calldata json, string calldata key) external view returns (bool);", + "id": "mockFunction", + "description": "Whenever a call is made to `callee` with calldata `data`, this cheatcode instead calls\n`target` with the same calldata. This functionality is similar to a delegate call made to\n`target` contract from `callee`.\nCan be used to substitute a call to a function with another implementation that captures\nthe primary logic of the original function but is easier to reason about.\nIf calldata is not a strict match then partial match by selector is attempted.", + "declaration": "function mockFunction(address callee, address target, bytes calldata data) external;", "visibility": "external", - "mutability": "view", - "signature": "keyExistsJson(string,string)", - "selector": "0xdb4235f6", + "mutability": "", + "signature": "mockFunction(address,address,bytes)", + "selector": "0xadf84d21", "selectorBytes": [ - 219, - 66, - 53, - 246 + 173, + 248, + 77, + 33 ] }, - "group": "json", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "keyExistsToml", - "description": "Checks if `key` exists in a TOML table.", - "declaration": "function keyExistsToml(string calldata toml, string calldata key) external view returns (bool);", + "id": "noAccessList", + "description": "Utility cheatcode to remove any EIP-2930 access list set by `accessList` cheatcode.", + "declaration": "function noAccessList() external;", "visibility": "external", - "mutability": "view", - "signature": "keyExistsToml(string,string)", - "selector": "0x600903ad", + "mutability": "", + "signature": "noAccessList()", + "selector": "0x238ad778", "selectorBytes": [ - 96, - 9, - 3, - 173 + 35, + 138, + 215, + 120 ] }, - "group": "toml", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "label", - "description": "Labels an address in call traces.", - "declaration": "function label(address account, string calldata newLabel) external;", + "id": "parseAddress", + "description": "Parses the given `string` into an `address`.", + "declaration": "function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue);", "visibility": "external", - "mutability": "", - "signature": "label(address,string)", - "selector": "0xc657c718", + "mutability": "pure", + "signature": "parseAddress(string)", + "selector": "0xc6ce059d", "selectorBytes": [ 198, - 87, - 199, - 24 + 206, + 5, + 157 ] }, - "group": "utilities", + "group": "string", "status": "stable", "safety": "safe" }, { "func": { - "id": "lastCallGas", - "description": "Gets the gas used in the last call from the callee perspective.", - "declaration": "function lastCallGas() external view returns (Gas memory gas);", + "id": "parseBool", + "description": "Parses the given `string` into a `bool`.", + "declaration": "function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue);", "visibility": "external", - "mutability": "view", - "signature": "lastCallGas()", - "selector": "0x2b589b28", + "mutability": "pure", + "signature": "parseBool(string)", + "selector": "0x974ef924", "selectorBytes": [ - 43, - 88, - 155, - 40 + 151, + 78, + 249, + 36 ] }, - "group": "evm", + "group": "string", "status": "stable", "safety": "safe" }, { "func": { - "id": "load", - "description": "Loads a storage slot from an address.", - "declaration": "function load(address target, bytes32 slot) external view returns (bytes32 data);", + "id": "parseBytes", + "description": "Parses the given `string` into `bytes`.", + "declaration": "function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue);", "visibility": "external", - "mutability": "view", - "signature": "load(address,bytes32)", - "selector": "0x667f9d70", + "mutability": "pure", + "signature": "parseBytes(string)", + "selector": "0x8f5d232d", "selectorBytes": [ - 102, - 127, - 157, - 112 + 143, + 93, + 35, + 45 ] }, - "group": "evm", + "group": "string", "status": "stable", "safety": "safe" }, { "func": { - "id": "loadAllocs", - "description": "Load a genesis JSON file's `allocs` into the in-memory EVM state.", - "declaration": "function loadAllocs(string calldata pathToAllocsJson) external;", + "id": "parseBytes32", + "description": "Parses the given `string` into a `bytes32`.", + "declaration": "function parseBytes32(string calldata stringifiedValue) external pure returns (bytes32 parsedValue);", "visibility": "external", - "mutability": "", - "signature": "loadAllocs(string)", - "selector": "0xb3a056d7", + "mutability": "pure", + "signature": "parseBytes32(string)", + "selector": "0x087e6e81", "selectorBytes": [ - 179, - 160, - 86, - 215 + 8, + 126, + 110, + 129 ] }, - "group": "evm", + "group": "string", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "makePersistent_0", - "description": "Marks that the account(s) should use persistent storage across fork swaps in a multifork setup\nMeaning, changes made to the state of this account will be kept when switching forks.", - "declaration": "function makePersistent(address account) external;", + "id": "parseInt", + "description": "Parses the given `string` into a `int256`.", + "declaration": "function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue);", "visibility": "external", - "mutability": "", - "signature": "makePersistent(address)", - "selector": "0x57e22dde", + "mutability": "pure", + "signature": "parseInt(string)", + "selector": "0x42346c5e", "selectorBytes": [ - 87, - 226, - 45, - 222 + 66, + 52, + 108, + 94 ] }, - "group": "evm", + "group": "string", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "makePersistent_1", - "description": "See `makePersistent(address)`.", - "declaration": "function makePersistent(address account0, address account1) external;", + "id": "parseJsonAddress", + "description": "Parses a string of JSON data at `key` and coerces it to `address`.", + "declaration": "function parseJsonAddress(string calldata json, string calldata key) external pure returns (address);", "visibility": "external", - "mutability": "", - "signature": "makePersistent(address,address)", - "selector": "0x4074e0a8", + "mutability": "pure", + "signature": "parseJsonAddress(string,string)", + "selector": "0x1e19e657", "selectorBytes": [ - 64, - 116, - 224, - 168 + 30, + 25, + 230, + 87 ] }, - "group": "evm", + "group": "json", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "makePersistent_2", - "description": "See `makePersistent(address)`.", - "declaration": "function makePersistent(address account0, address account1, address account2) external;", + "id": "parseJsonAddressArray", + "description": "Parses a string of JSON data at `key` and coerces it to `address[]`.", + "declaration": "function parseJsonAddressArray(string calldata json, string calldata key) external pure returns (address[] memory);", "visibility": "external", - "mutability": "", - "signature": "makePersistent(address,address,address)", - "selector": "0xefb77a75", + "mutability": "pure", + "signature": "parseJsonAddressArray(string,string)", + "selector": "0x2fce7883", "selectorBytes": [ - 239, - 183, - 122, - 117 + 47, + 206, + 120, + 131 ] }, - "group": "evm", + "group": "json", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "makePersistent_3", - "description": "See `makePersistent(address)`.", - "declaration": "function makePersistent(address[] calldata accounts) external;", + "id": "parseJsonBool", + "description": "Parses a string of JSON data at `key` and coerces it to `bool`.", + "declaration": "function parseJsonBool(string calldata json, string calldata key) external pure returns (bool);", "visibility": "external", - "mutability": "", - "signature": "makePersistent(address[])", - "selector": "0x1d9e269e", + "mutability": "pure", + "signature": "parseJsonBool(string,string)", + "selector": "0x9f86dc91", + "selectorBytes": [ + 159, + 134, + 220, + 145 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonBoolArray", + "description": "Parses a string of JSON data at `key` and coerces it to `bool[]`.", + "declaration": "function parseJsonBoolArray(string calldata json, string calldata key) external pure returns (bool[] memory);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonBoolArray(string,string)", + "selector": "0x91f3b94f", + "selectorBytes": [ + 145, + 243, + 185, + 79 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonBytes", + "description": "Parses a string of JSON data at `key` and coerces it to `bytes`.", + "declaration": "function parseJsonBytes(string calldata json, string calldata key) external pure returns (bytes memory);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonBytes(string,string)", + "selector": "0xfd921be8", + "selectorBytes": [ + 253, + 146, + 27, + 232 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonBytes32", + "description": "Parses a string of JSON data at `key` and coerces it to `bytes32`.", + "declaration": "function parseJsonBytes32(string calldata json, string calldata key) external pure returns (bytes32);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonBytes32(string,string)", + "selector": "0x1777e59d", + "selectorBytes": [ + 23, + 119, + 229, + 157 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonBytes32Array", + "description": "Parses a string of JSON data at `key` and coerces it to `bytes32[]`.", + "declaration": "function parseJsonBytes32Array(string calldata json, string calldata key) external pure returns (bytes32[] memory);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonBytes32Array(string,string)", + "selector": "0x91c75bc3", + "selectorBytes": [ + 145, + 199, + 91, + 195 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonBytesArray", + "description": "Parses a string of JSON data at `key` and coerces it to `bytes[]`.", + "declaration": "function parseJsonBytesArray(string calldata json, string calldata key) external pure returns (bytes[] memory);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonBytesArray(string,string)", + "selector": "0x6631aa99", + "selectorBytes": [ + 102, + 49, + 170, + 153 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonInt", + "description": "Parses a string of JSON data at `key` and coerces it to `int256`.", + "declaration": "function parseJsonInt(string calldata json, string calldata key) external pure returns (int256);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonInt(string,string)", + "selector": "0x7b048ccd", + "selectorBytes": [ + 123, + 4, + 140, + 205 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonIntArray", + "description": "Parses a string of JSON data at `key` and coerces it to `int256[]`.", + "declaration": "function parseJsonIntArray(string calldata json, string calldata key) external pure returns (int256[] memory);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonIntArray(string,string)", + "selector": "0x9983c28a", + "selectorBytes": [ + 153, + 131, + 194, + 138 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonKeys", + "description": "Returns an array of all the keys in a JSON object.", + "declaration": "function parseJsonKeys(string calldata json, string calldata key) external pure returns (string[] memory keys);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonKeys(string,string)", + "selector": "0x213e4198", + "selectorBytes": [ + 33, + 62, + 65, + 152 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonString", + "description": "Parses a string of JSON data at `key` and coerces it to `string`.", + "declaration": "function parseJsonString(string calldata json, string calldata key) external pure returns (string memory);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonString(string,string)", + "selector": "0x49c4fac8", + "selectorBytes": [ + 73, + 196, + 250, + 200 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonStringArray", + "description": "Parses a string of JSON data at `key` and coerces it to `string[]`.", + "declaration": "function parseJsonStringArray(string calldata json, string calldata key) external pure returns (string[] memory);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonStringArray(string,string)", + "selector": "0x498fdcf4", + "selectorBytes": [ + 73, + 143, + 220, + 244 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonTypeArray", + "description": "Parses a string of JSON data at `key` and coerces it to type array corresponding to `typeDescription`.", + "declaration": "function parseJsonTypeArray(string calldata json, string calldata key, string calldata typeDescription) external pure returns (bytes memory);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonTypeArray(string,string,string)", + "selector": "0x0175d535", + "selectorBytes": [ + 1, + 117, + 213, + 53 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonType_0", + "description": "Parses a string of JSON data and coerces it to type corresponding to `typeDescription`.", + "declaration": "function parseJsonType(string calldata json, string calldata typeDescription) external pure returns (bytes memory);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonType(string,string)", + "selector": "0xa9da313b", + "selectorBytes": [ + 169, + 218, + 49, + 59 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonType_1", + "description": "Parses a string of JSON data at `key` and coerces it to type corresponding to `typeDescription`.", + "declaration": "function parseJsonType(string calldata json, string calldata key, string calldata typeDescription) external pure returns (bytes memory);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonType(string,string,string)", + "selector": "0xe3f5ae33", + "selectorBytes": [ + 227, + 245, + 174, + 51 + ] + }, + "group": "json", + "status": "stable", + "safety": "safe" + }, + { + "func": { + "id": "parseJsonUint", + "description": "Parses a string of JSON data at `key` and coerces it to `uint256`.", + "declaration": "function parseJsonUint(string calldata json, string calldata key) external pure returns (uint256);", + "visibility": "external", + "mutability": "pure", + "signature": "parseJsonUint(string,string)", + "selector": "0xaddde2b6", "selectorBytes": [ - 29, - 158, - 38, - 158 + 173, + 221, + 226, + 182 ] }, - "group": "evm", + "group": "json", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "mockCallRevert_0", - "description": "Reverts a call to an address with specified revert data.", - "declaration": "function mockCallRevert(address callee, bytes calldata data, bytes calldata revertData) external;", + "id": "parseJsonUintArray", + "description": "Parses a string of JSON data at `key` and coerces it to `uint256[]`.", + "declaration": "function parseJsonUintArray(string calldata json, string calldata key) external pure returns (uint256[] memory);", "visibility": "external", - "mutability": "", - "signature": "mockCallRevert(address,bytes,bytes)", - "selector": "0xdbaad147", + "mutability": "pure", + "signature": "parseJsonUintArray(string,string)", + "selector": "0x522074ab", "selectorBytes": [ - 219, - 170, - 209, - 71 + 82, + 32, + 116, + 171 ] }, - "group": "evm", + "group": "json", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "mockCallRevert_1", - "description": "Reverts a call to an address with a specific `msg.value`, with specified revert data.", - "declaration": "function mockCallRevert(address callee, uint256 msgValue, bytes calldata data, bytes calldata revertData) external;", + "id": "parseJson_0", + "description": "ABI-encodes a JSON object.", + "declaration": "function parseJson(string calldata json) external pure returns (bytes memory abiEncodedData);", "visibility": "external", - "mutability": "", - "signature": "mockCallRevert(address,uint256,bytes,bytes)", - "selector": "0xd23cd037", + "mutability": "pure", + "signature": "parseJson(string)", + "selector": "0x6a82600a", "selectorBytes": [ - 210, - 60, - 208, - 55 + 106, + 130, + 96, + 10 ] }, - "group": "evm", + "group": "json", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "mockCallRevert_2", - "description": "Reverts a call to an address with specified revert data.\nOverload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.", - "declaration": "function mockCallRevert(address callee, bytes4 data, bytes calldata revertData) external;", + "id": "parseJson_1", + "description": "ABI-encodes a JSON object at `key`.", + "declaration": "function parseJson(string calldata json, string calldata key) external pure returns (bytes memory abiEncodedData);", "visibility": "external", - "mutability": "", - "signature": "mockCallRevert(address,bytes4,bytes)", - "selector": "0x2dfba5df", + "mutability": "pure", + "signature": "parseJson(string,string)", + "selector": "0x85940ef1", "selectorBytes": [ - 45, - 251, - 165, - 223 + 133, + 148, + 14, + 241 ] }, - "group": "evm", + "group": "json", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "mockCallRevert_3", - "description": "Reverts a call to an address with a specific `msg.value`, with specified revert data.\nOverload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.", - "declaration": "function mockCallRevert(address callee, uint256 msgValue, bytes4 data, bytes calldata revertData) external;", + "id": "parseTomlAddress", + "description": "Parses a string of TOML data at `key` and coerces it to `address`.", + "declaration": "function parseTomlAddress(string calldata toml, string calldata key) external pure returns (address);", "visibility": "external", - "mutability": "", - "signature": "mockCallRevert(address,uint256,bytes4,bytes)", - "selector": "0x596c8f04", + "mutability": "pure", + "signature": "parseTomlAddress(string,string)", + "selector": "0x65e7c844", "selectorBytes": [ - 89, - 108, - 143, - 4 + 101, + 231, + 200, + 68 ] }, - "group": "evm", + "group": "toml", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "mockCall_0", - "description": "Mocks a call to an address, returning specified data.\nCalldata can either be strict or a partial match, e.g. if you only\npass a Solidity selector to the expected calldata, then the entire Solidity\nfunction will be mocked.", - "declaration": "function mockCall(address callee, bytes calldata data, bytes calldata returnData) external;", + "id": "parseTomlAddressArray", + "description": "Parses a string of TOML data at `key` and coerces it to `address[]`.", + "declaration": "function parseTomlAddressArray(string calldata toml, string calldata key) external pure returns (address[] memory);", "visibility": "external", - "mutability": "", - "signature": "mockCall(address,bytes,bytes)", - "selector": "0xb96213e4", + "mutability": "pure", + "signature": "parseTomlAddressArray(string,string)", + "selector": "0x65c428e7", "selectorBytes": [ - 185, - 98, - 19, - 228 + 101, + 196, + 40, + 231 ] }, - "group": "evm", + "group": "toml", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "mockCall_1", - "description": "Mocks a call to an address with a specific `msg.value`, returning specified data.\nCalldata match takes precedence over `msg.value` in case of ambiguity.", - "declaration": "function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external;", + "id": "parseTomlBool", + "description": "Parses a string of TOML data at `key` and coerces it to `bool`.", + "declaration": "function parseTomlBool(string calldata toml, string calldata key) external pure returns (bool);", "visibility": "external", - "mutability": "", - "signature": "mockCall(address,uint256,bytes,bytes)", - "selector": "0x81409b91", + "mutability": "pure", + "signature": "parseTomlBool(string,string)", + "selector": "0xd30dced6", "selectorBytes": [ - 129, - 64, - 155, - 145 + 211, + 13, + 206, + 214 ] }, - "group": "evm", + "group": "toml", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "mockCall_2", - "description": "Mocks a call to an address, returning specified data.\nCalldata can either be strict or a partial match, e.g. if you only\npass a Solidity selector to the expected calldata, then the entire Solidity\nfunction will be mocked.\nOverload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.", - "declaration": "function mockCall(address callee, bytes4 data, bytes calldata returnData) external;", + "id": "parseTomlBoolArray", + "description": "Parses a string of TOML data at `key` and coerces it to `bool[]`.", + "declaration": "function parseTomlBoolArray(string calldata toml, string calldata key) external pure returns (bool[] memory);", "visibility": "external", - "mutability": "", - "signature": "mockCall(address,bytes4,bytes)", - "selector": "0x08e0c537", + "mutability": "pure", + "signature": "parseTomlBoolArray(string,string)", + "selector": "0x127cfe9a", "selectorBytes": [ - 8, - 224, - 197, - 55 + 18, + 124, + 254, + 154 ] }, - "group": "evm", + "group": "toml", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "mockCall_3", - "description": "Mocks a call to an address with a specific `msg.value`, returning specified data.\nCalldata match takes precedence over `msg.value` in case of ambiguity.\nOverload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.", - "declaration": "function mockCall(address callee, uint256 msgValue, bytes4 data, bytes calldata returnData) external;", + "id": "parseTomlBytes", + "description": "Parses a string of TOML data at `key` and coerces it to `bytes`.", + "declaration": "function parseTomlBytes(string calldata toml, string calldata key) external pure returns (bytes memory);", "visibility": "external", - "mutability": "", - "signature": "mockCall(address,uint256,bytes4,bytes)", - "selector": "0xe7b36a3d", + "mutability": "pure", + "signature": "parseTomlBytes(string,string)", + "selector": "0xd77bfdb9", "selectorBytes": [ - 231, - 179, - 106, - 61 + 215, + 123, + 253, + 185 ] }, - "group": "evm", + "group": "toml", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "mockCalls_0", - "description": "Mocks multiple calls to an address, returning specified data for each call.", - "declaration": "function mockCalls(address callee, bytes calldata data, bytes[] calldata returnData) external;", + "id": "parseTomlBytes32", + "description": "Parses a string of TOML data at `key` and coerces it to `bytes32`.", + "declaration": "function parseTomlBytes32(string calldata toml, string calldata key) external pure returns (bytes32);", "visibility": "external", - "mutability": "", - "signature": "mockCalls(address,bytes,bytes[])", - "selector": "0x5c5c3de9", + "mutability": "pure", + "signature": "parseTomlBytes32(string,string)", + "selector": "0x8e214810", "selectorBytes": [ - 92, - 92, - 61, - 233 + 142, + 33, + 72, + 16 ] }, - "group": "evm", + "group": "toml", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "mockCalls_1", - "description": "Mocks multiple calls to an address with a specific `msg.value`, returning specified data for each call.", - "declaration": "function mockCalls(address callee, uint256 msgValue, bytes calldata data, bytes[] calldata returnData) external;", + "id": "parseTomlBytes32Array", + "description": "Parses a string of TOML data at `key` and coerces it to `bytes32[]`.", + "declaration": "function parseTomlBytes32Array(string calldata toml, string calldata key) external pure returns (bytes32[] memory);", "visibility": "external", - "mutability": "", - "signature": "mockCalls(address,uint256,bytes,bytes[])", - "selector": "0x08bcbae1", + "mutability": "pure", + "signature": "parseTomlBytes32Array(string,string)", + "selector": "0x3e716f81", "selectorBytes": [ - 8, - 188, - 186, - 225 + 62, + 113, + 111, + 129 ] }, - "group": "evm", + "group": "toml", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "mockFunction", - "description": "Whenever a call is made to `callee` with calldata `data`, this cheatcode instead calls\n`target` with the same calldata. This functionality is similar to a delegate call made to\n`target` contract from `callee`.\nCan be used to substitute a call to a function with another implementation that captures\nthe primary logic of the original function but is easier to reason about.\nIf calldata is not a strict match then partial match by selector is attempted.", - "declaration": "function mockFunction(address callee, address target, bytes calldata data) external;", + "id": "parseTomlBytesArray", + "description": "Parses a string of TOML data at `key` and coerces it to `bytes[]`.", + "declaration": "function parseTomlBytesArray(string calldata toml, string calldata key) external pure returns (bytes[] memory);", "visibility": "external", - "mutability": "", - "signature": "mockFunction(address,address,bytes)", - "selector": "0xadf84d21", + "mutability": "pure", + "signature": "parseTomlBytesArray(string,string)", + "selector": "0xb197c247", "selectorBytes": [ - 173, - 248, - 77, - 33 + 177, + 151, + 194, + 71 ] }, - "group": "evm", + "group": "toml", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "noAccessList", - "description": "Utility cheatcode to remove any EIP-2930 access list set by `accessList` cheatcode.", - "declaration": "function noAccessList() external;", + "id": "parseTomlInt", + "description": "Parses a string of TOML data at `key` and coerces it to `int256`.", + "declaration": "function parseTomlInt(string calldata toml, string calldata key) external pure returns (int256);", "visibility": "external", - "mutability": "", - "signature": "noAccessList()", - "selector": "0x238ad778", + "mutability": "pure", + "signature": "parseTomlInt(string,string)", + "selector": "0xc1350739", "selectorBytes": [ - 35, - 138, - 215, - 120 + 193, + 53, + 7, + 57 ] }, - "group": "evm", + "group": "toml", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "parseAddress", - "description": "Parses the given `string` into an `address`.", - "declaration": "function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue);", + "id": "parseTomlIntArray", + "description": "Parses a string of TOML data at `key` and coerces it to `int256[]`.", + "declaration": "function parseTomlIntArray(string calldata toml, string calldata key) external pure returns (int256[] memory);", "visibility": "external", "mutability": "pure", - "signature": "parseAddress(string)", - "selector": "0xc6ce059d", + "signature": "parseTomlIntArray(string,string)", + "selector": "0xd3522ae6", "selectorBytes": [ - 198, - 206, - 5, - 157 + 211, + 82, + 42, + 230 ] }, - "group": "string", + "group": "toml", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseBool", - "description": "Parses the given `string` into a `bool`.", - "declaration": "function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue);", + "id": "parseTomlKeys", + "description": "Returns an array of all the keys in a TOML table.", + "declaration": "function parseTomlKeys(string calldata toml, string calldata key) external pure returns (string[] memory keys);", "visibility": "external", "mutability": "pure", - "signature": "parseBool(string)", - "selector": "0x974ef924", + "signature": "parseTomlKeys(string,string)", + "selector": "0x812a44b2", "selectorBytes": [ - 151, - 78, - 249, - 36 + 129, + 42, + 68, + 178 ] }, - "group": "string", + "group": "toml", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseBytes", - "description": "Parses the given `string` into `bytes`.", - "declaration": "function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue);", + "id": "parseTomlString", + "description": "Parses a string of TOML data at `key` and coerces it to `string`.", + "declaration": "function parseTomlString(string calldata toml, string calldata key) external pure returns (string memory);", "visibility": "external", "mutability": "pure", - "signature": "parseBytes(string)", - "selector": "0x8f5d232d", + "signature": "parseTomlString(string,string)", + "selector": "0x8bb8dd43", "selectorBytes": [ - 143, - 93, - 35, - 45 + 139, + 184, + 221, + 67 ] }, - "group": "string", + "group": "toml", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseBytes32", - "description": "Parses the given `string` into a `bytes32`.", - "declaration": "function parseBytes32(string calldata stringifiedValue) external pure returns (bytes32 parsedValue);", + "id": "parseTomlStringArray", + "description": "Parses a string of TOML data at `key` and coerces it to `string[]`.", + "declaration": "function parseTomlStringArray(string calldata toml, string calldata key) external pure returns (string[] memory);", "visibility": "external", "mutability": "pure", - "signature": "parseBytes32(string)", - "selector": "0x087e6e81", + "signature": "parseTomlStringArray(string,string)", + "selector": "0x9f629281", "selectorBytes": [ - 8, - 126, - 110, + 159, + 98, + 146, 129 ] }, - "group": "string", + "group": "toml", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseInt", - "description": "Parses the given `string` into a `int256`.", - "declaration": "function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue);", + "id": "parseTomlTypeArray", + "description": "Parses a string of TOML data at `key` and coerces it to type array corresponding to `typeDescription`.", + "declaration": "function parseTomlTypeArray(string calldata toml, string calldata key, string calldata typeDescription) external pure returns (bytes memory);", "visibility": "external", "mutability": "pure", - "signature": "parseInt(string)", - "selector": "0x42346c5e", + "signature": "parseTomlTypeArray(string,string,string)", + "selector": "0x49be3743", "selectorBytes": [ - 66, - 52, - 108, - 94 + 73, + 190, + 55, + 67 ] }, - "group": "string", + "group": "toml", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJsonAddress", - "description": "Parses a string of JSON data at `key` and coerces it to `address`.", - "declaration": "function parseJsonAddress(string calldata json, string calldata key) external pure returns (address);", + "id": "parseTomlType_0", + "description": "Parses a string of TOML data and coerces it to type corresponding to `typeDescription`.", + "declaration": "function parseTomlType(string calldata toml, string calldata typeDescription) external pure returns (bytes memory);", "visibility": "external", "mutability": "pure", - "signature": "parseJsonAddress(string,string)", - "selector": "0x1e19e657", + "signature": "parseTomlType(string,string)", + "selector": "0x47fa5e11", "selectorBytes": [ - 30, - 25, - 230, - 87 + 71, + 250, + 94, + 17 ] }, - "group": "json", + "group": "toml", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJsonAddressArray", - "description": "Parses a string of JSON data at `key` and coerces it to `address[]`.", - "declaration": "function parseJsonAddressArray(string calldata json, string calldata key) external pure returns (address[] memory);", + "id": "parseTomlType_1", + "description": "Parses a string of TOML data at `key` and coerces it to type corresponding to `typeDescription`.", + "declaration": "function parseTomlType(string calldata toml, string calldata key, string calldata typeDescription) external pure returns (bytes memory);", "visibility": "external", "mutability": "pure", - "signature": "parseJsonAddressArray(string,string)", - "selector": "0x2fce7883", + "signature": "parseTomlType(string,string,string)", + "selector": "0xf9fa5cdb", "selectorBytes": [ - 47, - 206, - 120, - 131 + 249, + 250, + 92, + 219 ] }, - "group": "json", + "group": "toml", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJsonBool", - "description": "Parses a string of JSON data at `key` and coerces it to `bool`.", - "declaration": "function parseJsonBool(string calldata json, string calldata key) external pure returns (bool);", + "id": "parseTomlUint", + "description": "Parses a string of TOML data at `key` and coerces it to `uint256`.", + "declaration": "function parseTomlUint(string calldata toml, string calldata key) external pure returns (uint256);", "visibility": "external", "mutability": "pure", - "signature": "parseJsonBool(string,string)", - "selector": "0x9f86dc91", + "signature": "parseTomlUint(string,string)", + "selector": "0xcc7b0487", "selectorBytes": [ - 159, - 134, - 220, - 145 + 204, + 123, + 4, + 135 ] }, - "group": "json", + "group": "toml", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJsonBoolArray", - "description": "Parses a string of JSON data at `key` and coerces it to `bool[]`.", - "declaration": "function parseJsonBoolArray(string calldata json, string calldata key) external pure returns (bool[] memory);", + "id": "parseTomlUintArray", + "description": "Parses a string of TOML data at `key` and coerces it to `uint256[]`.", + "declaration": "function parseTomlUintArray(string calldata toml, string calldata key) external pure returns (uint256[] memory);", "visibility": "external", "mutability": "pure", - "signature": "parseJsonBoolArray(string,string)", - "selector": "0x91f3b94f", + "signature": "parseTomlUintArray(string,string)", + "selector": "0xb5df27c8", "selectorBytes": [ - 145, - 243, - 185, - 79 + 181, + 223, + 39, + 200 ] }, - "group": "json", + "group": "toml", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJsonBytes", - "description": "Parses a string of JSON data at `key` and coerces it to `bytes`.", - "declaration": "function parseJsonBytes(string calldata json, string calldata key) external pure returns (bytes memory);", + "id": "parseToml_0", + "description": "ABI-encodes a TOML table.", + "declaration": "function parseToml(string calldata toml) external pure returns (bytes memory abiEncodedData);", "visibility": "external", "mutability": "pure", - "signature": "parseJsonBytes(string,string)", - "selector": "0xfd921be8", + "signature": "parseToml(string)", + "selector": "0x592151f0", "selectorBytes": [ - 253, - 146, - 27, - 232 + 89, + 33, + 81, + 240 ] }, - "group": "json", + "group": "toml", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJsonBytes32", - "description": "Parses a string of JSON data at `key` and coerces it to `bytes32`.", - "declaration": "function parseJsonBytes32(string calldata json, string calldata key) external pure returns (bytes32);", + "id": "parseToml_1", + "description": "ABI-encodes a TOML table at `key`.", + "declaration": "function parseToml(string calldata toml, string calldata key) external pure returns (bytes memory abiEncodedData);", "visibility": "external", "mutability": "pure", - "signature": "parseJsonBytes32(string,string)", - "selector": "0x1777e59d", + "signature": "parseToml(string,string)", + "selector": "0x37736e08", "selectorBytes": [ - 23, - 119, - 229, - 157 + 55, + 115, + 110, + 8 ] }, - "group": "json", + "group": "toml", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJsonBytes32Array", - "description": "Parses a string of JSON data at `key` and coerces it to `bytes32[]`.", - "declaration": "function parseJsonBytes32Array(string calldata json, string calldata key) external pure returns (bytes32[] memory);", + "id": "parseUint", + "description": "Parses the given `string` into a `uint256`.", + "declaration": "function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue);", "visibility": "external", "mutability": "pure", - "signature": "parseJsonBytes32Array(string,string)", - "selector": "0x91c75bc3", + "signature": "parseUint(string)", + "selector": "0xfa91454d", "selectorBytes": [ + 250, 145, - 199, - 91, - 195 + 69, + 77 ] }, - "group": "json", + "group": "string", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJsonBytesArray", - "description": "Parses a string of JSON data at `key` and coerces it to `bytes[]`.", - "declaration": "function parseJsonBytesArray(string calldata json, string calldata key) external pure returns (bytes[] memory);", + "id": "pauseGasMetering", + "description": "Pauses gas metering (i.e. gas usage is not counted). Noop if already paused.", + "declaration": "function pauseGasMetering() external;", "visibility": "external", - "mutability": "pure", - "signature": "parseJsonBytesArray(string,string)", - "selector": "0x6631aa99", + "mutability": "", + "signature": "pauseGasMetering()", + "selector": "0xd1a5b36f", "selectorBytes": [ - 102, - 49, - 170, - 153 + 209, + 165, + 179, + 111 ] }, - "group": "json", + "group": "evm", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJsonInt", - "description": "Parses a string of JSON data at `key` and coerces it to `int256`.", - "declaration": "function parseJsonInt(string calldata json, string calldata key) external pure returns (int256);", + "id": "pauseTracing", + "description": "Pauses collection of call traces. Useful in cases when you want to skip tracing of\ncomplex calls which are not useful for debugging.", + "declaration": "function pauseTracing() external view;", "visibility": "external", - "mutability": "pure", - "signature": "parseJsonInt(string,string)", - "selector": "0x7b048ccd", + "mutability": "view", + "signature": "pauseTracing()", + "selector": "0xc94d1f90", "selectorBytes": [ - 123, - 4, - 140, - 205 + 201, + 77, + 31, + 144 ] }, - "group": "json", + "group": "utilities", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJsonIntArray", - "description": "Parses a string of JSON data at `key` and coerces it to `int256[]`.", - "declaration": "function parseJsonIntArray(string calldata json, string calldata key) external pure returns (int256[] memory);", + "id": "prank_0", + "description": "Sets the *next* call's `msg.sender` to be the input address.", + "declaration": "function prank(address msgSender) external;", "visibility": "external", - "mutability": "pure", - "signature": "parseJsonIntArray(string,string)", - "selector": "0x9983c28a", + "mutability": "", + "signature": "prank(address)", + "selector": "0xca669fa7", "selectorBytes": [ - 153, - 131, - 194, - 138 + 202, + 102, + 159, + 167 ] }, - "group": "json", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "parseJsonKeys", - "description": "Returns an array of all the keys in a JSON object.", - "declaration": "function parseJsonKeys(string calldata json, string calldata key) external pure returns (string[] memory keys);", + "id": "prank_1", + "description": "Sets the *next* call's `msg.sender` to be the input address, and the `tx.origin` to be the second input.", + "declaration": "function prank(address msgSender, address txOrigin) external;", "visibility": "external", - "mutability": "pure", - "signature": "parseJsonKeys(string,string)", - "selector": "0x213e4198", + "mutability": "", + "signature": "prank(address,address)", + "selector": "0x47e50cce", "selectorBytes": [ - 33, - 62, - 65, - 152 + 71, + 229, + 12, + 206 ] }, - "group": "json", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "parseJsonString", - "description": "Parses a string of JSON data at `key` and coerces it to `string`.", - "declaration": "function parseJsonString(string calldata json, string calldata key) external pure returns (string memory);", + "id": "prank_2", + "description": "Sets the *next* delegate call's `msg.sender` to be the input address.", + "declaration": "function prank(address msgSender, bool delegateCall) external;", "visibility": "external", - "mutability": "pure", - "signature": "parseJsonString(string,string)", - "selector": "0x49c4fac8", + "mutability": "", + "signature": "prank(address,bool)", + "selector": "0xa7f8bf5c", "selectorBytes": [ - 73, - 196, - 250, - 200 + 167, + 248, + 191, + 92 ] }, - "group": "json", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "parseJsonStringArray", - "description": "Parses a string of JSON data at `key` and coerces it to `string[]`.", - "declaration": "function parseJsonStringArray(string calldata json, string calldata key) external pure returns (string[] memory);", + "id": "prank_3", + "description": "Sets the *next* delegate call's `msg.sender` to be the input address, and the `tx.origin` to be the second input.", + "declaration": "function prank(address msgSender, address txOrigin, bool delegateCall) external;", "visibility": "external", - "mutability": "pure", - "signature": "parseJsonStringArray(string,string)", - "selector": "0x498fdcf4", + "mutability": "", + "signature": "prank(address,address,bool)", + "selector": "0x7d73d042", "selectorBytes": [ - 73, - 143, - 220, - 244 + 125, + 115, + 208, + 66 ] }, - "group": "json", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "parseJsonTypeArray", - "description": "Parses a string of JSON data at `key` and coerces it to type array corresponding to `typeDescription`.", - "declaration": "function parseJsonTypeArray(string calldata json, string calldata key, string calldata typeDescription) external pure returns (bytes memory);", + "id": "prevrandao_0", + "description": "Sets `block.prevrandao`.\nNot available on EVM versions before Paris. Use `difficulty` instead.\nIf used on unsupported EVM versions it will revert.", + "declaration": "function prevrandao(bytes32 newPrevrandao) external;", "visibility": "external", - "mutability": "pure", - "signature": "parseJsonTypeArray(string,string,string)", - "selector": "0x0175d535", + "mutability": "", + "signature": "prevrandao(bytes32)", + "selector": "0x3b925549", "selectorBytes": [ - 1, - 117, - 213, - 53 + 59, + 146, + 85, + 73 ] }, - "group": "json", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "parseJsonType_0", - "description": "Parses a string of JSON data and coerces it to type corresponding to `typeDescription`.", - "declaration": "function parseJsonType(string calldata json, string calldata typeDescription) external pure returns (bytes memory);", + "id": "prevrandao_1", + "description": "Sets `block.prevrandao`.\nNot available on EVM versions before Paris. Use `difficulty` instead.\nIf used on unsupported EVM versions it will revert.", + "declaration": "function prevrandao(uint256 newPrevrandao) external;", "visibility": "external", - "mutability": "pure", - "signature": "parseJsonType(string,string)", - "selector": "0xa9da313b", + "mutability": "", + "signature": "prevrandao(uint256)", + "selector": "0x9cb1c0d4", "selectorBytes": [ - 169, - 218, - 49, - 59 + 156, + 177, + 192, + 212 ] }, - "group": "json", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "parseJsonType_1", - "description": "Parses a string of JSON data at `key` and coerces it to type corresponding to `typeDescription`.", - "declaration": "function parseJsonType(string calldata json, string calldata key, string calldata typeDescription) external pure returns (bytes memory);", + "id": "projectRoot", + "description": "Get the path of the current project root.", + "declaration": "function projectRoot() external view returns (string memory path);", "visibility": "external", - "mutability": "pure", - "signature": "parseJsonType(string,string,string)", - "selector": "0xe3f5ae33", + "mutability": "view", + "signature": "projectRoot()", + "selector": "0xd930a0e6", "selectorBytes": [ - 227, - 245, - 174, - 51 + 217, + 48, + 160, + 230 ] }, - "group": "json", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJsonUint", - "description": "Parses a string of JSON data at `key` and coerces it to `uint256`.", - "declaration": "function parseJsonUint(string calldata json, string calldata key) external pure returns (uint256);", + "id": "prompt", + "description": "Prompts the user for a string value in the terminal.", + "declaration": "function prompt(string calldata promptText) external returns (string memory input);", "visibility": "external", - "mutability": "pure", - "signature": "parseJsonUint(string,string)", - "selector": "0xaddde2b6", + "mutability": "", + "signature": "prompt(string)", + "selector": "0x47eaf474", "selectorBytes": [ - 173, - 221, - 226, - 182 + 71, + 234, + 244, + 116 ] }, - "group": "json", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJsonUintArray", - "description": "Parses a string of JSON data at `key` and coerces it to `uint256[]`.", - "declaration": "function parseJsonUintArray(string calldata json, string calldata key) external pure returns (uint256[] memory);", + "id": "promptAddress", + "description": "Prompts the user for an address in the terminal.", + "declaration": "function promptAddress(string calldata promptText) external returns (address);", "visibility": "external", - "mutability": "pure", - "signature": "parseJsonUintArray(string,string)", - "selector": "0x522074ab", + "mutability": "", + "signature": "promptAddress(string)", + "selector": "0x62ee05f4", "selectorBytes": [ - 82, - 32, - 116, - 171 + 98, + 238, + 5, + 244 ] }, - "group": "json", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJson_0", - "description": "ABI-encodes a JSON object.", - "declaration": "function parseJson(string calldata json) external pure returns (bytes memory abiEncodedData);", + "id": "promptSecret", + "description": "Prompts the user for a hidden string value in the terminal.", + "declaration": "function promptSecret(string calldata promptText) external returns (string memory input);", "visibility": "external", - "mutability": "pure", - "signature": "parseJson(string)", - "selector": "0x6a82600a", + "mutability": "", + "signature": "promptSecret(string)", + "selector": "0x1e279d41", "selectorBytes": [ - 106, - 130, - 96, - 10 + 30, + 39, + 157, + 65 ] }, - "group": "json", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseJson_1", - "description": "ABI-encodes a JSON object at `key`.", - "declaration": "function parseJson(string calldata json, string calldata key) external pure returns (bytes memory abiEncodedData);", + "id": "promptSecretUint", + "description": "Prompts the user for hidden uint256 in the terminal (usually pk).", + "declaration": "function promptSecretUint(string calldata promptText) external returns (uint256);", "visibility": "external", - "mutability": "pure", - "signature": "parseJson(string,string)", - "selector": "0x85940ef1", + "mutability": "", + "signature": "promptSecretUint(string)", + "selector": "0x69ca02b7", "selectorBytes": [ - 133, - 148, - 14, - 241 + 105, + 202, + 2, + 183 ] }, - "group": "json", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlAddress", - "description": "Parses a string of TOML data at `key` and coerces it to `address`.", - "declaration": "function parseTomlAddress(string calldata toml, string calldata key) external pure returns (address);", + "id": "promptUint", + "description": "Prompts the user for uint256 in the terminal.", + "declaration": "function promptUint(string calldata promptText) external returns (uint256);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlAddress(string,string)", - "selector": "0x65e7c844", + "mutability": "", + "signature": "promptUint(string)", + "selector": "0x652fd489", "selectorBytes": [ 101, - 231, - 200, - 68 + 47, + 212, + 137 ] }, - "group": "toml", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlAddressArray", - "description": "Parses a string of TOML data at `key` and coerces it to `address[]`.", - "declaration": "function parseTomlAddressArray(string calldata toml, string calldata key) external pure returns (address[] memory);", + "id": "publicKeyP256", + "description": "Derives secp256r1 public key from the provided `privateKey`.", + "declaration": "function publicKeyP256(uint256 privateKey) external pure returns (uint256 publicKeyX, uint256 publicKeyY);", "visibility": "external", "mutability": "pure", - "signature": "parseTomlAddressArray(string,string)", - "selector": "0x65c428e7", + "signature": "publicKeyP256(uint256)", + "selector": "0xc453949e", "selectorBytes": [ - 101, 196, - 40, - 231 + 83, + 148, + 158 ] }, - "group": "toml", + "group": "crypto", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlBool", - "description": "Parses a string of TOML data at `key` and coerces it to `bool`.", - "declaration": "function parseTomlBool(string calldata toml, string calldata key) external pure returns (bool);", + "id": "randomAddress", + "description": "Returns a random `address`.", + "declaration": "function randomAddress() external view returns (address);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlBool(string,string)", - "selector": "0xd30dced6", + "mutability": "view", + "signature": "randomAddress()", + "selector": "0xd5bee9f5", "selectorBytes": [ - 211, - 13, - 206, - 214 + 213, + 190, + 233, + 245 ] }, - "group": "toml", + "group": "utilities", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlBoolArray", - "description": "Parses a string of TOML data at `key` and coerces it to `bool[]`.", - "declaration": "function parseTomlBoolArray(string calldata toml, string calldata key) external pure returns (bool[] memory);", + "id": "randomBool", + "description": "Returns a random `bool`.", + "declaration": "function randomBool() external view returns (bool);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlBoolArray(string,string)", - "selector": "0x127cfe9a", + "mutability": "view", + "signature": "randomBool()", + "selector": "0xcdc126bd", "selectorBytes": [ - 18, - 124, - 254, - 154 + 205, + 193, + 38, + 189 ] }, - "group": "toml", + "group": "utilities", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlBytes", - "description": "Parses a string of TOML data at `key` and coerces it to `bytes`.", - "declaration": "function parseTomlBytes(string calldata toml, string calldata key) external pure returns (bytes memory);", + "id": "randomBytes", + "description": "Returns a random byte array value of the given length.", + "declaration": "function randomBytes(uint256 len) external view returns (bytes memory);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlBytes(string,string)", - "selector": "0xd77bfdb9", + "mutability": "view", + "signature": "randomBytes(uint256)", + "selector": "0x6c5d32a9", "selectorBytes": [ - 215, - 123, - 253, - 185 + 108, + 93, + 50, + 169 ] }, - "group": "toml", + "group": "utilities", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlBytes32", - "description": "Parses a string of TOML data at `key` and coerces it to `bytes32`.", - "declaration": "function parseTomlBytes32(string calldata toml, string calldata key) external pure returns (bytes32);", + "id": "randomBytes4", + "description": "Returns a random fixed-size byte array of length 4.", + "declaration": "function randomBytes4() external view returns (bytes4);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlBytes32(string,string)", - "selector": "0x8e214810", + "mutability": "view", + "signature": "randomBytes4()", + "selector": "0x9b7cd579", "selectorBytes": [ - 142, - 33, - 72, - 16 + 155, + 124, + 213, + 121 ] }, - "group": "toml", + "group": "utilities", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlBytes32Array", - "description": "Parses a string of TOML data at `key` and coerces it to `bytes32[]`.", - "declaration": "function parseTomlBytes32Array(string calldata toml, string calldata key) external pure returns (bytes32[] memory);", + "id": "randomBytes8", + "description": "Returns a random fixed-size byte array of length 8.", + "declaration": "function randomBytes8() external view returns (bytes8);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlBytes32Array(string,string)", - "selector": "0x3e716f81", + "mutability": "view", + "signature": "randomBytes8()", + "selector": "0x0497b0a5", "selectorBytes": [ - 62, - 113, - 111, - 129 + 4, + 151, + 176, + 165 ] }, - "group": "toml", + "group": "utilities", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlBytesArray", - "description": "Parses a string of TOML data at `key` and coerces it to `bytes[]`.", - "declaration": "function parseTomlBytesArray(string calldata toml, string calldata key) external pure returns (bytes[] memory);", + "id": "randomInt_0", + "description": "Returns a random `int256` value.", + "declaration": "function randomInt() external view returns (int256);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlBytesArray(string,string)", - "selector": "0xb197c247", + "mutability": "view", + "signature": "randomInt()", + "selector": "0x111f1202", "selectorBytes": [ - 177, - 151, - 194, - 71 + 17, + 31, + 18, + 2 ] }, - "group": "toml", + "group": "utilities", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlInt", - "description": "Parses a string of TOML data at `key` and coerces it to `int256`.", - "declaration": "function parseTomlInt(string calldata toml, string calldata key) external pure returns (int256);", + "id": "randomInt_1", + "description": "Returns a random `int256` value of given bits.", + "declaration": "function randomInt(uint256 bits) external view returns (int256);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlInt(string,string)", - "selector": "0xc1350739", - "selectorBytes": [ - 193, - 53, - 7, - 57 + "mutability": "view", + "signature": "randomInt(uint256)", + "selector": "0x12845966", + "selectorBytes": [ + 18, + 132, + 89, + 102 ] }, - "group": "toml", + "group": "utilities", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlIntArray", - "description": "Parses a string of TOML data at `key` and coerces it to `int256[]`.", - "declaration": "function parseTomlIntArray(string calldata toml, string calldata key) external pure returns (int256[] memory);", + "id": "randomUint_0", + "description": "Returns a random uint256 value.", + "declaration": "function randomUint() external view returns (uint256);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlIntArray(string,string)", - "selector": "0xd3522ae6", + "mutability": "view", + "signature": "randomUint()", + "selector": "0x25124730", "selectorBytes": [ - 211, - 82, - 42, - 230 + 37, + 18, + 71, + 48 ] }, - "group": "toml", + "group": "utilities", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlKeys", - "description": "Returns an array of all the keys in a TOML table.", - "declaration": "function parseTomlKeys(string calldata toml, string calldata key) external pure returns (string[] memory keys);", + "id": "randomUint_1", + "description": "Returns random uint256 value between the provided range (=min..=max).", + "declaration": "function randomUint(uint256 min, uint256 max) external view returns (uint256);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlKeys(string,string)", - "selector": "0x812a44b2", + "mutability": "view", + "signature": "randomUint(uint256,uint256)", + "selector": "0xd61b051b", "selectorBytes": [ - 129, - 42, - 68, - 178 + 214, + 27, + 5, + 27 ] }, - "group": "toml", + "group": "utilities", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlString", - "description": "Parses a string of TOML data at `key` and coerces it to `string`.", - "declaration": "function parseTomlString(string calldata toml, string calldata key) external pure returns (string memory);", + "id": "randomUint_2", + "description": "Returns a random `uint256` value of given bits.", + "declaration": "function randomUint(uint256 bits) external view returns (uint256);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlString(string,string)", - "selector": "0x8bb8dd43", + "mutability": "view", + "signature": "randomUint(uint256)", + "selector": "0xcf81e69c", "selectorBytes": [ - 139, - 184, - 221, - 67 + 207, + 129, + 230, + 156 ] }, - "group": "toml", + "group": "utilities", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlStringArray", - "description": "Parses a string of TOML data at `key` and coerces it to `string[]`.", - "declaration": "function parseTomlStringArray(string calldata toml, string calldata key) external pure returns (string[] memory);", + "id": "readCallers", + "description": "Reads the current `msg.sender` and `tx.origin` from state and reports if there is any active caller modification.", + "declaration": "function readCallers() external returns (CallerMode callerMode, address msgSender, address txOrigin);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlStringArray(string,string)", - "selector": "0x9f629281", + "mutability": "", + "signature": "readCallers()", + "selector": "0x4ad0bac9", "selectorBytes": [ - 159, - 98, - 146, - 129 + 74, + 208, + 186, + 201 ] }, - "group": "toml", + "group": "evm", "status": "stable", - "safety": "safe" + "safety": "unsafe" }, { "func": { - "id": "parseTomlTypeArray", - "description": "Parses a string of TOML data at `key` and coerces it to type array corresponding to `typeDescription`.", - "declaration": "function parseTomlTypeArray(string calldata toml, string calldata key, string calldata typeDescription) external pure returns (bytes memory);", + "id": "readDir_0", + "description": "Reads the directory at the given path recursively, up to `maxDepth`.\n`maxDepth` defaults to 1, meaning only the direct children of the given directory will be returned.\nFollows symbolic links if `followLinks` is true.", + "declaration": "function readDir(string calldata path) external view returns (DirEntry[] memory entries);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlTypeArray(string,string,string)", - "selector": "0x49be3743", + "mutability": "view", + "signature": "readDir(string)", + "selector": "0xc4bc59e0", "selectorBytes": [ - 73, - 190, - 55, - 67 + 196, + 188, + 89, + 224 ] }, - "group": "toml", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlType_0", - "description": "Parses a string of TOML data and coerces it to type corresponding to `typeDescription`.", - "declaration": "function parseTomlType(string calldata toml, string calldata typeDescription) external pure returns (bytes memory);", + "id": "readDir_1", + "description": "See `readDir(string)`.", + "declaration": "function readDir(string calldata path, uint64 maxDepth) external view returns (DirEntry[] memory entries);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlType(string,string)", - "selector": "0x47fa5e11", + "mutability": "view", + "signature": "readDir(string,uint64)", + "selector": "0x1497876c", "selectorBytes": [ - 71, - 250, - 94, - 17 + 20, + 151, + 135, + 108 ] }, - "group": "toml", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlType_1", - "description": "Parses a string of TOML data at `key` and coerces it to type corresponding to `typeDescription`.", - "declaration": "function parseTomlType(string calldata toml, string calldata key, string calldata typeDescription) external pure returns (bytes memory);", + "id": "readDir_2", + "description": "See `readDir(string)`.", + "declaration": "function readDir(string calldata path, uint64 maxDepth, bool followLinks) external view returns (DirEntry[] memory entries);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlType(string,string,string)", - "selector": "0xf9fa5cdb", + "mutability": "view", + "signature": "readDir(string,uint64,bool)", + "selector": "0x8102d70d", "selectorBytes": [ - 249, - 250, - 92, - 219 + 129, + 2, + 215, + 13 ] }, - "group": "toml", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlUint", - "description": "Parses a string of TOML data at `key` and coerces it to `uint256`.", - "declaration": "function parseTomlUint(string calldata toml, string calldata key) external pure returns (uint256);", + "id": "readFile", + "description": "Reads the entire content of file to string. `path` is relative to the project root.", + "declaration": "function readFile(string calldata path) external view returns (string memory data);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlUint(string,string)", - "selector": "0xcc7b0487", + "mutability": "view", + "signature": "readFile(string)", + "selector": "0x60f9bb11", "selectorBytes": [ - 204, - 123, - 4, - 135 + 96, + 249, + 187, + 17 ] }, - "group": "toml", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseTomlUintArray", - "description": "Parses a string of TOML data at `key` and coerces it to `uint256[]`.", - "declaration": "function parseTomlUintArray(string calldata toml, string calldata key) external pure returns (uint256[] memory);", + "id": "readFileBinary", + "description": "Reads the entire content of file as binary. `path` is relative to the project root.", + "declaration": "function readFileBinary(string calldata path) external view returns (bytes memory data);", "visibility": "external", - "mutability": "pure", - "signature": "parseTomlUintArray(string,string)", - "selector": "0xb5df27c8", + "mutability": "view", + "signature": "readFileBinary(string)", + "selector": "0x16ed7bc4", "selectorBytes": [ - 181, - 223, - 39, - 200 + 22, + 237, + 123, + 196 ] }, - "group": "toml", + "group": "filesystem", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseToml_0", - "description": "ABI-encodes a TOML table.", - "declaration": "function parseToml(string calldata toml) external pure returns (bytes memory abiEncodedData);", + "id": "readForkAddress", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `address`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkAddress(string calldata key) external view returns (address);", "visibility": "external", - "mutability": "pure", - "signature": "parseToml(string)", - "selector": "0x592151f0", + "mutability": "view", + "signature": "readForkAddress(string)", + "selector": "0x80ab4bca", "selectorBytes": [ - 89, - 33, - 81, - 240 + 128, + 171, + 75, + 202 ] }, - "group": "toml", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseToml_1", - "description": "ABI-encodes a TOML table at `key`.", - "declaration": "function parseToml(string calldata toml, string calldata key) external pure returns (bytes memory abiEncodedData);", + "id": "readForkAddressArray", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `address`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkAddressArray(string calldata key) external view returns (address[] memory);", "visibility": "external", - "mutability": "pure", - "signature": "parseToml(string,string)", - "selector": "0x37736e08", + "mutability": "view", + "signature": "readForkAddressArray(string)", + "selector": "0x3c69b4e5", "selectorBytes": [ - 55, - 115, - 110, - 8 + 60, + 105, + 180, + 229 ] }, - "group": "toml", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "parseUint", - "description": "Parses the given `string` into a `uint256`.", - "declaration": "function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue);", + "id": "readForkBool", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `bool`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkBool(string calldata key) external view returns (bool);", "visibility": "external", - "mutability": "pure", - "signature": "parseUint(string)", - "selector": "0xfa91454d", + "mutability": "view", + "signature": "readForkBool(string)", + "selector": "0x59d46fc3", "selectorBytes": [ - 250, - 145, - 69, - 77 + 89, + 212, + 111, + 195 ] }, - "group": "string", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "pauseGasMetering", - "description": "Pauses gas metering (i.e. gas usage is not counted). Noop if already paused.", - "declaration": "function pauseGasMetering() external;", + "id": "readForkBoolArray", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `bool`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkBoolArray(string calldata key) external view returns (bool[] memory);", "visibility": "external", - "mutability": "", - "signature": "pauseGasMetering()", - "selector": "0xd1a5b36f", + "mutability": "view", + "signature": "readForkBoolArray(string)", + "selector": "0x31313ddd", "selectorBytes": [ - 209, - 165, - 179, - 111 + 49, + 49, + 61, + 221 ] }, - "group": "evm", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "pauseTracing", - "description": "Pauses collection of call traces. Useful in cases when you want to skip tracing of\ncomplex calls which are not useful for debugging.", - "declaration": "function pauseTracing() external view;", + "id": "readForkBytes", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `bytes`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkBytes(string calldata key) external view returns (bytes memory);", "visibility": "external", "mutability": "view", - "signature": "pauseTracing()", - "selector": "0xc94d1f90", + "signature": "readForkBytes(string)", + "selector": "0xf577b434", "selectorBytes": [ - 201, - 77, - 31, - 144 + 245, + 119, + 180, + 52 ] }, - "group": "utilities", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "prank_0", - "description": "Sets the *next* call's `msg.sender` to be the input address.", - "declaration": "function prank(address msgSender) external;", + "id": "readForkBytes32", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `bytes32`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkBytes32(string calldata key) external view returns (bytes32);", "visibility": "external", - "mutability": "", - "signature": "prank(address)", - "selector": "0xca669fa7", + "mutability": "view", + "signature": "readForkBytes32(string)", + "selector": "0x98d86b9f", "selectorBytes": [ - 202, - 102, - 159, - 167 + 152, + 216, + 107, + 159 ] }, - "group": "evm", + "group": "forking", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "prank_1", - "description": "Sets the *next* call's `msg.sender` to be the input address, and the `tx.origin` to be the second input.", - "declaration": "function prank(address msgSender, address txOrigin) external;", + "id": "readForkBytes32Array", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `bytes32`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkBytes32Array(string calldata key) external view returns (bytes32[] memory);", "visibility": "external", - "mutability": "", - "signature": "prank(address,address)", - "selector": "0x47e50cce", + "mutability": "view", + "signature": "readForkBytes32Array(string)", + "selector": "0x31233ae7", "selectorBytes": [ - 71, - 229, - 12, - 206 + 49, + 35, + 58, + 231 ] }, - "group": "evm", + "group": "forking", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "prank_2", - "description": "Sets the *next* delegate call's `msg.sender` to be the input address.", - "declaration": "function prank(address msgSender, bool delegateCall) external;", + "id": "readForkBytesArray", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `bytes`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkBytesArray(string calldata key) external view returns (bytes[] memory);", "visibility": "external", - "mutability": "", - "signature": "prank(address,bool)", - "selector": "0xa7f8bf5c", + "mutability": "view", + "signature": "readForkBytesArray(string)", + "selector": "0xb8355047", "selectorBytes": [ - 167, - 248, - 191, - 92 + 184, + 53, + 80, + 71 ] }, - "group": "evm", + "group": "forking", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "prank_3", - "description": "Sets the *next* delegate call's `msg.sender` to be the input address, and the `tx.origin` to be the second input.", - "declaration": "function prank(address msgSender, address txOrigin, bool delegateCall) external;", + "id": "readForkChain", + "description": "Returns the chain name of the currently selected fork.", + "declaration": "function readForkChain() external view returns (string memory);", "visibility": "external", - "mutability": "", - "signature": "prank(address,address,bool)", - "selector": "0x7d73d042", + "mutability": "view", + "signature": "readForkChain()", + "selector": "0x99a10434", "selectorBytes": [ - 125, - 115, - 208, - 66 + 153, + 161, + 4, + 52 ] }, - "group": "evm", + "group": "forking", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "prevrandao_0", - "description": "Sets `block.prevrandao`.\nNot available on EVM versions before Paris. Use `difficulty` instead.\nIf used on unsupported EVM versions it will revert.", - "declaration": "function prevrandao(bytes32 newPrevrandao) external;", + "id": "readForkChainAddress", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `address`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkChainAddress(uint256 chain, string calldata key) external view returns (address);", "visibility": "external", - "mutability": "", - "signature": "prevrandao(bytes32)", - "selector": "0x3b925549", + "mutability": "view", + "signature": "readForkChainAddress(uint256,string)", + "selector": "0xada12db3", "selectorBytes": [ - 59, - 146, - 85, - 73 + 173, + 161, + 45, + 179 ] }, - "group": "evm", + "group": "forking", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "prevrandao_1", - "description": "Sets `block.prevrandao`.\nNot available on EVM versions before Paris. Use `difficulty` instead.\nIf used on unsupported EVM versions it will revert.", - "declaration": "function prevrandao(uint256 newPrevrandao) external;", + "id": "readForkChainAddressArray", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `address`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkChainAddressArray(uint256 chain, string calldata key) external view returns (address[] memory);", "visibility": "external", - "mutability": "", - "signature": "prevrandao(uint256)", - "selector": "0x9cb1c0d4", + "mutability": "view", + "signature": "readForkChainAddressArray(uint256,string)", + "selector": "0x563ee150", "selectorBytes": [ - 156, - 177, - 192, - 212 + 86, + 62, + 225, + 80 ] }, - "group": "evm", + "group": "forking", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "projectRoot", - "description": "Get the path of the current project root.", - "declaration": "function projectRoot() external view returns (string memory path);", + "id": "readForkChainBool", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `bool`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkChainBool(uint256 chain, string calldata key) external view returns (bool);", "visibility": "external", "mutability": "view", - "signature": "projectRoot()", - "selector": "0xd930a0e6", + "signature": "readForkChainBool(uint256,string)", + "selector": "0x60f0d22d", "selectorBytes": [ - 217, - 48, - 160, - 230 + 96, + 240, + 210, + 45 ] }, - "group": "filesystem", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "prompt", - "description": "Prompts the user for a string value in the terminal.", - "declaration": "function prompt(string calldata promptText) external returns (string memory input);", + "id": "readForkChainBoolArray", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `bool`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkChainBoolArray(uint256 chain, string calldata key) external view returns (bool[] memory);", "visibility": "external", - "mutability": "", - "signature": "prompt(string)", - "selector": "0x47eaf474", + "mutability": "view", + "signature": "readForkChainBoolArray(uint256,string)", + "selector": "0x7890a287", "selectorBytes": [ - 71, - 234, - 244, - 116 + 120, + 144, + 162, + 135 ] }, - "group": "filesystem", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "promptAddress", - "description": "Prompts the user for an address in the terminal.", - "declaration": "function promptAddress(string calldata promptText) external returns (address);", + "id": "readForkChainBytes", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `bytes`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkChainBytes(uint256 chain, string calldata key) external view returns (bytes memory);", "visibility": "external", - "mutability": "", - "signature": "promptAddress(string)", - "selector": "0x62ee05f4", + "mutability": "view", + "signature": "readForkChainBytes(uint256,string)", + "selector": "0x26a8a87b", "selectorBytes": [ - 98, - 238, - 5, - 244 + 38, + 168, + 168, + 123 ] }, - "group": "filesystem", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "promptSecret", - "description": "Prompts the user for a hidden string value in the terminal.", - "declaration": "function promptSecret(string calldata promptText) external returns (string memory input);", + "id": "readForkChainBytes32", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `bytes32`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkChainBytes32(uint256 chain, string calldata key) external view returns (bytes32);", "visibility": "external", - "mutability": "", - "signature": "promptSecret(string)", - "selector": "0x1e279d41", + "mutability": "view", + "signature": "readForkChainBytes32(uint256,string)", + "selector": "0x3b94101d", "selectorBytes": [ - 30, - 39, - 157, - 65 + 59, + 148, + 16, + 29 ] }, - "group": "filesystem", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "promptSecretUint", - "description": "Prompts the user for hidden uint256 in the terminal (usually pk).", - "declaration": "function promptSecretUint(string calldata promptText) external returns (uint256);", + "id": "readForkChainBytes32Array", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `bytes32`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkChainBytes32Array(uint256 chain, string calldata key) external view returns (bytes32[] memory);", "visibility": "external", - "mutability": "", - "signature": "promptSecretUint(string)", - "selector": "0x69ca02b7", + "mutability": "view", + "signature": "readForkChainBytes32Array(uint256,string)", + "selector": "0x1557cfd5", "selectorBytes": [ - 105, - 202, - 2, - 183 + 21, + 87, + 207, + 213 ] }, - "group": "filesystem", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "promptUint", - "description": "Prompts the user for uint256 in the terminal.", - "declaration": "function promptUint(string calldata promptText) external returns (uint256);", + "id": "readForkChainBytesArray", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `bytes`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkChainBytesArray(uint256 chain, string calldata key) external view returns (bytes[] memory);", "visibility": "external", - "mutability": "", - "signature": "promptUint(string)", - "selector": "0x652fd489", + "mutability": "view", + "signature": "readForkChainBytesArray(uint256,string)", + "selector": "0xbdcc82ec", "selectorBytes": [ - 101, - 47, - 212, - 137 + 189, + 204, + 130, + 236 ] }, - "group": "filesystem", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "publicKeyP256", - "description": "Derives secp256r1 public key from the provided `privateKey`.", - "declaration": "function publicKeyP256(uint256 privateKey) external pure returns (uint256 publicKeyX, uint256 publicKeyY);", - "visibility": "external", - "mutability": "pure", - "signature": "publicKeyP256(uint256)", - "selector": "0xc453949e", + "id": "readForkChainId", + "description": "Returns the chain id of the currently selected fork.", + "declaration": "function readForkChainId() external view returns (uint256);", + "visibility": "external", + "mutability": "view", + "signature": "readForkChainId()", + "selector": "0x69986b8c", "selectorBytes": [ - 196, - 83, - 148, - 158 + 105, + 152, + 107, + 140 ] }, - "group": "crypto", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "randomAddress", - "description": "Returns a random `address`.", - "declaration": "function randomAddress() external view returns (address);", + "id": "readForkChainIds", + "description": "Returns an array with the ids of all the configured fork chains.\nNote that the configured fork chains are subsections of the `[fork]` section of 'foundry.toml'.", + "declaration": "function readForkChainIds() external view returns (uint256[] memory);", "visibility": "external", "mutability": "view", - "signature": "randomAddress()", - "selector": "0xd5bee9f5", + "signature": "readForkChainIds()", + "selector": "0x890ec2f4", "selectorBytes": [ - 213, - 190, - 233, - 245 + 137, + 14, + 194, + 244 ] }, - "group": "utilities", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "randomBool", - "description": "Returns a random `bool`.", - "declaration": "function randomBool() external view returns (bool);", + "id": "readForkChainInt", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `int256`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkChainInt(uint256 chain, string calldata key) external view returns (int256);", "visibility": "external", "mutability": "view", - "signature": "randomBool()", - "selector": "0xcdc126bd", + "signature": "readForkChainInt(uint256,string)", + "selector": "0x2f0cb2a2", "selectorBytes": [ - 205, - 193, - 38, - 189 + 47, + 12, + 178, + 162 ] }, - "group": "utilities", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "randomBytes", - "description": "Returns a random byte array value of the given length.", - "declaration": "function randomBytes(uint256 len) external view returns (bytes memory);", + "id": "readForkChainIntArray", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `int256`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkChainIntArray(uint256 chain, string calldata key) external view returns (int256[] memory);", "visibility": "external", "mutability": "view", - "signature": "randomBytes(uint256)", - "selector": "0x6c5d32a9", + "signature": "readForkChainIntArray(uint256,string)", + "selector": "0xf47ef264", "selectorBytes": [ - 108, - 93, - 50, - 169 + 244, + 126, + 242, + 100 ] }, - "group": "utilities", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "randomBytes4", - "description": "Returns a random fixed-size byte array of length 4.", - "declaration": "function randomBytes4() external view returns (bytes4);", + "id": "readForkChainRpcUrl", + "description": "Returns the rpc url of the corresponding chain id.\nBy default, the rpc url of each fork is derived from the `[rpc_endpoints]`, unless\nthe rpc config is specifically informed in the fork config for that specific chain.", + "declaration": "function readForkChainRpcUrl(uint256 id) external view returns (string memory);", "visibility": "external", "mutability": "view", - "signature": "randomBytes4()", - "selector": "0x9b7cd579", + "signature": "readForkChainRpcUrl(uint256)", + "selector": "0x76394e84", "selectorBytes": [ - 155, - 124, - 213, - 121 + 118, + 57, + 78, + 132 ] }, - "group": "utilities", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "randomBytes8", - "description": "Returns a random fixed-size byte array of length 8.", - "declaration": "function randomBytes8() external view returns (bytes8);", + "id": "readForkChainString", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `string`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkChainString(uint256 chain, string calldata key) external view returns (string memory);", "visibility": "external", "mutability": "view", - "signature": "randomBytes8()", - "selector": "0x0497b0a5", + "signature": "readForkChainString(uint256,string)", + "selector": "0xf82a7685", "selectorBytes": [ - 4, - 151, - 176, - 165 + 248, + 42, + 118, + 133 ] }, - "group": "utilities", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "randomInt_0", - "description": "Returns a random `int256` value.", - "declaration": "function randomInt() external view returns (int256);", + "id": "readForkChainStringArray", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `string`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkChainStringArray(uint256 chain, string calldata key) external view returns (string[] memory);", "visibility": "external", "mutability": "view", - "signature": "randomInt()", - "selector": "0x111f1202", + "signature": "readForkChainStringArray(uint256,string)", + "selector": "0x03505f56", "selectorBytes": [ - 17, - 31, - 18, - 2 + 3, + 80, + 95, + 86 ] }, - "group": "utilities", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "randomInt_1", - "description": "Returns a random `int256` value of given bits.", - "declaration": "function randomInt(uint256 bits) external view returns (int256);", + "id": "readForkChainUint", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `uint256`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkChainUint(uint256 chain, string calldata key) external view returns (uint256);", "visibility": "external", "mutability": "view", - "signature": "randomInt(uint256)", - "selector": "0x12845966", + "signature": "readForkChainUint(uint256,string)", + "selector": "0x1b7eda4d", "selectorBytes": [ - 18, - 132, - 89, - 102 + 27, + 126, + 218, + 77 ] }, - "group": "utilities", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "randomUint_0", - "description": "Returns a random uint256 value.", - "declaration": "function randomUint() external view returns (uint256);", + "id": "readForkChainUintArray", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `uint256`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkChainUintArray(uint256 chain, string calldata key) external view returns (uint256[] memory);", "visibility": "external", "mutability": "view", - "signature": "randomUint()", - "selector": "0x25124730", + "signature": "readForkChainUintArray(uint256,string)", + "selector": "0xda7509b4", "selectorBytes": [ - 37, - 18, - 71, - 48 + 218, + 117, + 9, + 180 ] }, - "group": "utilities", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "randomUint_1", - "description": "Returns random uint256 value between the provided range (=min..=max).", - "declaration": "function randomUint(uint256 min, uint256 max) external view returns (uint256);", + "id": "readForkChains", + "description": "Returns an array with the name of all the configured fork chains.\nNote that the configured fork chains are subsections of the `[fork]` section of 'foundry.toml'.", + "declaration": "function readForkChains() external view returns (string[] memory);", "visibility": "external", "mutability": "view", - "signature": "randomUint(uint256,uint256)", - "selector": "0xd61b051b", + "signature": "readForkChains()", + "selector": "0x237f2335", "selectorBytes": [ - 214, - 27, - 5, - 27 + 35, + 127, + 35, + 53 ] }, - "group": "utilities", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "randomUint_2", - "description": "Returns a random `uint256` value of given bits.", - "declaration": "function randomUint(uint256 bits) external view returns (uint256);", + "id": "readForkInt", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `int256`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkInt(string calldata key) external view returns (int256);", "visibility": "external", "mutability": "view", - "signature": "randomUint(uint256)", - "selector": "0xcf81e69c", + "signature": "readForkInt(string)", + "selector": "0xdbfced07", "selectorBytes": [ - 207, - 129, - 230, - 156 + 219, + 252, + 237, + 7 ] }, - "group": "utilities", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "readCallers", - "description": "Reads the current `msg.sender` and `tx.origin` from state and reports if there is any active caller modification.", - "declaration": "function readCallers() external returns (CallerMode callerMode, address msgSender, address txOrigin);", + "id": "readForkIntArray", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `int256`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkIntArray(string calldata key) external view returns (int256[] memory);", "visibility": "external", - "mutability": "", - "signature": "readCallers()", - "selector": "0x4ad0bac9", + "mutability": "view", + "signature": "readForkIntArray(string)", + "selector": "0xd06f1229", "selectorBytes": [ - 74, 208, - 186, - 201 + 111, + 18, + 41 ] }, - "group": "evm", + "group": "forking", "status": "stable", - "safety": "unsafe" + "safety": "safe" }, { "func": { - "id": "readDir_0", - "description": "Reads the directory at the given path recursively, up to `maxDepth`.\n`maxDepth` defaults to 1, meaning only the direct children of the given directory will be returned.\nFollows symbolic links if `followLinks` is true.", - "declaration": "function readDir(string calldata path) external view returns (DirEntry[] memory entries);", + "id": "readForkRpcUrl", + "description": "Returns the rpc url of the currently selected fork.\nBy default, the rpc url of each fork is derived from the `[rpc_endpoints]`, unless\nthe rpc config is specifically informed in the fork config for that specific chain.", + "declaration": "function readForkRpcUrl() external view returns (string memory);", "visibility": "external", "mutability": "view", - "signature": "readDir(string)", - "selector": "0xc4bc59e0", + "signature": "readForkRpcUrl()", + "selector": "0xb5ca8455", "selectorBytes": [ - 196, - 188, - 89, - 224 + 181, + 202, + 132, + 85 ] }, - "group": "filesystem", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "readDir_1", - "description": "See `readDir(string)`.", - "declaration": "function readDir(string calldata path, uint64 maxDepth) external view returns (DirEntry[] memory entries);", + "id": "readForkString", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `string`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkString(string calldata key) external view returns (string memory);", "visibility": "external", "mutability": "view", - "signature": "readDir(string,uint64)", - "selector": "0x1497876c", + "signature": "readForkString(string)", + "selector": "0xbdb621a5", "selectorBytes": [ - 20, - 151, - 135, - 108 + 189, + 182, + 33, + 165 ] }, - "group": "filesystem", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "readDir_2", - "description": "See `readDir(string)`.", - "declaration": "function readDir(string calldata path, uint64 maxDepth, bool followLinks) external view returns (DirEntry[] memory entries);", + "id": "readForkStringArray", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `string`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkStringArray(string calldata key) external view returns (string[] memory);", "visibility": "external", "mutability": "view", - "signature": "readDir(string,uint64,bool)", - "selector": "0x8102d70d", + "signature": "readForkStringArray(string)", + "selector": "0x3b469f94", "selectorBytes": [ - 129, - 2, - 215, - 13 + 59, + 70, + 159, + 148 ] }, - "group": "filesystem", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "readFile", - "description": "Reads the entire content of file to string. `path` is relative to the project root.", - "declaration": "function readFile(string calldata path) external view returns (string memory data);", + "id": "readForkUint", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `uint256`.\nReverts if the key was not found or the value could not be parsed.", + "declaration": "function readForkUint(string calldata key) external view returns (uint256);", "visibility": "external", "mutability": "view", - "signature": "readFile(string)", - "selector": "0x60f9bb11", + "signature": "readForkUint(string)", + "selector": "0x28a1e7fe", "selectorBytes": [ - 96, - 249, - 187, - 17 + 40, + 161, + 231, + 254 ] }, - "group": "filesystem", + "group": "forking", "status": "stable", "safety": "safe" }, { "func": { - "id": "readFileBinary", - "description": "Reads the entire content of file as binary. `path` is relative to the project root.", - "declaration": "function readFileBinary(string calldata path) external view returns (bytes memory data);", + "id": "readForkUintArray", + "description": "Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `uint256`.\nReverts if a key was not found or any of the values could not be parsed.", + "declaration": "function readForkUintArray(string calldata key) external view returns (uint256[] memory);", "visibility": "external", "mutability": "view", - "signature": "readFileBinary(string)", - "selector": "0x16ed7bc4", + "signature": "readForkUintArray(string)", + "selector": "0xac032c02", "selectorBytes": [ - 22, - 237, - 123, - 196 + 172, + 3, + 44, + 2 ] }, - "group": "filesystem", + "group": "forking", "status": "stable", "safety": "safe" }, diff --git a/crates/cheatcodes/assets/cheatcodes.schema.json b/crates/cheatcodes/assets/cheatcodes.schema.json index ef0e061b22764..ed89119b03bfa 100644 --- a/crates/cheatcodes/assets/cheatcodes.schema.json +++ b/crates/cheatcodes/assets/cheatcodes.schema.json @@ -242,7 +242,7 @@ "const": "scripting" }, { - "description": "Cheatcodes that interact with the program's forking configuration.\n\nExamples: `forkChains`, `forkChainRpcUrl`, `forkUint`.\n\nSafety: safe.", + "description": "Cheatcodes that interact with the program's forking configuration.\n\nExamples: `forkChains`, `forkChainRpcUrl`, `readForkUint`, `readForkAddressArray`.\n\nSafety: safe.", "type": "string", "const": "forking" }, diff --git a/crates/cheatcodes/spec/src/cheatcode.rs b/crates/cheatcodes/spec/src/cheatcode.rs index 216adb4aa84b2..ab95c05da7b6b 100644 --- a/crates/cheatcodes/spec/src/cheatcode.rs +++ b/crates/cheatcodes/spec/src/cheatcode.rs @@ -88,7 +88,7 @@ pub enum Group { Scripting, /// Cheatcodes that interact with the program's forking configuration. /// - /// Examples: `forkChains`, `forkChainRpcUrl`, `forkUint`. + /// Examples: `readForkChains`, `readForkChainRpcUrl`, `readForkUint`, `readForkAddressArray`. /// /// Safety: safe. Forking, diff --git a/crates/cheatcodes/spec/src/vm.rs b/crates/cheatcodes/spec/src/vm.rs index 3281596acac62..b0f4477c9ca6a 100644 --- a/crates/cheatcodes/spec/src/vm.rs +++ b/crates/cheatcodes/spec/src/vm.rs @@ -2189,105 +2189,175 @@ interface Vm { /// /// Note that the configured fork chains are subsections of the `[fork]` section of 'foundry.toml'. #[cheatcode(group = Forking)] - function forkChains() external view returns (string[] memory); + function readForkChains() external view returns (string[] memory); /// Returns an array with the ids of all the configured fork chains. /// /// Note that the configured fork chains are subsections of the `[fork]` section of 'foundry.toml'. #[cheatcode(group = Forking)] - function forkChainIds() external view returns (uint256[] memory); + function readForkChainIds() external view returns (uint256[] memory); /// Returns the chain name of the currently selected fork. #[cheatcode(group = Forking)] - function forkChain() external view returns (string memory); + function readForkChain() external view returns (string memory); /// Returns the chain id of the currently selected fork. #[cheatcode(group = Forking)] - function forkChainId() external view returns (uint256); + function readForkChainId() external view returns (uint256); /// Returns the rpc url of the currently selected fork. /// /// By default, the rpc url of each fork is derived from the `[rpc_endpoints]`, unless /// the rpc config is specifically informed in the fork config for that specific chain. #[cheatcode(group = Forking)] - function forkRpcUrl() external view returns (string memory); + function readForkRpcUrl() external view returns (string memory); /// Returns the rpc url of the corresponding chain id. /// /// By default, the rpc url of each fork is derived from the `[rpc_endpoints]`, unless /// the rpc config is specifically informed in the fork config for that specific chain. #[cheatcode(group = Forking)] - function forkChainRpcUrl(uint256 id) external view returns (string memory); + function readForkChainRpcUrl(uint256 id) external view returns (string memory); - /// Gets the value for the key `key` from the currently active fork and parses it as `bool`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `bool`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkBool(string calldata key) external view returns (bool); + function readForkBool(string calldata key) external view returns (bool); - /// Gets the value for the key `key` from the fork config for chain `chain` and parses it as `bool`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `bool`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkChainBool(uint256 chain, string calldata key) external view returns (bool); + function readForkChainBool(uint256 chain, string calldata key) external view returns (bool); - /// Gets the value for the key `key` from the currently active fork and parses it as `int256`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `bool`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkBoolArray(string calldata key) external view returns (bool[] memory); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `bool`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkChainBoolArray(uint256 chain, string calldata key) external view returns (bool[] memory); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `int256`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkInt(string calldata key) external view returns (int256); + function readForkInt(string calldata key) external view returns (int256); - /// Gets the value for the key `key` from the fork config for chain `chain` and parses it as `int256`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `int256`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkChainInt(uint256 chain, string calldata key) external view returns (int256); + function readForkChainInt(uint256 chain, string calldata key) external view returns (int256); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `int256`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkIntArray(string calldata key) external view returns (int256[] memory); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `int256`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkChainIntArray(uint256 chain, string calldata key) external view returns (int256[] memory); - /// Gets the value for the key `key` from the currently active fork and parses it as `uint256`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `uint256`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkUint(string calldata key) external view returns (uint256); + function readForkUint(string calldata key) external view returns (uint256); - /// Gets the value for the key `key` from the fork config for chain `chain` and parses it as `uint256`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `uint256`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkChainUint(uint256 chain, string calldata key) external view returns (uint256); + function readForkChainUint(uint256 chain, string calldata key) external view returns (uint256); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `uint256`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkUintArray(string calldata key) external view returns (uint256[] memory); - /// Gets the value for the key `key` from the currently active fork and parses it as `address`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `uint256`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkChainUintArray(uint256 chain, string calldata key) external view returns (uint256[] memory); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `address`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkAddress(string calldata key) external view returns (address); + function readForkAddress(string calldata key) external view returns (address); - /// Gets the value for the key `key` from the fork config for chain `chain` and parses it as `address`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `address`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkChainAddress(uint256 chain, string calldata key) external view returns (address); + function readForkChainAddress(uint256 chain, string calldata key) external view returns (address); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `address`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkAddressArray(string calldata key) external view returns (address[] memory); - /// Gets the value for the key `key` from the currently active fork and parses it as `bytes32`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `address`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkChainAddressArray(uint256 chain, string calldata key) external view returns (address[] memory); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `bytes32`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkBytes32(string calldata key) external view returns (bytes32); + function readForkBytes32(string calldata key) external view returns (bytes32); - /// Gets the value for the key `key` from the fork config for chain `chain` and parses it as `bytes32`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `bytes32`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkChainBytes32(uint256 chain, string calldata key) external view returns (bytes32); + function readForkChainBytes32(uint256 chain, string calldata key) external view returns (bytes32); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `bytes32`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkBytes32Array(string calldata key) external view returns (bytes32[] memory); - /// Gets the value for the key `key` from the currently active fork and parses it as `string`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `bytes32`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkChainBytes32Array(uint256 chain, string calldata key) external view returns (bytes32[] memory); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `string`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkString(string calldata key) external view returns (string memory); + function readForkString(string calldata key) external view returns (string memory); - /// Gets the value for the key `key` from the fork config for chain `chain` and parses it as `string`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `string`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkChainString(uint256 chain, string calldata key) external view returns (string memory); + function readForkChainString(uint256 chain, string calldata key) external view returns (string memory); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `string`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkStringArray(string calldata key) external view returns (string[] memory); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `string`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkChainStringArray(uint256 chain, string calldata key) external view returns (string[] memory); - /// Gets the value for the key `key` from the currently active fork and parses it as `bytes`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as `bytes`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkBytes(string calldata key) external view returns (bytes memory); + function readForkBytes(string calldata key) external view returns (bytes memory); - /// Gets the value for the key `key` from the fork config for chain `chain` and parses it as `bytes`. + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as `bytes`. /// Reverts if the key was not found or the value could not be parsed. #[cheatcode(group = Forking)] - function forkChainBytes(uint256 chain, string calldata key) external view returns (bytes memory); + function readForkChainBytes(uint256 chain, string calldata key) external view returns (bytes memory); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the currently active fork and parses it as an array of `bytes`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkBytesArray(string calldata key) external view returns (bytes[] memory); + + /// Gets the value for the key `key` from the `[fork.]` section of `foundry.toml` for the specified chain and parses it as an array of `bytes`. + /// Reverts if a key was not found or any of the values could not be parsed. + #[cheatcode(group = Forking)] + function readForkChainBytesArray(uint256 chain, string calldata key) external view returns (bytes[] memory); // ======== Scripts ======== // -------- Broadcasting Transactions -------- diff --git a/crates/cheatcodes/src/config.rs b/crates/cheatcodes/src/config.rs index 361c1a9fe59da..8331bb4be6abc 100644 --- a/crates/cheatcodes/src/config.rs +++ b/crates/cheatcodes/src/config.rs @@ -4,7 +4,7 @@ use alloy_primitives::{U256, map::AddressHashMap}; use foundry_common::{ContractsByArtifact, fs::normalize_path}; use foundry_compilers::{ArtifactId, ProjectPathsConfig, utils::canonicalize}; use foundry_config::{ - Config, ForkConfig, FsPermissions, ResolvedRpcEndpoint, ResolvedRpcEndpoints, RpcEndpoint, + Config, ForkConfigs, FsPermissions, ResolvedRpcEndpoint, ResolvedRpcEndpoints, RpcEndpoint, RpcEndpointUrl, cache::StorageCachingConfig, fs_permissions::FsAccessKind, }; use foundry_evm_core::opts::EvmOpts; @@ -64,7 +64,7 @@ pub struct CheatsConfig { /// Mapping of chain IDs to their aliases pub chain_id_to_alias: HashMap, /// Fork configuration - pub forks: HashMap, + pub forks: ForkConfigs, } /// Chain data for getChain cheatcodes diff --git a/crates/cheatcodes/src/fork.rs b/crates/cheatcodes/src/fork.rs index 8c15218e3424d..e0d698658ea39 100644 --- a/crates/cheatcodes/src/fork.rs +++ b/crates/cheatcodes/src/fork.rs @@ -1,12 +1,15 @@ //! Implementations of [`Forking`](spec::Group::Forking) cheatcodes. -use crate::{Cheatcode, CheatsCtxt, DatabaseExt, Error, Result, Vm::*, string}; -use alloy_dyn_abi::DynSolType; +use crate::{ + Cheatcode, CheatsCtxt, DatabaseExt, Result, Vm::*, json::parse_json_as, + toml::toml_to_json_value, +}; +use alloy_dyn_abi::{DynSolType, DynSolValue}; use alloy_sol_types::SolValue; use eyre::OptionExt; use foundry_evm_core::ContextExt; -impl Cheatcode for forkChainIdsCall { +impl Cheatcode for readForkChainIdsCall { fn apply(&self, state: &mut crate::Cheatcodes) -> Result { let Self {} = self; Ok(state @@ -19,20 +22,20 @@ impl Cheatcode for forkChainIdsCall { } } -impl Cheatcode for forkChainsCall { +impl Cheatcode for readForkChainsCall { fn apply(&self, state: &mut crate::Cheatcodes) -> Result { let Self {} = self; Ok(state.config.forks.keys().collect::>().abi_encode()) } } -impl Cheatcode for forkChainCall { +impl Cheatcode for readForkChainCall { fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { Ok(get_active_fork_chain_name(ccx)?.abi_encode()) } } -impl Cheatcode for forkChainIdCall { +impl Cheatcode for readForkChainIdCall { fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { Ok(get_active_fork_chain_id(ccx)?.abi_encode()) } @@ -52,7 +55,7 @@ fn resolve_rpc_url(name: &'static str, state: &mut crate::Cheatcodes) -> Result bail!("[fork.{name}] subsection not found in [fork] of 'foundry.toml'") } -impl Cheatcode for forkChainRpcUrlCall { +impl Cheatcode for readForkChainRpcUrlCall { fn apply(&self, state: &mut crate::Cheatcodes) -> Result { let Self { id } = self; let name = get_chain_name(id.to::())?; @@ -60,32 +63,13 @@ impl Cheatcode for forkChainRpcUrlCall { } } -impl Cheatcode for forkRpcUrlCall { +impl Cheatcode for readForkRpcUrlCall { fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { let name = get_active_fork_chain_name(ccx)?; resolve_rpc_url(name, ccx.state) } } -fn cast_string(key: &str, val: &str, ty: &DynSolType) -> Result { - string::parse(val, ty).map_err(map_env_err(key, val)) -} - -/// Converts the error message of a failed parsing attempt to a more user-friendly message that -/// doesn't leak the value. -fn map_env_err<'a>(key: &'a str, value: &'a str) -> impl FnOnce(Error) -> Error + 'a { - move |e| { - // failed parsing as type `uint256`: parser error: - // - // ^ - // expected at least one digit - let mut e = e.to_string(); - e = e.replacen(&format!("\"{value}\""), &format!("${key}"), 1); - e = e.replacen(&format!("\n{value}\n"), &format!("\n${key}\n"), 1); - Error::from(e) - } -} - /// Gets the alloy chain name for a given chain id. fn get_chain_name(id: u64) -> Result<&'static str> { let chain = alloy_chains::Chain::from_id(id) @@ -109,108 +93,90 @@ fn get_active_fork_chain_name(ccx: &mut CheatsCtxt) -> Result<&'static str> { get_chain_name(get_active_fork_chain_id(ccx)?) } -impl Cheatcode for forkChainBoolCall { - fn apply(&self, state: &mut crate::Cheatcodes) -> Result { - let Self { chain, key } = self; - get_bool(chain.to::(), key, state) - } -} - -impl Cheatcode for forkBoolCall { - fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { - let Self { key } = self; - get_bool(get_active_fork_chain_id(ccx)?, key, ccx.state) - } -} - -impl Cheatcode for forkChainIntCall { - fn apply(&self, state: &mut crate::Cheatcodes) -> Result { - let Self { chain, key } = self; - get_int256(chain.to::(), key, state) - } -} - -impl Cheatcode for forkIntCall { - fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { - let Self { key } = self; - get_int256(get_active_fork_chain_id(ccx)?, key, ccx.state) - } -} - -impl Cheatcode for forkChainUintCall { - fn apply(&self, state: &mut crate::Cheatcodes) -> Result { - let Self { chain, key } = self; - get_uint256(chain.to::(), key, state) - } -} - -impl Cheatcode for forkUintCall { - fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { - let Self { key } = self; - get_uint256(get_active_fork_chain_id(ccx)?, key, ccx.state) - } -} - -impl Cheatcode for forkChainAddressCall { - fn apply(&self, state: &mut crate::Cheatcodes) -> Result { - let Self { chain, key } = self; - get_type_from_str_input(chain.to::(), key, &DynSolType::Address, state) - } -} - -impl Cheatcode for forkAddressCall { - fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { - let Self { key } = self; - let chain = get_active_fork_chain_id(ccx)?; - get_type_from_str_input(chain, key, &DynSolType::Address, ccx.state) - } -} - -impl Cheatcode for forkChainBytes32Call { - fn apply(&self, state: &mut crate::Cheatcodes) -> Result { - let Self { chain, key } = self; - get_type_from_str_input(chain.to::(), key, &DynSolType::FixedBytes(32), state) - } -} - -impl Cheatcode for forkBytes32Call { - fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { - let Self { key } = self; - let chain = get_active_fork_chain_id(ccx)?; - get_type_from_str_input(chain, key, &DynSolType::FixedBytes(32), ccx.state) - } -} - -impl Cheatcode for forkChainBytesCall { - fn apply(&self, state: &mut crate::Cheatcodes) -> Result { - let Self { chain, key } = self; - get_type_from_str_input(chain.to::(), key, &DynSolType::Bytes, state) - } -} - -impl Cheatcode for forkBytesCall { - fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { - let Self { key } = self; - let chain = get_active_fork_chain_id(ccx)?; - get_type_from_str_input(chain, key, &DynSolType::Bytes, ccx.state) - } -} - -impl Cheatcode for forkChainStringCall { - fn apply(&self, state: &mut crate::Cheatcodes) -> Result { - let Self { chain, key } = self; - get_type_from_str_input(chain.to::(), key, &DynSolType::String, state) - } -} - -impl Cheatcode for forkStringCall { - fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { - let Self { key } = self; - let chain = get_active_fork_chain_id(ccx)?; - get_type_from_str_input(chain, key, &DynSolType::String, ccx.state) - } +// Helper macros to generate cheatcode implementations +macro_rules! impl_get_value_cheatcode { + ($struct:ident, $sol_type:expr,stateful) => { + impl Cheatcode for $struct { + fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { + let Self { key } = self; + let chain = get_active_fork_chain_id(ccx)?; + get_value(chain, key, $sol_type, ccx.state) + } + } + }; + ($struct:ident, $sol_type:expr) => { + impl Cheatcode for $struct { + fn apply(&self, state: &mut crate::Cheatcodes) -> Result { + let Self { chain, key } = self; + get_value(chain.to::(), key, $sol_type, state) + } + } + }; } +macro_rules! impl_get_array_cheatcode { + ($struct:ident, $sol_type:expr,stateful) => { + impl Cheatcode for $struct { + fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { + let Self { key } = self; + let chain = get_active_fork_chain_id(ccx)?; + get_array(chain, key, $sol_type, ccx.state) + } + } + }; + ($struct:ident, $sol_type:expr) => { + impl Cheatcode for $struct { + fn apply(&self, state: &mut crate::Cheatcodes) -> Result { + let Self { chain, key } = self; + get_array(chain.to::(), key, $sol_type, state) + } + } + }; +} + +// Bool +impl_get_value_cheatcode!(readForkChainBoolCall, &DynSolType::Bool); +impl_get_value_cheatcode!(readForkBoolCall, &DynSolType::Bool, stateful); +impl_get_array_cheatcode!(readForkChainBoolArrayCall, &DynSolType::Bool); +impl_get_array_cheatcode!(readForkBoolArrayCall, &DynSolType::Bool, stateful); + +// Int +impl_get_value_cheatcode!(readForkChainIntCall, &DynSolType::Int(256)); +impl_get_value_cheatcode!(readForkIntCall, &DynSolType::Int(256), stateful); +impl_get_array_cheatcode!(readForkChainIntArrayCall, &DynSolType::Int(256)); +impl_get_array_cheatcode!(readForkIntArrayCall, &DynSolType::Int(256), stateful); + +// Uint +impl_get_value_cheatcode!(readForkChainUintCall, &DynSolType::Uint(256)); +impl_get_value_cheatcode!(readForkUintCall, &DynSolType::Uint(256), stateful); +impl_get_array_cheatcode!(readForkChainUintArrayCall, &DynSolType::Uint(256)); +impl_get_array_cheatcode!(readForkUintArrayCall, &DynSolType::Uint(256), stateful); + +// Address +impl_get_value_cheatcode!(readForkChainAddressCall, &DynSolType::Address); +impl_get_value_cheatcode!(readForkAddressCall, &DynSolType::Address, stateful); +impl_get_array_cheatcode!(readForkChainAddressArrayCall, &DynSolType::Address); +impl_get_array_cheatcode!(readForkAddressArrayCall, &DynSolType::Address, stateful); + +// Bytes32 +impl_get_value_cheatcode!(readForkChainBytes32Call, &DynSolType::FixedBytes(32)); +impl_get_value_cheatcode!(readForkBytes32Call, &DynSolType::FixedBytes(32), stateful); +impl_get_array_cheatcode!(readForkChainBytes32ArrayCall, &DynSolType::FixedBytes(32)); +impl_get_array_cheatcode!(readForkBytes32ArrayCall, &DynSolType::FixedBytes(32), stateful); + +// Bytes +impl_get_value_cheatcode!(readForkChainBytesCall, &DynSolType::Bytes); +impl_get_value_cheatcode!(readForkBytesCall, &DynSolType::Bytes, stateful); +impl_get_array_cheatcode!(readForkChainBytesArrayCall, &DynSolType::Bytes); +impl_get_array_cheatcode!(readForkBytesArrayCall, &DynSolType::Bytes, stateful); + +// String +impl_get_value_cheatcode!(readForkChainStringCall, &DynSolType::String); +impl_get_value_cheatcode!(readForkStringCall, &DynSolType::String, stateful); +impl_get_array_cheatcode!(readForkChainStringArrayCall, &DynSolType::String); +impl_get_array_cheatcode!(readForkStringArrayCall, &DynSolType::String, stateful); + +/// Generic helper to get any value from the TOML config. fn get_toml_value<'a>( name: &'a str, key: &'a str, @@ -227,62 +193,43 @@ fn get_toml_value<'a>( Ok(value) } -fn get_bool(chain: u64, key: &str, state: &crate::Cheatcodes) -> Result { +/// Generic helper to get any single value from the TOML config. +fn get_value(chain: u64, key: &str, ty: &DynSolType, state: &crate::Cheatcodes) -> Result { let name = get_chain_name(chain)?; let value = get_toml_value(name, key, state)?; - - if let Some(b) = value.as_bool() { - Ok(b.abi_encode()) - } else if let Some(v) = value.as_integer() { - Ok((v == 0).abi_encode()) - } else if let Some(s) = value.as_str() { - cast_string(key, s, &DynSolType::Bool) - } else { - bail!("Variable '{key}' in [fork.{name}] must be a boolean or a string"); - } + let sol_value = parse_toml_element(value, ty, key, name)?; + Ok(sol_value.abi_encode()) } -fn get_int256(chain: u64, key: &str, state: &crate::Cheatcodes) -> Result { +/// Generic helper to get an array of values from the TOML config. +fn get_array(chain: u64, key: &str, element_ty: &DynSolType, state: &crate::Cheatcodes) -> Result { let name = get_chain_name(chain)?; let value = get_toml_value(name, key, state)?; - if let Some(int_value) = value.as_integer() { - Ok(int_value.abi_encode()) - } else if let Some(s) = value.as_str() { - cast_string(key, s, &DynSolType::Int(256)) - } else { - bail!("Variable '{key}' in [fork.{name}] must be an integer or a string"); - } -} -fn get_uint256(chain: u64, key: &str, state: &crate::Cheatcodes) -> Result { - let name = get_chain_name(chain)?; - let value = get_toml_value(name, key, state)?; - - if let Some(int_value) = value.as_integer() { - if int_value >= 0 { - Ok((int_value as u64).abi_encode()) - } else { - bail!("Variable '{key}' in [fork.{name}] is a negative integer"); - } - } else if let Some(s) = value.as_str() { - cast_string(key, s, &DynSolType::Uint(256)) - } else { - bail!("Variable '{key}' in [fork.{name}] must be an integer or a string"); - } -} - -fn get_type_from_str_input( - chain: u64, - key: &str, - ty: &DynSolType, - state: &crate::Cheatcodes, -) -> Result { - let name = get_chain_name(chain)?; - let value = get_toml_value(name, key, state)?; - - if let Some(val) = value.as_str() { - cast_string(key, val, ty) - } else { - bail!("Variable '{key}' in [fork.{name}] must be a string"); - } + let arr = value + .as_array() + .ok_or_else(|| fmt_err!("Variable '{key}' in [fork.{name}] must be an array"))?; + + let result: Result> = arr + .iter() + .enumerate() + .map(|(i, elem)| { + let context = format!("{key}[{i}]"); + parse_toml_element(elem, element_ty, &context, name) + }) + .collect(); + + Ok(DynSolValue::Array(result?).abi_encode()) +} + +/// Parses a single TOML value into a specific Solidity type. +fn parse_toml_element( + elem: &toml::Value, + element_ty: &DynSolType, + context: &str, + fork_name: &str, +) -> Result { + // Convert TOML value to JSON value and use existing JSON parsing logic + parse_json_as(&toml_to_json_value(elem.to_owned()), element_ty) + .map_err(|e| fmt_err!("Failed to parse '{context}' in [fork.{fork_name}]: {e}")) } diff --git a/crates/cheatcodes/src/toml.rs b/crates/cheatcodes/src/toml.rs index 4ae16340ec6be..1f1e2a279b20f 100644 --- a/crates/cheatcodes/src/toml.rs +++ b/crates/cheatcodes/src/toml.rs @@ -228,7 +228,7 @@ fn format_json_to_toml(json: JsonValue) -> Result { } /// Convert a TOML value to a JSON value. -fn toml_to_json_value(toml: TomlValue) -> JsonValue { +pub(super) fn toml_to_json_value(toml: TomlValue) -> JsonValue { match toml { TomlValue::String(s) => match s.as_str() { "null" => JsonValue::Null, diff --git a/crates/config/src/fork_config.rs b/crates/config/src/fork_config.rs new file mode 100644 index 0000000000000..2f757816633fe --- /dev/null +++ b/crates/config/src/fork_config.rs @@ -0,0 +1,100 @@ +use crate::{ + RpcEndpoint, + error::ExtractConfigError, + resolve::{RE_PLACEHOLDER, UnresolvedEnvVarError, interpolate}, +}; + +use serde::{Deserialize, Serialize}; +use std::{collections::HashMap, ops::Deref}; + +/// Fork-scoped config for tests and scripts. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ForkConfigs(pub HashMap); + +impl ForkConfigs { + /// Resolve environment variables in all fork config fields + pub fn resolve_env_vars(&mut self) -> Result<(), ExtractConfigError> { + for (name, fork_config) in &mut self.0 { + // Take temporary ownership of the config, so that it can be consumed. + let config = std::mem::take(fork_config); + + // Resolve the env vars and place it back into the map. + *fork_config = config.resolved().map_err(|e| { + let msg = if !e.var.is_empty() { + format!("environment variable `{}` not found", e.var) + } else { + e.to_string() + }; + ExtractConfigError::new(figment::Error::from(format!( + "Failed to resolve fork config [forks.{name}]: {msg}" + ))) + })?; + } + + Ok(()) + } +} + +impl Deref for ForkConfigs { + type Target = HashMap; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +/// Fork-scoped config for tests and scripts. +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ForkChainConfig { + // Optional RPC endpoint for the fork. + // + // If uninformed, it will attempt to load one from `[rpc_endpoints]` with a matching alias + // for the name of the forked chain. + pub rpc_endpoint: Option, + // Any arbitrary key-value pair of variables. + pub vars: HashMap, +} + +impl ForkChainConfig { + /// Resolves environment variables in the fork configuration. + /// Returns a new ForkConfig with all environment variables resolved. + pub fn resolved(self) -> Result { + let mut resolved_vars = HashMap::new(); + for (key, value) in self.vars { + resolved_vars.insert(key, resolve_toml_value(value)?); + } + + Ok(Self { rpc_endpoint: self.rpc_endpoint, vars: resolved_vars }) + } +} + +/// Recursively resolves environment variables in a toml::Value +fn resolve_toml_value(value: toml::Value) -> Result { + match value { + toml::Value::String(s) => { + // Check if the string contains environment variable placeholders + if RE_PLACEHOLDER.is_match(&s) { + // Resolve the environment variables + let resolved = interpolate(&s)?; + Ok(toml::Value::String(resolved)) + } else { + Ok(toml::Value::String(s)) + } + } + toml::Value::Array(arr) => { + // Recursively resolve each element in the array + let resolved_arr: Result, _> = arr.into_iter().map(resolve_toml_value).collect(); + Ok(toml::Value::Array(resolved_arr?)) + } + toml::Value::Table(table) => { + // Recursively resolve each value in the table + let mut resolved_table = toml::map::Map::new(); + for (k, v) in table { + resolved_table.insert(k, resolve_toml_value(v)?); + } + Ok(toml::Value::Table(resolved_table)) + } + // Other types don't need resolution + other => Ok(other), + } +} diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index d5f5511234919..8e6964822c7b2 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -45,7 +45,7 @@ use semver::Version; use serde::{Deserialize, Serialize, Serializer}; use std::{ borrow::Cow, - collections::{BTreeMap, HashMap}, + collections::BTreeMap, fs, path::{Path, PathBuf}, str::FromStr, @@ -82,6 +82,9 @@ pub mod fs_permissions; pub use fs_permissions::FsPermissions; use fs_permissions::PathPermission; +pub mod fork_config; +pub use fork_config::{ForkChainConfig, ForkConfigs}; + pub mod error; use error::ExtractConfigError; pub use error::SolidityErrorCode; @@ -447,7 +450,7 @@ pub struct Config { #[serde(default, skip_serializing_if = "RpcEndpoints::is_empty")] pub rpc_endpoints: RpcEndpoints, /// Fork configuration - pub forks: HashMap, + pub forks: ForkConfigs, /// Whether to store the referenced sources in the metadata as literal data. pub use_literal_content: bool, /// Whether to include the metadata hash. @@ -563,18 +566,6 @@ pub struct Config { pub _non_exhaustive: (), } -/// Fork-scoped config for tests and scripts. -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ForkConfig { - // Optional RPC endpoint for the fork. - // - // If uninformed, it will attempt to load one from `[rpc_endpoints]` with a matching alias - // for the name of the forked chain. - pub rpc_endpoint: Option, - // Any arbitrary key-value pair of variables. - pub vars: HashMap, -} - /// Mapping of fallback standalone sections. See [`FallbackProfileProvider`]. pub const STANDALONE_FALLBACK_SECTIONS: &[(&str, &str)] = &[("invariant", "fuzz")]; @@ -698,6 +689,7 @@ impl Config { add_profile(&config.profile); config.normalize_optimizer_settings(); + config.forks.resolve_env_vars()?; Ok(config) } @@ -2643,7 +2635,7 @@ mod tests { use itertools::Itertools; use similar_asserts::assert_eq; use soldeer_core::remappings::RemappingsLocation; - use std::{fs::File, io::Write}; + use std::{collections::HashMap, fs::File, io::Write}; use tempfile::tempdir; // Helper function to clear `__warnings` in config, since it will be populated during loading @@ -5159,7 +5151,7 @@ mod tests { } #[test] - fn test_get_script_config() { + fn test_get_fork_config() { figment::Jail::expect_with(|jail| { jail.create_file( "foundry.toml", @@ -5167,21 +5159,43 @@ mod tests { [forks] [forks.mainnet] - rpc_endpoint = "mainnet-rpc" + rpc_endpoint = "${_MAINNET_RPC}" [forks.mainnet.vars] - weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" + weth = "${_WETH_ADDRESS}" usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" pool_name = "USDC-ETH" pool_fee = 3000 max_slippage = 500 + + # Array configurations for testing array support + bool_array = [true, false, true] + int_array = [-100, 200, -300] + uint_array = [100, 200, 300] + addr_array = [ + "${_ADDR1}", + "0x2222222222222222222222222222222222222222" + ] + bytes32_array = [ + "0x1111111111111111111111111111111111111111111111111111111111111111", + "0x2222222222222222222222222222222222222222222222222222222222222222" + ] + bytes_array = ["0x1234", "0x5678", "0xabcd"] + string_array = ["hello", "world", "test"] "#, )?; + + // Now set the environment variables + jail.set_env("_MAINNET_RPC", "mainnet-rpc"); + jail.set_env("_WETH_ADDRESS", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"); + jail.set_env("_ADDR1", "0x1111111111111111111111111111111111111111"); + + // Reload the config with env vars set let config = Config::load().unwrap(); - let expected: HashMap = vec![( + let expected: HashMap = vec![( "mainnet".to_string(), - ForkConfig { + ForkChainConfig { rpc_endpoint: Some(RpcEndpoint::new(RpcEndpointUrl::Url( "mainnet-rpc".to_string(), ))), @@ -5191,6 +5205,19 @@ mod tests { ("pool_name".into(), "USDC-ETH".into()), ("pool_fee".into(), 3000.into()), ("max_slippage".into(), 500.into()), + ("bool_array".into(), vec![true, false, true].into()), + ("int_array".into(), vec![-100i64, 200, -300].into()), + ("uint_array".into(), vec![100i64, 200, 300].into()), + ("addr_array".into(), vec![ + "0x1111111111111111111111111111111111111111", + "0x2222222222222222222222222222222222222222" + ].into()), + ("bytes32_array".into(), vec![ + "0x1111111111111111111111111111111111111111111111111111111111111111", + "0x2222222222222222222222222222222222222222222222222222222222222222" + ].into()), + ("bytes_array".into(), vec!["0x1234", "0x5678", "0xabcd"].into()), + ("string_array".into(), vec!["hello", "world", "test"].into()), ] .into_iter() .collect(), @@ -5205,10 +5232,90 @@ mod tests { let expected_mainnet = expected.get("mainnet").unwrap(); let mainnet = config.forks.get("mainnet").unwrap(); - assert_eq!(expected_mainnet.rpc_endpoint, mainnet.rpc_endpoint); + + // Verify that rpc_endpoint is now resolved to the actual value + if let Some(rpc) = &mainnet.rpc_endpoint { + // The rpc endpoint should be resolved after env var is set + let resolved_url = rpc.to_owned().resolve().url().unwrap(); + assert_eq!(resolved_url, "mainnet-rpc"); + } + + // Verify that weth is now resolved to the actual address + let weth_after = mainnet.vars.get("weth").unwrap(); + assert_eq!(weth_after.as_str().unwrap(), "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"); + + // Check all other vars match expected values for (k, v) in &expected_mainnet.vars { assert_eq!(v, mainnet.vars.get(k).unwrap()); } + + // Verify array values are properly loaded + let bool_array = mainnet.vars.get("bool_array").unwrap(); + assert!(bool_array.as_array().is_some()); + assert_eq!(bool_array.as_array().unwrap().len(), 3); + + let int_array = mainnet.vars.get("int_array").unwrap(); + assert!(int_array.as_array().is_some()); + assert_eq!(int_array.as_array().unwrap().len(), 3); + + let uint_array = mainnet.vars.get("uint_array").unwrap(); + assert!(uint_array.as_array().is_some()); + assert_eq!(uint_array.as_array().unwrap().len(), 3); + + // Verify that the environment variable in the array was resolved + let addr_array = mainnet.vars.get("addr_array").unwrap(); + assert!(addr_array.as_array().is_some()); + assert_eq!(addr_array.as_array().unwrap().len(), 2); + assert_eq!( + addr_array.as_array().unwrap()[0].as_str().unwrap(), + "0x1111111111111111111111111111111111111111" + ); + assert_eq!( + addr_array.as_array().unwrap()[1].as_str().unwrap(), + "0x2222222222222222222222222222222222222222" + ); + + let bytes32_array = mainnet.vars.get("bytes32_array").unwrap(); + assert!(bytes32_array.as_array().is_some()); + assert_eq!(bytes32_array.as_array().unwrap().len(), 2); + + let bytes_array = mainnet.vars.get("bytes_array").unwrap(); + assert!(bytes_array.as_array().is_some()); + assert_eq!(bytes_array.as_array().unwrap().len(), 3); + + let string_array = mainnet.vars.get("string_array").unwrap(); + assert!(string_array.as_array().is_some()); + assert_eq!(string_array.as_array().unwrap().len(), 3); + assert_eq!(string_array.as_array().unwrap()[0].as_str().unwrap(), "hello"); + + Ok(()) + }); + } + + #[test] + fn test_fork_config_missing_env_var_fails() { + figment::Jail::expect_with(|jail| { + jail.create_file( + "foundry.toml", + r#" + [forks] + [forks.mainnet] + rpc_endpoint = "${MISSING_RPC_VAR}" + + [forks.mainnet.vars] + some_value = "${MISSING_VAR}" + "#, + )?; + let result = Config::load(); + assert!(result.is_err()); + let err_str = result.unwrap_err().to_string(); + + // Check that the error message contains the chain name and specific variable name + assert!( + err_str.contains("[forks.mainnet]") + && (err_str.contains("MISSING_RPC_VAR") || err_str.contains("MISSING_VAR")) + ); + Ok(()) }); } diff --git a/crates/forge/tests/cli/script.rs b/crates/forge/tests/cli/script.rs index b47ac71d5534c..aadcd64ac5f35 100644 --- a/crates/forge/tests/cli/script.rs +++ b/crates/forge/tests/cli/script.rs @@ -5,7 +5,7 @@ use alloy_hardforks::EthereumHardfork; use alloy_primitives::{Address, Bytes, address, hex}; use anvil::{NodeConfig, spawn}; use forge_script_sequence::ScriptSequence; -use foundry_config::{ForkConfig, RpcEndpoint, RpcEndpointUrl, RpcEndpoints}; +use foundry_config::{ForkChainConfig, ForkConfigs, RpcEndpoint, RpcEndpointUrl, RpcEndpoints}; use foundry_test_utils::{ ScriptOutcome, ScriptTester, rpc::{self, next_http_archive_rpc_url}, @@ -3244,14 +3244,15 @@ forgetest_init!(can_access_fork_config_chain_ids, |prj, cmd| { prj.insert_ds_test(); prj.update_config(|config| { - config.forks = vec![ - ( - "mainnet".to_string(), - ForkConfig { - rpc_endpoint: Some(RpcEndpoint::new(RpcEndpointUrl::Url( - "mainnet-rpc".to_string(), - ))), - vars: vec![ + config.forks = ForkConfigs( + vec![ + ( + "mainnet".to_string(), + ForkChainConfig { + rpc_endpoint: Some(RpcEndpoint::new(RpcEndpointUrl::Url( + "mainnet-rpc".to_string(), + ))), + vars: vec![ ("i256".into(), "-1234".into()), ("u256".into(), 1234.into()), ("bool".into(), true.into()), @@ -3263,16 +3264,30 @@ forgetest_init!(can_access_fork_config_chain_ids, |prj, cmd| { ("addr".into(), "0xdeadbeef00000000000000000000000000000000".into()), ("bytes".into(), "0x00000000000f00".into()), ("str".into(), "bar".into()), + // Array configurations for testing new array cheatcodes + ("bool_array".into(), vec![true, false, true].into()), + ("int_array".into(), vec!["-100", "200", "-300"].into()), + ("uint_array".into(), vec!["100", "200", "300"].into()), + ("addr_array".into(), vec![ + "0x1111111111111111111111111111111111111111", + "0x2222222222222222222222222222222222222222" + ].into()), + ("bytes32_array".into(), vec![ + "0x1111111111111111111111111111111111111111111111111111111111111111", + "0x2222222222222222222222222222222222222222222222222222222222222222" + ].into()), + ("bytes_array".into(), vec!["0x1234", "0x5678", "0xabcd"].into()), + ("string_array".into(), vec!["hello", "world", "test"].into()), ] - .into_iter() - .collect(), - }, - ), - ( - "optimism".to_string(), - ForkConfig { - rpc_endpoint: None, - vars: vec![ + .into_iter() + .collect(), + }, + ), + ( + "optimism".to_string(), + ForkChainConfig { + rpc_endpoint: None, + vars: vec![ ("i256".into(), "-4321".into()), ("u256".into(), 4321.into()), ("bool".into(), "false".into()), @@ -3284,14 +3299,29 @@ forgetest_init!(can_access_fork_config_chain_ids, |prj, cmd| { ("addr".into(), "0x00000000000000000000000000000000deadbeef".into()), ("bytes".into(), "0x00f00000000000".into()), ("str".into(), "bazz".into()), + // Array configurations for testing new array cheatcodes + ("bool_array".into(), vec![false, true, false].into()), + ("int_array".into(), vec!["-400", "500", "-600"].into()), + ("uint_array".into(), vec!["400", "500", "600"].into()), + ("addr_array".into(), vec![ + "0x3333333333333333333333333333333333333333", + "0x4444444444444444444444444444444444444444" + ].into()), + ("bytes32_array".into(), vec![ + "0x3333333333333333333333333333333333333333333333333333333333333333", + "0x4444444444444444444444444444444444444444444444444444444444444444" + ].into()), + ("bytes_array".into(), vec!["0xdead", "0xbeef", "0xcafe"].into()), + ("string_array".into(), vec!["foo", "bar", "baz"].into()), ] - .into_iter() - .collect(), - }, - ), - ] - .into_iter() - .collect(); + .into_iter() + .collect(), + }, + ), + ] + .into_iter() + .collect(), + ); config.rpc_endpoints = RpcEndpoints::new(vec![( "optimism", @@ -3311,7 +3341,7 @@ contract ForkScript is DSTest { function run() public view { (uint256[2] memory chainIds, string[2] memory chains) = ([uint256(1), uint256(10)], ["mainnet", "optimism"]); - (uint256[] memory cheatChainIds, string[] memory cheatChains) = (vm.forkChainIds(), vm.forkChains()); + (uint256[] memory cheatChainIds, string[] memory cheatChains) = (vm.readForkChainIds(), vm.readForkChains()); for (uint256 i = 0; i < chains.length; i++) { assert(chainIds[i] == cheatChainIds[0] || chainIds[i] == cheatChainIds[1]); @@ -3319,14 +3349,14 @@ contract ForkScript is DSTest { console.log("chain:", chains[i]); console.log("id:", chainIds[i]); - string memory rpc = vm.forkChainRpcUrl(chainIds[i]); - int256 i256 = vm.forkChainInt(chainIds[i], "i256"); - uint256 u256 = vm.forkChainUint(chainIds[i], "u256"); - bool boolean = vm.forkChainBool(chainIds[i], "bool"); - address addr = vm.forkChainAddress(chainIds[i], "addr"); - bytes32 b256 = vm.forkChainBytes32(chainIds[i], "b256"); - bytes memory byytes = vm.forkChainBytes(chainIds[i], "bytes"); - string memory str = vm.forkChainString(chainIds[i], "str"); + string memory rpc = vm.readForkChainRpcUrl(chainIds[i]); + int256 i256 = vm.readForkChainInt(chainIds[i], "i256"); + uint256 u256 = vm.readForkChainUint(chainIds[i], "u256"); + bool boolean = vm.readForkChainBool(chainIds[i], "bool"); + address addr = vm.readForkChainAddress(chainIds[i], "addr"); + bytes32 b256 = vm.readForkChainBytes32(chainIds[i], "b256"); + bytes memory byytes = vm.readForkChainBytes(chainIds[i], "bytes"); + string memory str = vm.readForkChainString(chainIds[i], "str"); console.log(" > rpc:", rpc); console.log(" > vars:"); @@ -3341,6 +3371,50 @@ contract ForkScript is DSTest { || b256 == 0x000000000000000000000000000000000000000000000000000000deadc0ffee ); } + + // Test array cheatcodes in a separate function to avoid stack too deep + testArrayCheatcodes(); + } + + function testArrayCheatcodes() public view { + (uint256[2] memory chainIds, string[2] memory chains) = ([uint256(1), uint256(10)], ["mainnet", "optimism"]); + + for (uint256 i = 0; i < chains.length; i++) { + console.log("Testing arrays for chain:", chains[i]); + + // Test bool array + bool[] memory boolArray = vm.readForkChainBoolArray(chainIds[i], "bool_array"); + assert(boolArray.length == 3); + console.log(" > bool_array[0]:", boolArray[0]); + + // Test int array + int256[] memory intArray = vm.readForkChainIntArray(chainIds[i], "int_array"); + assert(intArray.length == 3); + console.log(" > int_array[0]:", intArray[0]); + + // Test uint array + uint256[] memory uintArray = vm.readForkChainUintArray(chainIds[i], "uint_array"); + assert(uintArray.length == 3); + console.log(" > uint_array[0]:", uintArray[0]); + + // Test address array + address[] memory addrArray = vm.readForkChainAddressArray(chainIds[i], "addr_array"); + assert(addrArray.length == 2); + console.log(" > addr_array[0]:", addrArray[0]); + + // Test bytes32 array + bytes32[] memory bytes32Array = vm.readForkChainBytes32Array(chainIds[i], "bytes32_array"); + assert(bytes32Array.length == 2); + + // Test bytes array + bytes[] memory bytesArray = vm.readForkChainBytesArray(chainIds[i], "bytes_array"); + assert(bytesArray.length == 3); + + // Test string array + string[] memory stringArray = vm.readForkChainStringArray(chainIds[i], "string_array"); + assert(stringArray.length == 3); + console.log(" > string_array[0]:", stringArray[0]); + } } function eqString(string memory s1, string memory s2) public pure returns(bool) { @@ -3371,6 +3445,18 @@ contract ForkScript is DSTest { > bool: false > addr: 0x00000000000000000000000000000000DeaDBeef > string: bazz + Testing arrays for chain: mainnet + > bool_array[0]: true + > int_array[0]: -100 + > uint_array[0]: 100 + > addr_array[0]: 0x1111111111111111111111111111111111111111 + > string_array[0]: hello + Testing arrays for chain: optimism + > bool_array[0]: false + > int_array[0]: -400 + > uint_array[0]: 400 + > addr_array[0]: 0x3333333333333333333333333333333333333333 + > string_array[0]: foo "#]]); }); @@ -3383,14 +3469,15 @@ forgetest_init!(can_derive_chain_id_access_fork_config, |prj, cmd| { let mainnet_endpoint = rpc::next_http_rpc_endpoint(); prj.update_config(|config| { - config.forks = vec![ - ( - "mainnet".to_string(), - ForkConfig { - rpc_endpoint: Some(RpcEndpoint::new(RpcEndpointUrl::Url( - mainnet_endpoint.clone(), - ))), - vars: vec![ + config.forks = ForkConfigs( + vec![ + ( + "mainnet".to_string(), + ForkChainConfig { + rpc_endpoint: Some(RpcEndpoint::new(RpcEndpointUrl::Url( + mainnet_endpoint.clone(), + ))), + vars: vec![ ("i256".into(), "-1234".into()), ("u256".into(), 1234.into()), ("bool".into(), true.into()), @@ -3402,16 +3489,30 @@ forgetest_init!(can_derive_chain_id_access_fork_config, |prj, cmd| { ("addr".into(), "0xdeadbeef00000000000000000000000000000000".into()), ("bytes".into(), "0x00000000000f00".into()), ("str".into(), "bar".into()), + // Array configurations for testing new array cheatcodes + ("bool_array".into(), vec![true, false, true].into()), + ("int_array".into(), vec!["-100", "200", "-300"].into()), + ("uint_array".into(), vec!["100", "200", "300"].into()), + ("addr_array".into(), vec![ + "0x1111111111111111111111111111111111111111", + "0x2222222222222222222222222222222222222222" + ].into()), + ("bytes32_array".into(), vec![ + "0x1111111111111111111111111111111111111111111111111111111111111111", + "0x2222222222222222222222222222222222222222222222222222222222222222" + ].into()), + ("bytes_array".into(), vec!["0x1234", "0x5678", "0xabcd"].into()), + ("string_array".into(), vec!["hello", "world", "test"].into()), ] - .into_iter() - .collect(), - }, - ), - ( - "optimism".to_string(), - ForkConfig { - rpc_endpoint: None, - vars: vec![ + .into_iter() + .collect(), + }, + ), + ( + "optimism".to_string(), + ForkChainConfig { + rpc_endpoint: None, + vars: vec![ ("i256".into(), "-4321".into()), ("u256".into(), 4321.into()), ("bool".into(), "false".into()), @@ -3423,14 +3524,29 @@ forgetest_init!(can_derive_chain_id_access_fork_config, |prj, cmd| { ("addr".into(), "0x00000000000000000000000000000000deadbeef".into()), ("bytes".into(), "0x00f00000000000".into()), ("str".into(), "bazz".into()), + // Array configurations for testing new array cheatcodes + ("bool_array".into(), vec![false, true, false].into()), + ("int_array".into(), vec!["-400", "500", "-600"].into()), + ("uint_array".into(), vec!["400", "500", "600"].into()), + ("addr_array".into(), vec![ + "0x3333333333333333333333333333333333333333", + "0x4444444444444444444444444444444444444444" + ].into()), + ("bytes32_array".into(), vec![ + "0x3333333333333333333333333333333333333333333333333333333333333333", + "0x4444444444444444444444444444444444444444444444444444444444444444" + ].into()), + ("bytes_array".into(), vec!["0xdead", "0xbeef", "0xcafe"].into()), + ("string_array".into(), vec!["foo", "bar", "baz"].into()), ] - .into_iter() - .collect(), - }, - ), - ] - .into_iter() - .collect(); + .into_iter() + .collect(), + }, + ), + ] + .into_iter() + .collect(), + ); config.rpc_endpoints = RpcEndpoints::new(vec![( "optimism", @@ -3449,23 +3565,23 @@ contract ForkTest is DSTest { Vm vm = Vm(HEVM_ADDRESS); function test_panicsWhithoutSelectedFork() public { - vm.forkChain(); + vm.readForkChain(); } function test_forkVars() public { vm.createSelectFork(""); - console.log("chain:", vm.forkChain()); - console.log("id:", vm.forkChainId()); - assert(eqString(vm.forkRpcUrl(), "")); + console.log("chain:", vm.readForkChain()); + console.log("id:", vm.readForkChainId()); + assert(eqString(vm.readForkRpcUrl(), "")); - int256 i256 = vm.forkInt("i256"); - uint256 u256 = vm.forkUint("u256"); - bool boolean = vm.forkBool("bool"); - address addr = vm.forkAddress("addr"); - bytes32 b256 = vm.forkBytes32("b256"); - bytes memory byytes = vm.forkBytes("bytes"); - string memory str = vm.forkString("str"); + int256 i256 = vm.readForkInt("i256"); + uint256 u256 = vm.readForkUint("u256"); + bool boolean = vm.readForkBool("bool"); + address addr = vm.readForkAddress("addr"); + bytes32 b256 = vm.readForkBytes32("b256"); + bytes memory byytes = vm.readForkBytes("bytes"); + string memory str = vm.readForkString("str"); console.log(" > vars:"); console.log(" > i256:", i256); @@ -3478,6 +3594,52 @@ contract ForkTest is DSTest { b256 == 0xdeadbeaf00000000000000000000000000000000000000000000000000000000 || b256 == 0x000000000000000000000000000000000000000000000000000000deadc0ffee ); + + // Test array cheatcodes in a separate function to avoid stack too deep + testArrayCheatcodes(); + } + + function testArrayCheatcodes() public { + // Test array cheatcodes without specifying chain (uses active fork) + console.log(" > Arrays:"); + + // Test bool array + bool[] memory boolArray = vm.readForkBoolArray("bool_array"); + assert(boolArray.length == 3); + assert(boolArray[0] == true); + console.log(" > bool_array[0]:", boolArray[0]); + + // Test int array + int256[] memory intArray = vm.readForkIntArray("int_array"); + assert(intArray.length == 3); + assert(intArray[0] == -100); + console.log(" > int_array[0]:", intArray[0]); + + // Test uint array + uint256[] memory uintArray = vm.readForkUintArray("uint_array"); + assert(uintArray.length == 3); + assert(uintArray[0] == 100); + console.log(" > uint_array[0]:", uintArray[0]); + + // Test address array + address[] memory addrArray = vm.readForkAddressArray("addr_array"); + assert(addrArray.length == 2); + assert(addrArray[0] == 0x1111111111111111111111111111111111111111); + console.log(" > addr_array[0]:", addrArray[0]); + + // Test bytes32 array + bytes32[] memory bytes32Array = vm.readForkBytes32Array("bytes32_array"); + assert(bytes32Array.length == 2); + + // Test bytes array + bytes[] memory bytesArray = vm.readForkBytesArray("bytes_array"); + assert(bytesArray.length == 3); + + // Test string array + string[] memory stringArray = vm.readForkStringArray("string_array"); + assert(stringArray.length == 3); + assert(eqString(stringArray[0], "hello")); + console.log(" > string_array[0]:", stringArray[0]); } function eqString(string memory s1, string memory s2) public pure returns(bool) { @@ -3501,8 +3663,67 @@ Logs: > bool: true > addr: 0xdEADBEeF00000000000000000000000000000000 > string: bar + > Arrays: + > bool_array[0]: true + > int_array[0]: -100 + > uint_array[0]: 100 + > addr_array[0]: 0x1111111111111111111111111111111111111111 + > string_array[0]: hello + +[FAIL: vm.readForkChain: a fork must be selected] test_panicsWhithoutSelectedFork() ([GAS]) +... +"#]]); +}); -[FAIL: vm.forkChain: a fork must be selected] test_panicsWhithoutSelectedFork() ([GAS]) +// Tests that it will throw an error when reading an address that is not 20 bytes +forgetest_init!(throws_error_when_reading_invalid_address, |prj, cmd| { + prj.insert_vm(); + prj.insert_console(); + prj.insert_ds_test(); + let mainnet_endpoint = rpc::next_http_rpc_endpoint(); + + prj.update_config(|config| { + config.forks = ForkConfigs( + vec![( + "mainnet".to_string(), + ForkChainConfig { + rpc_endpoint: Some(RpcEndpoint::new(RpcEndpointUrl::Url( + mainnet_endpoint.clone(), + ))), + vars: vec![("owner".into(), "0xdeadbeef".into())].into_iter().collect(), + }, + )] + .into_iter() + .collect(), + ); + }); + + prj.add_source( + "ForkTest.t.sol", + &r#" +import {Vm} from "./Vm.sol"; +import {DSTest} from "./test.sol"; +import {console} from "./console.sol"; + +contract ForkTest is DSTest { + Vm vm = Vm(HEVM_ADDRESS); + + function test_throwsErrorWhen() public { + vm.createSelectFork(""); + address owner = vm.readForkAddress("owner"); + } +} + "# + .replace("", &mainnet_endpoint), + ) + .unwrap(); + + cmd.args(["test", "ForkTest"]).assert_failure().stdout_eq(str![[r#" +... +[FAIL: vm.readForkAddress: Failed to parse 'owner' in [fork.mainnet]: failed parsing "0xdeadbeef" as type `address`: parser error: +0xdeadbeef +^ +invalid string length] test_throwsErrorWhen() ([GAS]) ... "#]]); }); diff --git a/testdata/cheats/Vm.sol b/testdata/cheats/Vm.sol index 69428698fb607..5bfb984158914 100644 --- a/testdata/cheats/Vm.sol +++ b/testdata/cheats/Vm.sol @@ -286,26 +286,6 @@ interface Vm { function expectSafeMemoryCall(uint64 min, uint64 max) external; function fee(uint256 newBasefee) external; function ffi(string[] calldata commandInput) external returns (bytes memory result); - function forkAddress(string calldata key) external view returns (address); - function forkBool(string calldata key) external view returns (bool); - function forkBytes(string calldata key) external view returns (bytes memory); - function forkBytes32(string calldata key) external view returns (bytes32); - function forkChain() external view returns (string memory); - function forkChainAddress(uint256 chain, string calldata key) external view returns (address); - function forkChainBool(uint256 chain, string calldata key) external view returns (bool); - function forkChainBytes(uint256 chain, string calldata key) external view returns (bytes memory); - function forkChainBytes32(uint256 chain, string calldata key) external view returns (bytes32); - function forkChainId() external view returns (uint256); - function forkChainIds() external view returns (uint256[] memory); - function forkChainInt(uint256 chain, string calldata key) external view returns (int256); - function forkChainRpcUrl(uint256 id) external view returns (string memory); - function forkChainString(uint256 chain, string calldata key) external view returns (string memory); - function forkChainUint(uint256 chain, string calldata key) external view returns (uint256); - function forkChains() external view returns (string[] memory); - function forkInt(string calldata key) external view returns (int256); - function forkRpcUrl() external view returns (string memory); - function forkString(string calldata key) external view returns (string memory); - function forkUint(string calldata key) external view returns (uint256); function foundryVersionAtLeast(string calldata version) external view returns (bool); function foundryVersionCmp(string calldata version) external view returns (int256); function fsMetadata(string calldata path) external view returns (FsMetadata memory metadata); @@ -444,6 +424,40 @@ interface Vm { function readDir(string calldata path, uint64 maxDepth, bool followLinks) external view returns (DirEntry[] memory entries); function readFile(string calldata path) external view returns (string memory data); function readFileBinary(string calldata path) external view returns (bytes memory data); + function readForkAddress(string calldata key) external view returns (address); + function readForkAddressArray(string calldata key) external view returns (address[] memory); + function readForkBool(string calldata key) external view returns (bool); + function readForkBoolArray(string calldata key) external view returns (bool[] memory); + function readForkBytes(string calldata key) external view returns (bytes memory); + function readForkBytes32(string calldata key) external view returns (bytes32); + function readForkBytes32Array(string calldata key) external view returns (bytes32[] memory); + function readForkBytesArray(string calldata key) external view returns (bytes[] memory); + function readForkChain() external view returns (string memory); + function readForkChainAddress(uint256 chain, string calldata key) external view returns (address); + function readForkChainAddressArray(uint256 chain, string calldata key) external view returns (address[] memory); + function readForkChainBool(uint256 chain, string calldata key) external view returns (bool); + function readForkChainBoolArray(uint256 chain, string calldata key) external view returns (bool[] memory); + function readForkChainBytes(uint256 chain, string calldata key) external view returns (bytes memory); + function readForkChainBytes32(uint256 chain, string calldata key) external view returns (bytes32); + function readForkChainBytes32Array(uint256 chain, string calldata key) external view returns (bytes32[] memory); + function readForkChainBytesArray(uint256 chain, string calldata key) external view returns (bytes[] memory); + function readForkChainId() external view returns (uint256); + function readForkChainIds() external view returns (uint256[] memory); + function readForkChainInt(uint256 chain, string calldata key) external view returns (int256); + function readForkChainIntArray(uint256 chain, string calldata key) external view returns (int256[] memory); + function readForkChainRpcUrl(uint256 id) external view returns (string memory); + function readForkChainString(uint256 chain, string calldata key) external view returns (string memory); + function readForkChainStringArray(uint256 chain, string calldata key) external view returns (string[] memory); + function readForkChainUint(uint256 chain, string calldata key) external view returns (uint256); + function readForkChainUintArray(uint256 chain, string calldata key) external view returns (uint256[] memory); + function readForkChains() external view returns (string[] memory); + function readForkInt(string calldata key) external view returns (int256); + function readForkIntArray(string calldata key) external view returns (int256[] memory); + function readForkRpcUrl() external view returns (string memory); + function readForkString(string calldata key) external view returns (string memory); + function readForkStringArray(string calldata key) external view returns (string[] memory); + function readForkUint(string calldata key) external view returns (uint256); + function readForkUintArray(string calldata key) external view returns (uint256[] memory); function readLine(string calldata path) external view returns (string memory line); function readLink(string calldata linkPath) external view returns (string memory targetPath); function record() external;