// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; pragma experimental ABIEncoderV2; import "./Vm.sol"; // Helpers for parsing keys into types. library stdJson { VmSafe private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); function parseRaw(string memory json, string memory key) internal pure returns (bytes memory) { return vm.parseJson(json, key); } function readUint(string memory json, string memory key) internal pure returns (uint256) { return abi.decode(vm.parseJson(json, key), (uint256)); } function readUintArray(string memory json, string memory key) internal pure returns (uint256[] memory) { return abi.decode(vm.parseJson(json, key), (uint256[])); } function readInt(string memory json, string memory key) internal pure returns (int256) { return abi.decode(vm.parseJson(json, key), (int256)); } function readIntArray(string memory json, string memory key) internal pure returns (int256[] memory) { return abi.decode(vm.parseJson(json, key), (int256[])); } function readBytes32(string memory json, string memory key) internal pure returns (bytes32) { return abi.decode(vm.parseJson(json, key), (bytes32)); } function readBytes32Array(string memory json, string memory key) internal pure returns (bytes32[] memory) { return abi.decode(vm.parseJson(json, key), (bytes32[])); } function readString(string memory json, string memory key) internal pure returns (string memory) { return abi.decode(vm.parseJson(json, key), (string)); } function readStringArray(string memory json, string memory key) internal pure returns (string[] memory) { return abi.decode(vm.parseJson(json, key), (string[])); } function readAddress(string memory json, string memory key) internal pure returns (address) { return abi.decode(vm.parseJson(json, key), (address)); } function readAddressArray(string memory json, string memory key) internal pure returns (address[] memory) { return abi.decode(vm.parseJson(json, key), (address[])); } function readBool(string memory json, string memory key) internal pure returns (bool) { return abi.decode(vm.parseJson(json, key), (bool)); } function readBoolArray(string memory json, string memory key) internal pure returns (bool[] memory) { return abi.decode(vm.parseJson(json, key), (bool[])); } function readBytes(string memory json, string memory key) internal pure returns (bytes memory) { return abi.decode(vm.parseJson(json, key), (bytes)); } function readBytesArray(string memory json, string memory key) internal pure returns (bytes[] memory) { return abi.decode(vm.parseJson(json, key), (bytes[])); } }