diff --git a/packages/linea-ens-resolver/deployments/mainnet/L1Resolver.json b/packages/linea-ens-resolver/deployments/mainnet/L1Resolver.json index 248b67948..c6e49b63e 100644 --- a/packages/linea-ens-resolver/deployments/mainnet/L1Resolver.json +++ b/packages/linea-ens-resolver/deployments/mainnet/L1Resolver.json @@ -1,5 +1,5 @@ { - "address": "0xEeB8abB9628db21Cb5CADe823FF7828706C9a65F", + "address": "0xde16ee87B0C019499cEBDde29c9F7686560f679a", "abi": [ { "inputs": [ @@ -250,6 +250,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getAcceptedL2BlockRangeLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, { "inputs": [ { @@ -479,34 +492,34 @@ "type": "function" } ], - "transactionHash": "0xdb2d6282f214d4fafbb877a5300407b06aac80ad58d0967d0214b3075ffb43eb", + "transactionHash": "0xdb9928a5416e3988e0c7653d2b281e138e543ac215a1ba002aee3137cde2420a", "receipt": { "to": null, "from": "0x644e1ce71A6AfF1Fc52955214DF978DBB28f7a97", - "contractAddress": "0xEeB8abB9628db21Cb5CADe823FF7828706C9a65F", - "transactionIndex": 7, - "gasUsed": "2068559", + "contractAddress": "0xde16ee87B0C019499cEBDde29c9F7686560f679a", + "transactionIndex": 109, + "gasUsed": "2076572", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3e334c7069c6f9ba18d2d9aaf6e467a0b3a00b60fae25342ba8e90201440ef23", - "transactionHash": "0xdb2d6282f214d4fafbb877a5300407b06aac80ad58d0967d0214b3075ffb43eb", + "blockHash": "0xc8086cd4097a26526040e0a2445d9cc96759115e4842c5ca54d9dcb2326eb71b", + "transactionHash": "0xdb9928a5416e3988e0c7653d2b281e138e543ac215a1ba002aee3137cde2420a", "logs": [], - "blockNumber": 20318022, - "cumulativeGasUsed": "3620263", + "blockNumber": 20410692, + "cumulativeGasUsed": "14324480", "status": 1, "byzantium": true }, "args": [ - "0x6401041c0D00E1ca2B4b1b93dA74d5BD0d50E57A", + "0x2aD1A39a3b616FB11ac5DB290061A0A5C09771f3", "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401", "https://api.studio.thegraph.com/query/69290/ens-linea-mainnet/version/latest", 59144 ], - "numDeployments": 2, - "solcInputHash": "617c92f0f6f9d0cc08a713d0472e5f03", - "metadata": "{\"compiler\":{\"version\":\"0.8.25+commit.b61c2a91\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IEVMVerifier\",\"name\":\"_verifier\",\"type\":\"address\"},{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"_nameWrapper\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_graphqlUrl\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_l2ChainId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CommandTooLong\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max\",\"type\":\"uint256\"}],\"name\":\"InvalidReference\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"urls\",\"type\":\"string[]\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes4\",\"name\":\"callbackFunction\",\"type\":\"bytes4\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"OffchainLookup\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"actual\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"}],\"name\":\"ResponseLengthMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"}],\"name\":\"StorageHandledByL2\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"max\",\"type\":\"uint256\"}],\"name\":\"TooManyCommands\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"graphqlUrl\",\"type\":\"string\"}],\"name\":\"MetadataChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"TargetSet\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"values\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"addrCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"values\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"addrCoinTypeCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"values\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"contenthashCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extradata\",\"type\":\"bytes\"}],\"name\":\"getStorageSlotsCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"getTarget\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"graphqlUrl\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2ChainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"metadata\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nameWrapper\",\"outputs\":[{\"internalType\":\"contract INameWrapper\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"result\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"result\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"setTarget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"values\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"textCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifier\",\"outputs\":[{\"internalType\":\"contract IEVMVerifier\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"StorageHandledByL2(uint256,address)\":[{\"details\":\"EIP-5559 - Error to raise when mutations are being deferred to an L2.\",\"params\":{\"chainId\":\"Chain ID to perform the deferred mutation to.\",\"contractAddress\":\"Contract Address at which the deferred mutation should transact with.\"}}]},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_ens\":\"The ENS registry address\",\"_graphqlUrl\":\"The offchain/l2 graphql endpoint url\",\"_l2ChainId\":\"The chainId at which the resolver resolves data from\",\"_nameWrapper\":\"The ENS name wrapper address\",\"_verifier\":\"The chain verifier address\"}},\"getStorageSlotsCallback(bytes,bytes)\":{\"details\":\"Internal callback function invoked by CCIP-Read in response to a `getStorageSlots` request.\"},\"getTarget(bytes)\":{\"details\":\"Returns the L2 target address that can answer queries for `name`.\",\"params\":{\"name\":\"DNS encoded ENS name to query\"},\"returns\":{\"node\":\"The node of the name\",\"target\":\"The L2 resolver address to verify against.\"}},\"metadata(bytes)\":{\"details\":\"This function provides metadata about the L1 Resolver, including its name, coin type, GraphQL URL, storage type, and encoded information.\",\"params\":{\"name\":\"The domain name in format (dnsEncoded)\"},\"returns\":{\"_0\":\"graphqlUrl The GraphQL URL used by the resolver\"}},\"resolve(bytes,bytes)\":{\"details\":\"Resolve and verify a record stored in l2 target address. It supports subname by fetching target recursively to the nearest parent.\",\"params\":{\"data\":\"The actual calldata\",\"name\":\"DNS encoded ENS name to query\"},\"returns\":{\"result\":\"result of the call\"}},\"setAddr(bytes,address)\":{\"details\":\"Resolve and throws an EIP 3559 compliant error\",\"params\":{\"_addr\":\"The actual calldata\",\"name\":\"DNS encoded ENS name to query\"},\"returns\":{\"result\":\"result of the call\"}},\"setTarget(bytes,address)\":{\"params\":{\"name\":\"The encoded name to query.\",\"target\":\"The L2 resolver address to verify against.\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"metadata(bytes)\":{\"notice\":\"Get metadata about the L1 Resolver\"},\"setTarget(bytes,address)\":{\"notice\":\"Set target address to verify against\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/L1Resolver.sol\":\"L1Resolver\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@ensdomains/ens-contracts/contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"@ensdomains/ens-contracts/contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"@ensdomains/ens-contracts/contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/IAddrSetter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\ninterface IAddrSetter {\\n function setAddr(\\n bytes calldata name,\\n address _addr\\n ) external view returns (bytes memory result);\\n}\\n\",\"keccak256\":\"0xd211ec6793d80d0bb7643d8f15e5773abe38541edee0b85eb83283ca5fdd1525\",\"license\":\"MIT\"},\"contracts/IMetadataResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\ninterface IMetadataResolver {\\n /*\\n * @notice Get metadata about the CCIP Resolver ENSIP 16 https://docs.ens.domains/ens-improvement-proposals/ensip-16-offchain-metadata\\n * @dev This function provides metadata about the CCIP Resolver, including its name, coin type, GraphQL URL, storage type, and encoded information.\\n * @param name The domain name in format (dnsEncoded)\\n * @return graphqlUrl The GraphQL URL used by the resolver\\n *\\n */\\n function metadata(\\n bytes calldata name\\n ) external view returns (string memory graphqlUrl);\\n\\n event MetadataChanged(bytes name, string graphqlUrl);\\n}\\n\",\"keccak256\":\"0xe2edf067122145bfd59e95b0f5b3507bd0cd2715b6b7d7068e70c6cbef09e5ae\",\"license\":\"MIT\"},\"contracts/ITargetResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\ninterface ITargetResolver {\\n function getTarget(\\n bytes memory name\\n ) external view returns (bytes32 node, address target);\\n}\\n\",\"keccak256\":\"0x2daa66377cc37fc99b927d87f5495259ed6e49c0f10af1f75bd5fd74964e5b78\",\"license\":\"MIT\"},\"contracts/L1Resolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\nimport {EVMFetcher} from \\\"linea-state-verifier/contracts/EVMFetcher.sol\\\";\\nimport {EVMFetchTarget} from \\\"linea-state-verifier/contracts/EVMFetchTarget.sol\\\";\\nimport {IEVMVerifier} from \\\"linea-state-verifier/contracts/IEVMVerifier.sol\\\";\\nimport \\\"@ensdomains/ens-contracts/contracts/registry/ENS.sol\\\";\\nimport {INameWrapper} from \\\"@ensdomains/ens-contracts/contracts/wrapper/INameWrapper.sol\\\";\\nimport {BytesUtils} from \\\"@ensdomains/ens-contracts/contracts/dnssec-oracle/BytesUtils.sol\\\";\\nimport {IAddrResolver} from \\\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddrResolver.sol\\\";\\nimport {IAddressResolver} from \\\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddressResolver.sol\\\";\\nimport {ITextResolver} from \\\"@ensdomains/ens-contracts/contracts/resolvers/profiles/ITextResolver.sol\\\";\\nimport {IContentHashResolver} from \\\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IContentHashResolver.sol\\\";\\nimport \\\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IExtendedResolver.sol\\\";\\nimport {ITargetResolver} from \\\"./ITargetResolver.sol\\\";\\nimport {IMetadataResolver} from \\\"./IMetadataResolver.sol\\\";\\nimport {IAddrSetter} from \\\"./IAddrSetter.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\ncontract L1Resolver is\\n EVMFetchTarget,\\n ITargetResolver,\\n IMetadataResolver,\\n IExtendedResolver,\\n IAddrSetter,\\n ERC165\\n{\\n using EVMFetcher for EVMFetcher.EVMFetchRequest;\\n using BytesUtils for bytes;\\n IEVMVerifier public immutable verifier;\\n ENS public immutable ens;\\n INameWrapper public immutable nameWrapper;\\n uint256 public immutable l2ChainId;\\n mapping(bytes32 => address) targets;\\n uint256 constant COIN_TYPE_ETH = 60;\\n uint256 constant RECORD_VERSIONS_SLOT = 0;\\n uint256 constant VERSIONABLE_ABIS_SLOT = 1;\\n uint256 constant VERSIONABLE_ADDRESSES_SLOT = 2;\\n uint256 constant VERSIONABLE_HASHES_SLOT = 3;\\n uint256 constant VERSIONABLE_TEXTS_SLOT = 10;\\n // To check how old is the value/proof returned and is in the acceptable range\\n uint256 constant L2_BLOCK_RANGE_ACCEPTED = 86400;\\n string public graphqlUrl;\\n\\n event TargetSet(bytes name, address target);\\n\\n function isAuthorised(bytes32 node) internal view returns (bool) {\\n // TODO: Add support for\\n // trustedETHController\\n // trustedReverseRegistrar\\n // isApprovedForAll\\n // isApprovedFor\\n address owner = ens.owner(node);\\n if (owner == address(nameWrapper)) {\\n owner = nameWrapper.ownerOf(uint256(node));\\n }\\n return owner == msg.sender;\\n }\\n\\n /**\\n * @dev EIP-5559 - Error to raise when mutations are being deferred to an L2.\\n * @param chainId Chain ID to perform the deferred mutation to.\\n * @param contractAddress Contract Address at which the deferred mutation should transact with.\\n */\\n error StorageHandledByL2(uint256 chainId, address contractAddress);\\n\\n /**\\n * @param _verifier The chain verifier address\\n * @param _ens The ENS registry address\\n * @param _nameWrapper The ENS name wrapper address\\n * @param _graphqlUrl The offchain/l2 graphql endpoint url\\n * @param _l2ChainId The chainId at which the resolver resolves data from\\n */\\n constructor(\\n IEVMVerifier _verifier,\\n ENS _ens,\\n INameWrapper _nameWrapper,\\n string memory _graphqlUrl,\\n uint256 _l2ChainId\\n ) {\\n require(\\n address(_nameWrapper) != address(0),\\n \\\"Name Wrapper address must be set\\\"\\n );\\n require(\\n address(_verifier) != address(0),\\n \\\"Verifier address must be set\\\"\\n );\\n require(address(_ens) != address(0), \\\"Registry address must be set\\\");\\n verifier = _verifier;\\n ens = _ens;\\n nameWrapper = _nameWrapper;\\n graphqlUrl = _graphqlUrl;\\n l2ChainId = _l2ChainId;\\n }\\n\\n /**\\n * Set target address to verify against\\n * @param name The encoded name to query.\\n * @param target The L2 resolver address to verify against.\\n */\\n function setTarget(bytes calldata name, address target) external {\\n (bytes32 node, ) = getTarget(name);\\n require(\\n isAuthorised(node),\\n \\\"Not authorized to set target for this node\\\"\\n );\\n targets[node] = target;\\n emit TargetSet(name, target);\\n emit MetadataChanged(name, graphqlUrl);\\n }\\n\\n /**\\n * @dev Returns the L2 target address that can answer queries for `name`.\\n * @param name DNS encoded ENS name to query\\n * @return node The node of the name\\n * @return target The L2 resolver address to verify against.\\n */\\n function getTarget(\\n bytes memory name\\n ) public view returns (bytes32 node, address target) {\\n return _getTarget(name, 0);\\n }\\n\\n function _getTarget(\\n bytes memory name,\\n uint256 offset\\n ) private view returns (bytes32 node, address target) {\\n uint256 len = name.readUint8(offset);\\n node = bytes32(0);\\n if (len > 0) {\\n bytes32 label = name.keccak(offset + 1, len);\\n (node, target) = _getTarget(name, offset + len + 1);\\n node = keccak256(abi.encodePacked(node, label));\\n if (targets[node] != address(0)) {\\n return (node, targets[node]);\\n }\\n } else {\\n return (bytes32(0), address(0));\\n }\\n return (node, target);\\n }\\n\\n /**\\n * @dev Resolve and verify a record stored in l2 target address. It supports subname by fetching target recursively to the nearest parent.\\n * @param name DNS encoded ENS name to query\\n * @param data The actual calldata\\n * @return result result of the call\\n */\\n function resolve(\\n bytes calldata name,\\n bytes calldata data\\n ) external view returns (bytes memory result) {\\n require(data.length >= 4, \\\"param data too short\\\");\\n\\n (, address target) = _getTarget(name, 0);\\n bytes4 selector = bytes4(data);\\n\\n if (selector == IAddrResolver.addr.selector) {\\n bytes32 node = abi.decode(data[4:], (bytes32));\\n return _addr(node, target);\\n }\\n if (selector == IAddressResolver.addr.selector) {\\n (bytes32 node, uint256 cointype) = abi.decode(\\n data[4:],\\n (bytes32, uint256)\\n );\\n return _addr(node, cointype, target);\\n }\\n if (selector == ITextResolver.text.selector) {\\n (bytes32 node, string memory key) = abi.decode(\\n data[4:],\\n (bytes32, string)\\n );\\n return bytes(_text(node, key, target));\\n }\\n if (selector == IContentHashResolver.contenthash.selector) {\\n bytes32 node = abi.decode(data[4:], (bytes32));\\n return _contenthash(node, target);\\n }\\n\\n // None selector has been found it reverts\\n revert(\\\"invalid selector\\\");\\n }\\n\\n /**\\n * @dev Resolve and throws an EIP 3559 compliant error\\n * @param name DNS encoded ENS name to query\\n * @param _addr The actual calldata\\n * @return result result of the call\\n */\\n function setAddr(\\n bytes calldata name,\\n address _addr\\n ) external view returns (bytes memory result) {\\n (, address target) = _getTarget(name, 0);\\n _writeDeferral(target);\\n }\\n\\n function _addr(\\n bytes32 node,\\n address target\\n ) private view returns (bytes memory) {\\n EVMFetcher\\n .newFetchRequest(verifier, target)\\n .getStatic(RECORD_VERSIONS_SLOT)\\n .element(node)\\n .getDynamic(VERSIONABLE_ADDRESSES_SLOT)\\n .ref(0)\\n .element(node)\\n .element(COIN_TYPE_ETH)\\n .fetch(\\n this.addrCallback.selector,\\n abi.encode(L2_BLOCK_RANGE_ACCEPTED)\\n ); // recordVersions\\n }\\n\\n function addrCallback(\\n bytes[] memory values,\\n bytes memory\\n ) external pure returns (bytes memory) {\\n return abi.encode(address(bytes20(values[1])));\\n }\\n\\n function _addr(\\n bytes32 node,\\n uint256 coinType,\\n address target\\n ) private view returns (bytes memory) {\\n EVMFetcher\\n .newFetchRequest(verifier, target)\\n .getStatic(RECORD_VERSIONS_SLOT)\\n .element(node)\\n .getDynamic(VERSIONABLE_ADDRESSES_SLOT)\\n .ref(0)\\n .element(node)\\n .element(coinType)\\n .fetch(\\n this.addrCoinTypeCallback.selector,\\n abi.encode(L2_BLOCK_RANGE_ACCEPTED)\\n );\\n }\\n\\n function addrCoinTypeCallback(\\n bytes[] memory values,\\n bytes memory\\n ) external pure returns (bytes memory) {\\n return abi.encode(values[1]);\\n }\\n\\n function _text(\\n bytes32 node,\\n string memory key,\\n address target\\n ) private view returns (bytes memory) {\\n EVMFetcher\\n .newFetchRequest(verifier, target)\\n .getStatic(RECORD_VERSIONS_SLOT)\\n .element(node)\\n .getDynamic(VERSIONABLE_TEXTS_SLOT)\\n .ref(0)\\n .element(node)\\n .element(key)\\n .fetch(\\n this.textCallback.selector,\\n abi.encode(L2_BLOCK_RANGE_ACCEPTED)\\n );\\n }\\n\\n function textCallback(\\n bytes[] memory values,\\n bytes memory\\n ) external pure returns (bytes memory) {\\n return abi.encode(string(values[1]));\\n }\\n\\n function _contenthash(\\n bytes32 node,\\n address target\\n ) private view returns (bytes memory) {\\n EVMFetcher\\n .newFetchRequest(verifier, target)\\n .getStatic(RECORD_VERSIONS_SLOT)\\n .element(node)\\n .getDynamic(VERSIONABLE_HASHES_SLOT)\\n .ref(0)\\n .element(node)\\n .fetch(\\n this.contenthashCallback.selector,\\n abi.encode(L2_BLOCK_RANGE_ACCEPTED)\\n );\\n }\\n\\n function contenthashCallback(\\n bytes[] memory values,\\n bytes memory\\n ) external pure returns (bytes memory) {\\n return abi.encode(values[1]);\\n }\\n\\n /**\\n * @notice Get metadata about the L1 Resolver\\n * @dev This function provides metadata about the L1 Resolver, including its name, coin type, GraphQL URL, storage type, and encoded information.\\n * @param name The domain name in format (dnsEncoded)\\n * @return graphqlUrl The GraphQL URL used by the resolver\\n */\\n function metadata(\\n bytes calldata name\\n ) external view returns (string memory) {\\n return (graphqlUrl);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view override returns (bool) {\\n return\\n interfaceId == type(IExtendedResolver).interfaceId ||\\n interfaceId == type(ITargetResolver).interfaceId ||\\n interfaceId == type(IMetadataResolver).interfaceId ||\\n interfaceId == type(IAddrSetter).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n function _writeDeferral(address target) internal view {\\n revert StorageHandledByL2(l2ChainId, target);\\n }\\n}\\n\",\"keccak256\":\"0x1264bded47dbe0d7841b368f2f21a647a321b3cf59e09f457528bd16be9e5f75\",\"license\":\"MIT\"},\"linea-state-verifier/contracts/EVMFetchTarget.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\nimport {IEVMVerifier} from \\\"./IEVMVerifier.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\n/**\\n * @dev Callback implementation for users of `EVMFetcher`. If you use `EVMFetcher`, your contract must\\n * inherit from this contract in order to handle callbacks correctly.\\n */\\nabstract contract EVMFetchTarget {\\n using Address for address;\\n\\n error ResponseLengthMismatch(uint256 actual, uint256 expected);\\n\\n /**\\n * @dev Internal callback function invoked by CCIP-Read in response to a `getStorageSlots` request.\\n */\\n function getStorageSlotsCallback(\\n bytes calldata response,\\n bytes calldata extradata\\n ) external returns (bytes memory) {\\n bytes memory proof = abi.decode(response, (bytes));\\n (\\n IEVMVerifier verifier,\\n address addr,\\n bytes32[] memory commands,\\n bytes[] memory constants,\\n bytes4 callback,\\n uint256 l2BlockRangeAccepted\\n ) = abi.decode(\\n extradata,\\n (IEVMVerifier, address, bytes32[], bytes[], bytes4, uint256)\\n );\\n bytes[] memory values = verifier.getStorageValues(\\n addr,\\n commands,\\n constants,\\n proof,\\n l2BlockRangeAccepted\\n );\\n if (values.length != commands.length) {\\n revert ResponseLengthMismatch(values.length, commands.length);\\n }\\n bytes memory ret = address(this).functionCall(\\n abi.encodeWithSelector(callback, values, \\\"\\\")\\n );\\n assembly {\\n return(add(ret, 32), mload(ret))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7e0ea45ce78d517d367bbd43282b0731b3c60f4a9fa3626ace7f5002421763e0\",\"license\":\"MIT\"},\"linea-state-verifier/contracts/EVMFetcher.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\nimport {IEVMVerifier} from \\\"./IEVMVerifier.sol\\\";\\nimport {EVMFetchTarget} from \\\"./EVMFetchTarget.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\ninterface IEVMGateway {\\n function getStorageSlots(\\n address addr,\\n bytes32[] memory commands,\\n bytes[] memory constants\\n ) external pure returns (bytes memory witness);\\n}\\n\\nuint8 constant FLAG_DYNAMIC = 0x01;\\nuint8 constant OP_CONSTANT = 0x00;\\nuint8 constant OP_BACKREF = 0x20;\\nuint8 constant OP_END = 0xff;\\n\\n/**\\n * @dev A library to facilitate requesting storage data proofs from contracts, possibly on a different chain.\\n * See l1-verifier/test/TestL1.sol for example usage.\\n */\\nlibrary EVMFetcher {\\n uint256 constant MAX_COMMANDS = 32;\\n uint256 constant MAX_CONSTANTS = 32; // Must not be greater than 32\\n\\n using Address for address;\\n\\n error TooManyCommands(uint256 max);\\n error CommandTooLong();\\n error InvalidReference(uint256 value, uint256 max);\\n error OffchainLookup(\\n address sender,\\n string[] urls,\\n bytes callData,\\n bytes4 callbackFunction,\\n bytes extraData\\n );\\n\\n struct EVMFetchRequest {\\n IEVMVerifier verifier;\\n address target;\\n bytes32[] commands;\\n uint256 operationIdx;\\n bytes[] constants;\\n }\\n\\n /**\\n * @dev Creates a request to fetch the value of multiple storage slots from a contract via CCIP-Read, possibly from\\n * another chain.\\n * Supports dynamic length values and slot numbers derived from other retrieved values.\\n * @param verifier An instance of a verifier contract that can provide and verify the storage slot information.\\n * @param target The address of the contract to fetch storage proofs for.\\n */\\n function newFetchRequest(\\n IEVMVerifier verifier,\\n address target\\n ) internal pure returns (EVMFetchRequest memory) {\\n bytes32[] memory commands = new bytes32[](MAX_COMMANDS);\\n bytes[] memory constants = new bytes[](MAX_CONSTANTS);\\n assembly {\\n mstore(commands, 0) // Set current array length to 0\\n mstore(constants, 0)\\n }\\n return EVMFetchRequest(verifier, target, commands, 0, constants);\\n }\\n\\n /**\\n * @dev Starts describing a new fetch request.\\n * Paths specify a series of hashing operations to derive the final slot ID.\\n * See https://docs.soliditylang.org/en/v0.8.17/internals/layout_in_storage.html for details on how Solidity\\n * lays out storage variables.\\n * @param request The request object being operated on.\\n * @param baseSlot The base slot ID that forms the root of the path.\\n */\\n function getStatic(\\n EVMFetchRequest memory request,\\n uint256 baseSlot\\n ) internal pure returns (EVMFetchRequest memory) {\\n bytes32[] memory commands = request.commands;\\n uint256 commandIdx = commands.length;\\n if (commandIdx > 0 && request.operationIdx < 32) {\\n // Terminate previous command\\n _addOperation(request, OP_END);\\n }\\n assembly {\\n mstore(commands, add(commandIdx, 1)) // Increment command array length\\n }\\n if (request.commands.length > MAX_COMMANDS) {\\n revert TooManyCommands(MAX_COMMANDS);\\n }\\n request.operationIdx = 0;\\n _addOperation(request, 0);\\n _addOperation(request, _addConstant(request, abi.encode(baseSlot)));\\n return request;\\n }\\n\\n /**\\n * @dev Starts describing a new fetch request.\\n * Paths specify a series of hashing operations to derive the final slot ID.\\n * See https://docs.soliditylang.org/en/v0.8.17/internals/layout_in_storage.html for details on how Solidity\\n * lays out storage variables.\\n * @param request The request object being operated on.\\n * @param baseSlot The base slot ID that forms the root of the path.\\n */\\n function getDynamic(\\n EVMFetchRequest memory request,\\n uint256 baseSlot\\n ) internal pure returns (EVMFetchRequest memory) {\\n bytes32[] memory commands = request.commands;\\n uint256 commandIdx = commands.length;\\n if (commandIdx > 0 && request.operationIdx < 32) {\\n // Terminate previous command\\n _addOperation(request, OP_END);\\n }\\n assembly {\\n mstore(commands, add(commandIdx, 1)) // Increment command array length\\n }\\n if (request.commands.length > MAX_COMMANDS) {\\n revert TooManyCommands(MAX_COMMANDS);\\n }\\n request.operationIdx = 0;\\n _addOperation(request, FLAG_DYNAMIC);\\n _addOperation(request, _addConstant(request, abi.encode(baseSlot)));\\n return request;\\n }\\n\\n /**\\n * @dev Adds a `uint256` element to the current path.\\n * @param request The request object being operated on.\\n * @param el The element to add.\\n */\\n function element(\\n EVMFetchRequest memory request,\\n uint256 el\\n ) internal pure returns (EVMFetchRequest memory) {\\n if (request.operationIdx >= 32) {\\n revert CommandTooLong();\\n }\\n _addOperation(request, _addConstant(request, abi.encode(el)));\\n return request;\\n }\\n\\n /**\\n * @dev Adds a `bytes32` element to the current path.\\n * @param request The request object being operated on.\\n * @param el The element to add.\\n */\\n function element(\\n EVMFetchRequest memory request,\\n bytes32 el\\n ) internal pure returns (EVMFetchRequest memory) {\\n if (request.operationIdx >= 32) {\\n revert CommandTooLong();\\n }\\n _addOperation(request, _addConstant(request, abi.encode(el)));\\n return request;\\n }\\n\\n /**\\n * @dev Adds an `address` element to the current path.\\n * @param request The request object being operated on.\\n * @param el The element to add.\\n */\\n function element(\\n EVMFetchRequest memory request,\\n address el\\n ) internal pure returns (EVMFetchRequest memory) {\\n if (request.operationIdx >= 32) {\\n revert CommandTooLong();\\n }\\n _addOperation(request, _addConstant(request, abi.encode(el)));\\n return request;\\n }\\n\\n /**\\n * @dev Adds a `bytes` element to the current path.\\n * @param request The request object being operated on.\\n * @param el The element to add.\\n */\\n function element(\\n EVMFetchRequest memory request,\\n bytes memory el\\n ) internal pure returns (EVMFetchRequest memory) {\\n if (request.operationIdx >= 32) {\\n revert CommandTooLong();\\n }\\n _addOperation(request, _addConstant(request, el));\\n return request;\\n }\\n\\n /**\\n * @dev Adds a `string` element to the current path.\\n * @param request The request object being operated on.\\n * @param el The element to add.\\n */\\n function element(\\n EVMFetchRequest memory request,\\n string memory el\\n ) internal pure returns (EVMFetchRequest memory) {\\n if (request.operationIdx >= 32) {\\n revert CommandTooLong();\\n }\\n _addOperation(request, _addConstant(request, bytes(el)));\\n return request;\\n }\\n\\n /**\\n * @dev Adds a reference to a previous fetch to the current path.\\n * @param request The request object being operated on.\\n * @param idx The index of the previous fetch request, starting at 0.\\n */\\n function ref(\\n EVMFetchRequest memory request,\\n uint8 idx\\n ) internal pure returns (EVMFetchRequest memory) {\\n if (request.operationIdx >= 32) {\\n revert CommandTooLong();\\n }\\n if (idx > request.commands.length || idx > 31) {\\n revert InvalidReference(idx, request.commands.length);\\n }\\n _addOperation(request, OP_BACKREF | idx);\\n return request;\\n }\\n\\n /**\\n * @dev Initiates the fetch request.\\n * Calling this function terminates execution; clients that implement CCIP-Read will make a callback to\\n * `callback` with the results of the operation.\\n * @param callbackId A callback function selector on this contract that will be invoked via CCIP-Read with the result of the lookup.\\n * The function must have a signature matching `(bytes[] memory values, bytes callbackData)` with a return type matching the call in which\\n * this function was invoked. Its return data will be returned as the return value of the entire CCIP-read operation.\\n * @param callbackData Extra data to supply to the callback.\\n */\\n function fetch(\\n EVMFetchRequest memory request,\\n bytes4 callbackId,\\n bytes memory callbackData\\n ) internal view {\\n if (request.commands.length > 0 && request.operationIdx < 32) {\\n // Terminate last command\\n _addOperation(request, OP_END);\\n }\\n\\n revert OffchainLookup(\\n address(this),\\n request.verifier.gatewayURLs(),\\n abi.encodeCall(\\n IEVMGateway.getStorageSlots,\\n (request.target, request.commands, request.constants)\\n ),\\n EVMFetchTarget.getStorageSlotsCallback.selector,\\n abi.encode(\\n request.verifier,\\n request.target,\\n request.commands,\\n request.constants,\\n callbackId,\\n callbackData\\n )\\n );\\n }\\n\\n function _addConstant(\\n EVMFetchRequest memory request,\\n bytes memory value\\n ) private pure returns (uint8 idx) {\\n bytes[] memory constants = request.constants;\\n idx = uint8(constants.length);\\n assembly {\\n mstore(constants, add(idx, 1)) // Increment constant array length\\n }\\n constants[idx] = value;\\n }\\n\\n function _addOperation(\\n EVMFetchRequest memory request,\\n uint8 op\\n ) private pure {\\n uint256 commandIdx = request.commands.length - 1;\\n request.commands[commandIdx] =\\n request.commands[commandIdx] |\\n (bytes32(bytes1(op)) >> (8 * request.operationIdx++));\\n }\\n}\\n\",\"keccak256\":\"0x96ccc4f320287222e427a2c4620d8e27cfc0a64820dc9b214ba396344eeb6a99\",\"license\":\"MIT\"},\"linea-state-verifier/contracts/IEVMVerifier.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\ninterface IEVMVerifier {\\n function gatewayURLs() external view returns (string[] memory);\\n\\n function getStorageValues(\\n address target,\\n bytes32[] memory commands,\\n bytes[] memory constants,\\n bytes memory proof,\\n uint256 l2BlockRangeAccepted\\n ) external view returns (bytes[] memory values);\\n}\\n\",\"keccak256\":\"0xd57e902e6a93880c9ec1e253ba767f1ed822fa997bfddd3bf474df1b5bc4e2b2\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6101006040523461038857612641803803908161001b8161038d565b91823960a08183810103126103885780516001600160a01b039182821682036103885760208101518381168103610388576040820151908482168203610388576060830151936001600160401b03851161038857601f938781018587830101121561038857808601516001600160401b03811161028e57601f19966100a6828801891660200161038d565b99828b5283016020838386010101116103885760005b82811061037257505060009089016020015260800151958381161561032e57808216156102e9578216156102a45760805260a05260c0528351906001600160401b03821161028e5760019283548481811c91168015610284575b602082101461026e57828111610226575b5060209183116001146101c75750819293946000926101bc575b5050600019600383901b1c191690821b1790555b60e05260405161228e90816103b3823960805181818161034601528181611403015281816115f9015281816117480152611875015260a0518181816105210152610a12015260c0518181816109550152610a47015260e051818181610c220152610c740152f35b015190503880610141565b8216908360005260206000209160005b81811061021057509583859697106101f7575b505050811b019055610155565b015160001960f88460031b161c191690553880806101ea565b87830151845592850192602092830192016101d7565b8460005260206000208380860160051c82019260208710610265575b0160051c019085905b828110610259575050610127565b6000815501859061024b565b92508192610242565b634e487b7160e01b600052602260045260246000fd5b90607f1690610116565b634e487b7160e01b600052604160045260246000fd5b60405162461bcd60e51b815260206004820152601c60248201527f52656769737472792061646472657373206d75737420626520736574000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601c60248201527f56657269666965722061646472657373206d75737420626520736574000000006044820152606490fd5b606460405162461bcd60e51b815260206004820152602060248201527f4e616d6520577261707065722061646472657373206d757374206265207365746044820152fd5b602082850182018101518c8301820152016100bc565b600080fd5b6040519190601f01601f191682016001600160401b0381118382101761028e5760405256fe6080604052600436101561001257600080fd5b60003560e01c806301ffc9a71461010d57806315f64386146101085780632b7ac3f31461010357806338bf92e6146100cc5780633f15457f146100fe5780634062b43f146100f95780635bdaa916146100f45780638a596ebe146100ef5780639061b923146100ea578063a8e5fbc0146100e5578063d358df77146100e0578063d6ae3cd5146100db578063de9abe5e146100cc578063f00eebf4146100d6578063f470901a146100d15763fcd2e381146100cc57600080fd5b6104a7565b610cac565b610c45565b610c0a565b6109cd565b61093f565b610821565b6107dc565b6106e1565b61063f565b61050b565b610330565b6102df565b61012c565b35906001600160e01b03198216820361012757565b600080fd5b346101275760203660031901126101275760043563ffffffff60e01b81168091036101275761018f90639061b92360e01b81149081156101c6575b81156101b5575b81156101a4575b8115610193575b5060405190151581529081906020820190565b0390f35b6301ffc9a760e01b1490503861017c565b633c03bafd60e21b81149150610175565b63452cb75f60e11b8114915061016e565b630afb21c360e11b81149150610167565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b0382111761020857604052565b6101d7565b61042081019081106001600160401b0382111761020857604052565b90601f801991011681019081106001600160401b0382111761020857604052565b6001600160401b03811161020857601f01601f191660200190565b9291926102718261024a565b9161027f6040519384610229565b829481845281830111610127578281602093846000960137010152565b9080601f83011215610127578160206102b793359101610265565b90565b906020828203126101275781356001600160401b038111610127576102b7920161029c565b34610127576020366003190112610127576004356001600160401b0381116101275761031b6000610316604093369060040161029c565b6112a9565b82519182526001600160a01b03166020820152f35b34610127576000366003190112610127576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b6001600160401b0381116102085760051b60200190565b81601f82011215610127578035916020916103a684610375565b936103b46040519586610229565b808552838086019160051b8301019280841161012757848301915b8483106103df5750505050505090565b82356001600160401b0381116101275786916104008484809489010161029c565b8152019201916103cf565b906040600319830112610127576001600160401b0360043581811161012757836104379160040161038c565b92602435918211610127576102b79160040161029c565b60005b8381106104615750506000910152565b8181015183820152602001610451565b9060209161048a8151809281855285808601910161044e565b601f01601f1916010190565b9060206102b7928181520190610471565b34610127576104b53661040b565b50805160011015610506576104e46104f2604061018f9301516040519283916020808401526040830190610471565b03601f198101835282610229565b604051918291602083526020830190610471565b610d34565b34610127576000366003190112610127576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b90600182811c92168015610580575b602083101461056a57565b634e487b7160e01b600052602260045260246000fd5b91607f169161055f565b9060009160019060015461059d81610550565b808352926020916001811690811561061a57506001146105be575b50505050565b9293945060016000527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6926000935b8585106106075750505060209250010190388080806105b8565b80548585018401529382019381016105ed565b92505050602093945060ff929192191683830152151560051b010190388080806105b8565b346101275760003660031901126101275761018f6040516104f2816106638161058a565b0382610229565b9181601f84011215610127578235916001600160401b038311610127576020838186019501011161012757565b6040600319820112610127576001600160401b039160043583811161012757826106c39160040161066a565b93909392602435918211610127576106dd9160040161066a565b9091565b3461012757610703600061070c6106f736610697565b959183919301906102ba565b93810190610d5e565b9096839592969461073e60018060a01b039384936040519a8b988997889663628e501560e11b88521660048701610f96565b0392165afa9182156107d7576000926107b2575b50815190519081810361078c576107848361077e866104e4604051938492602084015260248301610ff0565b3061136e565b602081519101f35b604051632918942560e01b815260048101919091526024810191909152604490fd5b0390fd5b6107d09192503d806000833e6107c88183610229565b810190610e5b565b9038610752565b610fe4565b34610127576020366003190112610127576004356001600160401b0381116101275761080c90369060040161066a565b505061018f6040516104f2816106638161058a565b3461012757610316600061085061083736610697565b94929095916108496004871015611014565b3691610265565b9290506001600160e01b03196108668383611057565b16631d9dabef60e11b811461092b576378e5bf0360e11b811461090e57631674750f60e21b81146108f15763bc1c58d160e01b146108d65760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b21039b2b632b1ba37b960811b6044820152606490fd5b816108ec926108e492611083565b8101906110a0565b611867565b50816109089261090092611083565b8101906110c5565b9061173a565b50816109259261091d92611083565b8101906110af565b906115df565b508161093a926108e492611083565b6113ed565b34610127576000366003190112610127576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b6001600160a01b0381160361012757565b604060031982011261012757600435906001600160401b038211610127576109bf9160040161066a565b90916024356102b781610984565b34610127576109db36610995565b916109ec6000610316368585610265565b506040516302571be360e01b8152600481018290526001600160a01b03602080836024817f000000000000000000000000000000000000000000000000000000000000000086165afa9283156107d757600093610be9575b507f00000000000000000000000000000000000000000000000000000000000000008216908383168214610b25575b505094610b0081610ae17f88781081cc340609705af0f96bf3ba64ea267873444e91725bd072f2af0f44d895610ad1610b0e967f3c68652dbd57659176ef0092991d5753aac3039c3134b7a3eb5689acfaccf62d9b33911614611104565b6000526000602052604060002090565b80546001600160a01b0319166001600160a01b03909216919091179055565b604051918291868684611184565b0390a1610b20604051928392836111ad565b0390a1005b6040516331a9108f60e11b8152600481018690529790935091908390889060249082905afa80156107d757610ae17f88781081cc340609705af0f96bf3ba64ea267873444e91725bd072f2af0f44d895610ad1610b009486947f3c68652dbd57659176ef0092991d5753aac3039c3134b7a3eb5689acfaccf62d9c610b0e99600092610bbc575b50509750959a5050955050610a73565b610bdb9250803d10610be2575b610bd38183610229565b810190611937565b3880610bac565b503d610bc9565b819350610c039083923d8611610be257610bd38183610229565b9290610a44565b346101275760003660031901126101275760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b34610127576044610c656000610316610c5d36610995565b503691610265565b60405163e0a0507160e01b81527f000000000000000000000000000000000000000000000000000000000000000060048201526001600160a01b0390911660248201529050fd5b3461012757610cba3661040b565b50805160011015610506576104e4610d13604061018f93015160208151910151906bffffffffffffffffffffffff19918281169160148110610d1f575b50506040805160609290921c6020830152909384925090820190565b60405191829182610496565b8391925060140360031b1b1616803880610cf7565b634e487b7160e01b600052603260045260246000fd5b80518210156105065760209160051b010190565b9060c082820312610127578135610d7481610984565b9260209283810135610d8581610984565b936001600160401b039060408301358281116101275783019085601f8301121561012757813591610db583610375565b92610dc36040519485610229565b808452828085019160051b83010191888311610127578301905b828210610e15575050505093606083013591821161012757610e0091830161038c565b9160a0610e0f60808401610112565b92013590565b81358152908301908301610ddd565b90929192610e318161024a565b91610e3f6040519384610229565b829482845282820111610127576020610e5993019061044e565b565b9060209081838203126101275782516001600160401b039384821161012757019080601f83011215610127578151610e9281610375565b94604090610ea36040519788610229565b828752858088019360051b8601019484861161012757868101935b868510610ed057505050505050505090565b845183811161012757820186603f82011215610127578891610efa88838886809601519101610e24565b815201940193610ebe565b90815180825260208080930193019160005b828110610f25575050505090565b835185529381019392810192600101610f17565b90808251908181526020809101926020808460051b8301019501936000915b848310610f685750505050505090565b9091929394958480610f86600193601f198682030187528a51610471565b9801930193019194939290610f58565b95949390608093610fc3610fdf94610fd19360018060a01b03168a5260a060208b015260a08a0190610f05565b9088820360408a0152610f39565b908682036060880152610471565b930152565b6040513d6000823e3d90fd5b611004602092604083526040830190610f39565b9082818303910152600081520190565b1561101b57565b60405162461bcd60e51b81526020600482015260146024820152731c185c985b4819185d18481d1bdbc81cda1bdc9d60621b6044820152606490fd5b6001600160e01b0319903581811693926004811061107457505050565b60040360031b82901b16169150565b909291928360041161012757831161012757600401916003190190565b90816020910312610127573590565b9190826040910312610127576020823592013590565b9190604083820312610127578235926020810135906001600160401b03821161012757019080601f83011215610127578160206102b793359101610265565b1561110b57565b60405162461bcd60e51b815260206004820152602a60248201527f4e6f7420617574686f72697a656420746f207365742074617267657420666f726044820152692074686973206e6f646560b01b6064820152608490fd5b908060209392818452848401376000828201840152601f01601f1916010190565b9160209161119d91959495604085526040850191611163565b6001600160a01b03909416910152565b91906111c191604084526040840191611163565b818103602092830152600180546000939290916111dd83610550565b808352926001811690811561125657506001146111fc575b5050505090565b9293509060016000527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf692846000945b83861061124257505050500101388080806111f5565b80548587018301529401938590820161122c565b60ff191685840152505090151560051b01019050388080806111f5565b634e487b7160e01b600052601160045260246000fd5b906001820180921161129757565b611273565b9190820180921161129757565b9190918051831015610506576020838201015160f81c801561136257906112ee6112e9836112e36112f4956112dd89611289565b8661194c565b9661129c565b611289565b906112a9565b6040805160208101938452908101949094529261131481606081016104e4565b51902060008181526020819052604090206001600160a01b0390611340905b546001600160a01b031690565b16611349579190565b91506102b7611333836000526000602052604060002090565b50509050600090600090565b906102b79160008060405193611383856101ed565b601e85527f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000602086015260208151910182855af13d156113e5573d916113c88361024a565b926113d66040519485610229565b83523d6000602085013e612034565b606091612034565b61142c6114366114318361142c61142761143b977f00000000000000000000000000000000000000000000000000000000000000006119a3565b611a3f565b611ab6565b611aea565b611b61565b611443611966565b50606081019060209081835110156115cd5760049060409061148161147b8351603c87820152868152611475816101ed565b8361222b565b826121ca565b8151936201518081860152808552611498856101ed565b8282019581875151151591826115c2575b50506115b4575b81516000906114cf906001600160a01b03165b6001600160a01b031690565b8451632d43cbef60e21b815295869182905afa9384156107d757600094611597575b5081810180516001600160a01b03168751608085018051875163ea9cd3bf60e01b87820152999391928a9261152b92919060248501611bd4565b0394601f19958681018a52611540908a610229565b516001600160a01b031692516001600160a01b031698519051908651998a9586019461156b95611c0a565b03908101855261157b9085610229565b51630556f18360e41b81529283926107ae923060048601611d4c565b6115ad9194503d806000833e6107c88183610229565b92386114f1565b6115bd826120c5565b6114b0565b5110905081386114a9565b604051631601fac760e31b8152600490fd5b8061142c61143661143161142c9461142c61142761161d997f00000000000000000000000000000000000000000000000000000000000000006119a3565b60406004815191602093620151808585015284845261163b846101ed565b8181019485515115158061172d575b61171f575b8151600090611666906001600160a01b03166114c3565b8451632d43cbef60e21b815295869182905afa9384156107d757600094611702575b5081810180516001600160a01b03168751608085018051875163ea9cd3bf60e01b87820152999391928a926116c292919060248501611bd4565b0394601f19958681018a526116d7908a610229565b516001600160a01b031692516001600160a01b031698519051908651998a9586019461156b95611c65565b6117189194503d806000833e6107c88183610229565b9238611688565b611728826120c5565b61164f565b508060608301511061164a565b918261142c61142761176c937f00000000000000000000000000000000000000000000000000000000000000006119a3565b91611775611966565b506020604084018051600181518015158061185a575b61184c575b019052515111611833576117e290600060608501526117ae8461216f565b61142c6040519461143661147b876117ce6020820190600a602083019252565b0397611475601f19998a8101835282610229565b906117eb611966565b506020606083015110156115cd5761147b611806918361222b565b61182e6040519283611822602082019062015180602083019252565b03908101845283610229565b611df0565b604051630251ce0160e31b815260206004820152602490fd5b611855886120c5565b611790565b508460608901511061178b565b908161142c611427611899937f00000000000000000000000000000000000000000000000000000000000000006119a3565b906118a2611966565b506020604083018051600181518015158061192a575b61191c575b0190525151116118335761142c82600060606118fd9501526118de8161216f565b61143661147b604051611475816104e460208201906003602083019252565b6040519062015180602083015260208252611917826101ed565b611f29565b611925876120c5565b6118bd565b50846060880151106118b8565b9081602091031261012757516102b781610984565b908281018082116112975782511061012757016020012090565b6040519060a082018281106001600160401b0382111761020857604052606060808360008152600060208201528260408201526000838201520152565b6119ab611966565b506040516119b88161020d565b602091602082526104009283366020850137604051936119d78561020d565b60005b818110611a305750505060008252600083526040519360a085018581106001600160401b03821117610208576040526001600160a01b039182168552166020840152604083015260006060830152608082015290565b606086820184015282016119da565b611a47611966565b5060206040820180516001815180151580611aa9575b611a9b575b0190525151116118335760006060820152611a7c81612123565b6102b761147b604051611475816104e460208201906000602083019252565b611aa4866120c5565b611a62565b5084606087015110611a5d565b90611abf611966565b506020606083015110156115cd5761147b6102b79160405190602082015260208152611475816101ed565b611af2611966565b5060206040820180516001815180151580611b54575b611b46575b0190525151116118335760006060820152611b278161216f565b6102b761147b604051611475816104e460208201906002602083019252565b611b4f866120c5565b611b0d565b5084606087015110611b08565b611b69611966565b50606081016020815110156115cd5760408201908151516000199182820191821161129757611b99828551610d4a565b51908051938414611297576001840190526001600160fd1b038316830361129757611bd092600160fd1b9060031b1c179251610d4a565b5290565b6001600160a01b0390911681526060602082018190526102b7939192611bfc91840190610f05565b916040818403910152610f39565b93906102b79593611c3c91611c4a9460018060a01b03809216885216602087015260c0604087015260c0860190610f05565b908482036060860152610f39565b91637a38480d60e11b608082015260a0818403910152610471565b93906102b79593611c3c91611c979460018060a01b03809216885216602087015260c0604087015260c0860190610f05565b91631c5fc97360e11b608082015260a0818403910152610471565b93906102b79593611c3c91611ce49460018060a01b03809216885216602087015260c0604087015260c0860190610f05565b91636f4d5f2f60e11b608082015260a0818403910152610471565b93906102b79593611c3c91611d319460018060a01b03809216885216602087015260c0604087015260c0860190610f05565b9163fcd2e38160e01b608082015260a0818403910152610471565b92909493919460a084019060018060a01b0316845260209060a06020860152865180915260c0850191602060c08360051b8801019801926000905b838210611dc457505050505084611da991846102b79697036040860152610471565b632ded548b60e11b6060840152916080818403910152610471565b90919293988380611de160019360bf198c82030186528d51610471565b9b019201920190939291611d87565b60046040820191825151151580611f1b575b611f0d575b8051600090611e1e906001600160a01b03166114c3565b604051632d43cbef60e21b815293849182905afa9182156107d757600092611ef0575b506020810180519093906001600160a01b031693815195608084019687519660405197889263ea9cd3bf60e01b60208501526024840192611e8193611bd4565b0393601f19948581018852611e969088610229565b516001600160a01b031691516001600160a01b031692519651604051978894611ec29460208701611cb2565b039081018452611ed29084610229565b604051630556f18360e41b81529283926107ae923060048601611d4c565b611f069192503d806000833e6107c88183610229565b9038611e41565b611f16816120c5565b611e07565b506020606082015110611e02565b60046040820191825151151580612026575b612018575b8051600090611f57906001600160a01b03166114c3565b604051632d43cbef60e21b815293849182905afa9182156107d757600092611ffb575b506020810180519093906001600160a01b031693815195608084019687519660405197889263ea9cd3bf60e01b60208501526024840192611fba93611bd4565b0393601f19948581018852611fcf9088610229565b516001600160a01b031691516001600160a01b031692519651604051978894611ec29460208701611cff565b6120119192503d806000833e6107c88183610229565b9038611f7a565b612021816120c5565b611f40565b506020606082015110611f3b565b919290156120965750815115612048575090565b3b156120515790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156120a95750805190602001fd5b60405162461bcd60e51b81529081906107ae9060048301610496565b6040810190815151600019918282019182116112975760606120e8838651610d4a565b5191018051938414611297576001840190526001600160fd1b0383168303611297576121209260ff60f81b9060031b1c179251610d4a565b52565b60408101805151600019808201918211611297576060612144838551610d4a565b5194018051918214611297576001820190526001600160fd1b03811603611297576121209151610d4a565b604081019081515160001991828201918211611297576060612192838651610d4a565b5191018051938414611297576001840190526001600160fd1b03831683036112975761212092600160f81b9060031b1c179251610d4a565b604081018051519092916000198083019283116112975760606121ee848751610d4a565b5192018051918214611297576001820190526001600160fd1b0381168103611297576121209360ff60f81b9060f81b169060031b1c179251610d4a565b60806122559193929301519260ff84511693849160018301825261224f8383610d4a565b52610d4a565b5056fea264697066735822122028e4f18d893eca1ab82b0aab9e99c190881e50b0e9fe2ee03b03daa2e08a1d0364736f6c63430008190033", - "deployedBytecode": "0x6080604052600436101561001257600080fd5b60003560e01c806301ffc9a71461010d57806315f64386146101085780632b7ac3f31461010357806338bf92e6146100cc5780633f15457f146100fe5780634062b43f146100f95780635bdaa916146100f45780638a596ebe146100ef5780639061b923146100ea578063a8e5fbc0146100e5578063d358df77146100e0578063d6ae3cd5146100db578063de9abe5e146100cc578063f00eebf4146100d6578063f470901a146100d15763fcd2e381146100cc57600080fd5b6104a7565b610cac565b610c45565b610c0a565b6109cd565b61093f565b610821565b6107dc565b6106e1565b61063f565b61050b565b610330565b6102df565b61012c565b35906001600160e01b03198216820361012757565b600080fd5b346101275760203660031901126101275760043563ffffffff60e01b81168091036101275761018f90639061b92360e01b81149081156101c6575b81156101b5575b81156101a4575b8115610193575b5060405190151581529081906020820190565b0390f35b6301ffc9a760e01b1490503861017c565b633c03bafd60e21b81149150610175565b63452cb75f60e11b8114915061016e565b630afb21c360e11b81149150610167565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b0382111761020857604052565b6101d7565b61042081019081106001600160401b0382111761020857604052565b90601f801991011681019081106001600160401b0382111761020857604052565b6001600160401b03811161020857601f01601f191660200190565b9291926102718261024a565b9161027f6040519384610229565b829481845281830111610127578281602093846000960137010152565b9080601f83011215610127578160206102b793359101610265565b90565b906020828203126101275781356001600160401b038111610127576102b7920161029c565b34610127576020366003190112610127576004356001600160401b0381116101275761031b6000610316604093369060040161029c565b6112a9565b82519182526001600160a01b03166020820152f35b34610127576000366003190112610127576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b6001600160401b0381116102085760051b60200190565b81601f82011215610127578035916020916103a684610375565b936103b46040519586610229565b808552838086019160051b8301019280841161012757848301915b8483106103df5750505050505090565b82356001600160401b0381116101275786916104008484809489010161029c565b8152019201916103cf565b906040600319830112610127576001600160401b0360043581811161012757836104379160040161038c565b92602435918211610127576102b79160040161029c565b60005b8381106104615750506000910152565b8181015183820152602001610451565b9060209161048a8151809281855285808601910161044e565b601f01601f1916010190565b9060206102b7928181520190610471565b34610127576104b53661040b565b50805160011015610506576104e46104f2604061018f9301516040519283916020808401526040830190610471565b03601f198101835282610229565b604051918291602083526020830190610471565b610d34565b34610127576000366003190112610127576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b90600182811c92168015610580575b602083101461056a57565b634e487b7160e01b600052602260045260246000fd5b91607f169161055f565b9060009160019060015461059d81610550565b808352926020916001811690811561061a57506001146105be575b50505050565b9293945060016000527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6926000935b8585106106075750505060209250010190388080806105b8565b80548585018401529382019381016105ed565b92505050602093945060ff929192191683830152151560051b010190388080806105b8565b346101275760003660031901126101275761018f6040516104f2816106638161058a565b0382610229565b9181601f84011215610127578235916001600160401b038311610127576020838186019501011161012757565b6040600319820112610127576001600160401b039160043583811161012757826106c39160040161066a565b93909392602435918211610127576106dd9160040161066a565b9091565b3461012757610703600061070c6106f736610697565b959183919301906102ba565b93810190610d5e565b9096839592969461073e60018060a01b039384936040519a8b988997889663628e501560e11b88521660048701610f96565b0392165afa9182156107d7576000926107b2575b50815190519081810361078c576107848361077e866104e4604051938492602084015260248301610ff0565b3061136e565b602081519101f35b604051632918942560e01b815260048101919091526024810191909152604490fd5b0390fd5b6107d09192503d806000833e6107c88183610229565b810190610e5b565b9038610752565b610fe4565b34610127576020366003190112610127576004356001600160401b0381116101275761080c90369060040161066a565b505061018f6040516104f2816106638161058a565b3461012757610316600061085061083736610697565b94929095916108496004871015611014565b3691610265565b9290506001600160e01b03196108668383611057565b16631d9dabef60e11b811461092b576378e5bf0360e11b811461090e57631674750f60e21b81146108f15763bc1c58d160e01b146108d65760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b21039b2b632b1ba37b960811b6044820152606490fd5b816108ec926108e492611083565b8101906110a0565b611867565b50816109089261090092611083565b8101906110c5565b9061173a565b50816109259261091d92611083565b8101906110af565b906115df565b508161093a926108e492611083565b6113ed565b34610127576000366003190112610127576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b6001600160a01b0381160361012757565b604060031982011261012757600435906001600160401b038211610127576109bf9160040161066a565b90916024356102b781610984565b34610127576109db36610995565b916109ec6000610316368585610265565b506040516302571be360e01b8152600481018290526001600160a01b03602080836024817f000000000000000000000000000000000000000000000000000000000000000086165afa9283156107d757600093610be9575b507f00000000000000000000000000000000000000000000000000000000000000008216908383168214610b25575b505094610b0081610ae17f88781081cc340609705af0f96bf3ba64ea267873444e91725bd072f2af0f44d895610ad1610b0e967f3c68652dbd57659176ef0092991d5753aac3039c3134b7a3eb5689acfaccf62d9b33911614611104565b6000526000602052604060002090565b80546001600160a01b0319166001600160a01b03909216919091179055565b604051918291868684611184565b0390a1610b20604051928392836111ad565b0390a1005b6040516331a9108f60e11b8152600481018690529790935091908390889060249082905afa80156107d757610ae17f88781081cc340609705af0f96bf3ba64ea267873444e91725bd072f2af0f44d895610ad1610b009486947f3c68652dbd57659176ef0092991d5753aac3039c3134b7a3eb5689acfaccf62d9c610b0e99600092610bbc575b50509750959a5050955050610a73565b610bdb9250803d10610be2575b610bd38183610229565b810190611937565b3880610bac565b503d610bc9565b819350610c039083923d8611610be257610bd38183610229565b9290610a44565b346101275760003660031901126101275760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b34610127576044610c656000610316610c5d36610995565b503691610265565b60405163e0a0507160e01b81527f000000000000000000000000000000000000000000000000000000000000000060048201526001600160a01b0390911660248201529050fd5b3461012757610cba3661040b565b50805160011015610506576104e4610d13604061018f93015160208151910151906bffffffffffffffffffffffff19918281169160148110610d1f575b50506040805160609290921c6020830152909384925090820190565b60405191829182610496565b8391925060140360031b1b1616803880610cf7565b634e487b7160e01b600052603260045260246000fd5b80518210156105065760209160051b010190565b9060c082820312610127578135610d7481610984565b9260209283810135610d8581610984565b936001600160401b039060408301358281116101275783019085601f8301121561012757813591610db583610375565b92610dc36040519485610229565b808452828085019160051b83010191888311610127578301905b828210610e15575050505093606083013591821161012757610e0091830161038c565b9160a0610e0f60808401610112565b92013590565b81358152908301908301610ddd565b90929192610e318161024a565b91610e3f6040519384610229565b829482845282820111610127576020610e5993019061044e565b565b9060209081838203126101275782516001600160401b039384821161012757019080601f83011215610127578151610e9281610375565b94604090610ea36040519788610229565b828752858088019360051b8601019484861161012757868101935b868510610ed057505050505050505090565b845183811161012757820186603f82011215610127578891610efa88838886809601519101610e24565b815201940193610ebe565b90815180825260208080930193019160005b828110610f25575050505090565b835185529381019392810192600101610f17565b90808251908181526020809101926020808460051b8301019501936000915b848310610f685750505050505090565b9091929394958480610f86600193601f198682030187528a51610471565b9801930193019194939290610f58565b95949390608093610fc3610fdf94610fd19360018060a01b03168a5260a060208b015260a08a0190610f05565b9088820360408a0152610f39565b908682036060880152610471565b930152565b6040513d6000823e3d90fd5b611004602092604083526040830190610f39565b9082818303910152600081520190565b1561101b57565b60405162461bcd60e51b81526020600482015260146024820152731c185c985b4819185d18481d1bdbc81cda1bdc9d60621b6044820152606490fd5b6001600160e01b0319903581811693926004811061107457505050565b60040360031b82901b16169150565b909291928360041161012757831161012757600401916003190190565b90816020910312610127573590565b9190826040910312610127576020823592013590565b9190604083820312610127578235926020810135906001600160401b03821161012757019080601f83011215610127578160206102b793359101610265565b1561110b57565b60405162461bcd60e51b815260206004820152602a60248201527f4e6f7420617574686f72697a656420746f207365742074617267657420666f726044820152692074686973206e6f646560b01b6064820152608490fd5b908060209392818452848401376000828201840152601f01601f1916010190565b9160209161119d91959495604085526040850191611163565b6001600160a01b03909416910152565b91906111c191604084526040840191611163565b818103602092830152600180546000939290916111dd83610550565b808352926001811690811561125657506001146111fc575b5050505090565b9293509060016000527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf692846000945b83861061124257505050500101388080806111f5565b80548587018301529401938590820161122c565b60ff191685840152505090151560051b01019050388080806111f5565b634e487b7160e01b600052601160045260246000fd5b906001820180921161129757565b611273565b9190820180921161129757565b9190918051831015610506576020838201015160f81c801561136257906112ee6112e9836112e36112f4956112dd89611289565b8661194c565b9661129c565b611289565b906112a9565b6040805160208101938452908101949094529261131481606081016104e4565b51902060008181526020819052604090206001600160a01b0390611340905b546001600160a01b031690565b16611349579190565b91506102b7611333836000526000602052604060002090565b50509050600090600090565b906102b79160008060405193611383856101ed565b601e85527f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000602086015260208151910182855af13d156113e5573d916113c88361024a565b926113d66040519485610229565b83523d6000602085013e612034565b606091612034565b61142c6114366114318361142c61142761143b977f00000000000000000000000000000000000000000000000000000000000000006119a3565b611a3f565b611ab6565b611aea565b611b61565b611443611966565b50606081019060209081835110156115cd5760049060409061148161147b8351603c87820152868152611475816101ed565b8361222b565b826121ca565b8151936201518081860152808552611498856101ed565b8282019581875151151591826115c2575b50506115b4575b81516000906114cf906001600160a01b03165b6001600160a01b031690565b8451632d43cbef60e21b815295869182905afa9384156107d757600094611597575b5081810180516001600160a01b03168751608085018051875163ea9cd3bf60e01b87820152999391928a9261152b92919060248501611bd4565b0394601f19958681018a52611540908a610229565b516001600160a01b031692516001600160a01b031698519051908651998a9586019461156b95611c0a565b03908101855261157b9085610229565b51630556f18360e41b81529283926107ae923060048601611d4c565b6115ad9194503d806000833e6107c88183610229565b92386114f1565b6115bd826120c5565b6114b0565b5110905081386114a9565b604051631601fac760e31b8152600490fd5b8061142c61143661143161142c9461142c61142761161d997f00000000000000000000000000000000000000000000000000000000000000006119a3565b60406004815191602093620151808585015284845261163b846101ed565b8181019485515115158061172d575b61171f575b8151600090611666906001600160a01b03166114c3565b8451632d43cbef60e21b815295869182905afa9384156107d757600094611702575b5081810180516001600160a01b03168751608085018051875163ea9cd3bf60e01b87820152999391928a926116c292919060248501611bd4565b0394601f19958681018a526116d7908a610229565b516001600160a01b031692516001600160a01b031698519051908651998a9586019461156b95611c65565b6117189194503d806000833e6107c88183610229565b9238611688565b611728826120c5565b61164f565b508060608301511061164a565b918261142c61142761176c937f00000000000000000000000000000000000000000000000000000000000000006119a3565b91611775611966565b506020604084018051600181518015158061185a575b61184c575b019052515111611833576117e290600060608501526117ae8461216f565b61142c6040519461143661147b876117ce6020820190600a602083019252565b0397611475601f19998a8101835282610229565b906117eb611966565b506020606083015110156115cd5761147b611806918361222b565b61182e6040519283611822602082019062015180602083019252565b03908101845283610229565b611df0565b604051630251ce0160e31b815260206004820152602490fd5b611855886120c5565b611790565b508460608901511061178b565b908161142c611427611899937f00000000000000000000000000000000000000000000000000000000000000006119a3565b906118a2611966565b506020604083018051600181518015158061192a575b61191c575b0190525151116118335761142c82600060606118fd9501526118de8161216f565b61143661147b604051611475816104e460208201906003602083019252565b6040519062015180602083015260208252611917826101ed565b611f29565b611925876120c5565b6118bd565b50846060880151106118b8565b9081602091031261012757516102b781610984565b908281018082116112975782511061012757016020012090565b6040519060a082018281106001600160401b0382111761020857604052606060808360008152600060208201528260408201526000838201520152565b6119ab611966565b506040516119b88161020d565b602091602082526104009283366020850137604051936119d78561020d565b60005b818110611a305750505060008252600083526040519360a085018581106001600160401b03821117610208576040526001600160a01b039182168552166020840152604083015260006060830152608082015290565b606086820184015282016119da565b611a47611966565b5060206040820180516001815180151580611aa9575b611a9b575b0190525151116118335760006060820152611a7c81612123565b6102b761147b604051611475816104e460208201906000602083019252565b611aa4866120c5565b611a62565b5084606087015110611a5d565b90611abf611966565b506020606083015110156115cd5761147b6102b79160405190602082015260208152611475816101ed565b611af2611966565b5060206040820180516001815180151580611b54575b611b46575b0190525151116118335760006060820152611b278161216f565b6102b761147b604051611475816104e460208201906002602083019252565b611b4f866120c5565b611b0d565b5084606087015110611b08565b611b69611966565b50606081016020815110156115cd5760408201908151516000199182820191821161129757611b99828551610d4a565b51908051938414611297576001840190526001600160fd1b038316830361129757611bd092600160fd1b9060031b1c179251610d4a565b5290565b6001600160a01b0390911681526060602082018190526102b7939192611bfc91840190610f05565b916040818403910152610f39565b93906102b79593611c3c91611c4a9460018060a01b03809216885216602087015260c0604087015260c0860190610f05565b908482036060860152610f39565b91637a38480d60e11b608082015260a0818403910152610471565b93906102b79593611c3c91611c979460018060a01b03809216885216602087015260c0604087015260c0860190610f05565b91631c5fc97360e11b608082015260a0818403910152610471565b93906102b79593611c3c91611ce49460018060a01b03809216885216602087015260c0604087015260c0860190610f05565b91636f4d5f2f60e11b608082015260a0818403910152610471565b93906102b79593611c3c91611d319460018060a01b03809216885216602087015260c0604087015260c0860190610f05565b9163fcd2e38160e01b608082015260a0818403910152610471565b92909493919460a084019060018060a01b0316845260209060a06020860152865180915260c0850191602060c08360051b8801019801926000905b838210611dc457505050505084611da991846102b79697036040860152610471565b632ded548b60e11b6060840152916080818403910152610471565b90919293988380611de160019360bf198c82030186528d51610471565b9b019201920190939291611d87565b60046040820191825151151580611f1b575b611f0d575b8051600090611e1e906001600160a01b03166114c3565b604051632d43cbef60e21b815293849182905afa9182156107d757600092611ef0575b506020810180519093906001600160a01b031693815195608084019687519660405197889263ea9cd3bf60e01b60208501526024840192611e8193611bd4565b0393601f19948581018852611e969088610229565b516001600160a01b031691516001600160a01b031692519651604051978894611ec29460208701611cb2565b039081018452611ed29084610229565b604051630556f18360e41b81529283926107ae923060048601611d4c565b611f069192503d806000833e6107c88183610229565b9038611e41565b611f16816120c5565b611e07565b506020606082015110611e02565b60046040820191825151151580612026575b612018575b8051600090611f57906001600160a01b03166114c3565b604051632d43cbef60e21b815293849182905afa9182156107d757600092611ffb575b506020810180519093906001600160a01b031693815195608084019687519660405197889263ea9cd3bf60e01b60208501526024840192611fba93611bd4565b0393601f19948581018852611fcf9088610229565b516001600160a01b031691516001600160a01b031692519651604051978894611ec29460208701611cff565b6120119192503d806000833e6107c88183610229565b9038611f7a565b612021816120c5565b611f40565b506020606082015110611f3b565b919290156120965750815115612048575090565b3b156120515790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156120a95750805190602001fd5b60405162461bcd60e51b81529081906107ae9060048301610496565b6040810190815151600019918282019182116112975760606120e8838651610d4a565b5191018051938414611297576001840190526001600160fd1b0383168303611297576121209260ff60f81b9060031b1c179251610d4a565b52565b60408101805151600019808201918211611297576060612144838551610d4a565b5194018051918214611297576001820190526001600160fd1b03811603611297576121209151610d4a565b604081019081515160001991828201918211611297576060612192838651610d4a565b5191018051938414611297576001840190526001600160fd1b03831683036112975761212092600160f81b9060031b1c179251610d4a565b604081018051519092916000198083019283116112975760606121ee848751610d4a565b5192018051918214611297576001820190526001600160fd1b0381168103611297576121209360ff60f81b9060f81b169060031b1c179251610d4a565b60806122559193929301519260ff84511693849160018301825261224f8383610d4a565b52610d4a565b5056fea264697066735822122028e4f18d893eca1ab82b0aab9e99c190881e50b0e9fe2ee03b03daa2e08a1d0364736f6c63430008190033", + "numDeployments": 3, + "solcInputHash": "97009251ed053ab9ef4f8e05bcccdb2b", + "metadata": "{\"compiler\":{\"version\":\"0.8.25+commit.b61c2a91\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IEVMVerifier\",\"name\":\"_verifier\",\"type\":\"address\"},{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"_nameWrapper\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_graphqlUrl\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_l2ChainId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CommandTooLong\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max\",\"type\":\"uint256\"}],\"name\":\"InvalidReference\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"urls\",\"type\":\"string[]\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes4\",\"name\":\"callbackFunction\",\"type\":\"bytes4\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"OffchainLookup\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"actual\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expected\",\"type\":\"uint256\"}],\"name\":\"ResponseLengthMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"}],\"name\":\"StorageHandledByL2\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"max\",\"type\":\"uint256\"}],\"name\":\"TooManyCommands\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"graphqlUrl\",\"type\":\"string\"}],\"name\":\"MetadataChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"TargetSet\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"values\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"addrCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"values\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"addrCoinTypeCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"values\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"contenthashCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAcceptedL2BlockRangeLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extradata\",\"type\":\"bytes\"}],\"name\":\"getStorageSlotsCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"getTarget\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"graphqlUrl\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2ChainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"metadata\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nameWrapper\",\"outputs\":[{\"internalType\":\"contract INameWrapper\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"result\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"result\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"setTarget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"values\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"textCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifier\",\"outputs\":[{\"internalType\":\"contract IEVMVerifier\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"StorageHandledByL2(uint256,address)\":[{\"details\":\"EIP-5559 - Error to raise when mutations are being deferred to an L2.\",\"params\":{\"chainId\":\"Chain ID to perform the deferred mutation to.\",\"contractAddress\":\"Contract Address at which the deferred mutation should transact with.\"}}]},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_ens\":\"The ENS registry address\",\"_graphqlUrl\":\"The offchain/l2 graphql endpoint url\",\"_l2ChainId\":\"The chainId at which the resolver resolves data from\",\"_nameWrapper\":\"The ENS name wrapper address\",\"_verifier\":\"The chain verifier address\"}},\"getAcceptedL2BlockRangeLength()\":{\"details\":\"inherits from EVMFetchTarget\"},\"getStorageSlotsCallback(bytes,bytes)\":{\"details\":\"Internal callback function invoked by CCIP-Read in response to a `getStorageSlots` request.\"},\"getTarget(bytes)\":{\"details\":\"Returns the L2 target address that can answer queries for `name`.\",\"params\":{\"name\":\"DNS encoded ENS name to query\"},\"returns\":{\"node\":\"The node of the name\",\"target\":\"The L2 resolver address to verify against.\"}},\"metadata(bytes)\":{\"details\":\"This function provides metadata about the L1 Resolver, including its name, coin type, GraphQL URL, storage type, and encoded information.\",\"params\":{\"name\":\"The domain name in format (dnsEncoded)\"},\"returns\":{\"_0\":\"graphqlUrl The GraphQL URL used by the resolver\"}},\"resolve(bytes,bytes)\":{\"details\":\"Resolve and verify a record stored in l2 target address. It supports subname by fetching target recursively to the nearest parent.\",\"params\":{\"data\":\"The actual calldata\",\"name\":\"DNS encoded ENS name to query\"},\"returns\":{\"result\":\"result of the call\"}},\"setAddr(bytes,address)\":{\"details\":\"Resolve and throws an EIP 3559 compliant error\",\"params\":{\"_addr\":\"The actual calldata\",\"name\":\"DNS encoded ENS name to query\"},\"returns\":{\"result\":\"result of the call\"}},\"setTarget(bytes,address)\":{\"params\":{\"name\":\"The encoded name to query.\",\"target\":\"The L2 resolver address to verify against.\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"metadata(bytes)\":{\"notice\":\"Get metadata about the L1 Resolver\"},\"setTarget(bytes,address)\":{\"notice\":\"Set target address to verify against\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/L1Resolver.sol\":\"L1Resolver\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@ensdomains/ens-contracts/contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"@ensdomains/ens-contracts/contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"@ensdomains/ens-contracts/contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"@ensdomains/ens-contracts/contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/IAddrSetter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\ninterface IAddrSetter {\\n function setAddr(\\n bytes calldata name,\\n address _addr\\n ) external view returns (bytes memory result);\\n}\\n\",\"keccak256\":\"0xd211ec6793d80d0bb7643d8f15e5773abe38541edee0b85eb83283ca5fdd1525\",\"license\":\"MIT\"},\"contracts/IMetadataResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\ninterface IMetadataResolver {\\n /*\\n * @notice Get metadata about the CCIP Resolver ENSIP 16 https://docs.ens.domains/ens-improvement-proposals/ensip-16-offchain-metadata\\n * @dev This function provides metadata about the CCIP Resolver, including its name, coin type, GraphQL URL, storage type, and encoded information.\\n * @param name The domain name in format (dnsEncoded)\\n * @return graphqlUrl The GraphQL URL used by the resolver\\n *\\n */\\n function metadata(\\n bytes calldata name\\n ) external view returns (string memory graphqlUrl);\\n\\n event MetadataChanged(bytes name, string graphqlUrl);\\n}\\n\",\"keccak256\":\"0xe2edf067122145bfd59e95b0f5b3507bd0cd2715b6b7d7068e70c6cbef09e5ae\",\"license\":\"MIT\"},\"contracts/ITargetResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\ninterface ITargetResolver {\\n function getTarget(\\n bytes memory name\\n ) external view returns (bytes32 node, address target);\\n}\\n\",\"keccak256\":\"0x2daa66377cc37fc99b927d87f5495259ed6e49c0f10af1f75bd5fd74964e5b78\",\"license\":\"MIT\"},\"contracts/L1Resolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\nimport {EVMFetcher} from \\\"linea-state-verifier/contracts/EVMFetcher.sol\\\";\\nimport {EVMFetchTarget} from \\\"linea-state-verifier/contracts/EVMFetchTarget.sol\\\";\\nimport {IEVMVerifier} from \\\"linea-state-verifier/contracts/IEVMVerifier.sol\\\";\\nimport \\\"@ensdomains/ens-contracts/contracts/registry/ENS.sol\\\";\\nimport {INameWrapper} from \\\"@ensdomains/ens-contracts/contracts/wrapper/INameWrapper.sol\\\";\\nimport {BytesUtils} from \\\"@ensdomains/ens-contracts/contracts/dnssec-oracle/BytesUtils.sol\\\";\\nimport {IAddrResolver} from \\\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddrResolver.sol\\\";\\nimport {IAddressResolver} from \\\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddressResolver.sol\\\";\\nimport {ITextResolver} from \\\"@ensdomains/ens-contracts/contracts/resolvers/profiles/ITextResolver.sol\\\";\\nimport {IContentHashResolver} from \\\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IContentHashResolver.sol\\\";\\nimport \\\"@ensdomains/ens-contracts/contracts/resolvers/profiles/IExtendedResolver.sol\\\";\\nimport {ITargetResolver} from \\\"./ITargetResolver.sol\\\";\\nimport {IMetadataResolver} from \\\"./IMetadataResolver.sol\\\";\\nimport {IAddrSetter} from \\\"./IAddrSetter.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\ncontract L1Resolver is\\n EVMFetchTarget,\\n ITargetResolver,\\n IMetadataResolver,\\n IExtendedResolver,\\n IAddrSetter,\\n ERC165\\n{\\n using EVMFetcher for EVMFetcher.EVMFetchRequest;\\n using BytesUtils for bytes;\\n IEVMVerifier public immutable verifier;\\n ENS public immutable ens;\\n INameWrapper public immutable nameWrapper;\\n uint256 public immutable l2ChainId;\\n mapping(bytes32 => address) targets;\\n uint256 constant COIN_TYPE_ETH = 60;\\n uint256 constant RECORD_VERSIONS_SLOT = 0;\\n uint256 constant VERSIONABLE_ABIS_SLOT = 1;\\n uint256 constant VERSIONABLE_ADDRESSES_SLOT = 2;\\n uint256 constant VERSIONABLE_HASHES_SLOT = 3;\\n uint256 constant VERSIONABLE_TEXTS_SLOT = 10;\\n // To check how old is the value/proof returned and is in the acceptable range\\n uint256 constant ACCEPTED_L2_BLOCK_RANGE_LENGTH = 86400;\\n string public graphqlUrl;\\n\\n event TargetSet(bytes name, address target);\\n\\n function isAuthorised(bytes32 node) internal view returns (bool) {\\n // TODO: Add support for\\n // trustedETHController\\n // trustedReverseRegistrar\\n // isApprovedForAll\\n // isApprovedFor\\n address owner = ens.owner(node);\\n if (owner == address(nameWrapper)) {\\n owner = nameWrapper.ownerOf(uint256(node));\\n }\\n return owner == msg.sender;\\n }\\n\\n /**\\n * @dev EIP-5559 - Error to raise when mutations are being deferred to an L2.\\n * @param chainId Chain ID to perform the deferred mutation to.\\n * @param contractAddress Contract Address at which the deferred mutation should transact with.\\n */\\n error StorageHandledByL2(uint256 chainId, address contractAddress);\\n\\n /**\\n * @param _verifier The chain verifier address\\n * @param _ens The ENS registry address\\n * @param _nameWrapper The ENS name wrapper address\\n * @param _graphqlUrl The offchain/l2 graphql endpoint url\\n * @param _l2ChainId The chainId at which the resolver resolves data from\\n */\\n constructor(\\n IEVMVerifier _verifier,\\n ENS _ens,\\n INameWrapper _nameWrapper,\\n string memory _graphqlUrl,\\n uint256 _l2ChainId\\n ) {\\n require(\\n address(_nameWrapper) != address(0),\\n \\\"Name Wrapper address must be set\\\"\\n );\\n require(\\n address(_verifier) != address(0),\\n \\\"Verifier address must be set\\\"\\n );\\n require(address(_ens) != address(0), \\\"Registry address must be set\\\");\\n verifier = _verifier;\\n ens = _ens;\\n nameWrapper = _nameWrapper;\\n graphqlUrl = _graphqlUrl;\\n l2ChainId = _l2ChainId;\\n }\\n\\n /**\\n * @dev inherits from EVMFetchTarget\\n */\\n function getAcceptedL2BlockRangeLength()\\n public\\n pure\\n override\\n returns (uint256)\\n {\\n return ACCEPTED_L2_BLOCK_RANGE_LENGTH;\\n }\\n\\n /**\\n * Set target address to verify against\\n * @param name The encoded name to query.\\n * @param target The L2 resolver address to verify against.\\n */\\n function setTarget(bytes calldata name, address target) external {\\n (bytes32 node, ) = getTarget(name);\\n require(\\n isAuthorised(node),\\n \\\"Not authorized to set target for this node\\\"\\n );\\n targets[node] = target;\\n emit TargetSet(name, target);\\n emit MetadataChanged(name, graphqlUrl);\\n }\\n\\n /**\\n * @dev Returns the L2 target address that can answer queries for `name`.\\n * @param name DNS encoded ENS name to query\\n * @return node The node of the name\\n * @return target The L2 resolver address to verify against.\\n */\\n function getTarget(\\n bytes memory name\\n ) public view returns (bytes32 node, address target) {\\n return _getTarget(name, 0);\\n }\\n\\n function _getTarget(\\n bytes memory name,\\n uint256 offset\\n ) private view returns (bytes32 node, address target) {\\n uint256 len = name.readUint8(offset);\\n node = bytes32(0);\\n if (len > 0) {\\n bytes32 label = name.keccak(offset + 1, len);\\n (node, target) = _getTarget(name, offset + len + 1);\\n node = keccak256(abi.encodePacked(node, label));\\n if (targets[node] != address(0)) {\\n return (node, targets[node]);\\n }\\n } else {\\n return (bytes32(0), address(0));\\n }\\n return (node, target);\\n }\\n\\n /**\\n * @dev Resolve and verify a record stored in l2 target address. It supports subname by fetching target recursively to the nearest parent.\\n * @param name DNS encoded ENS name to query\\n * @param data The actual calldata\\n * @return result result of the call\\n */\\n function resolve(\\n bytes calldata name,\\n bytes calldata data\\n ) external view returns (bytes memory result) {\\n require(data.length >= 4, \\\"param data too short\\\");\\n\\n (, address target) = _getTarget(name, 0);\\n bytes4 selector = bytes4(data);\\n\\n if (selector == IAddrResolver.addr.selector) {\\n bytes32 node = abi.decode(data[4:], (bytes32));\\n return _addr(node, target);\\n }\\n if (selector == IAddressResolver.addr.selector) {\\n (bytes32 node, uint256 cointype) = abi.decode(\\n data[4:],\\n (bytes32, uint256)\\n );\\n return _addr(node, cointype, target);\\n }\\n if (selector == ITextResolver.text.selector) {\\n (bytes32 node, string memory key) = abi.decode(\\n data[4:],\\n (bytes32, string)\\n );\\n return bytes(_text(node, key, target));\\n }\\n if (selector == IContentHashResolver.contenthash.selector) {\\n bytes32 node = abi.decode(data[4:], (bytes32));\\n return _contenthash(node, target);\\n }\\n\\n // None selector has been found it reverts\\n revert(\\\"invalid selector\\\");\\n }\\n\\n /**\\n * @dev Resolve and throws an EIP 3559 compliant error\\n * @param name DNS encoded ENS name to query\\n * @param _addr The actual calldata\\n * @return result result of the call\\n */\\n function setAddr(\\n bytes calldata name,\\n address _addr\\n ) external view returns (bytes memory result) {\\n (, address target) = _getTarget(name, 0);\\n _writeDeferral(target);\\n }\\n\\n function _addr(\\n bytes32 node,\\n address target\\n ) private view returns (bytes memory) {\\n EVMFetcher\\n .newFetchRequest(verifier, target)\\n .getStatic(RECORD_VERSIONS_SLOT)\\n .element(node)\\n .getDynamic(VERSIONABLE_ADDRESSES_SLOT)\\n .ref(0)\\n .element(node)\\n .element(COIN_TYPE_ETH)\\n .fetch(this.addrCallback.selector, \\\"\\\"); // recordVersions\\n }\\n\\n function addrCallback(\\n bytes[] memory values,\\n bytes memory\\n ) external pure returns (bytes memory) {\\n return abi.encode(address(bytes20(values[1])));\\n }\\n\\n function _addr(\\n bytes32 node,\\n uint256 coinType,\\n address target\\n ) private view returns (bytes memory) {\\n EVMFetcher\\n .newFetchRequest(verifier, target)\\n .getStatic(RECORD_VERSIONS_SLOT)\\n .element(node)\\n .getDynamic(VERSIONABLE_ADDRESSES_SLOT)\\n .ref(0)\\n .element(node)\\n .element(coinType)\\n .fetch(this.addrCoinTypeCallback.selector, \\\"\\\");\\n }\\n\\n function addrCoinTypeCallback(\\n bytes[] memory values,\\n bytes memory\\n ) external pure returns (bytes memory) {\\n return abi.encode(values[1]);\\n }\\n\\n function _text(\\n bytes32 node,\\n string memory key,\\n address target\\n ) private view returns (bytes memory) {\\n EVMFetcher\\n .newFetchRequest(verifier, target)\\n .getStatic(RECORD_VERSIONS_SLOT)\\n .element(node)\\n .getDynamic(VERSIONABLE_TEXTS_SLOT)\\n .ref(0)\\n .element(node)\\n .element(key)\\n .fetch(this.textCallback.selector, \\\"\\\");\\n }\\n\\n function textCallback(\\n bytes[] memory values,\\n bytes memory\\n ) external pure returns (bytes memory) {\\n return abi.encode(string(values[1]));\\n }\\n\\n function _contenthash(\\n bytes32 node,\\n address target\\n ) private view returns (bytes memory) {\\n EVMFetcher\\n .newFetchRequest(verifier, target)\\n .getStatic(RECORD_VERSIONS_SLOT)\\n .element(node)\\n .getDynamic(VERSIONABLE_HASHES_SLOT)\\n .ref(0)\\n .element(node)\\n .fetch(this.contenthashCallback.selector, \\\"\\\");\\n }\\n\\n function contenthashCallback(\\n bytes[] memory values,\\n bytes memory\\n ) external pure returns (bytes memory) {\\n return abi.encode(values[1]);\\n }\\n\\n /**\\n * @notice Get metadata about the L1 Resolver\\n * @dev This function provides metadata about the L1 Resolver, including its name, coin type, GraphQL URL, storage type, and encoded information.\\n * @param name The domain name in format (dnsEncoded)\\n * @return graphqlUrl The GraphQL URL used by the resolver\\n */\\n function metadata(\\n bytes calldata name\\n ) external view returns (string memory) {\\n return (graphqlUrl);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view override returns (bool) {\\n return\\n interfaceId == type(IExtendedResolver).interfaceId ||\\n interfaceId == type(ITargetResolver).interfaceId ||\\n interfaceId == type(IMetadataResolver).interfaceId ||\\n interfaceId == type(IAddrSetter).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n function _writeDeferral(address target) internal view {\\n revert StorageHandledByL2(l2ChainId, target);\\n }\\n}\\n\",\"keccak256\":\"0x1d1493d8782436eba3da5a85fe0df84385268a7747ce3bce765489285823e423\",\"license\":\"MIT\"},\"linea-state-verifier/contracts/EVMFetchTarget.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\nimport {IEVMVerifier} from \\\"./IEVMVerifier.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\n/**\\n * @dev Callback implementation for users of `EVMFetcher`. If you use `EVMFetcher`, your contract must\\n * inherit from this contract in order to handle callbacks correctly.\\n */\\nabstract contract EVMFetchTarget {\\n using Address for address;\\n\\n error ResponseLengthMismatch(uint256 actual, uint256 expected);\\n\\n /**\\n * @dev Internal callback function invoked by CCIP-Read in response to a `getStorageSlots` request.\\n */\\n function getStorageSlotsCallback(\\n bytes calldata response,\\n bytes calldata extradata\\n ) external returns (bytes memory) {\\n bytes memory proof = abi.decode(response, (bytes));\\n (\\n IEVMVerifier verifier,\\n address addr,\\n bytes32[] memory commands,\\n bytes[] memory constants,\\n bytes4 callback,\\n bytes memory callbackData\\n ) = abi.decode(\\n extradata,\\n (IEVMVerifier, address, bytes32[], bytes[], bytes4, bytes)\\n );\\n\\n bytes[] memory values = verifier.getStorageValues(\\n addr,\\n commands,\\n constants,\\n proof,\\n getAcceptedL2BlockRangeLength()\\n );\\n if (values.length != commands.length) {\\n revert ResponseLengthMismatch(values.length, commands.length);\\n }\\n bytes memory ret = address(this).functionCall(\\n abi.encodeWithSelector(callback, values, callbackData)\\n );\\n assembly {\\n return(add(ret, 32), mload(ret))\\n }\\n }\\n\\n /**\\n * @dev The child contract has to return an accepted L2 block range used by the verifier\\n * to verify that the block number verified is in the accepted block range.\\n */\\n function getAcceptedL2BlockRangeLength()\\n public\\n view\\n virtual\\n returns (uint256);\\n}\\n\",\"keccak256\":\"0x99bc88dfa486655161d325ff89c6402d3e7a331253e5266c7019935db591c68c\",\"license\":\"MIT\"},\"linea-state-verifier/contracts/EVMFetcher.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\nimport {IEVMVerifier} from \\\"./IEVMVerifier.sol\\\";\\nimport {EVMFetchTarget} from \\\"./EVMFetchTarget.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\ninterface IEVMGateway {\\n function getStorageSlots(\\n address addr,\\n bytes32[] memory commands,\\n bytes[] memory constants\\n ) external pure returns (bytes memory witness);\\n}\\n\\nuint8 constant FLAG_DYNAMIC = 0x01;\\nuint8 constant OP_CONSTANT = 0x00;\\nuint8 constant OP_BACKREF = 0x20;\\nuint8 constant OP_END = 0xff;\\n\\n/**\\n * @dev A library to facilitate requesting storage data proofs from contracts, possibly on a different chain.\\n * See l1-verifier/test/TestL1.sol for example usage.\\n */\\nlibrary EVMFetcher {\\n uint256 constant MAX_COMMANDS = 32;\\n uint256 constant MAX_CONSTANTS = 32; // Must not be greater than 32\\n\\n using Address for address;\\n\\n error TooManyCommands(uint256 max);\\n error CommandTooLong();\\n error InvalidReference(uint256 value, uint256 max);\\n error OffchainLookup(\\n address sender,\\n string[] urls,\\n bytes callData,\\n bytes4 callbackFunction,\\n bytes extraData\\n );\\n\\n struct EVMFetchRequest {\\n IEVMVerifier verifier;\\n address target;\\n bytes32[] commands;\\n uint256 operationIdx;\\n bytes[] constants;\\n }\\n\\n /**\\n * @dev Creates a request to fetch the value of multiple storage slots from a contract via CCIP-Read, possibly from\\n * another chain.\\n * Supports dynamic length values and slot numbers derived from other retrieved values.\\n * @param verifier An instance of a verifier contract that can provide and verify the storage slot information.\\n * @param target The address of the contract to fetch storage proofs for.\\n */\\n function newFetchRequest(\\n IEVMVerifier verifier,\\n address target\\n ) internal pure returns (EVMFetchRequest memory) {\\n bytes32[] memory commands = new bytes32[](MAX_COMMANDS);\\n bytes[] memory constants = new bytes[](MAX_CONSTANTS);\\n assembly {\\n mstore(commands, 0) // Set current array length to 0\\n mstore(constants, 0)\\n }\\n return EVMFetchRequest(verifier, target, commands, 0, constants);\\n }\\n\\n /**\\n * @dev Starts describing a new fetch request.\\n * Paths specify a series of hashing operations to derive the final slot ID.\\n * See https://docs.soliditylang.org/en/v0.8.17/internals/layout_in_storage.html for details on how Solidity\\n * lays out storage variables.\\n * @param request The request object being operated on.\\n * @param baseSlot The base slot ID that forms the root of the path.\\n */\\n function getStatic(\\n EVMFetchRequest memory request,\\n uint256 baseSlot\\n ) internal pure returns (EVMFetchRequest memory) {\\n bytes32[] memory commands = request.commands;\\n uint256 commandIdx = commands.length;\\n if (commandIdx > 0 && request.operationIdx < 32) {\\n // Terminate previous command\\n _addOperation(request, OP_END);\\n }\\n assembly {\\n mstore(commands, add(commandIdx, 1)) // Increment command array length\\n }\\n if (request.commands.length > MAX_COMMANDS) {\\n revert TooManyCommands(MAX_COMMANDS);\\n }\\n request.operationIdx = 0;\\n _addOperation(request, 0);\\n _addOperation(request, _addConstant(request, abi.encode(baseSlot)));\\n return request;\\n }\\n\\n /**\\n * @dev Starts describing a new fetch request.\\n * Paths specify a series of hashing operations to derive the final slot ID.\\n * See https://docs.soliditylang.org/en/v0.8.17/internals/layout_in_storage.html for details on how Solidity\\n * lays out storage variables.\\n * @param request The request object being operated on.\\n * @param baseSlot The base slot ID that forms the root of the path.\\n */\\n function getDynamic(\\n EVMFetchRequest memory request,\\n uint256 baseSlot\\n ) internal pure returns (EVMFetchRequest memory) {\\n bytes32[] memory commands = request.commands;\\n uint256 commandIdx = commands.length;\\n if (commandIdx > 0 && request.operationIdx < 32) {\\n // Terminate previous command\\n _addOperation(request, OP_END);\\n }\\n assembly {\\n mstore(commands, add(commandIdx, 1)) // Increment command array length\\n }\\n if (request.commands.length > MAX_COMMANDS) {\\n revert TooManyCommands(MAX_COMMANDS);\\n }\\n request.operationIdx = 0;\\n _addOperation(request, FLAG_DYNAMIC);\\n _addOperation(request, _addConstant(request, abi.encode(baseSlot)));\\n return request;\\n }\\n\\n /**\\n * @dev Adds a `uint256` element to the current path.\\n * @param request The request object being operated on.\\n * @param el The element to add.\\n */\\n function element(\\n EVMFetchRequest memory request,\\n uint256 el\\n ) internal pure returns (EVMFetchRequest memory) {\\n if (request.operationIdx >= 32) {\\n revert CommandTooLong();\\n }\\n _addOperation(request, _addConstant(request, abi.encode(el)));\\n return request;\\n }\\n\\n /**\\n * @dev Adds a `bytes32` element to the current path.\\n * @param request The request object being operated on.\\n * @param el The element to add.\\n */\\n function element(\\n EVMFetchRequest memory request,\\n bytes32 el\\n ) internal pure returns (EVMFetchRequest memory) {\\n if (request.operationIdx >= 32) {\\n revert CommandTooLong();\\n }\\n _addOperation(request, _addConstant(request, abi.encode(el)));\\n return request;\\n }\\n\\n /**\\n * @dev Adds an `address` element to the current path.\\n * @param request The request object being operated on.\\n * @param el The element to add.\\n */\\n function element(\\n EVMFetchRequest memory request,\\n address el\\n ) internal pure returns (EVMFetchRequest memory) {\\n if (request.operationIdx >= 32) {\\n revert CommandTooLong();\\n }\\n _addOperation(request, _addConstant(request, abi.encode(el)));\\n return request;\\n }\\n\\n /**\\n * @dev Adds a `bytes` element to the current path.\\n * @param request The request object being operated on.\\n * @param el The element to add.\\n */\\n function element(\\n EVMFetchRequest memory request,\\n bytes memory el\\n ) internal pure returns (EVMFetchRequest memory) {\\n if (request.operationIdx >= 32) {\\n revert CommandTooLong();\\n }\\n _addOperation(request, _addConstant(request, el));\\n return request;\\n }\\n\\n /**\\n * @dev Adds a `string` element to the current path.\\n * @param request The request object being operated on.\\n * @param el The element to add.\\n */\\n function element(\\n EVMFetchRequest memory request,\\n string memory el\\n ) internal pure returns (EVMFetchRequest memory) {\\n if (request.operationIdx >= 32) {\\n revert CommandTooLong();\\n }\\n _addOperation(request, _addConstant(request, bytes(el)));\\n return request;\\n }\\n\\n /**\\n * @dev Adds a reference to a previous fetch to the current path.\\n * @param request The request object being operated on.\\n * @param idx The index of the previous fetch request, starting at 0.\\n */\\n function ref(\\n EVMFetchRequest memory request,\\n uint8 idx\\n ) internal pure returns (EVMFetchRequest memory) {\\n if (request.operationIdx >= 32) {\\n revert CommandTooLong();\\n }\\n if (idx > request.commands.length || idx > 31) {\\n revert InvalidReference(idx, request.commands.length);\\n }\\n _addOperation(request, OP_BACKREF | idx);\\n return request;\\n }\\n\\n /**\\n * @dev Initiates the fetch request.\\n * Calling this function terminates execution; clients that implement CCIP-Read will make a callback to\\n * `callback` with the results of the operation.\\n * @param callbackId A callback function selector on this contract that will be invoked via CCIP-Read with the result of the lookup.\\n * The function must have a signature matching `(bytes[] memory values, bytes callbackData)` with a return type matching the call in which\\n * this function was invoked. Its return data will be returned as the return value of the entire CCIP-read operation.\\n * @param callbackData Extra data to supply to the callback.\\n */\\n function fetch(\\n EVMFetchRequest memory request,\\n bytes4 callbackId,\\n bytes memory callbackData\\n ) internal view {\\n if (request.commands.length > 0 && request.operationIdx < 32) {\\n // Terminate last command\\n _addOperation(request, OP_END);\\n }\\n\\n revert OffchainLookup(\\n address(this),\\n request.verifier.gatewayURLs(),\\n abi.encodeCall(\\n IEVMGateway.getStorageSlots,\\n (request.target, request.commands, request.constants)\\n ),\\n EVMFetchTarget.getStorageSlotsCallback.selector,\\n abi.encode(\\n request.verifier,\\n request.target,\\n request.commands,\\n request.constants,\\n callbackId,\\n callbackData\\n )\\n );\\n }\\n\\n function _addConstant(\\n EVMFetchRequest memory request,\\n bytes memory value\\n ) private pure returns (uint8 idx) {\\n bytes[] memory constants = request.constants;\\n idx = uint8(constants.length);\\n assembly {\\n mstore(constants, add(idx, 1)) // Increment constant array length\\n }\\n constants[idx] = value;\\n }\\n\\n function _addOperation(\\n EVMFetchRequest memory request,\\n uint8 op\\n ) private pure {\\n uint256 commandIdx = request.commands.length - 1;\\n request.commands[commandIdx] =\\n request.commands[commandIdx] |\\n (bytes32(bytes1(op)) >> (8 * request.operationIdx++));\\n }\\n}\\n\",\"keccak256\":\"0x96ccc4f320287222e427a2c4620d8e27cfc0a64820dc9b214ba396344eeb6a99\",\"license\":\"MIT\"},\"linea-state-verifier/contracts/IEVMVerifier.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\ninterface IEVMVerifier {\\n function gatewayURLs() external view returns (string[] memory);\\n\\n function getStorageValues(\\n address target,\\n bytes32[] memory commands,\\n bytes[] memory constants,\\n bytes memory proof,\\n uint256 acceptedL2BlockRangeLength\\n ) external view returns (bytes[] memory values);\\n}\\n\",\"keccak256\":\"0x3e111236291da207c09145b288d0c98a20fb0845b5c5c4cadd4a465b269787cd\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101006040523461038857612666803803908161001b8161038d565b91823960a08183810103126103885780516001600160a01b039182821682036103885760208101518381168103610388576040820151908482168203610388576060830151936001600160401b03851161038857601f938781018587830101121561038857808601516001600160401b03811161028e57601f19966100a6828801891660200161038d565b99828b5283016020838386010101116103885760005b82811061037257505060009089016020015260800151958381161561032e57808216156102e9578216156102a45760805260a05260c0528351906001600160401b03821161028e5760019283548481811c91168015610284575b602082101461026e57828111610226575b5060209183116001146101c75750819293946000926101bc575b5050600019600383901b1c191690821b1790555b60e0526040516122b390816103b3823960805181818161037101528181611463015281816116520152818161179f01526118a3015260a05181818161054c0152610a5e015260c0518181816109a10152610a93015260e051818181610c6e0152610cc00152f35b015190503880610141565b8216908360005260206000209160005b81811061021057509583859697106101f7575b505050811b019055610155565b015160001960f88460031b161c191690553880806101ea565b87830151845592850192602092830192016101d7565b8460005260206000208380860160051c82019260208710610265575b0160051c019085905b828110610259575050610127565b6000815501859061024b565b92508192610242565b634e487b7160e01b600052602260045260246000fd5b90607f1690610116565b634e487b7160e01b600052604160045260246000fd5b60405162461bcd60e51b815260206004820152601c60248201527f52656769737472792061646472657373206d75737420626520736574000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601c60248201527f56657269666965722061646472657373206d75737420626520736574000000006044820152606490fd5b606460405162461bcd60e51b815260206004820152602060248201527f4e616d6520577261707065722061646472657373206d757374206265207365746044820152fd5b602082850182018101518c8301820152016100bc565b600080fd5b6040519190601f01601f191682016001600160401b0381118382101761028e5760405256fe6080604052600436101561001257600080fd5b60003560e01c806301ffc9a71461011d57806315f64386146101185780632b7ac3f31461011357806338bf92e6146100d75780633f15457f1461010e5780634062b43f146101095780635bdaa916146101045780636d74e86e146100ff5780638a596ebe146100fa5780639061b923146100f5578063a8e5fbc0146100f0578063d358df77146100eb578063d6ae3cd5146100e6578063de9abe5e146100d7578063f00eebf4146100e1578063f470901a146100dc5763fcd2e381146100d757600080fd5b6104d2565b610cf8565b610c91565b610c56565b610a19565b61098b565b61086d565b610828565b61080a565b61070c565b61066a565b610536565b61035b565b61030a565b61013c565b35906001600160e01b03198216820361013757565b600080fd5b346101375760203660031901126101375760043563ffffffff60e01b81168091036101375761019f90639061b92360e01b81149081156101d6575b81156101c5575b81156101b4575b81156101a3575b5060405190151581529081906020820190565b0390f35b6301ffc9a760e01b1490503861018c565b633c03bafd60e21b81149150610185565b63452cb75f60e11b8114915061017e565b630afb21c360e11b81149150610177565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b0382111761021857604052565b6101e7565b602081019081106001600160401b0382111761021857604052565b61042081019081106001600160401b0382111761021857604052565b90601f801991011681019081106001600160401b0382111761021857604052565b6001600160401b03811161021857601f01601f191660200190565b92919261029c82610275565b916102aa6040519384610254565b829481845281830111610137578281602093846000960137010152565b9080601f83011215610137578160206102e293359101610290565b90565b906020828203126101375781356001600160401b038111610137576102e292016102c7565b34610137576020366003190112610137576004356001600160401b03811161013757610346600061034160409336906004016102c7565b611309565b82519182526001600160a01b03166020820152f35b34610137576000366003190112610137576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b6001600160401b0381116102185760051b60200190565b81601f82011215610137578035916020916103d1846103a0565b936103df6040519586610254565b808552838086019160051b8301019280841161013757848301915b84831061040a5750505050505090565b82356001600160401b03811161013757869161042b848480948901016102c7565b8152019201916103fa565b906040600319830112610137576001600160401b036004358181116101375783610462916004016103b7565b92602435918211610137576102e2916004016102c7565b60005b83811061048c5750506000910152565b818101518382015260200161047c565b906020916104b581518092818552858086019101610479565b601f01601f1916010190565b9060206102e292818152019061049c565b34610137576104e036610436565b508051600110156105315761050f61051d604061019f930151604051928391602080840152604083019061049c565b03601f198101835282610254565b60405191829160208352602083019061049c565b610d80565b34610137576000366003190112610137576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b90600182811c921680156105ab575b602083101461059557565b634e487b7160e01b600052602260045260246000fd5b91607f169161058a565b906000916001906001546105c88161057b565b808352926020916001811690811561064557506001146105e9575b50505050565b9293945060016000527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6926000935b8585106106325750505060209250010190388080806105e3565b8054858501840152938201938101610618565b92505050602093945060ff929192191683830152151560051b010190388080806105e3565b346101375760003660031901126101375761019f60405161051d8161068e816105b5565b0382610254565b9181601f84011215610137578235916001600160401b038311610137576020838186019501011161013757565b6040600319820112610137576001600160401b039160043583811161013757826106ee91600401610695565b939093926024359182116101375761070891600401610695565b9091565b346101375761076b600061073161073a610725366106c2565b949183919301906102e5565b92810190610daa565b95839592979460018060a09b949b1b039283926040519a8b978896879563628e501560e11b87521660048601610ff3565b0392165afa928315610805576000936107e0575b5082519051908181036107ba576107b2846107ac8761050f8760405194859360208501526024840161104f565b306113ce565b602081519101f35b604051632918942560e01b815260048101919091526024810191909152604490fd5b0390fd5b6107fe9193503d806000833e6107f68183610254565b810190610eb8565b913861077f565b611043565b34610137576000366003190112610137576020604051620151808152f35b34610137576020366003190112610137576004356001600160401b03811161013757610858903690600401610695565b505061019f60405161051d8161068e816105b5565b3461013757610341600061089c610883366106c2565b94929095916108956004871015611074565b3691610290565b9290506001600160e01b03196108b283836110b7565b16631d9dabef60e11b8114610977576378e5bf0360e11b811461095a57631674750f60e21b811461093d5763bc1c58d160e01b146109225760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b21039b2b632b1ba37b960811b6044820152606490fd5b8161093892610930926110e3565b810190611100565b611895565b50816109549261094c926110e3565b810190611125565b90611790565b508161097192610969926110e3565b81019061110f565b90611638565b508161098692610930926110e3565b61144d565b34610137576000366003190112610137576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b6001600160a01b0381160361013757565b604060031982011261013757600435906001600160401b03821161013757610a0b91600401610695565b90916024356102e2816109d0565b3461013757610a27366109e1565b91610a386000610341368585610290565b506040516302571be360e01b8152600481018290526001600160a01b03602080836024817f000000000000000000000000000000000000000000000000000000000000000086165afa92831561080557600093610c35575b507f00000000000000000000000000000000000000000000000000000000000000008216908383168214610b71575b505094610b4c81610b2d7f88781081cc340609705af0f96bf3ba64ea267873444e91725bd072f2af0f44d895610b1d610b5a967f3c68652dbd57659176ef0092991d5753aac3039c3134b7a3eb5689acfaccf62d9b33911614611164565b6000526000602052604060002090565b80546001600160a01b0319166001600160a01b03909216919091179055565b6040519182918686846111e4565b0390a1610b6c6040519283928361120d565b0390a1005b6040516331a9108f60e11b8152600481018690529790935091908390889060249082905afa801561080557610b2d7f88781081cc340609705af0f96bf3ba64ea267873444e91725bd072f2af0f44d895610b1d610b4c9486947f3c68652dbd57659176ef0092991d5753aac3039c3134b7a3eb5689acfaccf62d9c610b5a99600092610c08575b50509750959a5050955050610abf565b610c279250803d10610c2e575b610c1f8183610254565b81019061195c565b3880610bf8565b503d610c15565b819350610c4f9083923d8611610c2e57610c1f8183610254565b9290610a90565b346101375760003660031901126101375760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b34610137576044610cb16000610341610ca9366109e1565b503691610290565b60405163e0a0507160e01b81527f000000000000000000000000000000000000000000000000000000000000000060048201526001600160a01b0390911660248201529050fd5b3461013757610d0636610436565b508051600110156105315761050f610d5f604061019f93015160208151910151906bffffffffffffffffffffffff19918281169160148110610d6b575b50506040805160609290921c6020830152909384925090820190565b604051918291826104c1565b8391925060140360031b1b1616803880610d43565b634e487b7160e01b600052603260045260246000fd5b80518210156105315760209160051b010190565b91909160c081840312610137578035610dc2816109d0565b92602080830135610dd2816109d0565b936001600160401b039160408501358381116101375785019084601f8301121561013757813591610e02836103a0565b92610e106040519485610254565b808452828085019160051b83010191878311610137578301905b828210610e7257505050509360608101358381116101375784610e4e9183016103b7565b93610e5b60808301610122565b9360a0830135908111610137576102e292016102c7565b81358152908301908301610e2a565b90929192610e8e81610275565b91610e9c6040519384610254565b829482845282820111610137576020610eb6930190610479565b565b9060209081838203126101375782516001600160401b039384821161013757019080601f83011215610137578151610eef816103a0565b94604090610f006040519788610254565b828752858088019360051b8601019484861161013757868101935b868510610f2d57505050505050505090565b845183811161013757820186603f82011215610137578891610f5788838886809601519101610e81565b815201940193610f1b565b90815180825260208080930193019160005b828110610f82575050505090565b835185529381019392810192600101610f74565b90808251908181526020809101926020808460051b8301019501936000915b848310610fc55750505050505090565b9091929394958480610fe3600193601f198682030187528a5161049c565b9801930193019194939290610fb5565b9493611030620151809461102260809561103e9560018060a01b03168a5260a060208b015260a08a0190610f62565b9088820360408a0152610f96565b90868203606088015261049c565b930152565b6040513d6000823e3d90fd5b90916110666102e293604084526040840190610f96565b91602081840391015261049c565b1561107b57565b60405162461bcd60e51b81526020600482015260146024820152731c185c985b4819185d18481d1bdbc81cda1bdc9d60621b6044820152606490fd5b6001600160e01b031990358181169392600481106110d457505050565b60040360031b82901b16169150565b909291928360041161013757831161013757600401916003190190565b90816020910312610137573590565b9190826040910312610137576020823592013590565b9190604083820312610137578235926020810135906001600160401b03821161013757019080601f83011215610137578160206102e293359101610290565b1561116b57565b60405162461bcd60e51b815260206004820152602a60248201527f4e6f7420617574686f72697a656420746f207365742074617267657420666f726044820152692074686973206e6f646560b01b6064820152608490fd5b908060209392818452848401376000828201840152601f01601f1916010190565b916020916111fd919594956040855260408501916111c3565b6001600160a01b03909416910152565b9190611221916040845260408401916111c3565b8181036020928301526001805460009392909161123d8361057b565b80835292600181169081156112b6575060011461125c575b5050505090565b9293509060016000527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf692846000945b8386106112a25750505050010138808080611255565b80548587018301529401938590820161128c565b60ff191685840152505090151560051b0101905038808080611255565b634e487b7160e01b600052601160045260246000fd5b90600182018092116112f757565b6112d3565b919082018092116112f757565b9190918051831015610531576020838201015160f81c80156113c2579061134e611349836113436113549561133d896112e9565b86611971565b966112fc565b6112e9565b90611309565b60408051602081019384529081019490945292611374816060810161050f565b51902060008181526020819052604090206001600160a01b03906113a0905b546001600160a01b031690565b166113a9579190565b91506102e2611393836000526000602052604060002090565b50509050600090600090565b906102e291600080604051936113e3856101fd565b601e85527f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000602086015260208151910182855af13d15611445573d9161142883610275565b926114366040519485610254565b83523d6000602085013e612059565b606091612059565b61148c6114966114918361148c61148761149b977f00000000000000000000000000000000000000000000000000000000000000006119c8565b611a64565b611adb565b611b0f565b611b86565b6114a361198b565b5060608101906020908183511015611626576004906040906114e16114db8351603c878201528681526114d5816101fd565b83612250565b826121ef565b8151936114ed8561021d565b6000855282820195818751511515918261161b575b505061160d575b8151600090611528906001600160a01b03165b6001600160a01b031690565b8451632d43cbef60e21b815295869182905afa938415610805576000946115f0575b5081810180516001600160a01b03168751608085018051875163ea9cd3bf60e01b87820152999391928a9261158492919060248501611bf9565b0394601f19958681018a52611599908a610254565b516001600160a01b031692516001600160a01b031698519051908651998a958601946115c495611c2f565b0390810185526115d49085610254565b51630556f18360e41b81529283926107dc923060048601611d71565b6116069194503d806000833e6107f68183610254565b923861154a565b611616826120ea565b611509565b511090508138611502565b604051631601fac760e31b8152600490fd5b8061148c61149661149161148c9461148c611487611676997f00000000000000000000000000000000000000000000000000000000000000006119c8565b60409060048251926116878461021d565b6000845280830192835151151580611782575b611774575b80516000906116b6906001600160a01b031661151c565b8351632d43cbef60e21b815294859182905afa92831561080557600093611757575b506020810180519094906001600160a01b0316948151966080840197885197865198899263ea9cd3bf60e01b6020850152602484019261171793611bf9565b0393601f1994858101895261172c9089610254565b516001600160a01b031691516001600160a01b03169251975185519889946115c49460208701611c8a565b61176d9193503d806000833e6107f68183610254565b91386116d8565b61177d816120ea565b61169f565b50602060608201511061169a565b90918161148c6114876117c3937f00000000000000000000000000000000000000000000000000000000000000006119c8565b906117cc61198b565b5060206040830180516001815180151580611888575b61187a575b0190525151116118615761148c826000606061182795015261180881612194565b6114966114db6040516114d58161050f6020820190600a602083019252565b9061183061198b565b50602060608301511015611626576114db61184b9183612250565b604051906118588261021d565b60008252611e15565b604051630251ce0160e31b815260206004820152602490fd5b611883876120ea565b6117e7565b50846060880151106117e2565b908161148c6114876118c7937f00000000000000000000000000000000000000000000000000000000000000006119c8565b906118d061198b565b506020604083018051600181518015158061194f575b611941575b0190525151116118615761148c826000606061192b95015261190c81612194565b6114966114db6040516114d58161050f60208201906003602083019252565b604051906119388261021d565b60008252611f4e565b61194a876120ea565b6118eb565b50846060880151106118e6565b9081602091031261013757516102e2816109d0565b908281018082116112f75782511061013757016020012090565b6040519060a082018281106001600160401b0382111761021857604052606060808360008152600060208201528260408201526000838201520152565b6119d061198b565b506040516119dd81610238565b602091602082526104009283366020850137604051936119fc85610238565b60005b818110611a555750505060008252600083526040519360a085018581106001600160401b03821117610218576040526001600160a01b039182168552166020840152604083015260006060830152608082015290565b606086820184015282016119ff565b611a6c61198b565b5060206040820180516001815180151580611ace575b611ac0575b0190525151116118615760006060820152611aa181612148565b6102e26114db6040516114d58161050f60208201906000602083019252565b611ac9866120ea565b611a87565b5084606087015110611a82565b90611ae461198b565b50602060608301511015611626576114db6102e291604051906020820152602081526114d5816101fd565b611b1761198b565b5060206040820180516001815180151580611b79575b611b6b575b0190525151116118615760006060820152611b4c81612194565b6102e26114db6040516114d58161050f60208201906002602083019252565b611b74866120ea565b611b32565b5084606087015110611b2d565b611b8e61198b565b5060608101602081511015611626576040820190815151600019918282019182116112f757611bbe828551610d96565b519080519384146112f7576001840190526001600160fd1b03831683036112f757611bf592600160fd1b9060031b1c179251610d96565b5290565b6001600160a01b0390911681526060602082018190526102e2939192611c2191840190610f62565b916040818403910152610f96565b93906102e29593611c6191611c6f9460018060a01b03809216885216602087015260c0604087015260c0860190610f62565b908482036060860152610f96565b91637a38480d60e11b608082015260a081840391015261049c565b93906102e29593611c6191611cbc9460018060a01b03809216885216602087015260c0604087015260c0860190610f62565b91631c5fc97360e11b608082015260a081840391015261049c565b93906102e29593611c6191611d099460018060a01b03809216885216602087015260c0604087015260c0860190610f62565b91636f4d5f2f60e11b608082015260a081840391015261049c565b93906102e29593611c6191611d569460018060a01b03809216885216602087015260c0604087015260c0860190610f62565b9163fcd2e38160e01b608082015260a081840391015261049c565b92909493919460a084019060018060a01b0316845260209060a06020860152865180915260c0850191602060c08360051b8801019801926000905b838210611de957505050505084611dce91846102e2969703604086015261049c565b632ded548b60e11b606084015291608081840391015261049c565b90919293988380611e0660019360bf198c82030186528d5161049c565b9b019201920190939291611dac565b60046040820191825151151580611f40575b611f32575b8051600090611e43906001600160a01b031661151c565b604051632d43cbef60e21b815293849182905afa91821561080557600092611f15575b506020810180519093906001600160a01b031693815195608084019687519660405197889263ea9cd3bf60e01b60208501526024840192611ea693611bf9565b0393601f19948581018852611ebb9088610254565b516001600160a01b031691516001600160a01b031692519651604051978894611ee79460208701611cd7565b039081018452611ef79084610254565b604051630556f18360e41b81529283926107dc923060048601611d71565b611f2b9192503d806000833e6107f68183610254565b9038611e66565b611f3b816120ea565b611e2c565b506020606082015110611e27565b6004604082019182515115158061204b575b61203d575b8051600090611f7c906001600160a01b031661151c565b604051632d43cbef60e21b815293849182905afa91821561080557600092612020575b506020810180519093906001600160a01b031693815195608084019687519660405197889263ea9cd3bf60e01b60208501526024840192611fdf93611bf9565b0393601f19948581018852611ff49088610254565b516001600160a01b031691516001600160a01b031692519651604051978894611ee79460208701611d24565b6120369192503d806000833e6107f68183610254565b9038611f9f565b612046816120ea565b611f65565b506020606082015110611f60565b919290156120bb575081511561206d575090565b3b156120765790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156120ce5750805190602001fd5b60405162461bcd60e51b81529081906107dc90600483016104c1565b6040810190815151600019918282019182116112f757606061210d838651610d96565b51910180519384146112f7576001840190526001600160fd1b03831683036112f7576121459260ff60f81b9060031b1c179251610d96565b52565b604081018051516000198082019182116112f7576060612169838551610d96565b51940180519182146112f7576001820190526001600160fd1b038116036112f7576121459151610d96565b6040810190815151600019918282019182116112f75760606121b7838651610d96565b51910180519384146112f7576001840190526001600160fd1b03831683036112f75761214592600160f81b9060031b1c179251610d96565b604081018051519092916000198083019283116112f7576060612213848751610d96565b51920180519182146112f7576001820190526001600160fd1b03811681036112f7576121459360ff60f81b9060f81b169060031b1c179251610d96565b608061227a9193929301519260ff8451169384916001830182526122748383610d96565b52610d96565b5056fea2646970667358221220d0079c3d882566d4f8b428db44b78d6cd6af0cab43c41d234019c1e2e21d205164736f6c63430008190033", + "deployedBytecode": "0x6080604052600436101561001257600080fd5b60003560e01c806301ffc9a71461011d57806315f64386146101185780632b7ac3f31461011357806338bf92e6146100d75780633f15457f1461010e5780634062b43f146101095780635bdaa916146101045780636d74e86e146100ff5780638a596ebe146100fa5780639061b923146100f5578063a8e5fbc0146100f0578063d358df77146100eb578063d6ae3cd5146100e6578063de9abe5e146100d7578063f00eebf4146100e1578063f470901a146100dc5763fcd2e381146100d757600080fd5b6104d2565b610cf8565b610c91565b610c56565b610a19565b61098b565b61086d565b610828565b61080a565b61070c565b61066a565b610536565b61035b565b61030a565b61013c565b35906001600160e01b03198216820361013757565b600080fd5b346101375760203660031901126101375760043563ffffffff60e01b81168091036101375761019f90639061b92360e01b81149081156101d6575b81156101c5575b81156101b4575b81156101a3575b5060405190151581529081906020820190565b0390f35b6301ffc9a760e01b1490503861018c565b633c03bafd60e21b81149150610185565b63452cb75f60e11b8114915061017e565b630afb21c360e11b81149150610177565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b0382111761021857604052565b6101e7565b602081019081106001600160401b0382111761021857604052565b61042081019081106001600160401b0382111761021857604052565b90601f801991011681019081106001600160401b0382111761021857604052565b6001600160401b03811161021857601f01601f191660200190565b92919261029c82610275565b916102aa6040519384610254565b829481845281830111610137578281602093846000960137010152565b9080601f83011215610137578160206102e293359101610290565b90565b906020828203126101375781356001600160401b038111610137576102e292016102c7565b34610137576020366003190112610137576004356001600160401b03811161013757610346600061034160409336906004016102c7565b611309565b82519182526001600160a01b03166020820152f35b34610137576000366003190112610137576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b6001600160401b0381116102185760051b60200190565b81601f82011215610137578035916020916103d1846103a0565b936103df6040519586610254565b808552838086019160051b8301019280841161013757848301915b84831061040a5750505050505090565b82356001600160401b03811161013757869161042b848480948901016102c7565b8152019201916103fa565b906040600319830112610137576001600160401b036004358181116101375783610462916004016103b7565b92602435918211610137576102e2916004016102c7565b60005b83811061048c5750506000910152565b818101518382015260200161047c565b906020916104b581518092818552858086019101610479565b601f01601f1916010190565b9060206102e292818152019061049c565b34610137576104e036610436565b508051600110156105315761050f61051d604061019f930151604051928391602080840152604083019061049c565b03601f198101835282610254565b60405191829160208352602083019061049c565b610d80565b34610137576000366003190112610137576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b90600182811c921680156105ab575b602083101461059557565b634e487b7160e01b600052602260045260246000fd5b91607f169161058a565b906000916001906001546105c88161057b565b808352926020916001811690811561064557506001146105e9575b50505050565b9293945060016000527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6926000935b8585106106325750505060209250010190388080806105e3565b8054858501840152938201938101610618565b92505050602093945060ff929192191683830152151560051b010190388080806105e3565b346101375760003660031901126101375761019f60405161051d8161068e816105b5565b0382610254565b9181601f84011215610137578235916001600160401b038311610137576020838186019501011161013757565b6040600319820112610137576001600160401b039160043583811161013757826106ee91600401610695565b939093926024359182116101375761070891600401610695565b9091565b346101375761076b600061073161073a610725366106c2565b949183919301906102e5565b92810190610daa565b95839592979460018060a09b949b1b039283926040519a8b978896879563628e501560e11b87521660048601610ff3565b0392165afa928315610805576000936107e0575b5082519051908181036107ba576107b2846107ac8761050f8760405194859360208501526024840161104f565b306113ce565b602081519101f35b604051632918942560e01b815260048101919091526024810191909152604490fd5b0390fd5b6107fe9193503d806000833e6107f68183610254565b810190610eb8565b913861077f565b611043565b34610137576000366003190112610137576020604051620151808152f35b34610137576020366003190112610137576004356001600160401b03811161013757610858903690600401610695565b505061019f60405161051d8161068e816105b5565b3461013757610341600061089c610883366106c2565b94929095916108956004871015611074565b3691610290565b9290506001600160e01b03196108b283836110b7565b16631d9dabef60e11b8114610977576378e5bf0360e11b811461095a57631674750f60e21b811461093d5763bc1c58d160e01b146109225760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b21039b2b632b1ba37b960811b6044820152606490fd5b8161093892610930926110e3565b810190611100565b611895565b50816109549261094c926110e3565b810190611125565b90611790565b508161097192610969926110e3565b81019061110f565b90611638565b508161098692610930926110e3565b61144d565b34610137576000366003190112610137576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b6001600160a01b0381160361013757565b604060031982011261013757600435906001600160401b03821161013757610a0b91600401610695565b90916024356102e2816109d0565b3461013757610a27366109e1565b91610a386000610341368585610290565b506040516302571be360e01b8152600481018290526001600160a01b03602080836024817f000000000000000000000000000000000000000000000000000000000000000086165afa92831561080557600093610c35575b507f00000000000000000000000000000000000000000000000000000000000000008216908383168214610b71575b505094610b4c81610b2d7f88781081cc340609705af0f96bf3ba64ea267873444e91725bd072f2af0f44d895610b1d610b5a967f3c68652dbd57659176ef0092991d5753aac3039c3134b7a3eb5689acfaccf62d9b33911614611164565b6000526000602052604060002090565b80546001600160a01b0319166001600160a01b03909216919091179055565b6040519182918686846111e4565b0390a1610b6c6040519283928361120d565b0390a1005b6040516331a9108f60e11b8152600481018690529790935091908390889060249082905afa801561080557610b2d7f88781081cc340609705af0f96bf3ba64ea267873444e91725bd072f2af0f44d895610b1d610b4c9486947f3c68652dbd57659176ef0092991d5753aac3039c3134b7a3eb5689acfaccf62d9c610b5a99600092610c08575b50509750959a5050955050610abf565b610c279250803d10610c2e575b610c1f8183610254565b81019061195c565b3880610bf8565b503d610c15565b819350610c4f9083923d8611610c2e57610c1f8183610254565b9290610a90565b346101375760003660031901126101375760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b34610137576044610cb16000610341610ca9366109e1565b503691610290565b60405163e0a0507160e01b81527f000000000000000000000000000000000000000000000000000000000000000060048201526001600160a01b0390911660248201529050fd5b3461013757610d0636610436565b508051600110156105315761050f610d5f604061019f93015160208151910151906bffffffffffffffffffffffff19918281169160148110610d6b575b50506040805160609290921c6020830152909384925090820190565b604051918291826104c1565b8391925060140360031b1b1616803880610d43565b634e487b7160e01b600052603260045260246000fd5b80518210156105315760209160051b010190565b91909160c081840312610137578035610dc2816109d0565b92602080830135610dd2816109d0565b936001600160401b039160408501358381116101375785019084601f8301121561013757813591610e02836103a0565b92610e106040519485610254565b808452828085019160051b83010191878311610137578301905b828210610e7257505050509360608101358381116101375784610e4e9183016103b7565b93610e5b60808301610122565b9360a0830135908111610137576102e292016102c7565b81358152908301908301610e2a565b90929192610e8e81610275565b91610e9c6040519384610254565b829482845282820111610137576020610eb6930190610479565b565b9060209081838203126101375782516001600160401b039384821161013757019080601f83011215610137578151610eef816103a0565b94604090610f006040519788610254565b828752858088019360051b8601019484861161013757868101935b868510610f2d57505050505050505090565b845183811161013757820186603f82011215610137578891610f5788838886809601519101610e81565b815201940193610f1b565b90815180825260208080930193019160005b828110610f82575050505090565b835185529381019392810192600101610f74565b90808251908181526020809101926020808460051b8301019501936000915b848310610fc55750505050505090565b9091929394958480610fe3600193601f198682030187528a5161049c565b9801930193019194939290610fb5565b9493611030620151809461102260809561103e9560018060a01b03168a5260a060208b015260a08a0190610f62565b9088820360408a0152610f96565b90868203606088015261049c565b930152565b6040513d6000823e3d90fd5b90916110666102e293604084526040840190610f96565b91602081840391015261049c565b1561107b57565b60405162461bcd60e51b81526020600482015260146024820152731c185c985b4819185d18481d1bdbc81cda1bdc9d60621b6044820152606490fd5b6001600160e01b031990358181169392600481106110d457505050565b60040360031b82901b16169150565b909291928360041161013757831161013757600401916003190190565b90816020910312610137573590565b9190826040910312610137576020823592013590565b9190604083820312610137578235926020810135906001600160401b03821161013757019080601f83011215610137578160206102e293359101610290565b1561116b57565b60405162461bcd60e51b815260206004820152602a60248201527f4e6f7420617574686f72697a656420746f207365742074617267657420666f726044820152692074686973206e6f646560b01b6064820152608490fd5b908060209392818452848401376000828201840152601f01601f1916010190565b916020916111fd919594956040855260408501916111c3565b6001600160a01b03909416910152565b9190611221916040845260408401916111c3565b8181036020928301526001805460009392909161123d8361057b565b80835292600181169081156112b6575060011461125c575b5050505090565b9293509060016000527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf692846000945b8386106112a25750505050010138808080611255565b80548587018301529401938590820161128c565b60ff191685840152505090151560051b0101905038808080611255565b634e487b7160e01b600052601160045260246000fd5b90600182018092116112f757565b6112d3565b919082018092116112f757565b9190918051831015610531576020838201015160f81c80156113c2579061134e611349836113436113549561133d896112e9565b86611971565b966112fc565b6112e9565b90611309565b60408051602081019384529081019490945292611374816060810161050f565b51902060008181526020819052604090206001600160a01b03906113a0905b546001600160a01b031690565b166113a9579190565b91506102e2611393836000526000602052604060002090565b50509050600090600090565b906102e291600080604051936113e3856101fd565b601e85527f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000602086015260208151910182855af13d15611445573d9161142883610275565b926114366040519485610254565b83523d6000602085013e612059565b606091612059565b61148c6114966114918361148c61148761149b977f00000000000000000000000000000000000000000000000000000000000000006119c8565b611a64565b611adb565b611b0f565b611b86565b6114a361198b565b5060608101906020908183511015611626576004906040906114e16114db8351603c878201528681526114d5816101fd565b83612250565b826121ef565b8151936114ed8561021d565b6000855282820195818751511515918261161b575b505061160d575b8151600090611528906001600160a01b03165b6001600160a01b031690565b8451632d43cbef60e21b815295869182905afa938415610805576000946115f0575b5081810180516001600160a01b03168751608085018051875163ea9cd3bf60e01b87820152999391928a9261158492919060248501611bf9565b0394601f19958681018a52611599908a610254565b516001600160a01b031692516001600160a01b031698519051908651998a958601946115c495611c2f565b0390810185526115d49085610254565b51630556f18360e41b81529283926107dc923060048601611d71565b6116069194503d806000833e6107f68183610254565b923861154a565b611616826120ea565b611509565b511090508138611502565b604051631601fac760e31b8152600490fd5b8061148c61149661149161148c9461148c611487611676997f00000000000000000000000000000000000000000000000000000000000000006119c8565b60409060048251926116878461021d565b6000845280830192835151151580611782575b611774575b80516000906116b6906001600160a01b031661151c565b8351632d43cbef60e21b815294859182905afa92831561080557600093611757575b506020810180519094906001600160a01b0316948151966080840197885197865198899263ea9cd3bf60e01b6020850152602484019261171793611bf9565b0393601f1994858101895261172c9089610254565b516001600160a01b031691516001600160a01b03169251975185519889946115c49460208701611c8a565b61176d9193503d806000833e6107f68183610254565b91386116d8565b61177d816120ea565b61169f565b50602060608201511061169a565b90918161148c6114876117c3937f00000000000000000000000000000000000000000000000000000000000000006119c8565b906117cc61198b565b5060206040830180516001815180151580611888575b61187a575b0190525151116118615761148c826000606061182795015261180881612194565b6114966114db6040516114d58161050f6020820190600a602083019252565b9061183061198b565b50602060608301511015611626576114db61184b9183612250565b604051906118588261021d565b60008252611e15565b604051630251ce0160e31b815260206004820152602490fd5b611883876120ea565b6117e7565b50846060880151106117e2565b908161148c6114876118c7937f00000000000000000000000000000000000000000000000000000000000000006119c8565b906118d061198b565b506020604083018051600181518015158061194f575b611941575b0190525151116118615761148c826000606061192b95015261190c81612194565b6114966114db6040516114d58161050f60208201906003602083019252565b604051906119388261021d565b60008252611f4e565b61194a876120ea565b6118eb565b50846060880151106118e6565b9081602091031261013757516102e2816109d0565b908281018082116112f75782511061013757016020012090565b6040519060a082018281106001600160401b0382111761021857604052606060808360008152600060208201528260408201526000838201520152565b6119d061198b565b506040516119dd81610238565b602091602082526104009283366020850137604051936119fc85610238565b60005b818110611a555750505060008252600083526040519360a085018581106001600160401b03821117610218576040526001600160a01b039182168552166020840152604083015260006060830152608082015290565b606086820184015282016119ff565b611a6c61198b565b5060206040820180516001815180151580611ace575b611ac0575b0190525151116118615760006060820152611aa181612148565b6102e26114db6040516114d58161050f60208201906000602083019252565b611ac9866120ea565b611a87565b5084606087015110611a82565b90611ae461198b565b50602060608301511015611626576114db6102e291604051906020820152602081526114d5816101fd565b611b1761198b565b5060206040820180516001815180151580611b79575b611b6b575b0190525151116118615760006060820152611b4c81612194565b6102e26114db6040516114d58161050f60208201906002602083019252565b611b74866120ea565b611b32565b5084606087015110611b2d565b611b8e61198b565b5060608101602081511015611626576040820190815151600019918282019182116112f757611bbe828551610d96565b519080519384146112f7576001840190526001600160fd1b03831683036112f757611bf592600160fd1b9060031b1c179251610d96565b5290565b6001600160a01b0390911681526060602082018190526102e2939192611c2191840190610f62565b916040818403910152610f96565b93906102e29593611c6191611c6f9460018060a01b03809216885216602087015260c0604087015260c0860190610f62565b908482036060860152610f96565b91637a38480d60e11b608082015260a081840391015261049c565b93906102e29593611c6191611cbc9460018060a01b03809216885216602087015260c0604087015260c0860190610f62565b91631c5fc97360e11b608082015260a081840391015261049c565b93906102e29593611c6191611d099460018060a01b03809216885216602087015260c0604087015260c0860190610f62565b91636f4d5f2f60e11b608082015260a081840391015261049c565b93906102e29593611c6191611d569460018060a01b03809216885216602087015260c0604087015260c0860190610f62565b9163fcd2e38160e01b608082015260a081840391015261049c565b92909493919460a084019060018060a01b0316845260209060a06020860152865180915260c0850191602060c08360051b8801019801926000905b838210611de957505050505084611dce91846102e2969703604086015261049c565b632ded548b60e11b606084015291608081840391015261049c565b90919293988380611e0660019360bf198c82030186528d5161049c565b9b019201920190939291611dac565b60046040820191825151151580611f40575b611f32575b8051600090611e43906001600160a01b031661151c565b604051632d43cbef60e21b815293849182905afa91821561080557600092611f15575b506020810180519093906001600160a01b031693815195608084019687519660405197889263ea9cd3bf60e01b60208501526024840192611ea693611bf9565b0393601f19948581018852611ebb9088610254565b516001600160a01b031691516001600160a01b031692519651604051978894611ee79460208701611cd7565b039081018452611ef79084610254565b604051630556f18360e41b81529283926107dc923060048601611d71565b611f2b9192503d806000833e6107f68183610254565b9038611e66565b611f3b816120ea565b611e2c565b506020606082015110611e27565b6004604082019182515115158061204b575b61203d575b8051600090611f7c906001600160a01b031661151c565b604051632d43cbef60e21b815293849182905afa91821561080557600092612020575b506020810180519093906001600160a01b031693815195608084019687519660405197889263ea9cd3bf60e01b60208501526024840192611fdf93611bf9565b0393601f19948581018852611ff49088610254565b516001600160a01b031691516001600160a01b031692519651604051978894611ee79460208701611d24565b6120369192503d806000833e6107f68183610254565b9038611f9f565b612046816120ea565b611f65565b506020606082015110611f60565b919290156120bb575081511561206d575090565b3b156120765790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156120ce5750805190602001fd5b60405162461bcd60e51b81529081906107dc90600483016104c1565b6040810190815151600019918282019182116112f757606061210d838651610d96565b51910180519384146112f7576001840190526001600160fd1b03831683036112f7576121459260ff60f81b9060031b1c179251610d96565b52565b604081018051516000198082019182116112f7576060612169838551610d96565b51940180519182146112f7576001820190526001600160fd1b038116036112f7576121459151610d96565b6040810190815151600019918282019182116112f75760606121b7838651610d96565b51910180519384146112f7576001840190526001600160fd1b03831683036112f75761214592600160f81b9060031b1c179251610d96565b604081018051519092916000198083019283116112f7576060612213848751610d96565b51920180519182146112f7576001820190526001600160fd1b03811681036112f7576121459360ff60f81b9060f81b169060031b1c179251610d96565b608061227a9193929301519260ff8451169384916001830182526122748383610d96565b52610d96565b5056fea2646970667358221220d0079c3d882566d4f8b428db44b78d6cd6af0cab43c41d234019c1e2e21d205164736f6c63430008190033", "devdoc": { "errors": { "StorageHandledByL2(uint256,address)": [ @@ -530,6 +543,9 @@ "_verifier": "The chain verifier address" } }, + "getAcceptedL2BlockRangeLength()": { + "details": "inherits from EVMFetchTarget" + }, "getStorageSlotsCallback(bytes,bytes)": { "details": "Internal callback function invoked by CCIP-Read in response to a `getStorageSlots` request." }, @@ -599,7 +615,7 @@ "storageLayout": { "storage": [ { - "astId": 13938, + "astId": 15841, "contract": "contracts/L1Resolver.sol:L1Resolver", "label": "targets", "offset": 0, @@ -607,7 +623,7 @@ "type": "t_mapping(t_bytes32,t_address)" }, { - "astId": 13961, + "astId": 15864, "contract": "contracts/L1Resolver.sol:L1Resolver", "label": "graphqlUrl", "offset": 0, diff --git a/packages/linea-ens-resolver/deployments/mainnet/LineaSparseProofVerifier.json b/packages/linea-ens-resolver/deployments/mainnet/LineaSparseProofVerifier.json index a18b986e0..84c369e5b 100644 --- a/packages/linea-ens-resolver/deployments/mainnet/LineaSparseProofVerifier.json +++ b/packages/linea-ens-resolver/deployments/mainnet/LineaSparseProofVerifier.json @@ -1,5 +1,5 @@ { - "address": "0x6401041c0D00E1ca2B4b1b93dA74d5BD0d50E57A", + "address": "0x2aD1A39a3b616FB11ac5DB290061A0A5C09771f3", "abi": [ { "inputs": [ @@ -108,7 +108,7 @@ }, { "internalType": "uint256", - "name": "l2BlockRangeAccepted", + "name": "acceptedL2BlockRangeLength", "type": "uint256" } ], @@ -124,19 +124,19 @@ "type": "function" } ], - "transactionHash": "0x53ee4457273b5e7f918b678a2d3cffc3b6d54621dfd1b47d6760cd5be19f2b7d", + "transactionHash": "0x3aae945cb962ed2da3ea940e874ccee0ff933741c10efb054e26b45e3c7f0d6b", "receipt": { "to": null, "from": "0x644e1ce71A6AfF1Fc52955214DF978DBB28f7a97", - "contractAddress": "0x6401041c0D00E1ca2B4b1b93dA74d5BD0d50E57A", - "transactionIndex": 16, + "contractAddress": "0x2aD1A39a3b616FB11ac5DB290061A0A5C09771f3", + "transactionIndex": 13, "gasUsed": "1551573", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x35746a88efb5e597904e2bb60a9c8c04990f22ade5fccfc0248ac6c004068aa0", - "transactionHash": "0x53ee4457273b5e7f918b678a2d3cffc3b6d54621dfd1b47d6760cd5be19f2b7d", + "blockHash": "0x19d8214a92a234b925067b91bcc094a7e42329f802ae8a4ef105b9ca01833197", + "transactionHash": "0x3aae945cb962ed2da3ea940e874ccee0ff933741c10efb054e26b45e3c7f0d6b", "logs": [], - "blockNumber": 20318013, - "cumulativeGasUsed": "4363580", + "blockNumber": 20410691, + "cumulativeGasUsed": "4368008", "status": 1, "byzantium": true }, @@ -146,11 +146,11 @@ ], "0xd19d4B5d358258f05D7B411E21A1460D11B0876F" ], - "numDeployments": 2, - "solcInputHash": "617c92f0f6f9d0cc08a713d0472e5f03", - "metadata": "{\"compiler\":{\"version\":\"0.8.25+commit.b61c2a91\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"urls\",\"type\":\"string[]\"},{\"internalType\":\"address\",\"name\":\"rollup\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"}],\"name\":\"InvalidSlotSize\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"UnknownOpcode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_gatewayURLs\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_rollup\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gatewayURLs\",\"outputs\":[{\"internalType\":\"string[]\",\"name\":\"\",\"type\":\"string[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"commands\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes[]\",\"name\":\"constants\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"l2BlockRangeAccepted\",\"type\":\"uint256\"}],\"name\":\"getStorageValues\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"values\",\"type\":\"bytes[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"linea-state-verifier/contracts/LineaSparseProofVerifier.sol\":\"LineaSparseProofVerifier\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[],\"viaIR\":true},\"sources\":{\"linea-state-verifier/contracts/IEVMVerifier.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\ninterface IEVMVerifier {\\n function gatewayURLs() external view returns (string[] memory);\\n\\n function getStorageValues(\\n address target,\\n bytes32[] memory commands,\\n bytes[] memory constants,\\n bytes memory proof,\\n uint256 l2BlockRangeAccepted\\n ) external view returns (bytes[] memory values);\\n}\\n\",\"keccak256\":\"0xd57e902e6a93880c9ec1e253ba767f1ed822fa997bfddd3bf474df1b5bc4e2b2\",\"license\":\"MIT\"},\"linea-state-verifier/contracts/LineaProofHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\nimport {SparseMerkleProof} from \\\"./lib/SparseMerkleProof.sol\\\";\\n\\nuint256 constant LAST_LEAF_INDEX = 41;\\n\\nstruct AccountProof {\\n bytes value;\\n bytes[] proofRelatedNodes;\\n}\\n\\nstruct StorageProof {\\n bytes32 value;\\n bytes[] proofRelatedNodes;\\n}\\n\\nstruct AccountProofStruct {\\n address key;\\n uint256 leafIndex;\\n AccountProof proof;\\n}\\n\\nstruct StorageProofStruct {\\n bytes32 key;\\n uint256 leafIndex;\\n StorageProof proof;\\n bool initialized;\\n}\\n\\nuint8 constant OP_CONSTANT = 0x00;\\nuint8 constant OP_BACKREF = 0x20;\\nuint8 constant FLAG_DYNAMIC = 0x01;\\n\\nlibrary LineaProofHelper {\\n error UnknownOpcode(uint8);\\n error InvalidSlotSize(uint256 size);\\n\\n function executeOperation(\\n bytes1 operation,\\n bytes[] memory constants,\\n bytes[] memory values\\n ) private pure returns (bytes memory) {\\n uint8 opcode = uint8(operation) & 0xe0;\\n uint8 operand = uint8(operation) & 0x1f;\\n\\n if (opcode == OP_CONSTANT) {\\n return constants[operand];\\n } else if (opcode == OP_BACKREF) {\\n return values[operand];\\n } else {\\n revert UnknownOpcode(opcode);\\n }\\n }\\n\\n function computeFirstSlot(\\n bytes32 command,\\n bytes[] memory constants,\\n bytes[] memory values\\n ) private pure returns (bool isDynamic, uint256 slot) {\\n uint8 flags = uint8(command[0]);\\n isDynamic = (flags & FLAG_DYNAMIC) != 0;\\n\\n bytes memory slotData = executeOperation(command[1], constants, values);\\n require(slotData.length == 32, \\\"First path element must be 32 bytes\\\");\\n slot = uint256(bytes32(slotData));\\n\\n for (uint256 j = 2; j < 32 && command[j] != 0xff; j++) {\\n bytes memory index = executeOperation(\\n command[j],\\n constants,\\n values\\n );\\n slot = uint256(keccak256(abi.encodePacked(index, slot)));\\n }\\n }\\n\\n function getDynamicValue(\\n uint256 slot,\\n uint256 proofIdx,\\n StorageProofStruct[] memory storageProofs,\\n SparseMerkleProof.Account memory account\\n ) private pure returns (bytes memory value, uint256 newProofIdx) {\\n if (!storageProofs[proofIdx].initialized) {\\n return (\\\"\\\", proofIdx++);\\n }\\n verifyStorageProof(\\n account,\\n storageProofs[proofIdx].leafIndex,\\n storageProofs[proofIdx].proof.proofRelatedNodes,\\n storageProofs[proofIdx].proof.value,\\n bytes32(slot)\\n );\\n uint256 firstValue = uint256(storageProofs[proofIdx++].proof.value);\\n if (firstValue & 0x01 == 0x01) {\\n // Long value: first slot is `length * 2 + 1`, following slots are data.\\n slot = uint256(keccak256(abi.encodePacked(slot)));\\n value = new bytes(firstValue >> 1);\\n uint256 off;\\n while (off < value.length) {\\n verifyStorageProof(\\n account,\\n storageProofs[proofIdx].leafIndex,\\n storageProofs[proofIdx].proof.proofRelatedNodes,\\n storageProofs[proofIdx].proof.value,\\n bytes32(slot++)\\n );\\n off += 32;\\n bytes32 temp = storageProofs[proofIdx++].proof.value;\\n assembly {\\n mstore(add(value, off), temp)\\n }\\n }\\n return (value, proofIdx);\\n } else {\\n uint256 length = (firstValue & 0xFF) >> 1;\\n return (sliceBytes(abi.encode(firstValue), 0, length), proofIdx);\\n }\\n }\\n\\n function sliceBytes(\\n bytes memory data,\\n uint256 start,\\n uint256 length\\n ) public pure returns (bytes memory) {\\n require(start + length <= data.length, \\\"sliceBytes: out of range\\\");\\n\\n bytes memory result = new bytes(length);\\n for (uint256 i = 0; i < length; i++) {\\n result[i] = data[i + start];\\n }\\n\\n return result;\\n }\\n\\n function verifyAccountProof(\\n address target,\\n AccountProofStruct memory accountProof,\\n bytes32 stateRoot\\n ) private pure returns (bool) {\\n // Verify the target contract first against the account proof's last leaf node's hkey\\n bytes32 targetHash = SparseMerkleProof.mimcHash(abi.encode(target));\\n SparseMerkleProof.Leaf memory accountLeaf = SparseMerkleProof.getLeaf(\\n accountProof.proof.proofRelatedNodes[LAST_LEAF_INDEX]\\n );\\n bytes32 hKey = accountLeaf.hKey;\\n\\n require(targetHash == hKey, \\\"LineaProofHelper: wrong target\\\");\\n\\n // Verify the account's proof itself\\n bool accountProofVerified = SparseMerkleProof.verifyProof(\\n accountProof.proof.proofRelatedNodes,\\n accountProof.leafIndex,\\n stateRoot\\n );\\n\\n bytes32 hAccountValue = SparseMerkleProof.hashAccountValue(\\n accountProof.proof.value\\n );\\n\\n require(\\n accountProofVerified && accountLeaf.hValue == hAccountValue,\\n \\\"LineaProofHelper: invalid account proof\\\"\\n );\\n\\n return true;\\n }\\n\\n function verifyStorageProof(\\n SparseMerkleProof.Account memory account,\\n uint256 leafIndex,\\n bytes[] memory proof,\\n bytes32 value,\\n bytes32 key\\n ) private pure {\\n bool storageProofVerified = SparseMerkleProof.verifyProof(\\n proof,\\n leafIndex,\\n account.storageRoot\\n );\\n\\n SparseMerkleProof.Leaf memory storageLeaf = SparseMerkleProof.getLeaf(\\n proof[LAST_LEAF_INDEX]\\n );\\n\\n // Verify the key\\n bytes32 hKey = SparseMerkleProof.hashStorageValue(key);\\n\\n // Verify the storage value\\n bytes32 hValue = SparseMerkleProof.hashStorageValue(value);\\n require(\\n storageProofVerified &&\\n storageLeaf.hKey == hKey &&\\n storageLeaf.hValue == hValue,\\n \\\"LineaProofHelper: invalid storage proof\\\"\\n );\\n }\\n\\n function getStorageValues(\\n address target,\\n bytes32[] memory commands,\\n bytes[] memory constants,\\n bytes32 stateRoot,\\n AccountProofStruct memory accountProof,\\n StorageProofStruct[] memory storageProofs\\n ) internal pure returns (bytes[] memory values) {\\n require(\\n commands.length <= storageProofs.length,\\n \\\"LineaProofHelper: commands number > storage proofs number\\\"\\n );\\n verifyAccountProof(target, accountProof, stateRoot);\\n SparseMerkleProof.Account memory account = SparseMerkleProof.getAccount(\\n accountProof.proof.value\\n );\\n uint256 proofIdx = 0;\\n values = new bytes[](commands.length);\\n for (uint256 i = 0; i < commands.length; i++) {\\n bytes32 command = commands[i];\\n (bool isDynamic, uint256 slot) = computeFirstSlot(\\n command,\\n constants,\\n values\\n );\\n if (!isDynamic) {\\n if (!storageProofs[proofIdx].initialized) {\\n values[i] = abi.encode(0);\\n proofIdx++;\\n } else {\\n verifyStorageProof(\\n account,\\n storageProofs[proofIdx].leafIndex,\\n storageProofs[proofIdx].proof.proofRelatedNodes,\\n storageProofs[proofIdx].proof.value,\\n bytes32(slot)\\n );\\n\\n values[i] = abi.encode(\\n storageProofs[proofIdx++].proof.value\\n );\\n\\n if (values[i].length > 32) {\\n revert InvalidSlotSize(values[i].length);\\n }\\n }\\n } else {\\n (values[i], proofIdx) = getDynamicValue(\\n slot,\\n proofIdx,\\n storageProofs,\\n account\\n );\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3ae8167e864cd8ae1e6804d3555c7df29142d1ae1347d1f74fe0c5dcd44368d5\",\"license\":\"MIT\"},\"linea-state-verifier/contracts/LineaSparseProofVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\nimport {IEVMVerifier} from \\\"./IEVMVerifier.sol\\\";\\nimport {StorageProofStruct, AccountProofStruct, LineaProofHelper} from \\\"./LineaProofHelper.sol\\\";\\n\\ninterface IRollup {\\n function stateRootHashes(\\n uint256 l2blockNumber\\n ) external view returns (bytes32);\\n\\n function currentL2BlockNumber() external view returns (uint256);\\n}\\n\\ncontract LineaSparseProofVerifier is IEVMVerifier {\\n string[] public _gatewayURLs;\\n address public _rollup;\\n\\n constructor(string[] memory urls, address rollup) {\\n _gatewayURLs = urls;\\n _rollup = rollup;\\n }\\n\\n function getStorageValues(\\n address target,\\n bytes32[] memory commands,\\n bytes[] memory constants,\\n bytes memory proof,\\n uint256 l2BlockRangeAccepted\\n ) external view returns (bytes[] memory values) {\\n (\\n uint256 blockNo,\\n AccountProofStruct memory accountProof,\\n StorageProofStruct[] memory storageProofs\\n ) = abi.decode(\\n proof,\\n (uint256, AccountProofStruct, StorageProofStruct[])\\n );\\n\\n // Check that the L2 block number used is a recent one and is part of the range accepted\\n uint256 currentL2BlockNumber = IRollup(_rollup).currentL2BlockNumber();\\n require(\\n (currentL2BlockNumber <= l2BlockRangeAccepted &&\\n blockNo <= currentL2BlockNumber) ||\\n blockNo >= currentL2BlockNumber - l2BlockRangeAccepted,\\n \\\"LineaSparseProofVerifier: block not in range accepted\\\"\\n );\\n\\n bytes32 stateRoot = IRollup(_rollup).stateRootHashes(blockNo);\\n require(\\n stateRoot != bytes32(0),\\n \\\"LineaSparseProofVerifier: invalid state root\\\"\\n );\\n\\n return\\n LineaProofHelper.getStorageValues(\\n target,\\n commands,\\n constants,\\n stateRoot,\\n accountProof,\\n storageProofs\\n );\\n }\\n\\n function gatewayURLs() external view override returns (string[] memory) {\\n return _gatewayURLs;\\n }\\n}\\n\",\"keccak256\":\"0x9f674a5af2cf840ba766ede12bda078e7c2094a3fce6e178a4d4c4a3f5f95315\",\"license\":\"MIT\"},\"linea-state-verifier/contracts/lib/Mimc.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n\\n// Copyright 2023 Consensys Software Inc.\\n//\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n// you may not use this file except in compliance with the License.\\n// You may obtain a copy of the License at\\n//\\n// http://www.apache.org/licenses/LICENSE-2.0\\n//\\n// Unless required by applicable law or agreed to in writing, software\\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n// See the License for the specific language governing permissions and\\n// limitations under the License.\\n\\n// Code generated by gnark DO NOT EDIT\\npragma solidity 0.8.25;\\n\\n/**\\n * @title Library to perform MiMC hashing\\n * @author ConsenSys Software Inc.\\n * @custom:security-contact security-report@linea.build\\n */\\nlibrary Mimc {\\n /**\\n * Thrown when the data is not provided\\n */\\n error DataMissing();\\n\\n /**\\n * Thrown when the data is not purely in 32 byte chunks\\n */\\n error DataIsNotMod32();\\n\\n uint256 constant FR_FIELD =\\n 8444461749428370424248824938781546531375899335154063827935233455917409239041;\\n /**\\n * @notice Performs a MiMC hash on the data provided\\n * @param _msg The data to be hashed\\n * @dev Only data that has length modulus 32 is hashed, reverts otherwise\\n * @return mimcHash The computed MiMC hash\\n */\\n function hash(\\n bytes calldata _msg\\n ) external pure returns (bytes32 mimcHash) {\\n if (_msg.length == 0) {\\n revert DataMissing();\\n }\\n\\n if (_msg.length % 0x20 != 0) {\\n revert DataIsNotMod32();\\n }\\n\\n assembly {\\n let chunks := div(add(_msg.length, 0x1f), 0x20)\\n\\n for {\\n let i := 0\\n } lt(i, chunks) {\\n i := add(i, 1)\\n } {\\n let offset := add(_msg.offset, mul(i, 0x20))\\n let chunk := calldataload(offset)\\n\\n let r := encrypt(mimcHash, chunk)\\n mimcHash := addmod(\\n addmod(mimcHash, r, FR_FIELD),\\n chunk,\\n FR_FIELD\\n )\\n }\\n\\n function encrypt(h, chunk) -> output {\\n let frField := FR_FIELD\\n let tmpSum := 0\\n\\n tmpSum := addmod(\\n addmod(chunk, h, frField),\\n 6780559962679281898511952483033644312910028090361101779689089025541625982996,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2327326745520207001136649348523057964841679868424949608370212081331899020358,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6201177823658417253260885485467023993767823924255470286063250782233002635405,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3401276671970505639801802718275229999176446092725813928949571059366811327963,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 796636033841689627732941016044857384234234277501564259311815186813195010627,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 159507412325830262114089631199386481336725966652415909300570415682233424809,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 1669348614406363339435491723584591316524711695667693315027811919444714635748,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2220664510675218580883672035712942523468288190837741520497926350441362544422,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 1294712289478715410717626660893541311126892630747701030449280341780183665665,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6758843230175145783288330173723849603007070607311612566540600202723911987180,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6271650829101108787041306415787253036818921034903891854433479166754956001513,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 8037654458661109859150348337922011363549131313762043865209663327750426111866,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2450972517788523786981910980516860147992539249204314270739451472218657823669,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2707650969937705465351357815756127556801434183777713569980595073268026256128,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 7874262417209200618473337039194351886630571503697269268624099887104149796259,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3089899920017810079637556867207463807565125948241456751227734590626249857937,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 8231877132811199596376758288825197494440517476607659739835166243301765860904,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 4889925300033981791993403687473437637164964770774352761851347729331041993593,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 506118690894045980182310960875885680782486421163823930266542078948815948062,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 4773308728424659273056201947330432214661646691949138677097247858746575076542,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6610301125072219342086627276930551094394509958433369744427479834611436778066,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 8062913614098409973923064402439991628739389434149534836396892159147794104642,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2576406140423312875091927795739341819101209176346955562285186911769083519728,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6247267546819369987508590432055536928557259658317014243676640822343115627202,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2354620213005699835215298236574714075068230025566107498090395819138978823906,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 1012123997779098542887516673253442986051441272786218052382513879552027657616,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 220252773286234814215172180118321537145064642853938490221604200051823270477,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2306037967476458159399202685728266972768173510335885477997450635969358782263,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 5906000615460106310157278190403974694555979202144571560620360962365001056276,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 8029952345415718287377564183334920026617762793749604843629313086537726648143,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6806091261750378774545720021859645013630360296898036304733359077422908323188,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3791365032107216523624488143755156784159183778414385385850652127088602339940,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 7713951866326004273632564650741019619975760271948208739458822610304231437565,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2159153222189174173490067225063044363535871059524538695070191871847470955412,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3459892854150586819083449948613048924207735017129514254460829121652786324530,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 8165919441562399076732808928206069494664474480220235797297111305840352207764,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 5067127638759272574597184239140007718698192996511162583428330546781376830321,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 7564926180046670501077982861476967417487855218354401587881011340975488196742,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 4793316512087044382791577380686883286681140325373390439122763061600650301139,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 12025027725022723723984202199185080936456585195449250668991990971241927925,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 5056480146405086811789505170440731715530475328844870175949109998024731067467,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3850822128034659558863504800917443538100103152464488164345952697508772708155,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 5490569542353168488797150359760203713598401616662275350850844170956899716180,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6809916892509991991280249336166027496157481609693382555884367500846199028644,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6102228360565846712478499570512196976845845959851353003471378423251561935785,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 7957411254301481793006532646538815862020547208300835763521138686017052464640,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 7577948604138385646013244290592520699579040577712519004775644201729392063846,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6025758357861563690691793181574484773095829890586160167641973490103511417496,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2004214547184552249779883547311284063339374005887218065319674453115808726850,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 1316449090346410801845183915381769525990226349513436734911941391785200212382,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 4556285572033080226119128815763547597118327635770271287655822355222839175285,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2369904002063218534853867482545647755243877244064168179905450676831047307618,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 7451702566176584025980909730992154118931318734166468698682947787653334803016,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 1329300832483899103910420486510886619321904846687482243968569167489052205690,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3238521361072472828313630322811653086792441312858682853521070248794222258735,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3475214489590830586915334473771293324307275731565327099797069845161869229357,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 4274287601159036159363576568654710230919275259553081321690187920135177947814,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6938336600682072955973769075275160235517201022692151378695173193891386346405,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3998198747256139339077883878547228988120873864712400941893285440315291004215,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6699213631756936754252081929574788294275116402464654263316543921533804167968,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6962236729635042756258761323749531146700535903704299930132981735734543600942,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6961288456480688271133399693659146309378114560595485436408179085016705585674,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n output := addmod(output, h, frField)\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7ce398ff779301fa880cfbe0c803f3955c1908cba02948b56e759173ecba0b52\",\"license\":\"Apache-2.0\"},\"linea-state-verifier/contracts/lib/SparseMerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity 0.8.25;\\n\\nimport {Mimc} from \\\"./Mimc.sol\\\";\\n\\n/**\\n * @title Library to perform SparseMerkleProof actions using the MiMC hashing algorithm\\n * @author ConsenSys Software Inc.\\n * @custom:security-contact security-report@linea.build\\n */\\nlibrary SparseMerkleProof {\\n using Mimc for *;\\n\\n /**\\n * The Account struct represents the state of the account including the storage root, nonce, balance and codesize\\n * @dev This is mapped directly to the output of the storage proof\\n */\\n struct Account {\\n uint64 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 mimcCodeHash;\\n bytes32 keccakCodeHash;\\n uint64 codeSize;\\n }\\n\\n /**\\n * Represents the leaf structure in both account and storage tries\\n * @dev This is mapped directly to the output of the storage proof\\n */\\n struct Leaf {\\n uint256 prev;\\n uint256 next;\\n bytes32 hKey;\\n bytes32 hValue;\\n }\\n\\n /**\\n * Thrown when expected bytes length is incorrect\\n */\\n error WrongBytesLength(uint256 expectedLength, uint256 bytesLength);\\n\\n /**\\n * Thrown when the length of bytes is not in exactly 32 byte chunks\\n */\\n error LengthNotMod32();\\n\\n /**\\n * Thrown when the leaf index is higher than the tree depth\\n */\\n error MaxTreeLeafIndexExceed();\\n\\n /**\\n * Thrown when the length of the unformatted proof is not provided exactly as expected (UNFORMATTED_PROOF_LENGTH)\\n */\\n error WrongProofLength(uint256 expectedLength, uint256 actualLength);\\n\\n uint256 internal constant TREE_DEPTH = 40;\\n uint256 internal constant UNFORMATTED_PROOF_LENGTH = 42;\\n bytes32 internal constant ZERO_HASH = 0x0;\\n uint256 internal constant MAX_TREE_LEAF_INDEX = 2 ** TREE_DEPTH - 1;\\n\\n /**\\n * @notice Formats input, computes root and returns true if it matches the provided merkle root\\n * @param _rawProof Raw sparse merkle tree proof\\n * @param _leafIndex Index of the leaf\\n * @param _root Sparse merkle root\\n * @return If the computed merkle root matches the provided one\\n */\\n function verifyProof(\\n bytes[] calldata _rawProof,\\n uint256 _leafIndex,\\n bytes32 _root\\n ) external pure returns (bool) {\\n if (_rawProof.length != UNFORMATTED_PROOF_LENGTH) {\\n revert WrongProofLength(UNFORMATTED_PROOF_LENGTH, _rawProof.length);\\n }\\n\\n (\\n bytes32 nextFreeNode,\\n bytes32 leafHash,\\n bytes32[] memory proof\\n ) = _formatProof(_rawProof);\\n return _verify(proof, leafHash, _leafIndex, _root, nextFreeNode);\\n }\\n\\n /**\\n * @notice Hash a value using MIMC hash\\n * @param _input Value to hash\\n * @return {bytes32} Mimc hash\\n */\\n function mimcHash(bytes calldata _input) external pure returns (bytes32) {\\n return Mimc.hash(_input);\\n }\\n\\n /**\\n * @notice Get leaf\\n * @param _encodedLeaf Encoded leaf bytes (prev, next, hKey, hValue)\\n * @return Leaf Formatted leaf struct\\n */\\n function getLeaf(\\n bytes calldata _encodedLeaf\\n ) external pure returns (Leaf memory) {\\n return _parseLeaf(_encodedLeaf);\\n }\\n\\n /**\\n * @notice Get account\\n * @param _encodedAccountValue Encoded account value bytes (nonce, balance, storageRoot, mimcCodeHash, keccakCodeHash, codeSize)\\n * @return Account Formatted account struct\\n */\\n function getAccount(\\n bytes calldata _encodedAccountValue\\n ) external pure returns (Account memory) {\\n return _parseAccount(_encodedAccountValue);\\n }\\n\\n /**\\n * @notice Hash account value\\n * @param _value Encoded account value bytes (nonce, balance, storageRoot, mimcCodeHash, keccakCodeHash, codeSize)\\n * @return {bytes32} Account value hash\\n */\\n function hashAccountValue(\\n bytes calldata _value\\n ) external pure returns (bytes32) {\\n Account memory account = _parseAccount(_value);\\n (bytes32 msb, bytes32 lsb) = _splitBytes32(account.keccakCodeHash);\\n return\\n Mimc.hash(\\n abi.encode(\\n account.nonce,\\n account.balance,\\n account.storageRoot,\\n account.mimcCodeHash,\\n lsb,\\n msb,\\n account.codeSize\\n )\\n );\\n }\\n\\n /**\\n * @notice Hash storage value\\n * @param _value Encoded storage value bytes\\n * @return {bytes32} Storage value hash\\n */\\n function hashStorageValue(bytes32 _value) external pure returns (bytes32) {\\n (bytes32 msb, bytes32 lsb) = _splitBytes32(_value);\\n return Mimc.hash(abi.encodePacked(lsb, msb));\\n }\\n\\n /**\\n * @notice Parse leaf value\\n * @param _encodedLeaf Encoded leaf bytes (prev, next, hKey, hValue)\\n * @return {Leaf} Formatted leaf struct\\n */\\n function _parseLeaf(\\n bytes calldata _encodedLeaf\\n ) private pure returns (Leaf memory) {\\n if (_encodedLeaf.length != 128) {\\n revert WrongBytesLength(128, _encodedLeaf.length);\\n }\\n return abi.decode(_encodedLeaf, (Leaf));\\n }\\n\\n /**\\n * @notice Parse account value\\n * @param _value Encoded account value bytes (nonce, balance, storageRoot, mimcCodeHash, keccakCodeHash, codeSize)\\n * @return {Account} Formatted account struct\\n */\\n function _parseAccount(\\n bytes calldata _value\\n ) private pure returns (Account memory) {\\n if (_value.length != 192) {\\n revert WrongBytesLength(192, _value.length);\\n }\\n return abi.decode(_value, (Account));\\n }\\n\\n /**\\n * @notice Split bytes32 into two bytes32 taking most significant bits and least significant bits\\n * @param _b bytes to split\\n * @return msb Most significant bits\\n * @return lsb Least significant bits\\n */\\n function _splitBytes32(\\n bytes32 _b\\n ) private pure returns (bytes32 msb, bytes32 lsb) {\\n assembly {\\n msb := shr(128, _b)\\n lsb := and(_b, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\\n }\\n }\\n\\n /**\\n * @notice Format proof\\n * @param _rawProof Non formatted proof array\\n * @return (bytes32, bytes32, bytes32[]) NextFreeNode, leafHash and formatted proof array\\n */\\n function _formatProof(\\n bytes[] calldata _rawProof\\n ) private pure returns (bytes32, bytes32, bytes32[] memory) {\\n uint256 rawProofLength = _rawProof.length;\\n uint256 formattedProofLength = rawProofLength - 2;\\n\\n bytes32[] memory proof = new bytes32[](formattedProofLength);\\n\\n if (_rawProof[0].length != 0x40) {\\n revert WrongBytesLength(0x40, _rawProof[0].length);\\n }\\n\\n bytes32 nextFreeNode = bytes32(_rawProof[0][:32]);\\n bytes32 leafHash = Mimc.hash(_rawProof[rawProofLength - 1]);\\n\\n for (uint256 i = 1; i < formattedProofLength; ) {\\n proof[formattedProofLength - i] = Mimc.hash(_rawProof[i]);\\n unchecked {\\n ++i;\\n }\\n }\\n\\n // If the sibling leaf (_rawProof[formattedProofLength]) is equal to zero bytes we don't hash it\\n if (_isZeroBytes(_rawProof[formattedProofLength])) {\\n proof[0] = ZERO_HASH;\\n } else {\\n proof[0] = Mimc.hash(_rawProof[formattedProofLength]);\\n }\\n\\n return (nextFreeNode, leafHash, proof);\\n }\\n\\n /**\\n * @notice Check if bytes contain only zero byte elements\\n * @param _data Bytes to be checked\\n * @return isZeroBytes true if bytes contain only zero byte elements, false otherwise\\n */\\n function _isZeroBytes(\\n bytes calldata _data\\n ) private pure returns (bool isZeroBytes) {\\n if (_data.length % 0x20 != 0) {\\n revert LengthNotMod32();\\n }\\n\\n isZeroBytes = true;\\n assembly {\\n let dataStart := _data.offset\\n\\n for {\\n let currentPtr := dataStart\\n } lt(currentPtr, add(dataStart, _data.length)) {\\n currentPtr := add(currentPtr, 0x20)\\n } {\\n let dataWord := calldataload(currentPtr)\\n\\n if eq(iszero(dataWord), 0) {\\n isZeroBytes := 0\\n break\\n }\\n }\\n }\\n }\\n\\n /**\\n * @notice Computes merkle root from proof and compares it to the provided root\\n * @param _proof Sparse merkle tree proof\\n * @param _leafHash Leaf hash\\n * @param _leafIndex Index of the leaf\\n * @param _root Sparse merkle root\\n * @param _nextFreeNode Next free node\\n * @return If the computed merkle root matches the provided one\\n */\\n function _verify(\\n bytes32[] memory _proof,\\n bytes32 _leafHash,\\n uint256 _leafIndex,\\n bytes32 _root,\\n bytes32 _nextFreeNode\\n ) private pure returns (bool) {\\n bytes32 computedHash = _leafHash;\\n uint256 currentIndex = _leafIndex;\\n\\n if (_leafIndex > MAX_TREE_LEAF_INDEX) {\\n revert MaxTreeLeafIndexExceed();\\n }\\n\\n for (uint256 height; height < TREE_DEPTH; ++height) {\\n if ((currentIndex >> height) & 1 == 1)\\n computedHash = Mimc.hash(\\n abi.encodePacked(_proof[height], computedHash)\\n );\\n else\\n computedHash = Mimc.hash(\\n abi.encodePacked(computedHash, _proof[height])\\n );\\n }\\n\\n return\\n Mimc.hash(abi.encodePacked(_nextFreeNode, computedHash)) == _root;\\n }\\n}\\n\",\"keccak256\":\"0xd7738d73506bffcf02c5e4ce5761e3d429261e5c522c39cf43eb9b6c943154de\",\"license\":\"AGPL-3.0\"}},\"version\":1}", - "bytecode": "0x604060806040523461029f57611c7b908138038061001c81610346565b93843982019060408383031261029f5782516001600160401b03919082811161029f57840190601f9284848401121561029f57825195602093828811610289576005938860051b9786610070818b01610346565b809b8152019087829a8501019381851161029f5790818980979695949301925b8584106102a45750505050505001519560018060a01b03871680970361029f57519368010000000000000000851161028957600095865486885580871061021e575b50868052848720939087905b87891061010657600180546001600160a01b0319168b1790556040516118be90816103bd8239f35b805180519086821161020a5790889161011f895461036b565b8781116101d6575b50829087831160011461016f579180600195928695948892610164575b5050600019600383901b1c191690841b1789555b019601980197946100de565b015190503880610144565b8986528386209190601f198416875b8181106101be57509160019693918588979694106101a5575b505050831b83018955610158565b015160001960f88460031b161c19169055388080610197565b8284015185558d96600190950194938401930161017e565b6101fb908a8752848720898086018a1c820192878710610201575b01891c01906103a5565b38610127565b925081926101f1565b634e487b7160e01b84526041600452602484fd5b8780528686892091820191015b81811061023857506100d2565b80896102466001935461036b565b80610254575b50500161022b565b8681118414610268575081555b893861024c565b828252610280878b842092018a1c82018583016103a5565b81835555610261565b634e487b7160e01b600052604160045260246000fd5b600080fd5b9091928094959697505188811161029f57820183603f8201121561029f578a810151898111610331576102de818e01601f19168d01610346565b918183528588838301011161029f579290918c926000945b8186106103195750600090820184015281528b9897969582019493925001610090565b8086018a015183870186015293909401938d936102f6565b60246000634e487b7160e01b81526041600452fd5b6040519190601f01601f191682016001600160401b0381118382101761028957604052565b90600182811c9216801561039b575b602083101461038557565b634e487b7160e01b600052602260045260246000fd5b91607f169161037a565b8181106103b0575050565b600081556001016103a556fe6080604052600436101561001257600080fd5b6000803560e01c908163a183bada1461013b578163b50f2fbc1461005557508063c51ca02a146100505763f36c452e1461004b57600080fd5b61059e565b6103a8565b3461013857806003193601126101385780546100708161024c565b9061007e604051928361022b565b80825282805260209283830191817f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563845b8383106101145750505050604051928484019085855251809152604084019460408260051b8601019392955b8287106100e85785850386f35b909192938280610104600193603f198a82030186528851610184565b96019201960195929190926100db565b6001888192610126859b9a989b6104a2565b815201920192019190969395966100af565b80fd5b346101385780600319360112610138576001546001600160a01b03166080908152602090f35b60005b8381106101745750506000910152565b8181015183820152602001610164565b9060209161019d81518092818552858086019101610161565b601f01601f1916010190565b6001600160a01b038116036101ba57565b600080fd5b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b038211176101f057604052565b6101bf565b604081019081106001600160401b038211176101f057604052565b606081019081106001600160401b038211176101f057604052565b90601f801991011681019081106001600160401b038211176101f057604052565b6001600160401b0381116101f05760051b60200190565b6001600160401b0381116101f057601f01601f191660200190565b81601f820112156101ba5780359061029582610263565b926102a3604051948561022b565b828452602083830101116101ba57816000926020809301838601378301015290565b81601f820112156101ba578035916020916102df8461024c565b936102ed604051958661022b565b808552838086019160051b830101928084116101ba57848301915b8483106103185750505050505090565b82356001600160401b0381116101ba5786916103398484809489010161027e565b815201920191610308565b6020808201906020835283518092526040830192602060408460051b8301019501936000915b84831061037a5750505050505090565b9091929394958480610398600193603f198682030187528a51610184565b980193019301919493929061036a565b346101ba5760a03660031901126101ba576004356103c5816101a9565b602435906001600160401b03908183116101ba57366023840112156101ba5782600401356103f28161024c565b93610400604051958661022b565b8185526020916024602087019160051b830101913683116101ba57602401905b82821061047d57505050506044358281116101ba576104439036906004016102c5565b926064359283116101ba576104799361046361046d94369060040161027e565b91608435936109a6565b60405191829182610344565b0390f35b81358152908301908301610420565b634e487b7160e01b600052603260045260246000fd5b906040519060009280549360018560011c9260018716918215610580575b60209160208610841461056c5787986104e0878a98999a60209181520190565b9490811561054b5750600114610503575b505050506105019250038361022b565b565b610517919450959195600052602060002090565b946000935b82851061053557505050610501935001388080806104f1565b865485850152958601958895509381019361051c565b93505050506105019491925060ff19168252151560051b01388080806104f1565b634e487b7160e01b85526022600452602485fd5b93607f16936104c0565b90602061059b928181520190610184565b90565b346101ba5760203660031901126101ba576004356000548110156101ba576105ee61047991600080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563016104a2565b604051918291602083526020830190610184565b81601f820112156101ba57805161061881610263565b92610626604051948561022b565b818452602082840101116101ba5761059b9160208085019101610161565b81601f820112156101ba5780519160209161065e8461024c565b9361066c604051958661022b565b808552838086019160051b830101928084116101ba57848301915b8483106106975750505050505090565b82516001600160401b0381116101ba5786916106b884848094890101610602565b815201920191610687565b519081151582036101ba57565b9080601f830112156101ba578151916020916106eb8461024c565b936040926106fb8451968761022b565b818652848087019260051b820101938385116101ba57858201925b858410610727575050505050505090565b83516001600160401b03908181116101ba57840191601f19916080848903840181136101ba57855191610759836101d5565b8b8601518352868601518c840152606091828701518281116101ba578890880196878d0301126101ba5787519661078f886101f5565b8d8701518852888701519283116101ba578d976107b48d8a6107c296819b0101610644565b8882015289860152016106c3565b90820152815201930192610716565b916060838303126101ba578251926020810151926001600160401b03938481116101ba578201936060858303126101ba5760409485519061081182610210565b805161081c816101a9565b82526020810151602083015286810151908382116101ba570186818503126101ba5786519061084a826101f5565b80518481116101ba578561085f918301610602565b82526020810151908482116101ba5761087a91869101610644565b602082015286820152948301519081116101ba5761059b92016106d0565b908160209103126101ba575190565b6040513d6000823e3d90fd5b634e487b7160e01b600052601160045260246000fd5b919082039182116108d657565b6108b3565b156108e257565b60405162461bcd60e51b815260206004820152603560248201527f4c696e656153706172736550726f6f6656657269666965723a20626c6f636b206044820152741b9bdd081a5b881c985b99d9481858d8d95c1d1959605a1b6064820152608490fd5b1561094c57565b60405162461bcd60e51b815260206004820152602c60248201527f4c696e656153706172736550726f6f6656657269666965723a20696e76616c6960448201526b19081cdd185d19481c9bdbdd60a21b6064820152608490fd5b909293916109bf855195602080809883010191016107d1565b95919390946109e76109db6109db60015460018060a01b031690565b6001600160a01b031690565b60405163695378f560e01b815295908987600481845afa968715610aa957610a51978b94610a3192600092610acd575b50808211159182610ac2575b8215610aae575b50506108db565b6040518080988194638be745d160e01b8352600483019190602083019252565b03915afa938415610aa95761059b97600095610a7a575b5050610a75841515610945565b610c65565b610a9a929550803d10610aa2575b610a92818361022b565b810190610898565b923880610a68565b503d610a88565b6108a7565b610ab892506108c9565b8310153880610a2a565b808611159250610a23565b610ae5919250863d8811610aa257610a92818361022b565b9038610a17565b15610af357565b60405162461bcd60e51b815260206004820152603960248201527f4c696e656150726f6f6648656c7065723a20636f6d6d616e6473206e756d626560448201527f72203e2073746f726167652070726f6f6673206e756d626572000000000000006064820152608490fd5b51906001600160401b03821682036101ba57565b908160c09103126101ba576040519060c082018281106001600160401b038211176101f057610bda9160a091604052610baa81610b5e565b84526020810151602085015260408101516040850152606081015160608501526080810151608085015201610b5e565b60a082015290565b90610bec8261024c565b610bf9604051918261022b565b8281528092610c0a601f199161024c565b019060005b828110610c1b57505050565b806060602080938501015201610c0f565b805160291015610c3d576105400190565b61048c565b8051821015610c3d5760209160051b010190565b60001981146108d65760010190565b9284610c8492949796939597610c7f865186511015610aec565b611012565b5060408095015151908551906360f0f00f60e01b825260c08280610cad6004966004830161058a565b038173Bf8C454Af2f08fDD90bB7B029b0C2c07c2a7b4A35af4918215610aa957600092610e78575b50600094610ce38551610be2565b94865b8151881015610e6d57898486610d078a87610d018e89610c42565b516112ad565b9290610e4b57610d2d91506060610d2186610d2993610c42565b510151151590565b1590565b15610d7d57505160006020820152600191610d7491610d5981604081015b03601f19810183528261022b565b610d638b8b610c42565b52610d6e8a8a610c42565b50610c56565b975b0196610ce6565b610dbd90868460209c959c94610db28682610da68583610d9d828a610c42565b51015197610c42565b5101510151928b610c42565b51015151918a6115d3565b610d4b610dec8c610dd7610dd08d610c56565b9c89610c42565b510151518d5184810191825292839160200190565b610df6838a610c42565b52610e018289610c42565b50610e0c8289610c42565b515111610e1b57600190610d76565b85610e47610e2a8c938a610c42565b515192519283926354d0209160e01b845283019190602083019252565b0390fd5b9091610e5b9350936001946113dd565b9890610e67828a610c42565b52610d76565b505050505050925050565b610e9b91925060c03d60c011610ea2575b610e93818361022b565b810190610b72565b9038610cd5565b503d610e89565b908160809103126101ba57606060405191610ec3836101d5565b8051835260208101516020840152604081015160408401520151606082015290565b15610eec57565b60405162461bcd60e51b815260206004820152601e60248201527f4c696e656150726f6f6648656c7065723a2077726f6e672074617267657400006044820152606490fd5b908160209103126101ba5761059b906106c3565b909392919360608201606083528151809152608083019060808160051b850101926020809101926000905b838210610f8a575050505050906040919460208201520152565b90919293948380610fa7600193607f198b82030186528951610184565b97019201920190939291610f70565b15610fbd57565b60405162461bcd60e51b815260206004820152602760248201527f4c696e656150726f6f6648656c7065723a20696e76616c6964206163636f756e6044820152663a10383937b7b360c91b6064820152608490fd5b604080516001600160a01b039092166020808401919091529373Bf8C454Af2f08fDD90bB7B029b0C2c07c2a7b4A39261106d9290869061105481808501610d4b565b82518095819263b893e57960e01b83526004830161058a565b0381875af4928315610aa9576000936111f5575b506110b28186019560806110988989510151610c2c565b51845180948192635ea5a98f60e01b83526004830161058a565b0381895af4948515610aa95788926000966111c0575b506110d7908487015114610ee5565b865182015190820151835163662e10f560e11b815294859283926110ff929160048501610f45565b0381875af4938415610aa957869260009561118f575b5061113794955151915180809681946302318a3960e61b83526004830161058a565b03915af4918215610aa95761115d94600093611170575b505082611162575b5050610fb6565b600190565b606001511490503880611156565b611187929350803d10610aa257610a92818361022b565b90388061114e565b61113795506111b390843d86116111b9575b6111ab818361022b565b810190610f31565b94611115565b503d6111a1565b6110d79196506111e79060803d6080116111ee575b6111df818361022b565b810190610ea9565b95906110c8565b503d6111d5565b61120d919350863d8811610aa257610a92818361022b565b9138611081565b1561121b57565b60405162461bcd60e51b815260206004820152602360248201527f4669727374207061746820656c656d656e74206d75737420626520333220627960448201526274657360e81b6064820152608490fd5b602081519101519060208110611280575090565b6000199060200360031b1b1690565b60209291906112a5849282815194859201610161565b019081520190565b92906001908160018660001a1615159560f86112d087858460011a60f81b611788565b916112e96020936112e46020825114611214565b61126c565b976002965b6112fc575b50505050505050565b9091929394959784891080809161135e575b156113575715610c3d5761134b90610d4b611342611331858b888f1a8a1b611788565b926040519283918a8301958661128f565b51902098610c56565b959493929190846112ee565b50976112f3565b15610c3d576001600160f81b0319848b1a861b8116141561130e565b60405190602082018281106001600160401b038211176101f05760405260008252565b906113a782610263565b6113b4604051918261022b565b82815280926113c5601f1991610263565b0190602036910137565b90602082018092116108d657565b919093926113f3610d296060610d218886610c42565b61156257602092836114058785610c42565b5101519161143782604094878661141c8c8a610c42565b51015101518661142c8c8a610c42565b5101515191856115d3565b8261144b61144489610c56565b9886610c42565b5101515190600192600180841614600014611523579561148a899397865161147e81610d4b868201948560209181520190565b5190209760011c61139d565b966000855b6114a0575b50505050505050509190565b885181101561151e576114f26114f79286896114dd87826114d18f9c836114c88f8390610c42565b5101519d610c42565b5101510151928d610c42565b51015151906114eb83610c56565b98886115d3565b6113cf565b938561150c6115058c610c56565b9b89610c42565b5101515185890152939289938561148f565b611494565b50509250508161155461155e94611546607f945195869283019190602083019252565b03601f19810185528461022b565b60011c16906117f1565b9190565b50505061156e82610c56565b5061155e61137a565b1561157e57565b60405162461bcd60e51b815260206004820152602760248201527f4c696e656150726f6f6648656c7065723a20696e76616c69642073746f7261676044820152663290383937b7b360c91b6064820152608490fd5b939091929373Bf8C454Af2f08fDD90bB7B029b0C2c07c2a7b4A3906040809101519581519463662e10f560e11b8652858061161660209a8b948b60048501610f45565b0381865af4948515610aa95760009561175e575b50608061163b611655959697610c2c565b51835180968192635ea5a98f60e01b83526004830161058a565b0381865af4938415610aa95760009461173d575b5081516333bbbd4160e21b8082526004820196909652908782602481875af4938415610aa9576116b696899360009661171e575b5084518098819482938352600483019190602083019252565b03915af4938415610aa957610501966000956116ff575b5050846116f2575b5050826116e4575b5050611577565b6060015114905038806116dd565b82015114925038806116d5565b611716929550803d10610aa257610a92818361022b565b9238806116cd565b611736919650843d8611610aa257610a92818361022b565b943861169d565b61175791945060803d6080116111ee576111df818361022b565b9238611669565b61165594955061163b61177f6080928a3d8c116111b9576111ab818361022b565b9695505061162a565b9291909260f81c92601f60e0851694169184156000146117b257506117ae929350610c42565b5190565b9050602084036117c7576117ae929350610c42565b604051632cde2db560e21b815260048101859052602490fd5b908151811015610c3d570160200190565b9081518111611843576118038161139d565b9160009060005b838110611818575050505090565b6001906001600160f81b031961182e82856117e0565b5116841a61183c82886117e0565b530161180a565b60405162461bcd60e51b815260206004820152601860248201527f736c69636542797465733a206f7574206f662072616e676500000000000000006044820152606490fdfea26469706673582212209e0ca502d019bec52663b80cc9d732645bbbf57d7d1af74376c3351ffbd37f6f64736f6c63430008190033", - "deployedBytecode": "0x6080604052600436101561001257600080fd5b6000803560e01c908163a183bada1461013b578163b50f2fbc1461005557508063c51ca02a146100505763f36c452e1461004b57600080fd5b61059e565b6103a8565b3461013857806003193601126101385780546100708161024c565b9061007e604051928361022b565b80825282805260209283830191817f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563845b8383106101145750505050604051928484019085855251809152604084019460408260051b8601019392955b8287106100e85785850386f35b909192938280610104600193603f198a82030186528851610184565b96019201960195929190926100db565b6001888192610126859b9a989b6104a2565b815201920192019190969395966100af565b80fd5b346101385780600319360112610138576001546001600160a01b03166080908152602090f35b60005b8381106101745750506000910152565b8181015183820152602001610164565b9060209161019d81518092818552858086019101610161565b601f01601f1916010190565b6001600160a01b038116036101ba57565b600080fd5b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b038211176101f057604052565b6101bf565b604081019081106001600160401b038211176101f057604052565b606081019081106001600160401b038211176101f057604052565b90601f801991011681019081106001600160401b038211176101f057604052565b6001600160401b0381116101f05760051b60200190565b6001600160401b0381116101f057601f01601f191660200190565b81601f820112156101ba5780359061029582610263565b926102a3604051948561022b565b828452602083830101116101ba57816000926020809301838601378301015290565b81601f820112156101ba578035916020916102df8461024c565b936102ed604051958661022b565b808552838086019160051b830101928084116101ba57848301915b8483106103185750505050505090565b82356001600160401b0381116101ba5786916103398484809489010161027e565b815201920191610308565b6020808201906020835283518092526040830192602060408460051b8301019501936000915b84831061037a5750505050505090565b9091929394958480610398600193603f198682030187528a51610184565b980193019301919493929061036a565b346101ba5760a03660031901126101ba576004356103c5816101a9565b602435906001600160401b03908183116101ba57366023840112156101ba5782600401356103f28161024c565b93610400604051958661022b565b8185526020916024602087019160051b830101913683116101ba57602401905b82821061047d57505050506044358281116101ba576104439036906004016102c5565b926064359283116101ba576104799361046361046d94369060040161027e565b91608435936109a6565b60405191829182610344565b0390f35b81358152908301908301610420565b634e487b7160e01b600052603260045260246000fd5b906040519060009280549360018560011c9260018716918215610580575b60209160208610841461056c5787986104e0878a98999a60209181520190565b9490811561054b5750600114610503575b505050506105019250038361022b565b565b610517919450959195600052602060002090565b946000935b82851061053557505050610501935001388080806104f1565b865485850152958601958895509381019361051c565b93505050506105019491925060ff19168252151560051b01388080806104f1565b634e487b7160e01b85526022600452602485fd5b93607f16936104c0565b90602061059b928181520190610184565b90565b346101ba5760203660031901126101ba576004356000548110156101ba576105ee61047991600080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563016104a2565b604051918291602083526020830190610184565b81601f820112156101ba57805161061881610263565b92610626604051948561022b565b818452602082840101116101ba5761059b9160208085019101610161565b81601f820112156101ba5780519160209161065e8461024c565b9361066c604051958661022b565b808552838086019160051b830101928084116101ba57848301915b8483106106975750505050505090565b82516001600160401b0381116101ba5786916106b884848094890101610602565b815201920191610687565b519081151582036101ba57565b9080601f830112156101ba578151916020916106eb8461024c565b936040926106fb8451968761022b565b818652848087019260051b820101938385116101ba57858201925b858410610727575050505050505090565b83516001600160401b03908181116101ba57840191601f19916080848903840181136101ba57855191610759836101d5565b8b8601518352868601518c840152606091828701518281116101ba578890880196878d0301126101ba5787519661078f886101f5565b8d8701518852888701519283116101ba578d976107b48d8a6107c296819b0101610644565b8882015289860152016106c3565b90820152815201930192610716565b916060838303126101ba578251926020810151926001600160401b03938481116101ba578201936060858303126101ba5760409485519061081182610210565b805161081c816101a9565b82526020810151602083015286810151908382116101ba570186818503126101ba5786519061084a826101f5565b80518481116101ba578561085f918301610602565b82526020810151908482116101ba5761087a91869101610644565b602082015286820152948301519081116101ba5761059b92016106d0565b908160209103126101ba575190565b6040513d6000823e3d90fd5b634e487b7160e01b600052601160045260246000fd5b919082039182116108d657565b6108b3565b156108e257565b60405162461bcd60e51b815260206004820152603560248201527f4c696e656153706172736550726f6f6656657269666965723a20626c6f636b206044820152741b9bdd081a5b881c985b99d9481858d8d95c1d1959605a1b6064820152608490fd5b1561094c57565b60405162461bcd60e51b815260206004820152602c60248201527f4c696e656153706172736550726f6f6656657269666965723a20696e76616c6960448201526b19081cdd185d19481c9bdbdd60a21b6064820152608490fd5b909293916109bf855195602080809883010191016107d1565b95919390946109e76109db6109db60015460018060a01b031690565b6001600160a01b031690565b60405163695378f560e01b815295908987600481845afa968715610aa957610a51978b94610a3192600092610acd575b50808211159182610ac2575b8215610aae575b50506108db565b6040518080988194638be745d160e01b8352600483019190602083019252565b03915afa938415610aa95761059b97600095610a7a575b5050610a75841515610945565b610c65565b610a9a929550803d10610aa2575b610a92818361022b565b810190610898565b923880610a68565b503d610a88565b6108a7565b610ab892506108c9565b8310153880610a2a565b808611159250610a23565b610ae5919250863d8811610aa257610a92818361022b565b9038610a17565b15610af357565b60405162461bcd60e51b815260206004820152603960248201527f4c696e656150726f6f6648656c7065723a20636f6d6d616e6473206e756d626560448201527f72203e2073746f726167652070726f6f6673206e756d626572000000000000006064820152608490fd5b51906001600160401b03821682036101ba57565b908160c09103126101ba576040519060c082018281106001600160401b038211176101f057610bda9160a091604052610baa81610b5e565b84526020810151602085015260408101516040850152606081015160608501526080810151608085015201610b5e565b60a082015290565b90610bec8261024c565b610bf9604051918261022b565b8281528092610c0a601f199161024c565b019060005b828110610c1b57505050565b806060602080938501015201610c0f565b805160291015610c3d576105400190565b61048c565b8051821015610c3d5760209160051b010190565b60001981146108d65760010190565b9284610c8492949796939597610c7f865186511015610aec565b611012565b5060408095015151908551906360f0f00f60e01b825260c08280610cad6004966004830161058a565b038173__$ad35a2d5dfd3b3559b9c8d4d3b1202b26b$__5af4918215610aa957600092610e78575b50600094610ce38551610be2565b94865b8151881015610e6d57898486610d078a87610d018e89610c42565b516112ad565b9290610e4b57610d2d91506060610d2186610d2993610c42565b510151151590565b1590565b15610d7d57505160006020820152600191610d7491610d5981604081015b03601f19810183528261022b565b610d638b8b610c42565b52610d6e8a8a610c42565b50610c56565b975b0196610ce6565b610dbd90868460209c959c94610db28682610da68583610d9d828a610c42565b51015197610c42565b5101510151928b610c42565b51015151918a6115d3565b610d4b610dec8c610dd7610dd08d610c56565b9c89610c42565b510151518d5184810191825292839160200190565b610df6838a610c42565b52610e018289610c42565b50610e0c8289610c42565b515111610e1b57600190610d76565b85610e47610e2a8c938a610c42565b515192519283926354d0209160e01b845283019190602083019252565b0390fd5b9091610e5b9350936001946113dd565b9890610e67828a610c42565b52610d76565b505050505050925050565b610e9b91925060c03d60c011610ea2575b610e93818361022b565b810190610b72565b9038610cd5565b503d610e89565b908160809103126101ba57606060405191610ec3836101d5565b8051835260208101516020840152604081015160408401520151606082015290565b15610eec57565b60405162461bcd60e51b815260206004820152601e60248201527f4c696e656150726f6f6648656c7065723a2077726f6e672074617267657400006044820152606490fd5b908160209103126101ba5761059b906106c3565b909392919360608201606083528151809152608083019060808160051b850101926020809101926000905b838210610f8a575050505050906040919460208201520152565b90919293948380610fa7600193607f198b82030186528951610184565b97019201920190939291610f70565b15610fbd57565b60405162461bcd60e51b815260206004820152602760248201527f4c696e656150726f6f6648656c7065723a20696e76616c6964206163636f756e6044820152663a10383937b7b360c91b6064820152608490fd5b604080516001600160a01b039092166020808401919091529373__$ad35a2d5dfd3b3559b9c8d4d3b1202b26b$__9261106d9290869061105481808501610d4b565b82518095819263b893e57960e01b83526004830161058a565b0381875af4928315610aa9576000936111f5575b506110b28186019560806110988989510151610c2c565b51845180948192635ea5a98f60e01b83526004830161058a565b0381895af4948515610aa95788926000966111c0575b506110d7908487015114610ee5565b865182015190820151835163662e10f560e11b815294859283926110ff929160048501610f45565b0381875af4938415610aa957869260009561118f575b5061113794955151915180809681946302318a3960e61b83526004830161058a565b03915af4918215610aa95761115d94600093611170575b505082611162575b5050610fb6565b600190565b606001511490503880611156565b611187929350803d10610aa257610a92818361022b565b90388061114e565b61113795506111b390843d86116111b9575b6111ab818361022b565b810190610f31565b94611115565b503d6111a1565b6110d79196506111e79060803d6080116111ee575b6111df818361022b565b810190610ea9565b95906110c8565b503d6111d5565b61120d919350863d8811610aa257610a92818361022b565b9138611081565b1561121b57565b60405162461bcd60e51b815260206004820152602360248201527f4669727374207061746820656c656d656e74206d75737420626520333220627960448201526274657360e81b6064820152608490fd5b602081519101519060208110611280575090565b6000199060200360031b1b1690565b60209291906112a5849282815194859201610161565b019081520190565b92906001908160018660001a1615159560f86112d087858460011a60f81b611788565b916112e96020936112e46020825114611214565b61126c565b976002965b6112fc575b50505050505050565b9091929394959784891080809161135e575b156113575715610c3d5761134b90610d4b611342611331858b888f1a8a1b611788565b926040519283918a8301958661128f565b51902098610c56565b959493929190846112ee565b50976112f3565b15610c3d576001600160f81b0319848b1a861b8116141561130e565b60405190602082018281106001600160401b038211176101f05760405260008252565b906113a782610263565b6113b4604051918261022b565b82815280926113c5601f1991610263565b0190602036910137565b90602082018092116108d657565b919093926113f3610d296060610d218886610c42565b61156257602092836114058785610c42565b5101519161143782604094878661141c8c8a610c42565b51015101518661142c8c8a610c42565b5101515191856115d3565b8261144b61144489610c56565b9886610c42565b5101515190600192600180841614600014611523579561148a899397865161147e81610d4b868201948560209181520190565b5190209760011c61139d565b966000855b6114a0575b50505050505050509190565b885181101561151e576114f26114f79286896114dd87826114d18f9c836114c88f8390610c42565b5101519d610c42565b5101510151928d610c42565b51015151906114eb83610c56565b98886115d3565b6113cf565b938561150c6115058c610c56565b9b89610c42565b5101515185890152939289938561148f565b611494565b50509250508161155461155e94611546607f945195869283019190602083019252565b03601f19810185528461022b565b60011c16906117f1565b9190565b50505061156e82610c56565b5061155e61137a565b1561157e57565b60405162461bcd60e51b815260206004820152602760248201527f4c696e656150726f6f6648656c7065723a20696e76616c69642073746f7261676044820152663290383937b7b360c91b6064820152608490fd5b939091929373__$ad35a2d5dfd3b3559b9c8d4d3b1202b26b$__906040809101519581519463662e10f560e11b8652858061161660209a8b948b60048501610f45565b0381865af4948515610aa95760009561175e575b50608061163b611655959697610c2c565b51835180968192635ea5a98f60e01b83526004830161058a565b0381865af4938415610aa95760009461173d575b5081516333bbbd4160e21b8082526004820196909652908782602481875af4938415610aa9576116b696899360009661171e575b5084518098819482938352600483019190602083019252565b03915af4938415610aa957610501966000956116ff575b5050846116f2575b5050826116e4575b5050611577565b6060015114905038806116dd565b82015114925038806116d5565b611716929550803d10610aa257610a92818361022b565b9238806116cd565b611736919650843d8611610aa257610a92818361022b565b943861169d565b61175791945060803d6080116111ee576111df818361022b565b9238611669565b61165594955061163b61177f6080928a3d8c116111b9576111ab818361022b565b9695505061162a565b9291909260f81c92601f60e0851694169184156000146117b257506117ae929350610c42565b5190565b9050602084036117c7576117ae929350610c42565b604051632cde2db560e21b815260048101859052602490fd5b908151811015610c3d570160200190565b9081518111611843576118038161139d565b9160009060005b838110611818575050505090565b6001906001600160f81b031961182e82856117e0565b5116841a61183c82886117e0565b530161180a565b60405162461bcd60e51b815260206004820152601860248201527f736c69636542797465733a206f7574206f662072616e676500000000000000006044820152606490fdfea26469706673582212209e0ca502d019bec52663b80cc9d732645bbbf57d7d1af74376c3351ffbd37f6f64736f6c63430008190033", + "numDeployments": 3, + "solcInputHash": "97009251ed053ab9ef4f8e05bcccdb2b", + "metadata": "{\"compiler\":{\"version\":\"0.8.25+commit.b61c2a91\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"urls\",\"type\":\"string[]\"},{\"internalType\":\"address\",\"name\":\"rollup\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"}],\"name\":\"InvalidSlotSize\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"UnknownOpcode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_gatewayURLs\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_rollup\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gatewayURLs\",\"outputs\":[{\"internalType\":\"string[]\",\"name\":\"\",\"type\":\"string[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"commands\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes[]\",\"name\":\"constants\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"acceptedL2BlockRangeLength\",\"type\":\"uint256\"}],\"name\":\"getStorageValues\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"values\",\"type\":\"bytes[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"linea-state-verifier/contracts/LineaSparseProofVerifier.sol\":\"LineaSparseProofVerifier\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[],\"viaIR\":true},\"sources\":{\"linea-state-verifier/contracts/IEVMVerifier.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\ninterface IEVMVerifier {\\n function gatewayURLs() external view returns (string[] memory);\\n\\n function getStorageValues(\\n address target,\\n bytes32[] memory commands,\\n bytes[] memory constants,\\n bytes memory proof,\\n uint256 acceptedL2BlockRangeLength\\n ) external view returns (bytes[] memory values);\\n}\\n\",\"keccak256\":\"0x3e111236291da207c09145b288d0c98a20fb0845b5c5c4cadd4a465b269787cd\",\"license\":\"MIT\"},\"linea-state-verifier/contracts/LineaProofHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\nimport {SparseMerkleProof} from \\\"./lib/SparseMerkleProof.sol\\\";\\n\\nuint256 constant LAST_LEAF_INDEX = 41;\\n\\nstruct AccountProof {\\n bytes value;\\n bytes[] proofRelatedNodes;\\n}\\n\\nstruct StorageProof {\\n bytes32 value;\\n bytes[] proofRelatedNodes;\\n}\\n\\nstruct AccountProofStruct {\\n address key;\\n uint256 leafIndex;\\n AccountProof proof;\\n}\\n\\nstruct StorageProofStruct {\\n bytes32 key;\\n uint256 leafIndex;\\n StorageProof proof;\\n bool initialized;\\n}\\n\\nuint8 constant OP_CONSTANT = 0x00;\\nuint8 constant OP_BACKREF = 0x20;\\nuint8 constant FLAG_DYNAMIC = 0x01;\\n\\nlibrary LineaProofHelper {\\n error UnknownOpcode(uint8);\\n error InvalidSlotSize(uint256 size);\\n\\n function executeOperation(\\n bytes1 operation,\\n bytes[] memory constants,\\n bytes[] memory values\\n ) private pure returns (bytes memory) {\\n uint8 opcode = uint8(operation) & 0xe0;\\n uint8 operand = uint8(operation) & 0x1f;\\n\\n if (opcode == OP_CONSTANT) {\\n return constants[operand];\\n } else if (opcode == OP_BACKREF) {\\n return values[operand];\\n } else {\\n revert UnknownOpcode(opcode);\\n }\\n }\\n\\n function computeFirstSlot(\\n bytes32 command,\\n bytes[] memory constants,\\n bytes[] memory values\\n ) private pure returns (bool isDynamic, uint256 slot) {\\n uint8 flags = uint8(command[0]);\\n isDynamic = (flags & FLAG_DYNAMIC) != 0;\\n\\n bytes memory slotData = executeOperation(command[1], constants, values);\\n require(slotData.length == 32, \\\"First path element must be 32 bytes\\\");\\n slot = uint256(bytes32(slotData));\\n\\n for (uint256 j = 2; j < 32 && command[j] != 0xff; j++) {\\n bytes memory index = executeOperation(\\n command[j],\\n constants,\\n values\\n );\\n slot = uint256(keccak256(abi.encodePacked(index, slot)));\\n }\\n }\\n\\n function getDynamicValue(\\n uint256 slot,\\n uint256 proofIdx,\\n StorageProofStruct[] memory storageProofs,\\n SparseMerkleProof.Account memory account\\n ) private pure returns (bytes memory value, uint256 newProofIdx) {\\n if (!storageProofs[proofIdx].initialized) {\\n return (\\\"\\\", proofIdx++);\\n }\\n verifyStorageProof(\\n account,\\n storageProofs[proofIdx].leafIndex,\\n storageProofs[proofIdx].proof.proofRelatedNodes,\\n storageProofs[proofIdx].proof.value,\\n bytes32(slot)\\n );\\n uint256 firstValue = uint256(storageProofs[proofIdx++].proof.value);\\n if (firstValue & 0x01 == 0x01) {\\n // Long value: first slot is `length * 2 + 1`, following slots are data.\\n slot = uint256(keccak256(abi.encodePacked(slot)));\\n value = new bytes(firstValue >> 1);\\n uint256 off;\\n while (off < value.length) {\\n verifyStorageProof(\\n account,\\n storageProofs[proofIdx].leafIndex,\\n storageProofs[proofIdx].proof.proofRelatedNodes,\\n storageProofs[proofIdx].proof.value,\\n bytes32(slot++)\\n );\\n off += 32;\\n bytes32 temp = storageProofs[proofIdx++].proof.value;\\n assembly {\\n mstore(add(value, off), temp)\\n }\\n }\\n return (value, proofIdx);\\n } else {\\n uint256 length = (firstValue & 0xFF) >> 1;\\n return (sliceBytes(abi.encode(firstValue), 0, length), proofIdx);\\n }\\n }\\n\\n function sliceBytes(\\n bytes memory data,\\n uint256 start,\\n uint256 length\\n ) public pure returns (bytes memory) {\\n require(start + length <= data.length, \\\"sliceBytes: out of range\\\");\\n\\n bytes memory result = new bytes(length);\\n for (uint256 i = 0; i < length; i++) {\\n result[i] = data[i + start];\\n }\\n\\n return result;\\n }\\n\\n function verifyAccountProof(\\n address target,\\n AccountProofStruct memory accountProof,\\n bytes32 stateRoot\\n ) private pure returns (bool) {\\n // Verify the target contract first against the account proof's last leaf node's hkey\\n bytes32 targetHash = SparseMerkleProof.mimcHash(abi.encode(target));\\n SparseMerkleProof.Leaf memory accountLeaf = SparseMerkleProof.getLeaf(\\n accountProof.proof.proofRelatedNodes[LAST_LEAF_INDEX]\\n );\\n bytes32 hKey = accountLeaf.hKey;\\n\\n require(targetHash == hKey, \\\"LineaProofHelper: wrong target\\\");\\n\\n // Verify the account's proof itself\\n bool accountProofVerified = SparseMerkleProof.verifyProof(\\n accountProof.proof.proofRelatedNodes,\\n accountProof.leafIndex,\\n stateRoot\\n );\\n\\n bytes32 hAccountValue = SparseMerkleProof.hashAccountValue(\\n accountProof.proof.value\\n );\\n\\n require(\\n accountProofVerified && accountLeaf.hValue == hAccountValue,\\n \\\"LineaProofHelper: invalid account proof\\\"\\n );\\n\\n return true;\\n }\\n\\n function verifyStorageProof(\\n SparseMerkleProof.Account memory account,\\n uint256 leafIndex,\\n bytes[] memory proof,\\n bytes32 value,\\n bytes32 key\\n ) private pure {\\n bool storageProofVerified = SparseMerkleProof.verifyProof(\\n proof,\\n leafIndex,\\n account.storageRoot\\n );\\n\\n SparseMerkleProof.Leaf memory storageLeaf = SparseMerkleProof.getLeaf(\\n proof[LAST_LEAF_INDEX]\\n );\\n\\n // Verify the key\\n bytes32 hKey = SparseMerkleProof.hashStorageValue(key);\\n\\n // Verify the storage value\\n bytes32 hValue = SparseMerkleProof.hashStorageValue(value);\\n require(\\n storageProofVerified &&\\n storageLeaf.hKey == hKey &&\\n storageLeaf.hValue == hValue,\\n \\\"LineaProofHelper: invalid storage proof\\\"\\n );\\n }\\n\\n function getStorageValues(\\n address target,\\n bytes32[] memory commands,\\n bytes[] memory constants,\\n bytes32 stateRoot,\\n AccountProofStruct memory accountProof,\\n StorageProofStruct[] memory storageProofs\\n ) internal pure returns (bytes[] memory values) {\\n require(\\n commands.length <= storageProofs.length,\\n \\\"LineaProofHelper: commands number > storage proofs number\\\"\\n );\\n verifyAccountProof(target, accountProof, stateRoot);\\n SparseMerkleProof.Account memory account = SparseMerkleProof.getAccount(\\n accountProof.proof.value\\n );\\n uint256 proofIdx = 0;\\n values = new bytes[](commands.length);\\n for (uint256 i = 0; i < commands.length; i++) {\\n bytes32 command = commands[i];\\n (bool isDynamic, uint256 slot) = computeFirstSlot(\\n command,\\n constants,\\n values\\n );\\n if (!isDynamic) {\\n if (!storageProofs[proofIdx].initialized) {\\n values[i] = abi.encode(0);\\n proofIdx++;\\n } else {\\n verifyStorageProof(\\n account,\\n storageProofs[proofIdx].leafIndex,\\n storageProofs[proofIdx].proof.proofRelatedNodes,\\n storageProofs[proofIdx].proof.value,\\n bytes32(slot)\\n );\\n\\n values[i] = abi.encode(\\n storageProofs[proofIdx++].proof.value\\n );\\n\\n if (values[i].length > 32) {\\n revert InvalidSlotSize(values[i].length);\\n }\\n }\\n } else {\\n (values[i], proofIdx) = getDynamicValue(\\n slot,\\n proofIdx,\\n storageProofs,\\n account\\n );\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3ae8167e864cd8ae1e6804d3555c7df29142d1ae1347d1f74fe0c5dcd44368d5\",\"license\":\"MIT\"},\"linea-state-verifier/contracts/LineaSparseProofVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.25;\\n\\nimport {IEVMVerifier} from \\\"./IEVMVerifier.sol\\\";\\nimport {StorageProofStruct, AccountProofStruct, LineaProofHelper} from \\\"./LineaProofHelper.sol\\\";\\n\\ninterface IRollup {\\n function stateRootHashes(\\n uint256 l2blockNumber\\n ) external view returns (bytes32);\\n\\n function currentL2BlockNumber() external view returns (uint256);\\n}\\n\\ncontract LineaSparseProofVerifier is IEVMVerifier {\\n string[] public _gatewayURLs;\\n address public _rollup;\\n\\n constructor(string[] memory urls, address rollup) {\\n _gatewayURLs = urls;\\n _rollup = rollup;\\n }\\n\\n function getStorageValues(\\n address target,\\n bytes32[] memory commands,\\n bytes[] memory constants,\\n bytes memory proof,\\n uint256 acceptedL2BlockRangeLength\\n ) external view returns (bytes[] memory values) {\\n (\\n uint256 blockNo,\\n AccountProofStruct memory accountProof,\\n StorageProofStruct[] memory storageProofs\\n ) = abi.decode(\\n proof,\\n (uint256, AccountProofStruct, StorageProofStruct[])\\n );\\n\\n // Check that the L2 block number used is a recent one and is part of the range accepted\\n uint256 currentL2BlockNumber = IRollup(_rollup).currentL2BlockNumber();\\n require(\\n (currentL2BlockNumber <= acceptedL2BlockRangeLength &&\\n blockNo <= currentL2BlockNumber) ||\\n (blockNo >= currentL2BlockNumber - acceptedL2BlockRangeLength),\\n \\\"LineaSparseProofVerifier: block not in range accepted\\\"\\n );\\n\\n bytes32 stateRoot = IRollup(_rollup).stateRootHashes(blockNo);\\n require(\\n stateRoot != bytes32(0),\\n \\\"LineaSparseProofVerifier: invalid state root\\\"\\n );\\n\\n return\\n LineaProofHelper.getStorageValues(\\n target,\\n commands,\\n constants,\\n stateRoot,\\n accountProof,\\n storageProofs\\n );\\n }\\n\\n function gatewayURLs() external view override returns (string[] memory) {\\n return _gatewayURLs;\\n }\\n}\\n\",\"keccak256\":\"0xa689f18e9e208b2d8ecd1d9a9dcb42b1b4aafbf4740114cab9fdfb150994cb47\",\"license\":\"MIT\"},\"linea-state-verifier/contracts/lib/Mimc.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n\\n// Copyright 2023 Consensys Software Inc.\\n//\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n// you may not use this file except in compliance with the License.\\n// You may obtain a copy of the License at\\n//\\n// http://www.apache.org/licenses/LICENSE-2.0\\n//\\n// Unless required by applicable law or agreed to in writing, software\\n// distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n// See the License for the specific language governing permissions and\\n// limitations under the License.\\n\\n// Code generated by gnark DO NOT EDIT\\npragma solidity 0.8.25;\\n\\n/**\\n * @title Library to perform MiMC hashing\\n * @author ConsenSys Software Inc.\\n * @custom:security-contact security-report@linea.build\\n */\\nlibrary Mimc {\\n /**\\n * Thrown when the data is not provided\\n */\\n error DataMissing();\\n\\n /**\\n * Thrown when the data is not purely in 32 byte chunks\\n */\\n error DataIsNotMod32();\\n\\n uint256 constant FR_FIELD =\\n 8444461749428370424248824938781546531375899335154063827935233455917409239041;\\n /**\\n * @notice Performs a MiMC hash on the data provided\\n * @param _msg The data to be hashed\\n * @dev Only data that has length modulus 32 is hashed, reverts otherwise\\n * @return mimcHash The computed MiMC hash\\n */\\n function hash(\\n bytes calldata _msg\\n ) external pure returns (bytes32 mimcHash) {\\n if (_msg.length == 0) {\\n revert DataMissing();\\n }\\n\\n if (_msg.length % 0x20 != 0) {\\n revert DataIsNotMod32();\\n }\\n\\n assembly {\\n let chunks := div(add(_msg.length, 0x1f), 0x20)\\n\\n for {\\n let i := 0\\n } lt(i, chunks) {\\n i := add(i, 1)\\n } {\\n let offset := add(_msg.offset, mul(i, 0x20))\\n let chunk := calldataload(offset)\\n\\n let r := encrypt(mimcHash, chunk)\\n mimcHash := addmod(\\n addmod(mimcHash, r, FR_FIELD),\\n chunk,\\n FR_FIELD\\n )\\n }\\n\\n function encrypt(h, chunk) -> output {\\n let frField := FR_FIELD\\n let tmpSum := 0\\n\\n tmpSum := addmod(\\n addmod(chunk, h, frField),\\n 6780559962679281898511952483033644312910028090361101779689089025541625982996,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2327326745520207001136649348523057964841679868424949608370212081331899020358,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6201177823658417253260885485467023993767823924255470286063250782233002635405,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3401276671970505639801802718275229999176446092725813928949571059366811327963,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 796636033841689627732941016044857384234234277501564259311815186813195010627,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 159507412325830262114089631199386481336725966652415909300570415682233424809,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 1669348614406363339435491723584591316524711695667693315027811919444714635748,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2220664510675218580883672035712942523468288190837741520497926350441362544422,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 1294712289478715410717626660893541311126892630747701030449280341780183665665,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6758843230175145783288330173723849603007070607311612566540600202723911987180,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6271650829101108787041306415787253036818921034903891854433479166754956001513,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 8037654458661109859150348337922011363549131313762043865209663327750426111866,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2450972517788523786981910980516860147992539249204314270739451472218657823669,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2707650969937705465351357815756127556801434183777713569980595073268026256128,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 7874262417209200618473337039194351886630571503697269268624099887104149796259,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3089899920017810079637556867207463807565125948241456751227734590626249857937,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 8231877132811199596376758288825197494440517476607659739835166243301765860904,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 4889925300033981791993403687473437637164964770774352761851347729331041993593,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 506118690894045980182310960875885680782486421163823930266542078948815948062,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 4773308728424659273056201947330432214661646691949138677097247858746575076542,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6610301125072219342086627276930551094394509958433369744427479834611436778066,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 8062913614098409973923064402439991628739389434149534836396892159147794104642,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2576406140423312875091927795739341819101209176346955562285186911769083519728,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6247267546819369987508590432055536928557259658317014243676640822343115627202,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2354620213005699835215298236574714075068230025566107498090395819138978823906,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 1012123997779098542887516673253442986051441272786218052382513879552027657616,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 220252773286234814215172180118321537145064642853938490221604200051823270477,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2306037967476458159399202685728266972768173510335885477997450635969358782263,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 5906000615460106310157278190403974694555979202144571560620360962365001056276,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 8029952345415718287377564183334920026617762793749604843629313086537726648143,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6806091261750378774545720021859645013630360296898036304733359077422908323188,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3791365032107216523624488143755156784159183778414385385850652127088602339940,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 7713951866326004273632564650741019619975760271948208739458822610304231437565,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2159153222189174173490067225063044363535871059524538695070191871847470955412,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3459892854150586819083449948613048924207735017129514254460829121652786324530,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 8165919441562399076732808928206069494664474480220235797297111305840352207764,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 5067127638759272574597184239140007718698192996511162583428330546781376830321,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 7564926180046670501077982861476967417487855218354401587881011340975488196742,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 4793316512087044382791577380686883286681140325373390439122763061600650301139,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 12025027725022723723984202199185080936456585195449250668991990971241927925,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 5056480146405086811789505170440731715530475328844870175949109998024731067467,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3850822128034659558863504800917443538100103152464488164345952697508772708155,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 5490569542353168488797150359760203713598401616662275350850844170956899716180,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6809916892509991991280249336166027496157481609693382555884367500846199028644,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6102228360565846712478499570512196976845845959851353003471378423251561935785,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 7957411254301481793006532646538815862020547208300835763521138686017052464640,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 7577948604138385646013244290592520699579040577712519004775644201729392063846,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6025758357861563690691793181574484773095829890586160167641973490103511417496,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2004214547184552249779883547311284063339374005887218065319674453115808726850,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 1316449090346410801845183915381769525990226349513436734911941391785200212382,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 4556285572033080226119128815763547597118327635770271287655822355222839175285,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 2369904002063218534853867482545647755243877244064168179905450676831047307618,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 7451702566176584025980909730992154118931318734166468698682947787653334803016,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 1329300832483899103910420486510886619321904846687482243968569167489052205690,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3238521361072472828313630322811653086792441312858682853521070248794222258735,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3475214489590830586915334473771293324307275731565327099797069845161869229357,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 4274287601159036159363576568654710230919275259553081321690187920135177947814,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6938336600682072955973769075275160235517201022692151378695173193891386346405,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 3998198747256139339077883878547228988120873864712400941893285440315291004215,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6699213631756936754252081929574788294275116402464654263316543921533804167968,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6962236729635042756258761323749531146700535903704299930132981735734543600942,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n tmpSum := addmod(\\n addmod(output, h, frField),\\n 6961288456480688271133399693659146309378114560595485436408179085016705585674,\\n frField\\n )\\n output := mulmod(tmpSum, tmpSum, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(output, output, frField)\\n output := mulmod(\\n mulmod(output, output, frField),\\n tmpSum,\\n frField\\n )\\n\\n output := addmod(output, h, frField)\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7ce398ff779301fa880cfbe0c803f3955c1908cba02948b56e759173ecba0b52\",\"license\":\"Apache-2.0\"},\"linea-state-verifier/contracts/lib/SparseMerkleProof.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\npragma solidity 0.8.25;\\n\\nimport {Mimc} from \\\"./Mimc.sol\\\";\\n\\n/**\\n * @title Library to perform SparseMerkleProof actions using the MiMC hashing algorithm\\n * @author ConsenSys Software Inc.\\n * @custom:security-contact security-report@linea.build\\n */\\nlibrary SparseMerkleProof {\\n using Mimc for *;\\n\\n /**\\n * The Account struct represents the state of the account including the storage root, nonce, balance and codesize\\n * @dev This is mapped directly to the output of the storage proof\\n */\\n struct Account {\\n uint64 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 mimcCodeHash;\\n bytes32 keccakCodeHash;\\n uint64 codeSize;\\n }\\n\\n /**\\n * Represents the leaf structure in both account and storage tries\\n * @dev This is mapped directly to the output of the storage proof\\n */\\n struct Leaf {\\n uint256 prev;\\n uint256 next;\\n bytes32 hKey;\\n bytes32 hValue;\\n }\\n\\n /**\\n * Thrown when expected bytes length is incorrect\\n */\\n error WrongBytesLength(uint256 expectedLength, uint256 bytesLength);\\n\\n /**\\n * Thrown when the length of bytes is not in exactly 32 byte chunks\\n */\\n error LengthNotMod32();\\n\\n /**\\n * Thrown when the leaf index is higher than the tree depth\\n */\\n error MaxTreeLeafIndexExceed();\\n\\n /**\\n * Thrown when the length of the unformatted proof is not provided exactly as expected (UNFORMATTED_PROOF_LENGTH)\\n */\\n error WrongProofLength(uint256 expectedLength, uint256 actualLength);\\n\\n uint256 internal constant TREE_DEPTH = 40;\\n uint256 internal constant UNFORMATTED_PROOF_LENGTH = 42;\\n bytes32 internal constant ZERO_HASH = 0x0;\\n uint256 internal constant MAX_TREE_LEAF_INDEX = 2 ** TREE_DEPTH - 1;\\n\\n /**\\n * @notice Formats input, computes root and returns true if it matches the provided merkle root\\n * @param _rawProof Raw sparse merkle tree proof\\n * @param _leafIndex Index of the leaf\\n * @param _root Sparse merkle root\\n * @return If the computed merkle root matches the provided one\\n */\\n function verifyProof(\\n bytes[] calldata _rawProof,\\n uint256 _leafIndex,\\n bytes32 _root\\n ) external pure returns (bool) {\\n if (_rawProof.length != UNFORMATTED_PROOF_LENGTH) {\\n revert WrongProofLength(UNFORMATTED_PROOF_LENGTH, _rawProof.length);\\n }\\n\\n (\\n bytes32 nextFreeNode,\\n bytes32 leafHash,\\n bytes32[] memory proof\\n ) = _formatProof(_rawProof);\\n return _verify(proof, leafHash, _leafIndex, _root, nextFreeNode);\\n }\\n\\n /**\\n * @notice Hash a value using MIMC hash\\n * @param _input Value to hash\\n * @return {bytes32} Mimc hash\\n */\\n function mimcHash(bytes calldata _input) external pure returns (bytes32) {\\n return Mimc.hash(_input);\\n }\\n\\n /**\\n * @notice Get leaf\\n * @param _encodedLeaf Encoded leaf bytes (prev, next, hKey, hValue)\\n * @return Leaf Formatted leaf struct\\n */\\n function getLeaf(\\n bytes calldata _encodedLeaf\\n ) external pure returns (Leaf memory) {\\n return _parseLeaf(_encodedLeaf);\\n }\\n\\n /**\\n * @notice Get account\\n * @param _encodedAccountValue Encoded account value bytes (nonce, balance, storageRoot, mimcCodeHash, keccakCodeHash, codeSize)\\n * @return Account Formatted account struct\\n */\\n function getAccount(\\n bytes calldata _encodedAccountValue\\n ) external pure returns (Account memory) {\\n return _parseAccount(_encodedAccountValue);\\n }\\n\\n /**\\n * @notice Hash account value\\n * @param _value Encoded account value bytes (nonce, balance, storageRoot, mimcCodeHash, keccakCodeHash, codeSize)\\n * @return {bytes32} Account value hash\\n */\\n function hashAccountValue(\\n bytes calldata _value\\n ) external pure returns (bytes32) {\\n Account memory account = _parseAccount(_value);\\n (bytes32 msb, bytes32 lsb) = _splitBytes32(account.keccakCodeHash);\\n return\\n Mimc.hash(\\n abi.encode(\\n account.nonce,\\n account.balance,\\n account.storageRoot,\\n account.mimcCodeHash,\\n lsb,\\n msb,\\n account.codeSize\\n )\\n );\\n }\\n\\n /**\\n * @notice Hash storage value\\n * @param _value Encoded storage value bytes\\n * @return {bytes32} Storage value hash\\n */\\n function hashStorageValue(bytes32 _value) external pure returns (bytes32) {\\n (bytes32 msb, bytes32 lsb) = _splitBytes32(_value);\\n return Mimc.hash(abi.encodePacked(lsb, msb));\\n }\\n\\n /**\\n * @notice Parse leaf value\\n * @param _encodedLeaf Encoded leaf bytes (prev, next, hKey, hValue)\\n * @return {Leaf} Formatted leaf struct\\n */\\n function _parseLeaf(\\n bytes calldata _encodedLeaf\\n ) private pure returns (Leaf memory) {\\n if (_encodedLeaf.length != 128) {\\n revert WrongBytesLength(128, _encodedLeaf.length);\\n }\\n return abi.decode(_encodedLeaf, (Leaf));\\n }\\n\\n /**\\n * @notice Parse account value\\n * @param _value Encoded account value bytes (nonce, balance, storageRoot, mimcCodeHash, keccakCodeHash, codeSize)\\n * @return {Account} Formatted account struct\\n */\\n function _parseAccount(\\n bytes calldata _value\\n ) private pure returns (Account memory) {\\n if (_value.length != 192) {\\n revert WrongBytesLength(192, _value.length);\\n }\\n return abi.decode(_value, (Account));\\n }\\n\\n /**\\n * @notice Split bytes32 into two bytes32 taking most significant bits and least significant bits\\n * @param _b bytes to split\\n * @return msb Most significant bits\\n * @return lsb Least significant bits\\n */\\n function _splitBytes32(\\n bytes32 _b\\n ) private pure returns (bytes32 msb, bytes32 lsb) {\\n assembly {\\n msb := shr(128, _b)\\n lsb := and(_b, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\\n }\\n }\\n\\n /**\\n * @notice Format proof\\n * @param _rawProof Non formatted proof array\\n * @return (bytes32, bytes32, bytes32[]) NextFreeNode, leafHash and formatted proof array\\n */\\n function _formatProof(\\n bytes[] calldata _rawProof\\n ) private pure returns (bytes32, bytes32, bytes32[] memory) {\\n uint256 rawProofLength = _rawProof.length;\\n uint256 formattedProofLength = rawProofLength - 2;\\n\\n bytes32[] memory proof = new bytes32[](formattedProofLength);\\n\\n if (_rawProof[0].length != 0x40) {\\n revert WrongBytesLength(0x40, _rawProof[0].length);\\n }\\n\\n bytes32 nextFreeNode = bytes32(_rawProof[0][:32]);\\n bytes32 leafHash = Mimc.hash(_rawProof[rawProofLength - 1]);\\n\\n for (uint256 i = 1; i < formattedProofLength; ) {\\n proof[formattedProofLength - i] = Mimc.hash(_rawProof[i]);\\n unchecked {\\n ++i;\\n }\\n }\\n\\n // If the sibling leaf (_rawProof[formattedProofLength]) is equal to zero bytes we don't hash it\\n if (_isZeroBytes(_rawProof[formattedProofLength])) {\\n proof[0] = ZERO_HASH;\\n } else {\\n proof[0] = Mimc.hash(_rawProof[formattedProofLength]);\\n }\\n\\n return (nextFreeNode, leafHash, proof);\\n }\\n\\n /**\\n * @notice Check if bytes contain only zero byte elements\\n * @param _data Bytes to be checked\\n * @return isZeroBytes true if bytes contain only zero byte elements, false otherwise\\n */\\n function _isZeroBytes(\\n bytes calldata _data\\n ) private pure returns (bool isZeroBytes) {\\n if (_data.length % 0x20 != 0) {\\n revert LengthNotMod32();\\n }\\n\\n isZeroBytes = true;\\n assembly {\\n let dataStart := _data.offset\\n\\n for {\\n let currentPtr := dataStart\\n } lt(currentPtr, add(dataStart, _data.length)) {\\n currentPtr := add(currentPtr, 0x20)\\n } {\\n let dataWord := calldataload(currentPtr)\\n\\n if eq(iszero(dataWord), 0) {\\n isZeroBytes := 0\\n break\\n }\\n }\\n }\\n }\\n\\n /**\\n * @notice Computes merkle root from proof and compares it to the provided root\\n * @param _proof Sparse merkle tree proof\\n * @param _leafHash Leaf hash\\n * @param _leafIndex Index of the leaf\\n * @param _root Sparse merkle root\\n * @param _nextFreeNode Next free node\\n * @return If the computed merkle root matches the provided one\\n */\\n function _verify(\\n bytes32[] memory _proof,\\n bytes32 _leafHash,\\n uint256 _leafIndex,\\n bytes32 _root,\\n bytes32 _nextFreeNode\\n ) private pure returns (bool) {\\n bytes32 computedHash = _leafHash;\\n uint256 currentIndex = _leafIndex;\\n\\n if (_leafIndex > MAX_TREE_LEAF_INDEX) {\\n revert MaxTreeLeafIndexExceed();\\n }\\n\\n for (uint256 height; height < TREE_DEPTH; ++height) {\\n if ((currentIndex >> height) & 1 == 1)\\n computedHash = Mimc.hash(\\n abi.encodePacked(_proof[height], computedHash)\\n );\\n else\\n computedHash = Mimc.hash(\\n abi.encodePacked(computedHash, _proof[height])\\n );\\n }\\n\\n return\\n Mimc.hash(abi.encodePacked(_nextFreeNode, computedHash)) == _root;\\n }\\n}\\n\",\"keccak256\":\"0xd7738d73506bffcf02c5e4ce5761e3d429261e5c522c39cf43eb9b6c943154de\",\"license\":\"AGPL-3.0\"}},\"version\":1}", + "bytecode": "0x604060806040523461029f57611c7b908138038061001c81610346565b93843982019060408383031261029f5782516001600160401b03919082811161029f57840190601f9284848401121561029f57825195602093828811610289576005938860051b9786610070818b01610346565b809b8152019087829a8501019381851161029f5790818980979695949301925b8584106102a45750505050505001519560018060a01b03871680970361029f57519368010000000000000000851161028957600095865486885580871061021e575b50868052848720939087905b87891061010657600180546001600160a01b0319168b1790556040516118be90816103bd8239f35b805180519086821161020a5790889161011f895461036b565b8781116101d6575b50829087831160011461016f579180600195928695948892610164575b5050600019600383901b1c191690841b1789555b019601980197946100de565b015190503880610144565b8986528386209190601f198416875b8181106101be57509160019693918588979694106101a5575b505050831b83018955610158565b015160001960f88460031b161c19169055388080610197565b8284015185558d96600190950194938401930161017e565b6101fb908a8752848720898086018a1c820192878710610201575b01891c01906103a5565b38610127565b925081926101f1565b634e487b7160e01b84526041600452602484fd5b8780528686892091820191015b81811061023857506100d2565b80896102466001935461036b565b80610254575b50500161022b565b8681118414610268575081555b893861024c565b828252610280878b842092018a1c82018583016103a5565b81835555610261565b634e487b7160e01b600052604160045260246000fd5b600080fd5b9091928094959697505188811161029f57820183603f8201121561029f578a810151898111610331576102de818e01601f19168d01610346565b918183528588838301011161029f579290918c926000945b8186106103195750600090820184015281528b9897969582019493925001610090565b8086018a015183870186015293909401938d936102f6565b60246000634e487b7160e01b81526041600452fd5b6040519190601f01601f191682016001600160401b0381118382101761028957604052565b90600182811c9216801561039b575b602083101461038557565b634e487b7160e01b600052602260045260246000fd5b91607f169161037a565b8181106103b0575050565b600081556001016103a556fe6080604052600436101561001257600080fd5b6000803560e01c908163a183bada1461013b578163b50f2fbc1461005557508063c51ca02a146100505763f36c452e1461004b57600080fd5b61059e565b6103a8565b3461013857806003193601126101385780546100708161024c565b9061007e604051928361022b565b80825282805260209283830191817f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563845b8383106101145750505050604051928484019085855251809152604084019460408260051b8601019392955b8287106100e85785850386f35b909192938280610104600193603f198a82030186528851610184565b96019201960195929190926100db565b6001888192610126859b9a989b6104a2565b815201920192019190969395966100af565b80fd5b346101385780600319360112610138576001546001600160a01b03166080908152602090f35b60005b8381106101745750506000910152565b8181015183820152602001610164565b9060209161019d81518092818552858086019101610161565b601f01601f1916010190565b6001600160a01b038116036101ba57565b600080fd5b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b038211176101f057604052565b6101bf565b604081019081106001600160401b038211176101f057604052565b606081019081106001600160401b038211176101f057604052565b90601f801991011681019081106001600160401b038211176101f057604052565b6001600160401b0381116101f05760051b60200190565b6001600160401b0381116101f057601f01601f191660200190565b81601f820112156101ba5780359061029582610263565b926102a3604051948561022b565b828452602083830101116101ba57816000926020809301838601378301015290565b81601f820112156101ba578035916020916102df8461024c565b936102ed604051958661022b565b808552838086019160051b830101928084116101ba57848301915b8483106103185750505050505090565b82356001600160401b0381116101ba5786916103398484809489010161027e565b815201920191610308565b6020808201906020835283518092526040830192602060408460051b8301019501936000915b84831061037a5750505050505090565b9091929394958480610398600193603f198682030187528a51610184565b980193019301919493929061036a565b346101ba5760a03660031901126101ba576004356103c5816101a9565b602435906001600160401b03908183116101ba57366023840112156101ba5782600401356103f28161024c565b93610400604051958661022b565b8185526020916024602087019160051b830101913683116101ba57602401905b82821061047d57505050506044358281116101ba576104439036906004016102c5565b926064359283116101ba576104799361046361046d94369060040161027e565b91608435936109a6565b60405191829182610344565b0390f35b81358152908301908301610420565b634e487b7160e01b600052603260045260246000fd5b906040519060009280549360018560011c9260018716918215610580575b60209160208610841461056c5787986104e0878a98999a60209181520190565b9490811561054b5750600114610503575b505050506105019250038361022b565b565b610517919450959195600052602060002090565b946000935b82851061053557505050610501935001388080806104f1565b865485850152958601958895509381019361051c565b93505050506105019491925060ff19168252151560051b01388080806104f1565b634e487b7160e01b85526022600452602485fd5b93607f16936104c0565b90602061059b928181520190610184565b90565b346101ba5760203660031901126101ba576004356000548110156101ba576105ee61047991600080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563016104a2565b604051918291602083526020830190610184565b81601f820112156101ba57805161061881610263565b92610626604051948561022b565b818452602082840101116101ba5761059b9160208085019101610161565b81601f820112156101ba5780519160209161065e8461024c565b9361066c604051958661022b565b808552838086019160051b830101928084116101ba57848301915b8483106106975750505050505090565b82516001600160401b0381116101ba5786916106b884848094890101610602565b815201920191610687565b519081151582036101ba57565b9080601f830112156101ba578151916020916106eb8461024c565b936040926106fb8451968761022b565b818652848087019260051b820101938385116101ba57858201925b858410610727575050505050505090565b83516001600160401b03908181116101ba57840191601f19916080848903840181136101ba57855191610759836101d5565b8b8601518352868601518c840152606091828701518281116101ba578890880196878d0301126101ba5787519661078f886101f5565b8d8701518852888701519283116101ba578d976107b48d8a6107c296819b0101610644565b8882015289860152016106c3565b90820152815201930192610716565b916060838303126101ba578251926020810151926001600160401b03938481116101ba578201936060858303126101ba5760409485519061081182610210565b805161081c816101a9565b82526020810151602083015286810151908382116101ba570186818503126101ba5786519061084a826101f5565b80518481116101ba578561085f918301610602565b82526020810151908482116101ba5761087a91869101610644565b602082015286820152948301519081116101ba5761059b92016106d0565b908160209103126101ba575190565b6040513d6000823e3d90fd5b634e487b7160e01b600052601160045260246000fd5b919082039182116108d657565b6108b3565b156108e257565b60405162461bcd60e51b815260206004820152603560248201527f4c696e656153706172736550726f6f6656657269666965723a20626c6f636b206044820152741b9bdd081a5b881c985b99d9481858d8d95c1d1959605a1b6064820152608490fd5b1561094c57565b60405162461bcd60e51b815260206004820152602c60248201527f4c696e656153706172736550726f6f6656657269666965723a20696e76616c6960448201526b19081cdd185d19481c9bdbdd60a21b6064820152608490fd5b909293916109bf855195602080809883010191016107d1565b95919390946109e76109db6109db60015460018060a01b031690565b6001600160a01b031690565b60405163695378f560e01b815295908987600481845afa968715610aa957610a51978b94610a3192600092610acd575b50808211159182610ac2575b8215610aae575b50506108db565b6040518080988194638be745d160e01b8352600483019190602083019252565b03915afa938415610aa95761059b97600095610a7a575b5050610a75841515610945565b610c65565b610a9a929550803d10610aa2575b610a92818361022b565b810190610898565b923880610a68565b503d610a88565b6108a7565b610ab892506108c9565b8310153880610a2a565b808611159250610a23565b610ae5919250863d8811610aa257610a92818361022b565b9038610a17565b15610af357565b60405162461bcd60e51b815260206004820152603960248201527f4c696e656150726f6f6648656c7065723a20636f6d6d616e6473206e756d626560448201527f72203e2073746f726167652070726f6f6673206e756d626572000000000000006064820152608490fd5b51906001600160401b03821682036101ba57565b908160c09103126101ba576040519060c082018281106001600160401b038211176101f057610bda9160a091604052610baa81610b5e565b84526020810151602085015260408101516040850152606081015160608501526080810151608085015201610b5e565b60a082015290565b90610bec8261024c565b610bf9604051918261022b565b8281528092610c0a601f199161024c565b019060005b828110610c1b57505050565b806060602080938501015201610c0f565b805160291015610c3d576105400190565b61048c565b8051821015610c3d5760209160051b010190565b60001981146108d65760010190565b9284610c8492949796939597610c7f865186511015610aec565b611012565b5060408095015151908551906360f0f00f60e01b825260c08280610cad6004966004830161058a565b038173Bf8C454Af2f08fDD90bB7B029b0C2c07c2a7b4A35af4918215610aa957600092610e78575b50600094610ce38551610be2565b94865b8151881015610e6d57898486610d078a87610d018e89610c42565b516112ad565b9290610e4b57610d2d91506060610d2186610d2993610c42565b510151151590565b1590565b15610d7d57505160006020820152600191610d7491610d5981604081015b03601f19810183528261022b565b610d638b8b610c42565b52610d6e8a8a610c42565b50610c56565b975b0196610ce6565b610dbd90868460209c959c94610db28682610da68583610d9d828a610c42565b51015197610c42565b5101510151928b610c42565b51015151918a6115d3565b610d4b610dec8c610dd7610dd08d610c56565b9c89610c42565b510151518d5184810191825292839160200190565b610df6838a610c42565b52610e018289610c42565b50610e0c8289610c42565b515111610e1b57600190610d76565b85610e47610e2a8c938a610c42565b515192519283926354d0209160e01b845283019190602083019252565b0390fd5b9091610e5b9350936001946113dd565b9890610e67828a610c42565b52610d76565b505050505050925050565b610e9b91925060c03d60c011610ea2575b610e93818361022b565b810190610b72565b9038610cd5565b503d610e89565b908160809103126101ba57606060405191610ec3836101d5565b8051835260208101516020840152604081015160408401520151606082015290565b15610eec57565b60405162461bcd60e51b815260206004820152601e60248201527f4c696e656150726f6f6648656c7065723a2077726f6e672074617267657400006044820152606490fd5b908160209103126101ba5761059b906106c3565b909392919360608201606083528151809152608083019060808160051b850101926020809101926000905b838210610f8a575050505050906040919460208201520152565b90919293948380610fa7600193607f198b82030186528951610184565b97019201920190939291610f70565b15610fbd57565b60405162461bcd60e51b815260206004820152602760248201527f4c696e656150726f6f6648656c7065723a20696e76616c6964206163636f756e6044820152663a10383937b7b360c91b6064820152608490fd5b604080516001600160a01b039092166020808401919091529373Bf8C454Af2f08fDD90bB7B029b0C2c07c2a7b4A39261106d9290869061105481808501610d4b565b82518095819263b893e57960e01b83526004830161058a565b0381875af4928315610aa9576000936111f5575b506110b28186019560806110988989510151610c2c565b51845180948192635ea5a98f60e01b83526004830161058a565b0381895af4948515610aa95788926000966111c0575b506110d7908487015114610ee5565b865182015190820151835163662e10f560e11b815294859283926110ff929160048501610f45565b0381875af4938415610aa957869260009561118f575b5061113794955151915180809681946302318a3960e61b83526004830161058a565b03915af4918215610aa95761115d94600093611170575b505082611162575b5050610fb6565b600190565b606001511490503880611156565b611187929350803d10610aa257610a92818361022b565b90388061114e565b61113795506111b390843d86116111b9575b6111ab818361022b565b810190610f31565b94611115565b503d6111a1565b6110d79196506111e79060803d6080116111ee575b6111df818361022b565b810190610ea9565b95906110c8565b503d6111d5565b61120d919350863d8811610aa257610a92818361022b565b9138611081565b1561121b57565b60405162461bcd60e51b815260206004820152602360248201527f4669727374207061746820656c656d656e74206d75737420626520333220627960448201526274657360e81b6064820152608490fd5b602081519101519060208110611280575090565b6000199060200360031b1b1690565b60209291906112a5849282815194859201610161565b019081520190565b92906001908160018660001a1615159560f86112d087858460011a60f81b611788565b916112e96020936112e46020825114611214565b61126c565b976002965b6112fc575b50505050505050565b9091929394959784891080809161135e575b156113575715610c3d5761134b90610d4b611342611331858b888f1a8a1b611788565b926040519283918a8301958661128f565b51902098610c56565b959493929190846112ee565b50976112f3565b15610c3d576001600160f81b0319848b1a861b8116141561130e565b60405190602082018281106001600160401b038211176101f05760405260008252565b906113a782610263565b6113b4604051918261022b565b82815280926113c5601f1991610263565b0190602036910137565b90602082018092116108d657565b919093926113f3610d296060610d218886610c42565b61156257602092836114058785610c42565b5101519161143782604094878661141c8c8a610c42565b51015101518661142c8c8a610c42565b5101515191856115d3565b8261144b61144489610c56565b9886610c42565b5101515190600192600180841614600014611523579561148a899397865161147e81610d4b868201948560209181520190565b5190209760011c61139d565b966000855b6114a0575b50505050505050509190565b885181101561151e576114f26114f79286896114dd87826114d18f9c836114c88f8390610c42565b5101519d610c42565b5101510151928d610c42565b51015151906114eb83610c56565b98886115d3565b6113cf565b938561150c6115058c610c56565b9b89610c42565b5101515185890152939289938561148f565b611494565b50509250508161155461155e94611546607f945195869283019190602083019252565b03601f19810185528461022b565b60011c16906117f1565b9190565b50505061156e82610c56565b5061155e61137a565b1561157e57565b60405162461bcd60e51b815260206004820152602760248201527f4c696e656150726f6f6648656c7065723a20696e76616c69642073746f7261676044820152663290383937b7b360c91b6064820152608490fd5b939091929373Bf8C454Af2f08fDD90bB7B029b0C2c07c2a7b4A3906040809101519581519463662e10f560e11b8652858061161660209a8b948b60048501610f45565b0381865af4948515610aa95760009561175e575b50608061163b611655959697610c2c565b51835180968192635ea5a98f60e01b83526004830161058a565b0381865af4938415610aa95760009461173d575b5081516333bbbd4160e21b8082526004820196909652908782602481875af4938415610aa9576116b696899360009661171e575b5084518098819482938352600483019190602083019252565b03915af4938415610aa957610501966000956116ff575b5050846116f2575b5050826116e4575b5050611577565b6060015114905038806116dd565b82015114925038806116d5565b611716929550803d10610aa257610a92818361022b565b9238806116cd565b611736919650843d8611610aa257610a92818361022b565b943861169d565b61175791945060803d6080116111ee576111df818361022b565b9238611669565b61165594955061163b61177f6080928a3d8c116111b9576111ab818361022b565b9695505061162a565b9291909260f81c92601f60e0851694169184156000146117b257506117ae929350610c42565b5190565b9050602084036117c7576117ae929350610c42565b604051632cde2db560e21b815260048101859052602490fd5b908151811015610c3d570160200190565b9081518111611843576118038161139d565b9160009060005b838110611818575050505090565b6001906001600160f81b031961182e82856117e0565b5116841a61183c82886117e0565b530161180a565b60405162461bcd60e51b815260206004820152601860248201527f736c69636542797465733a206f7574206f662072616e676500000000000000006044820152606490fdfea2646970667358221220bf674c353b0518e8f9a049be3cb755f0a6ee3de40f95be991cae91cc79434b3964736f6c63430008190033", + "deployedBytecode": "0x6080604052600436101561001257600080fd5b6000803560e01c908163a183bada1461013b578163b50f2fbc1461005557508063c51ca02a146100505763f36c452e1461004b57600080fd5b61059e565b6103a8565b3461013857806003193601126101385780546100708161024c565b9061007e604051928361022b565b80825282805260209283830191817f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563845b8383106101145750505050604051928484019085855251809152604084019460408260051b8601019392955b8287106100e85785850386f35b909192938280610104600193603f198a82030186528851610184565b96019201960195929190926100db565b6001888192610126859b9a989b6104a2565b815201920192019190969395966100af565b80fd5b346101385780600319360112610138576001546001600160a01b03166080908152602090f35b60005b8381106101745750506000910152565b8181015183820152602001610164565b9060209161019d81518092818552858086019101610161565b601f01601f1916010190565b6001600160a01b038116036101ba57565b600080fd5b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b038211176101f057604052565b6101bf565b604081019081106001600160401b038211176101f057604052565b606081019081106001600160401b038211176101f057604052565b90601f801991011681019081106001600160401b038211176101f057604052565b6001600160401b0381116101f05760051b60200190565b6001600160401b0381116101f057601f01601f191660200190565b81601f820112156101ba5780359061029582610263565b926102a3604051948561022b565b828452602083830101116101ba57816000926020809301838601378301015290565b81601f820112156101ba578035916020916102df8461024c565b936102ed604051958661022b565b808552838086019160051b830101928084116101ba57848301915b8483106103185750505050505090565b82356001600160401b0381116101ba5786916103398484809489010161027e565b815201920191610308565b6020808201906020835283518092526040830192602060408460051b8301019501936000915b84831061037a5750505050505090565b9091929394958480610398600193603f198682030187528a51610184565b980193019301919493929061036a565b346101ba5760a03660031901126101ba576004356103c5816101a9565b602435906001600160401b03908183116101ba57366023840112156101ba5782600401356103f28161024c565b93610400604051958661022b565b8185526020916024602087019160051b830101913683116101ba57602401905b82821061047d57505050506044358281116101ba576104439036906004016102c5565b926064359283116101ba576104799361046361046d94369060040161027e565b91608435936109a6565b60405191829182610344565b0390f35b81358152908301908301610420565b634e487b7160e01b600052603260045260246000fd5b906040519060009280549360018560011c9260018716918215610580575b60209160208610841461056c5787986104e0878a98999a60209181520190565b9490811561054b5750600114610503575b505050506105019250038361022b565b565b610517919450959195600052602060002090565b946000935b82851061053557505050610501935001388080806104f1565b865485850152958601958895509381019361051c565b93505050506105019491925060ff19168252151560051b01388080806104f1565b634e487b7160e01b85526022600452602485fd5b93607f16936104c0565b90602061059b928181520190610184565b90565b346101ba5760203660031901126101ba576004356000548110156101ba576105ee61047991600080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563016104a2565b604051918291602083526020830190610184565b81601f820112156101ba57805161061881610263565b92610626604051948561022b565b818452602082840101116101ba5761059b9160208085019101610161565b81601f820112156101ba5780519160209161065e8461024c565b9361066c604051958661022b565b808552838086019160051b830101928084116101ba57848301915b8483106106975750505050505090565b82516001600160401b0381116101ba5786916106b884848094890101610602565b815201920191610687565b519081151582036101ba57565b9080601f830112156101ba578151916020916106eb8461024c565b936040926106fb8451968761022b565b818652848087019260051b820101938385116101ba57858201925b858410610727575050505050505090565b83516001600160401b03908181116101ba57840191601f19916080848903840181136101ba57855191610759836101d5565b8b8601518352868601518c840152606091828701518281116101ba578890880196878d0301126101ba5787519661078f886101f5565b8d8701518852888701519283116101ba578d976107b48d8a6107c296819b0101610644565b8882015289860152016106c3565b90820152815201930192610716565b916060838303126101ba578251926020810151926001600160401b03938481116101ba578201936060858303126101ba5760409485519061081182610210565b805161081c816101a9565b82526020810151602083015286810151908382116101ba570186818503126101ba5786519061084a826101f5565b80518481116101ba578561085f918301610602565b82526020810151908482116101ba5761087a91869101610644565b602082015286820152948301519081116101ba5761059b92016106d0565b908160209103126101ba575190565b6040513d6000823e3d90fd5b634e487b7160e01b600052601160045260246000fd5b919082039182116108d657565b6108b3565b156108e257565b60405162461bcd60e51b815260206004820152603560248201527f4c696e656153706172736550726f6f6656657269666965723a20626c6f636b206044820152741b9bdd081a5b881c985b99d9481858d8d95c1d1959605a1b6064820152608490fd5b1561094c57565b60405162461bcd60e51b815260206004820152602c60248201527f4c696e656153706172736550726f6f6656657269666965723a20696e76616c6960448201526b19081cdd185d19481c9bdbdd60a21b6064820152608490fd5b909293916109bf855195602080809883010191016107d1565b95919390946109e76109db6109db60015460018060a01b031690565b6001600160a01b031690565b60405163695378f560e01b815295908987600481845afa968715610aa957610a51978b94610a3192600092610acd575b50808211159182610ac2575b8215610aae575b50506108db565b6040518080988194638be745d160e01b8352600483019190602083019252565b03915afa938415610aa95761059b97600095610a7a575b5050610a75841515610945565b610c65565b610a9a929550803d10610aa2575b610a92818361022b565b810190610898565b923880610a68565b503d610a88565b6108a7565b610ab892506108c9565b8310153880610a2a565b808611159250610a23565b610ae5919250863d8811610aa257610a92818361022b565b9038610a17565b15610af357565b60405162461bcd60e51b815260206004820152603960248201527f4c696e656150726f6f6648656c7065723a20636f6d6d616e6473206e756d626560448201527f72203e2073746f726167652070726f6f6673206e756d626572000000000000006064820152608490fd5b51906001600160401b03821682036101ba57565b908160c09103126101ba576040519060c082018281106001600160401b038211176101f057610bda9160a091604052610baa81610b5e565b84526020810151602085015260408101516040850152606081015160608501526080810151608085015201610b5e565b60a082015290565b90610bec8261024c565b610bf9604051918261022b565b8281528092610c0a601f199161024c565b019060005b828110610c1b57505050565b806060602080938501015201610c0f565b805160291015610c3d576105400190565b61048c565b8051821015610c3d5760209160051b010190565b60001981146108d65760010190565b9284610c8492949796939597610c7f865186511015610aec565b611012565b5060408095015151908551906360f0f00f60e01b825260c08280610cad6004966004830161058a565b038173__$ad35a2d5dfd3b3559b9c8d4d3b1202b26b$__5af4918215610aa957600092610e78575b50600094610ce38551610be2565b94865b8151881015610e6d57898486610d078a87610d018e89610c42565b516112ad565b9290610e4b57610d2d91506060610d2186610d2993610c42565b510151151590565b1590565b15610d7d57505160006020820152600191610d7491610d5981604081015b03601f19810183528261022b565b610d638b8b610c42565b52610d6e8a8a610c42565b50610c56565b975b0196610ce6565b610dbd90868460209c959c94610db28682610da68583610d9d828a610c42565b51015197610c42565b5101510151928b610c42565b51015151918a6115d3565b610d4b610dec8c610dd7610dd08d610c56565b9c89610c42565b510151518d5184810191825292839160200190565b610df6838a610c42565b52610e018289610c42565b50610e0c8289610c42565b515111610e1b57600190610d76565b85610e47610e2a8c938a610c42565b515192519283926354d0209160e01b845283019190602083019252565b0390fd5b9091610e5b9350936001946113dd565b9890610e67828a610c42565b52610d76565b505050505050925050565b610e9b91925060c03d60c011610ea2575b610e93818361022b565b810190610b72565b9038610cd5565b503d610e89565b908160809103126101ba57606060405191610ec3836101d5565b8051835260208101516020840152604081015160408401520151606082015290565b15610eec57565b60405162461bcd60e51b815260206004820152601e60248201527f4c696e656150726f6f6648656c7065723a2077726f6e672074617267657400006044820152606490fd5b908160209103126101ba5761059b906106c3565b909392919360608201606083528151809152608083019060808160051b850101926020809101926000905b838210610f8a575050505050906040919460208201520152565b90919293948380610fa7600193607f198b82030186528951610184565b97019201920190939291610f70565b15610fbd57565b60405162461bcd60e51b815260206004820152602760248201527f4c696e656150726f6f6648656c7065723a20696e76616c6964206163636f756e6044820152663a10383937b7b360c91b6064820152608490fd5b604080516001600160a01b039092166020808401919091529373__$ad35a2d5dfd3b3559b9c8d4d3b1202b26b$__9261106d9290869061105481808501610d4b565b82518095819263b893e57960e01b83526004830161058a565b0381875af4928315610aa9576000936111f5575b506110b28186019560806110988989510151610c2c565b51845180948192635ea5a98f60e01b83526004830161058a565b0381895af4948515610aa95788926000966111c0575b506110d7908487015114610ee5565b865182015190820151835163662e10f560e11b815294859283926110ff929160048501610f45565b0381875af4938415610aa957869260009561118f575b5061113794955151915180809681946302318a3960e61b83526004830161058a565b03915af4918215610aa95761115d94600093611170575b505082611162575b5050610fb6565b600190565b606001511490503880611156565b611187929350803d10610aa257610a92818361022b565b90388061114e565b61113795506111b390843d86116111b9575b6111ab818361022b565b810190610f31565b94611115565b503d6111a1565b6110d79196506111e79060803d6080116111ee575b6111df818361022b565b810190610ea9565b95906110c8565b503d6111d5565b61120d919350863d8811610aa257610a92818361022b565b9138611081565b1561121b57565b60405162461bcd60e51b815260206004820152602360248201527f4669727374207061746820656c656d656e74206d75737420626520333220627960448201526274657360e81b6064820152608490fd5b602081519101519060208110611280575090565b6000199060200360031b1b1690565b60209291906112a5849282815194859201610161565b019081520190565b92906001908160018660001a1615159560f86112d087858460011a60f81b611788565b916112e96020936112e46020825114611214565b61126c565b976002965b6112fc575b50505050505050565b9091929394959784891080809161135e575b156113575715610c3d5761134b90610d4b611342611331858b888f1a8a1b611788565b926040519283918a8301958661128f565b51902098610c56565b959493929190846112ee565b50976112f3565b15610c3d576001600160f81b0319848b1a861b8116141561130e565b60405190602082018281106001600160401b038211176101f05760405260008252565b906113a782610263565b6113b4604051918261022b565b82815280926113c5601f1991610263565b0190602036910137565b90602082018092116108d657565b919093926113f3610d296060610d218886610c42565b61156257602092836114058785610c42565b5101519161143782604094878661141c8c8a610c42565b51015101518661142c8c8a610c42565b5101515191856115d3565b8261144b61144489610c56565b9886610c42565b5101515190600192600180841614600014611523579561148a899397865161147e81610d4b868201948560209181520190565b5190209760011c61139d565b966000855b6114a0575b50505050505050509190565b885181101561151e576114f26114f79286896114dd87826114d18f9c836114c88f8390610c42565b5101519d610c42565b5101510151928d610c42565b51015151906114eb83610c56565b98886115d3565b6113cf565b938561150c6115058c610c56565b9b89610c42565b5101515185890152939289938561148f565b611494565b50509250508161155461155e94611546607f945195869283019190602083019252565b03601f19810185528461022b565b60011c16906117f1565b9190565b50505061156e82610c56565b5061155e61137a565b1561157e57565b60405162461bcd60e51b815260206004820152602760248201527f4c696e656150726f6f6648656c7065723a20696e76616c69642073746f7261676044820152663290383937b7b360c91b6064820152608490fd5b939091929373__$ad35a2d5dfd3b3559b9c8d4d3b1202b26b$__906040809101519581519463662e10f560e11b8652858061161660209a8b948b60048501610f45565b0381865af4948515610aa95760009561175e575b50608061163b611655959697610c2c565b51835180968192635ea5a98f60e01b83526004830161058a565b0381865af4938415610aa95760009461173d575b5081516333bbbd4160e21b8082526004820196909652908782602481875af4938415610aa9576116b696899360009661171e575b5084518098819482938352600483019190602083019252565b03915af4938415610aa957610501966000956116ff575b5050846116f2575b5050826116e4575b5050611577565b6060015114905038806116dd565b82015114925038806116d5565b611716929550803d10610aa257610a92818361022b565b9238806116cd565b611736919650843d8611610aa257610a92818361022b565b943861169d565b61175791945060803d6080116111ee576111df818361022b565b9238611669565b61165594955061163b61177f6080928a3d8c116111b9576111ab818361022b565b9695505061162a565b9291909260f81c92601f60e0851694169184156000146117b257506117ae929350610c42565b5190565b9050602084036117c7576117ae929350610c42565b604051632cde2db560e21b815260048101859052602490fd5b908151811015610c3d570160200190565b9081518111611843576118038161139d565b9160009060005b838110611818575050505090565b6001906001600160f81b031961182e82856117e0565b5116841a61183c82886117e0565b530161180a565b60405162461bcd60e51b815260206004820152601860248201527f736c69636542797465733a206f7574206f662072616e676500000000000000006044820152606490fdfea2646970667358221220bf674c353b0518e8f9a049be3cb755f0a6ee3de40f95be991cae91cc79434b3964736f6c63430008190033", "libraries": { "SparseMerkleProof": "0xBf8C454Af2f08fDD90bB7B029b0C2c07c2a7b4A3" }, @@ -167,7 +167,7 @@ "storageLayout": { "storage": [ { - "astId": 16320, + "astId": 19363, "contract": "linea-state-verifier/contracts/LineaSparseProofVerifier.sol:LineaSparseProofVerifier", "label": "_gatewayURLs", "offset": 0, @@ -175,7 +175,7 @@ "type": "t_array(t_string_storage)dyn_storage" }, { - "astId": 16322, + "astId": 19365, "contract": "linea-state-verifier/contracts/LineaSparseProofVerifier.sol:LineaSparseProofVerifier", "label": "_rollup", "offset": 0, diff --git a/packages/linea-ens-resolver/deployments/mainnet/solcInputs/97009251ed053ab9ef4f8e05bcccdb2b.json b/packages/linea-ens-resolver/deployments/mainnet/solcInputs/97009251ed053ab9ef4f8e05bcccdb2b.json new file mode 100644 index 000000000..5f1935318 --- /dev/null +++ b/packages/linea-ens-resolver/deployments/mainnet/solcInputs/97009251ed053ab9ef4f8e05bcccdb2b.json @@ -0,0 +1,301 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "@ensdomains/ens-contracts/contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/reverseRegistrar/IL2ReverseResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IL2ReverseResolver {\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n string memory name\n ) external returns (bytes32);\n\n function setNameForAddrWithSignatureAndOwnable(\n address contractAddr,\n address owner,\n string memory name,\n uint256 inceptionDate,\n bytes memory signature\n ) external returns (bytes32);\n\n function setText(\n string calldata key,\n string calldata value\n ) external returns (bytes32);\n\n function setTextForAddr(\n address addr,\n string calldata key,\n string calldata value\n ) external returns (bytes32);\n\n function setTextForAddrWithSignatureAndOwnable(\n address contractAddr,\n address owner,\n string calldata key,\n string calldata value,\n uint256 inceptionDate,\n bytes memory signature\n ) external returns (bytes32);\n\n function clearRecords(address addr) external;\n}\n" + }, + "@ensdomains/ens-contracts/contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimForAddrWithSignature(\n address addr,\n address owner,\n address resolver,\n address relayer,\n uint256 signatureExpiry,\n bytes calldata signature\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function setNameForAddrWithSignature(\n address addr,\n address owner,\n address resolver,\n address relayer,\n uint256 signatureExpiry,\n bytes calldata signature,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/reverseRegistrar/ISignatureReverseResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ISignatureReverseResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event NameChanged(bytes32 indexed node, string name);\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n function setNameForAddrWithSignature(\n address addr,\n string memory name,\n uint256 inceptionDate,\n bytes memory signature\n ) external returns (bytes32);\n\n function setTextForAddrWithSignature(\n address addr,\n string calldata key,\n string calldata value,\n uint256 inceptionDate,\n bytes memory signature\n ) external returns (bytes32);\n\n function clearRecordsWithSignature(\n address addr,\n uint256 inceptionDate,\n bytes memory signature\n ) external;\n\n function name(bytes32 node) external view returns (string memory);\n\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/reverseRegistrar/L2ReverseResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IL2ReverseResolver.sol\";\nimport \"./SignatureReverseResolver.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"../resolvers/profiles/ITextResolver.sol\";\nimport \"../resolvers/profiles/INameResolver.sol\";\nimport \"../root/Controllable.sol\";\nimport \"../resolvers/Multicallable.sol\";\nimport \"../utils/LowLevelCallUtils.sol\";\n\nerror NotOwnerOfContract();\n\n/**\n * A L2 reverser registrar. Deployed to each L2 chain.\n */\ncontract L2ReverseResolver is\n Multicallable,\n IL2ReverseResolver,\n SignatureReverseResolver\n{\n using ECDSA for bytes32;\n\n bytes32 public immutable L2ReverseNode;\n\n /*\n * @dev Constructor\n * @param _L2ReverseNode The namespace to set. The converntion is '${coinType}.reverse'\n * @param _coinType The cointype converted from the chainId of the chain this contract is deployed to.\n */\n constructor(\n bytes32 _L2ReverseNode,\n uint256 _coinType\n ) SignatureReverseResolver(_L2ReverseNode, _coinType) {\n L2ReverseNode = _L2ReverseNode;\n }\n\n modifier ownerAndAuthorisedWithSignature(\n bytes32 hash,\n address addr,\n address owner,\n uint256 inceptionDate,\n bytes memory signature\n ) {\n isOwnerAndAuthorisedWithSignature(\n hash,\n addr,\n owner,\n inceptionDate,\n signature\n );\n _;\n }\n\n function isAuthorised(address addr) internal view override returns (bool) {\n if (addr != msg.sender && !ownsContract(addr, msg.sender)) {\n revert Unauthorised();\n }\n }\n\n function computeOwnerMessage(\n bytes32 hash,\n address addr,\n address owner,\n uint256 inceptionDate\n ) public view returns (bytes32) {\n // Follow ERC191 version 0 https://eips.ethereum.org/EIPS/eip-191\n return\n keccak256(\n abi.encodePacked(\n address(this),\n hash,\n addr,\n owner,\n inceptionDate,\n coinType\n )\n ).toEthSignedMessageHash();\n }\n\n function isOwnerAndAuthorisedWithSignature(\n bytes32 hash,\n address addr,\n address owner,\n uint256 inceptionDate,\n bytes memory signature\n ) internal view returns (bool) {\n bytes32 message = computeOwnerMessage(hash, addr, owner, inceptionDate);\n bytes32 node = _getNamehash(addr);\n\n if (!ownsContract(addr, owner)) {\n revert NotOwnerOfContract();\n }\n\n if (\n !SignatureChecker.isValidERC1271SignatureNow(\n owner,\n message,\n signature\n )\n ) {\n revert InvalidSignature();\n }\n\n if (\n inceptionDate <= lastUpdated[node] || // must be newer than current record\n inceptionDate / 1000 >= block.timestamp // must be in the past\n ) {\n revert InvalidSignatureDate();\n }\n }\n\n /**\n * @dev Sets the name for a contract that is owned by a SCW using a signature\n * @param contractAddr The reverse node to set\n * @param owner The owner of the contract (via Ownable)\n * @param name The name of the reverse record\n * @param inceptionDate Date from when this signature is valid from\n * @param signature The signature of an address that will return true on isValidSignature for the owner\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddrWithSignatureAndOwnable(\n address contractAddr,\n address owner,\n string memory name,\n uint256 inceptionDate,\n bytes memory signature\n )\n public\n ownerAndAuthorisedWithSignature(\n keccak256(\n abi.encodePacked(\n IL2ReverseResolver\n .setNameForAddrWithSignatureAndOwnable\n .selector,\n name\n )\n ),\n contractAddr,\n owner,\n inceptionDate,\n signature\n )\n returns (bytes32)\n {\n bytes32 node = _getNamehash(contractAddr);\n _setName(node, name, inceptionDate);\n emit ReverseClaimed(contractAddr, node);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return setNameForAddr(msg.sender, name);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the addr provided account.\n * Can be used if the addr is a contract that is owned by a SCW.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n\n function setNameForAddr(\n address addr,\n string memory name\n ) public authorised(addr) returns (bytes32) {\n bytes32 node = _getNamehash(addr);\n _setName(node, name, block.timestamp);\n emit ReverseClaimed(addr, node);\n return node;\n }\n\n /**\n * @dev Sets the name for a contract that is owned by a SCW using a signature\n * @param contractAddr The reverse node to set\n * @param owner The owner of the contract (via Ownable)\n * @param key The name of the reverse record\n * @param value The name of the reverse record\n * @param inceptionDate Date from when this signature is valid from\n * @param signature The signature of an address that will return true on isValidSignature for the owner\n * @return The ENS node hash of the reverse record.\n */\n function setTextForAddrWithSignatureAndOwnable(\n address contractAddr,\n address owner,\n string calldata key,\n string calldata value,\n uint256 inceptionDate,\n bytes memory signature\n )\n public\n ownerAndAuthorisedWithSignature(\n keccak256(\n abi.encodePacked(\n IL2ReverseResolver\n .setTextForAddrWithSignatureAndOwnable\n .selector,\n key,\n value\n )\n ),\n contractAddr,\n owner,\n inceptionDate,\n signature\n )\n returns (bytes32)\n {\n bytes32 node = _getNamehash(contractAddr);\n _setText(node, key, value, inceptionDate);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account.\n * @param key The key for this text record.\n * @param value The value to set for this text record.\n * @return The ENS node hash of the reverse record.\n */\n function setText(\n string calldata key,\n string calldata value\n ) public override returns (bytes32) {\n return setTextForAddr(msg.sender, key, value);\n }\n\n /**\n * @dev Sets the `text(key)` record for the reverse ENS record associated with\n * the addr provided account.\n * @param key The key for this text record.\n * @param value The value to set for this text record.\n * @return The ENS node hash of the reverse record.\n */\n\n function setTextForAddr(\n address addr,\n string calldata key,\n string calldata value\n ) public override authorised(addr) returns (bytes32) {\n bytes32 node = _getNamehash(addr);\n _setText(node, key, value, block.timestamp);\n return node;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param addr The node to update.\n */\n function clearRecords(address addr) public virtual authorised(addr) {\n _clearRecords(addr);\n }\n\n function ownsContract(\n address contractAddr,\n address addr\n ) internal view returns (bool) {\n try Ownable(contractAddr).owner() returns (address owner) {\n return owner == addr;\n } catch {\n return false;\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(Multicallable, SignatureReverseResolver)\n returns (bool)\n {\n return\n interfaceID == type(IL2ReverseResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"../root/Controllable.sol\";\nimport \"../utils/LowLevelCallUtils.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\nerror InvalidSignature();\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n using ECDSA for bytes32;\n using LowLevelCallUtils for address;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = addr.sha3HexAddress();\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddrWithSignature(\n address addr,\n address owner,\n address resolver,\n address relayer,\n uint256 signatureExpiry,\n bytes memory signature\n ) public override returns (bytes32) {\n bytes32 labelHash = addr.sha3HexAddress();\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n\n bytes32 hash = keccak256(\n abi.encodePacked(\n IReverseRegistrar.claimForAddrWithSignature.selector,\n addr,\n owner,\n resolver,\n relayer,\n signatureExpiry\n )\n );\n\n bytes32 message = hash.toEthSignedMessageHash();\n\n if (\n !SignatureChecker.isValidSignatureNow(addr, message, signature) ||\n relayer != msg.sender ||\n signatureExpiry < block.timestamp ||\n signatureExpiry > block.timestamp + 1 days\n ) {\n revert InvalidSignature();\n }\n\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddrWithSignature(\n address addr,\n address owner,\n address resolver,\n address relayer,\n uint256 signatureExpiry,\n bytes memory signature,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddrWithSignature(\n addr,\n owner,\n resolver,\n relayer,\n signatureExpiry,\n signature\n );\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, addr.sha3HexAddress())\n );\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/reverseRegistrar/SignatureReverseResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./ISignatureReverseResolver.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"../root/Controllable.sol\";\nimport \"../utils/LowLevelCallUtils.sol\";\n\nerror InvalidSignature();\nerror InvalidSignatureDate();\nerror Unauthorised();\n\ncontract SignatureReverseResolver is ISignatureReverseResolver {\n using ECDSA for bytes32;\n using LowLevelCallUtils for address;\n mapping(bytes32 => uint256) public lastUpdated;\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n mapping(bytes32 => uint64) internal recordVersions;\n\n bytes32 public immutable parentNode;\n uint256 public immutable coinType;\n\n /*\n * @dev Constructor\n * @param parentNode The namespace to set.\n * @param _coinType The coinType converted from the chainId of the chain this contract is deployed to.\n */\n constructor(bytes32 _parentNode, uint256 _coinType) {\n parentNode = _parentNode;\n coinType = _coinType;\n }\n\n modifier authorised(address addr) {\n isAuthorised(addr);\n _;\n }\n\n modifier authorisedSignature(\n bytes32 hash,\n address addr,\n uint256 inceptionDate,\n bytes memory signature\n ) {\n isAuthorisedWithSignature(hash, addr, inceptionDate, signature);\n _;\n }\n\n function isAuthorised(address addr) internal view virtual returns (bool) {}\n\n function getSignedMessageHash(\n bytes32 hash,\n address addr,\n uint256 inceptionDate\n ) public view returns (bytes32) {\n // Follow ERC191 version 0 https://eips.ethereum.org/EIPS/eip-191\n return\n keccak256(\n abi.encodePacked(\n address(this),\n hash,\n addr,\n inceptionDate,\n coinType\n )\n ).toEthSignedMessageHash();\n }\n\n function isAuthorisedWithSignature(\n bytes32 hash,\n address addr,\n uint256 inceptionDate,\n bytes memory signature\n ) internal view returns (bool) {\n bytes32 message = getSignedMessageHash(hash, addr, inceptionDate);\n bytes32 node = _getNamehash(addr);\n\n if (!SignatureChecker.isValidSignatureNow(addr, message, signature)) {\n revert InvalidSignature();\n }\n\n if (\n inceptionDate <= lastUpdated[node] || // must be newer than current record\n inceptionDate / 1000 >= block.timestamp // must be in the past\n ) {\n revert InvalidSignatureDate();\n }\n }\n\n /**\n * @dev Sets the name for an addr using a signature that can be verified with ERC1271.\n * @param addr The reverse record to set\n * @param name The name of the reverse record\n * @param inceptionDate Date from when this signature is valid from\n * @param signature The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddrWithSignature(\n address addr,\n string memory name,\n uint256 inceptionDate,\n bytes memory signature\n )\n public\n authorisedSignature(\n keccak256(\n abi.encodePacked(\n ISignatureReverseResolver\n .setNameForAddrWithSignature\n .selector,\n name\n )\n ),\n addr,\n inceptionDate,\n signature\n )\n returns (bytes32)\n {\n bytes32 node = _getNamehash(addr);\n _setName(node, name, inceptionDate);\n emit ReverseClaimed(addr, node);\n return node;\n }\n\n /**\n * @dev Sets the name for an addr using a signature that can be verified with ERC1271.\n * @param addr The reverse record to set\n * @param key The key of the text record\n * @param value The value of the text record\n * @param inceptionDate Date from when this signature is valid from\n * @param signature The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function setTextForAddrWithSignature(\n address addr,\n string calldata key,\n string calldata value,\n uint256 inceptionDate,\n bytes memory signature\n )\n public\n authorisedSignature(\n keccak256(\n abi.encodePacked(\n ISignatureReverseResolver\n .setTextForAddrWithSignature\n .selector,\n key,\n value\n )\n ),\n addr,\n inceptionDate,\n signature\n )\n returns (bytes32)\n {\n bytes32 node = _getNamehash(addr);\n _setText(node, key, value, inceptionDate);\n return node;\n }\n\n function _setText(\n bytes32 node,\n string calldata key,\n string calldata value,\n uint256 inceptionDate\n ) internal {\n versionable_texts[recordVersions[node]][node][key] = value;\n _setLastUpdated(node, inceptionDate);\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) public view returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function _setName(\n bytes32 node,\n string memory newName,\n uint256 inceptionDate\n ) internal virtual {\n versionable_names[recordVersions[node]][node] = newName;\n _setLastUpdated(node, inceptionDate);\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) public view returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param addr The node to update.\n */\n function _clearRecords(address addr) internal {\n bytes32 labelHash = addr.sha3HexAddress();\n bytes32 reverseNode = keccak256(\n abi.encodePacked(parentNode, labelHash)\n );\n recordVersions[reverseNode]++;\n emit VersionChanged(reverseNode, recordVersions[reverseNode]);\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param addr The node to update.\n * @param signature A signature proving ownership of the node.\n */\n function clearRecordsWithSignature(\n address addr,\n uint256 inceptionDate,\n bytes memory signature\n )\n public\n authorisedSignature(\n keccak256(\n abi.encodePacked(\n ISignatureReverseResolver.clearRecordsWithSignature.selector\n )\n ),\n addr,\n inceptionDate,\n signature\n )\n {\n _clearRecords(addr);\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public view returns (bytes32) {\n return keccak256(abi.encodePacked(parentNode, addr.sha3HexAddress()));\n }\n\n function _getNamehash(address addr) internal view returns (bytes32) {\n bytes32 labelHash = addr.sha3HexAddress();\n return keccak256(abi.encodePacked(parentNode, labelHash));\n }\n\n function _setLastUpdated(bytes32 node, uint256 inceptionDate) internal {\n lastUpdated[node] = inceptionDate;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return interfaceID == type(ISignatureReverseResolver).interfaceId;\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n // This is the hex encoding of the string 'abcdefghijklmnopqrstuvwxyz'\n // It is used as a constant to lookup the characters of the hex address\n bytes32 constant lookup =\n 0x3031323334353637383961626364656600000000000000000000000000000000;\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) internal pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "@ensdomains/ens-contracts/contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "@ensdomains/ens-contracts/contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "@ensdomains/ens-contracts/contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1271.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\n * Argent and Gnosis Safe.\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n /**\n * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\n * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\n *\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\n */\n function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n return\n (error == ECDSA.RecoverError.NoError && recovered == signer) ||\n isValidERC1271SignatureNow(signer, hash, signature);\n }\n\n /**\n * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated\n * against the signer smart contract using ERC1271.\n *\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\n */\n function isValidERC1271SignatureNow(\n address signer,\n bytes32 hash,\n bytes memory signature\n ) internal view returns (bool) {\n (bool success, bytes memory result) = signer.staticcall(\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n );\n return (success &&\n result.length >= 32 &&\n abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/clones-with-immutable-args/Clone.sol": { + "content": "// SPDX-License-Identifier: BSD\npragma solidity ^0.8.4;\n\n/// @title Clone\n/// @author zefram.eth\n/// @notice Provides helper functions for reading immutable args from calldata\ncontract Clone {\n /// @notice Reads an immutable arg with type address\n /// @param argOffset The offset of the arg in the packed data\n /// @return arg The arg value\n function _getArgAddress(\n uint256 argOffset\n ) internal pure returns (address arg) {\n uint256 offset = _getImmutableArgsOffset();\n // solhint-disable-next-line no-inline-assembly\n assembly {\n arg := shr(0x60, calldataload(add(offset, argOffset)))\n }\n }\n\n /// @notice Reads an immutable arg with type uint256\n /// @param argOffset The offset of the arg in the packed data\n /// @return arg The arg value\n function _getArgUint256(\n uint256 argOffset\n ) internal pure returns (uint256 arg) {\n uint256 offset = _getImmutableArgsOffset();\n // solhint-disable-next-line no-inline-assembly\n assembly {\n arg := calldataload(add(offset, argOffset))\n }\n }\n\n /// @notice Reads a uint256 array stored in the immutable args.\n /// @param argOffset The offset of the arg in the packed data\n /// @param arrLen Number of elements in the array\n /// @return arr The array\n function _getArgUint256Array(\n uint256 argOffset,\n uint64 arrLen\n ) internal pure returns (uint256[] memory arr) {\n uint256 offset = _getImmutableArgsOffset();\n uint256 el;\n arr = new uint256[](arrLen);\n for (uint64 i = 0; i < arrLen; i++) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n el := calldataload(add(add(offset, argOffset), mul(i, 32)))\n }\n arr[i] = el;\n }\n return arr;\n }\n\n /// @notice Reads an immutable arg with type uint64\n /// @param argOffset The offset of the arg in the packed data\n /// @return arg The arg value\n function _getArgUint64(\n uint256 argOffset\n ) internal pure returns (uint64 arg) {\n uint256 offset = _getImmutableArgsOffset();\n // solhint-disable-next-line no-inline-assembly\n assembly {\n arg := shr(0xc0, calldataload(add(offset, argOffset)))\n }\n }\n\n /// @notice Reads an immutable arg with type uint8\n /// @param argOffset The offset of the arg in the packed data\n /// @return arg The arg value\n function _getArgUint8(uint256 argOffset) internal pure returns (uint8 arg) {\n uint256 offset = _getImmutableArgsOffset();\n // solhint-disable-next-line no-inline-assembly\n assembly {\n arg := shr(0xf8, calldataload(add(offset, argOffset)))\n }\n }\n\n /// @return offset The offset of the packed immutable args in calldata\n function _getImmutableArgsOffset() internal pure returns (uint256 offset) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n offset := sub(\n calldatasize(),\n add(shr(240, calldataload(sub(calldatasize(), 2))), 2)\n )\n }\n }\n}\n" + }, + "contracts/clones-with-immutable-args/ClonesWithImmutableArgs.sol": { + "content": "// SPDX-License-Identifier: BSD\n\npragma solidity ^0.8.4;\n\n/// @title ClonesWithImmutableArgs\n/// @author wighawag, zefram.eth, nick.eth\n/// @notice Enables creating clone contracts with immutable args\nlibrary ClonesWithImmutableArgs {\n /// @dev The CREATE3 proxy bytecode.\n uint256 private constant _CREATE3_PROXY_BYTECODE =\n 0x67363d3d37363d34f03d5260086018f3;\n\n /// @dev Hash of the `_CREATE3_PROXY_BYTECODE`.\n /// Equivalent to `keccak256(abi.encodePacked(hex\"67363d3d37363d34f03d5260086018f3\"))`.\n bytes32 private constant _CREATE3_PROXY_BYTECODE_HASH =\n 0x21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f;\n\n error CreateFail();\n error InitializeFail();\n\n enum CloneType {\n CREATE,\n CREATE2,\n PREDICT_CREATE2\n }\n\n /// @notice Creates a clone proxy of the implementation contract, with immutable args\n /// @dev data cannot exceed 65535 bytes, since 2 bytes are used to store the data length\n /// @param implementation The implementation contract to clone\n /// @param data Encoded immutable args\n /// @return instance The address of the created clone\n function clone(\n address implementation,\n bytes memory data\n ) internal returns (address payable instance) {\n return clone(implementation, data, 0);\n }\n\n /// @notice Creates a clone proxy of the implementation contract, with immutable args\n /// @dev data cannot exceed 65535 bytes, since 2 bytes are used to store the data length\n /// @param implementation The implementation contract to clone\n /// @param data Encoded immutable args\n /// @param value The amount of wei to transfer to the created clone\n /// @return instance The address of the created clone\n function clone(\n address implementation,\n bytes memory data,\n uint256 value\n ) internal returns (address payable instance) {\n bytes memory creationcode = getCreationBytecode(implementation, data);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n instance := create(\n value,\n add(creationcode, 0x20),\n mload(creationcode)\n )\n }\n if (instance == address(0)) {\n revert CreateFail();\n }\n }\n\n /// @notice Creates a clone proxy of the implementation contract, with immutable args,\n /// using CREATE2\n /// @dev data cannot exceed 65535 bytes, since 2 bytes are used to store the data length\n /// @param implementation The implementation contract to clone\n /// @param data Encoded immutable args\n /// @return instance The address of the created clone\n function clone2(\n address implementation,\n bytes memory data\n ) internal returns (address payable instance) {\n return clone2(implementation, data, 0);\n }\n\n /// @notice Creates a clone proxy of the implementation contract, with immutable args,\n /// using CREATE2\n /// @dev data cannot exceed 65535 bytes, since 2 bytes are used to store the data length\n /// @param implementation The implementation contract to clone\n /// @param data Encoded immutable args\n /// @param value The amount of wei to transfer to the created clone\n /// @return instance The address of the created clone\n function clone2(\n address implementation,\n bytes memory data,\n uint256 value\n ) internal returns (address payable instance) {\n bytes memory creationcode = getCreationBytecode(implementation, data);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n instance := create2(\n value,\n add(creationcode, 0x20),\n mload(creationcode),\n 0\n )\n }\n if (instance == address(0)) {\n revert CreateFail();\n }\n }\n\n /// @notice Computes the address of a clone created using CREATE2\n /// @dev data cannot exceed 65535 bytes, since 2 bytes are used to store the data length\n /// @param implementation The implementation contract to clone\n /// @param data Encoded immutable args\n /// @return instance The address of the clone\n function addressOfClone2(\n address implementation,\n bytes memory data\n ) internal view returns (address payable instance) {\n bytes memory creationcode = getCreationBytecode(implementation, data);\n bytes32 bytecodeHash = keccak256(creationcode);\n instance = payable(\n address(\n uint160(\n uint256(\n keccak256(\n abi.encodePacked(\n bytes1(0xff),\n address(this),\n bytes32(0),\n bytecodeHash\n )\n )\n )\n )\n )\n );\n }\n\n /// @notice Computes bytecode for a clone\n /// @dev data cannot exceed 65535 bytes, since 2 bytes are used to store the data length\n /// @param implementation The implementation contract to clone\n /// @param data Encoded immutable args\n /// @return ret Creation bytecode for the clone contract\n function getCreationBytecode(\n address implementation,\n bytes memory data\n ) internal pure returns (bytes memory ret) {\n // unrealistic for memory ptr or data length to exceed 256 bits\n unchecked {\n uint256 extraLength = data.length + 2; // +2 bytes for telling how much data there is appended to the call\n uint256 creationSize = 0x41 + extraLength;\n uint256 runSize = creationSize - 10;\n uint256 dataPtr;\n uint256 ptr;\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n ret := mload(0x40)\n mstore(ret, creationSize)\n mstore(0x40, add(ret, creationSize))\n ptr := add(ret, 0x20)\n\n // -------------------------------------------------------------------------------------------------------------\n // CREATION (10 bytes)\n // -------------------------------------------------------------------------------------------------------------\n\n // 61 runtime | PUSH2 runtime (r) | r | –\n mstore(\n ptr,\n 0x6100000000000000000000000000000000000000000000000000000000000000\n )\n mstore(add(ptr, 0x01), shl(240, runSize)) // size of the contract running bytecode (16 bits)\n\n // creation size = 0a\n // 3d | RETURNDATASIZE | 0 r | –\n // 81 | DUP2 | r 0 r | –\n // 60 creation | PUSH1 creation (c) | c r 0 r | –\n // 3d | RETURNDATASIZE | 0 c r 0 r | –\n // 39 | CODECOPY | 0 r | [0-runSize): runtime code\n // f3 | RETURN | | [0-runSize): runtime code\n\n // -------------------------------------------------------------------------------------------------------------\n // RUNTIME (55 bytes + extraLength)\n // -------------------------------------------------------------------------------------------------------------\n\n // 3d | RETURNDATASIZE | 0 | –\n // 3d | RETURNDATASIZE | 0 0 | –\n // 3d | RETURNDATASIZE | 0 0 0 | –\n // 3d | RETURNDATASIZE | 0 0 0 0 | –\n // 36 | CALLDATASIZE | cds 0 0 0 0 | –\n // 3d | RETURNDATASIZE | 0 cds 0 0 0 0 | –\n // 3d | RETURNDATASIZE | 0 0 cds 0 0 0 0 | –\n // 37 | CALLDATACOPY | 0 0 0 0 | [0, cds) = calldata\n // 61 | PUSH2 extra | extra 0 0 0 0 | [0, cds) = calldata\n mstore(\n add(ptr, 0x03),\n 0x3d81600a3d39f33d3d3d3d363d3d376100000000000000000000000000000000\n )\n mstore(add(ptr, 0x13), shl(240, extraLength))\n\n // 60 0x37 | PUSH1 0x37 | 0x37 extra 0 0 0 0 | [0, cds) = calldata // 0x37 (55) is runtime size - data\n // 36 | CALLDATASIZE | cds 0x37 extra 0 0 0 0 | [0, cds) = calldata\n // 39 | CODECOPY | 0 0 0 0 | [0, cds) = calldata, [cds, cds+extra) = extraData\n // 36 | CALLDATASIZE | cds 0 0 0 0 | [0, cds) = calldata, [cds, cds+extra) = extraData\n // 61 extra | PUSH2 extra | extra cds 0 0 0 0 | [0, cds) = calldata, [cds, cds+extra) = extraData\n mstore(\n add(ptr, 0x15),\n 0x6037363936610000000000000000000000000000000000000000000000000000\n )\n mstore(add(ptr, 0x1b), shl(240, extraLength))\n\n // 01 | ADD | cds+extra 0 0 0 0 | [0, cds) = calldata, [cds, cds+extra) = extraData\n // 3d | RETURNDATASIZE | 0 cds+extra 0 0 0 0 | [0, cds) = calldata, [cds, cds+extra) = extraData\n // 73 addr | PUSH20 0x123… | addr 0 cds+extra 0 0 0 0 | [0, cds) = calldata, [cds, cds+extra) = extraData\n mstore(\n add(ptr, 0x1d),\n 0x013d730000000000000000000000000000000000000000000000000000000000\n )\n mstore(add(ptr, 0x20), shl(0x60, implementation))\n\n // 5a | GAS | gas addr 0 cds+extra 0 0 0 0 | [0, cds) = calldata, [cds, cds+extra) = extraData\n // f4 | DELEGATECALL | success 0 0 | [0, cds) = calldata, [cds, cds+extra) = extraData\n // 3d | RETURNDATASIZE | rds success 0 0 | [0, cds) = calldata, [cds, cds+extra) = extraData\n // 3d | RETURNDATASIZE | rds rds success 0 0 | [0, cds) = calldata, [cds, cds+extra) = extraData\n // 93 | SWAP4 | 0 rds success 0 rds | [0, cds) = calldata, [cds, cds+extra) = extraData\n // 80 | DUP1 | 0 0 rds success 0 rds | [0, cds) = calldata, [cds, cds+extra) = extraData\n // 3e | RETURNDATACOPY | success 0 rds | [0, rds) = return data (there might be some irrelevant leftovers in memory [rds, cds+0x37) when rds < cds+0x37)\n // 60 0x35 | PUSH1 0x35 | 0x35 sucess 0 rds | [0, rds) = return data\n // 57 | JUMPI | 0 rds | [0, rds) = return data\n // fd | REVERT | – | [0, rds) = return data\n // 5b | JUMPDEST | 0 rds | [0, rds) = return data\n // f3 | RETURN | – | [0, rds) = return data\n mstore(\n add(ptr, 0x34),\n 0x5af43d3d93803e603557fd5bf300000000000000000000000000000000000000\n )\n }\n\n // -------------------------------------------------------------------------------------------------------------\n // APPENDED DATA (Accessible from extcodecopy)\n // (but also send as appended data to the delegatecall)\n // -------------------------------------------------------------------------------------------------------------\n\n extraLength -= 2;\n uint256 counter = extraLength;\n uint256 copyPtr = ptr + 0x41;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n dataPtr := add(data, 32)\n }\n for (; counter >= 32; counter -= 32) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n mstore(copyPtr, mload(dataPtr))\n }\n\n copyPtr += 32;\n dataPtr += 32;\n }\n uint256 mask = ~(256 ** (32 - counter) - 1);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n mstore(copyPtr, and(mload(dataPtr), mask))\n }\n copyPtr += counter;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n mstore(copyPtr, shl(240, extraLength))\n }\n }\n }\n\n /// @notice Creates a clone proxy of the implementation contract, with immutable args. Uses CREATE3\n /// to implement deterministic deployment.\n /// @dev data cannot exceed 65535 bytes, since 2 bytes are used to store the data length\n /// @param implementation The implementation contract to clone\n /// @param data Encoded immutable args\n /// @param salt The salt used by the CREATE3 deployment\n /// @return deployed The address of the created clone\n function clone3(\n address implementation,\n bytes memory data,\n bytes32 salt\n ) internal returns (address deployed) {\n return clone3(implementation, data, salt, 0);\n }\n\n /// @notice Creates a clone proxy of the implementation contract, with immutable args. Uses CREATE3\n /// to implement deterministic deployment.\n /// @dev data cannot exceed 65535 bytes, since 2 bytes are used to store the data length\n /// @param implementation The implementation contract to clone\n /// @param data Encoded immutable args\n /// @param salt The salt used by the CREATE3 deployment\n /// @param value The amount of wei to transfer to the created clone\n /// @return deployed The address of the created clone\n function clone3(\n address implementation,\n bytes memory data,\n bytes32 salt,\n uint256 value\n ) internal returns (address deployed) {\n // unrealistic for memory ptr or data length to exceed 256 bits\n unchecked {\n uint256 extraLength = data.length + 2; // +2 bytes for telling how much data there is appended to the call\n uint256 creationSize = 0x43 + extraLength;\n uint256 ptr;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n ptr := mload(0x40)\n\n // -------------------------------------------------------------------------------------------------------------\n // CREATION (11 bytes)\n // -------------------------------------------------------------------------------------------------------------\n\n // 3d | RETURNDATASIZE | 0 | –\n // 61 runtime | PUSH2 runtime (r) | r 0 | –\n mstore(\n ptr,\n 0x3d61000000000000000000000000000000000000000000000000000000000000\n )\n mstore(add(ptr, 0x02), shl(240, sub(creationSize, 11))) // size of the contract running bytecode (16 bits)\n\n // creation size = 0b\n // 80 | DUP1 | r r 0 | –\n // 60 creation | PUSH1 creation (c) | c r r 0 | –\n // 3d | RETURNDATASIZE | 0 c r r 0 | –\n // 39 | CODECOPY | r 0 | [0-2d]: runtime code\n // 81 | DUP2 | 0 c 0 | [0-2d]: runtime code\n // f3 | RETURN | 0 | [0-2d]: runtime code\n mstore(\n add(ptr, 0x04),\n 0x80600b3d3981f300000000000000000000000000000000000000000000000000\n )\n\n // -------------------------------------------------------------------------------------------------------------\n // RUNTIME\n // -------------------------------------------------------------------------------------------------------------\n\n // 36 | CALLDATASIZE | cds | –\n // 3d | RETURNDATASIZE | 0 cds | –\n // 3d | RETURNDATASIZE | 0 0 cds | –\n // 37 | CALLDATACOPY | – | [0, cds] = calldata\n // 61 | PUSH2 extra | extra | [0, cds] = calldata\n mstore(\n add(ptr, 0x0b),\n 0x363d3d3761000000000000000000000000000000000000000000000000000000\n )\n mstore(add(ptr, 0x10), shl(240, extraLength))\n\n // 60 0x38 | PUSH1 0x38 | 0x38 extra | [0, cds] = calldata // 0x38 (56) is runtime size - data\n // 36 | CALLDATASIZE | cds 0x38 extra | [0, cds] = calldata\n // 39 | CODECOPY | _ | [0, cds] = calldata\n // 3d | RETURNDATASIZE | 0 | [0, cds] = calldata\n // 3d | RETURNDATASIZE | 0 0 | [0, cds] = calldata\n // 3d | RETURNDATASIZE | 0 0 0 | [0, cds] = calldata\n // 36 | CALLDATASIZE | cds 0 0 0 | [0, cds] = calldata\n // 61 extra | PUSH2 extra | extra cds 0 0 0 | [0, cds] = calldata\n mstore(\n add(ptr, 0x12),\n 0x603836393d3d3d36610000000000000000000000000000000000000000000000\n )\n mstore(add(ptr, 0x1b), shl(240, extraLength))\n\n // 01 | ADD | cds+extra 0 0 0 | [0, cds] = calldata\n // 3d | RETURNDATASIZE | 0 cds 0 0 0 | [0, cds] = calldata\n // 73 addr | PUSH20 0x123… | addr 0 cds 0 0 0 | [0, cds] = calldata\n mstore(\n add(ptr, 0x1d),\n 0x013d730000000000000000000000000000000000000000000000000000000000\n )\n mstore(add(ptr, 0x20), shl(0x60, implementation))\n\n // 5a | GAS | gas addr 0 cds 0 0 0 | [0, cds] = calldata\n // f4 | DELEGATECALL | success 0 | [0, cds] = calldata\n // 3d | RETURNDATASIZE | rds success 0 | [0, cds] = calldata\n // 82 | DUP3 | 0 rds success 0 | [0, cds] = calldata\n // 80 | DUP1 | 0 0 rds success 0 | [0, cds] = calldata\n // 3e | RETURNDATACOPY | success 0 | [0, rds] = return data (there might be some irrelevant leftovers in memory [rds, cds] when rds < cds)\n // 90 | SWAP1 | 0 success | [0, rds] = return data\n // 3d | RETURNDATASIZE | rds 0 success | [0, rds] = return data\n // 91 | SWAP2 | success 0 rds | [0, rds] = return data\n // 60 0x36 | PUSH1 0x36 | 0x36 sucess 0 rds | [0, rds] = return data\n // 57 | JUMPI | 0 rds | [0, rds] = return data\n // fd | REVERT | – | [0, rds] = return data\n // 5b | JUMPDEST | 0 rds | [0, rds] = return data\n // f3 | RETURN | – | [0, rds] = return data\n\n mstore(\n add(ptr, 0x34),\n 0x5af43d82803e903d91603657fd5bf30000000000000000000000000000000000\n )\n }\n\n // -------------------------------------------------------------------------------------------------------------\n // APPENDED DATA (Accessible from extcodecopy)\n // (but also send as appended data to the delegatecall)\n // -------------------------------------------------------------------------------------------------------------\n\n extraLength -= 2;\n uint256 counter = extraLength;\n uint256 copyPtr = ptr + 0x43;\n uint256 dataPtr;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n dataPtr := add(data, 32)\n }\n for (; counter >= 32; counter -= 32) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n mstore(copyPtr, mload(dataPtr))\n }\n\n copyPtr += 32;\n dataPtr += 32;\n }\n uint256 mask = ~(256 ** (32 - counter) - 1);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n mstore(copyPtr, and(mload(dataPtr), mask))\n }\n copyPtr += counter;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n mstore(copyPtr, shl(240, extraLength))\n }\n\n /// @solidity memory-safe-assembly\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Store the `_PROXY_BYTECODE` into scratch space.\n mstore(0x00, _CREATE3_PROXY_BYTECODE)\n // Deploy a new contract with our pre-made bytecode via CREATE2.\n let proxy := create2(0, 0x10, 0x10, salt)\n\n // If the result of `create2` is the zero address, revert.\n if iszero(proxy) {\n // Store the function selector of `CreateFail()`.\n mstore(0x00, 0xebfef188)\n // Revert with (offset, size).\n revert(0x1c, 0x04)\n }\n\n // Store the proxy's address.\n mstore(0x14, proxy)\n // 0xd6 = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x01).\n // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex).\n mstore(0x00, 0xd694)\n // Nonce of the proxy contract (1).\n mstore8(0x34, 0x01)\n\n deployed := and(\n keccak256(0x1e, 0x17),\n 0xffffffffffffffffffffffffffffffffffffffff\n )\n\n // If the `call` fails or the code size of `deployed` is zero, revert.\n // The second argument of the or() call is evaluated first, which is important\n // here because extcodesize(deployed) is only non-zero after the call() to the proxy\n // is made and the contract is successfully deployed.\n if or(\n iszero(extcodesize(deployed)),\n iszero(\n call(\n gas(), // Gas remaining.\n proxy, // Proxy's address.\n value, // Ether value.\n ptr, // Pointer to the creation code\n creationSize, // Size of the creation code\n 0x00, // Offset of output.\n 0x00 // Length of output.\n )\n )\n ) {\n // Store the function selector of `InitializeFail()`.\n mstore(0x00, 0x8f86d2f1)\n // Revert with (offset, size).\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @notice Returns the CREATE3 deterministic address of the contract deployed via cloneDeterministic().\n /// @dev Forked from https://github.com/Vectorized/solady/blob/main/src/utils/CREATE3.sol\n /// @param salt The salt used by the CREATE3 deployment\n function addressOfClone3(\n bytes32 salt\n ) internal view returns (address deployed) {\n /// @solidity memory-safe-assembly\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Cache the free memory pointer.\n let m := mload(0x40)\n // Store `address(this)`.\n mstore(0x00, address())\n // Store the prefix.\n mstore8(0x0b, 0xff)\n // Store the salt.\n mstore(0x20, salt)\n // Store the bytecode hash.\n mstore(0x40, _CREATE3_PROXY_BYTECODE_HASH)\n\n // Store the proxy's address.\n mstore(0x14, keccak256(0x0b, 0x55))\n // Restore the free memory pointer.\n mstore(0x40, m)\n // 0xd6 = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x01).\n // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex).\n mstore(0x00, 0xd694)\n // Nonce of the proxy contract (1).\n mstore8(0x34, 0x01)\n\n deployed := and(\n keccak256(0x1e, 0x17),\n 0xffffffffffffffffffffffffffffffffffffffff\n )\n }\n }\n}\n" + }, + "contracts/delegatableResolver/DelegatableResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@ensdomains/ens-contracts/contracts/resolvers/profiles/ABIResolver.sol\";\nimport \"@ensdomains/ens-contracts/contracts/resolvers/profiles/AddrResolver.sol\";\nimport \"@ensdomains/ens-contracts/contracts/resolvers/profiles/ContentHashResolver.sol\";\nimport \"@ensdomains/ens-contracts/contracts/resolvers/profiles/DNSResolver.sol\";\nimport \"@ensdomains/ens-contracts/contracts/resolvers/profiles/InterfaceResolver.sol\";\nimport \"@ensdomains/ens-contracts/contracts/resolvers/profiles/NameResolver.sol\";\nimport \"@ensdomains/ens-contracts/contracts/resolvers/profiles/PubkeyResolver.sol\";\nimport \"@ensdomains/ens-contracts/contracts/resolvers/profiles/TextResolver.sol\";\nimport \"@ensdomains/ens-contracts/contracts/resolvers/profiles/ExtendedResolver.sol\";\nimport \"./Multicallable.sol\";\nimport \"./IDelegatableResolver.sol\";\nimport {Clone} from \"../clones-with-immutable-args/Clone.sol\";\n\n/**\n * A delegated resolver that allows the resolver owner to add an operator to update records of a node on behalf of the owner.\n * address.\n */\ncontract DelegatableResolver is\n Clone,\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n using BytesUtils for bytes;\n\n // Logged when an operator is added or removed.\n event Approval(\n bytes32 indexed node,\n address indexed operator,\n bytes name,\n bool approved\n );\n\n error NotAuthorized(bytes32 node);\n\n //node => (delegate => isAuthorised)\n mapping(bytes32 => mapping(address => bool)) operators;\n\n /*\n * Check to see if the operator has been approved by the owner for the node.\n * @param name The ENS node to query\n * @param offset The offset of the label to query recursively. Start from the 0 position and kepp adding the length of each label as it traverse. The function exits when len is 0.\n * @param operator The address of the operator to query\n * @return node The node of the name passed as an argument\n * @return authorized The boolean state of whether the operator is approved to update record of the name\n */\n function getAuthorisedNode(\n bytes memory name,\n uint256 offset,\n address operator\n ) public view returns (bytes32 node, bool authorized) {\n uint256 len = name.readUint8(offset);\n node = bytes32(0);\n if (len > 0) {\n bytes32 label = name.keccak(offset + 1, len);\n (node, authorized) = getAuthorisedNode(\n name,\n offset + len + 1,\n operator\n );\n node = keccak256(abi.encodePacked(node, label));\n } else {\n return (\n node,\n authorized || operators[node][operator] || owner() == operator\n );\n }\n return (node, authorized || operators[node][operator]);\n }\n\n /**\n * @dev Approve an operator to be able to updated records on a node.\n */\n function approve(\n bytes memory name,\n address operator,\n bool approved\n ) external {\n (bytes32 node, bool authorized) = getAuthorisedNode(\n name,\n 0,\n msg.sender\n );\n if (!authorized) {\n revert NotAuthorized(node);\n }\n operators[node][operator] = approved;\n emit Approval(node, operator, name, approved);\n }\n\n /*\n * Returns the owner address passed set by the Factory\n * @return address The owner address\n */\n function owner() public view returns (address) {\n return _getArgAddress(0);\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n return msg.sender == owner() || operators[node][msg.sender];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return\n interfaceID == type(IDelegatableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/delegatableResolver/DelegatableResolverFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport \"./DelegatableResolver.sol\";\nimport {ClonesWithImmutableArgs} from \"../clones-with-immutable-args/ClonesWithImmutableArgs.sol\";\n\n/**\n * A resolver factory that creates a dedicated resolver for each user\n */\n\ncontract DelegatableResolverFactory {\n using ClonesWithImmutableArgs for address;\n\n DelegatableResolver public implementation;\n event NewDelegatableResolver(address resolver, address owner);\n\n constructor(DelegatableResolver _implementation) {\n implementation = _implementation;\n }\n\n /*\n * Create the unique address unique to the owner\n * @param address The address of the resolver owner\n * @return address The address of the newly created Resolver\n */\n function create(\n address owner\n ) external returns (DelegatableResolver clone) {\n bytes memory data = abi.encodePacked(owner);\n clone = DelegatableResolver(address(implementation).clone2(data));\n emit NewDelegatableResolver(address(clone), owner);\n }\n\n /*\n * Returns the unique address unique to the owner\n * @param address The address of the resolver owner\n * @return address The address of the newly created Resolver\n */\n function predictAddress(address owner) external returns (address clone) {\n bytes memory data = abi.encodePacked(owner);\n clone = address(implementation).addressOfClone2(data);\n }\n}\n" + }, + "contracts/delegatableResolver/IDelegatableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDelegatableResolver {\n function approve(\n bytes memory name,\n address operator,\n bool approved\n ) external;\n\n function getAuthorisedNode(\n bytes memory name,\n uint256 offset,\n address operator\n ) external returns (bytes32 node, bool authorized);\n\n function owner() external view returns (address);\n}\n" + }, + "contracts/delegatableResolver/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/delegatableResolver/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/deps.sol": { + "content": "// SPDX-License-Identifier: MIT\n\nimport \"@ensdomains/ens-contracts/contracts/registry/ENSRegistry.sol\";\nimport \"@ensdomains/ens-contracts/contracts/wrapper/NameWrapper.sol\";\nimport \"@ensdomains/ens-contracts/contracts/ethregistrar/BaseRegistrarImplementation.sol\";\nimport \"@ensdomains/ens-contracts/contracts/wrapper/StaticMetadataService.sol\";\nimport {L2ReverseResolver} from \"@ensdomains/ens-contracts/contracts/reverseRegistrar/L2ReverseResolver.sol\";\nimport {ReverseRegistrar} from \"@ensdomains/ens-contracts/contracts/reverseRegistrar/ReverseRegistrar.sol\";\nimport {PublicResolver} from \"@ensdomains/ens-contracts/contracts/resolvers/PublicResolver.sol\";\nimport {LineaSparseProofVerifier} from \"linea-state-verifier/contracts/LineaSparseProofVerifier.sol\";\n" + }, + "contracts/IAddrSetter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.25;\n\ninterface IAddrSetter {\n function setAddr(\n bytes calldata name,\n address _addr\n ) external view returns (bytes memory result);\n}\n" + }, + "contracts/IMetadataResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.25;\n\ninterface IMetadataResolver {\n /*\n * @notice Get metadata about the CCIP Resolver ENSIP 16 https://docs.ens.domains/ens-improvement-proposals/ensip-16-offchain-metadata\n * @dev This function provides metadata about the CCIP Resolver, including its name, coin type, GraphQL URL, storage type, and encoded information.\n * @param name The domain name in format (dnsEncoded)\n * @return graphqlUrl The GraphQL URL used by the resolver\n *\n */\n function metadata(\n bytes calldata name\n ) external view returns (string memory graphqlUrl);\n\n event MetadataChanged(bytes name, string graphqlUrl);\n}\n" + }, + "contracts/ITargetResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.25;\n\ninterface ITargetResolver {\n function getTarget(\n bytes memory name\n ) external view returns (bytes32 node, address target);\n}\n" + }, + "contracts/L1Resolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.25;\n\nimport {EVMFetcher} from \"linea-state-verifier/contracts/EVMFetcher.sol\";\nimport {EVMFetchTarget} from \"linea-state-verifier/contracts/EVMFetchTarget.sol\";\nimport {IEVMVerifier} from \"linea-state-verifier/contracts/IEVMVerifier.sol\";\nimport \"@ensdomains/ens-contracts/contracts/registry/ENS.sol\";\nimport {INameWrapper} from \"@ensdomains/ens-contracts/contracts/wrapper/INameWrapper.sol\";\nimport {BytesUtils} from \"@ensdomains/ens-contracts/contracts/dnssec-oracle/BytesUtils.sol\";\nimport {IAddrResolver} from \"@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddrResolver.sol\";\nimport {IAddressResolver} from \"@ensdomains/ens-contracts/contracts/resolvers/profiles/IAddressResolver.sol\";\nimport {ITextResolver} from \"@ensdomains/ens-contracts/contracts/resolvers/profiles/ITextResolver.sol\";\nimport {IContentHashResolver} from \"@ensdomains/ens-contracts/contracts/resolvers/profiles/IContentHashResolver.sol\";\nimport \"@ensdomains/ens-contracts/contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport {ITargetResolver} from \"./ITargetResolver.sol\";\nimport {IMetadataResolver} from \"./IMetadataResolver.sol\";\nimport {IAddrSetter} from \"./IAddrSetter.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract L1Resolver is\n EVMFetchTarget,\n ITargetResolver,\n IMetadataResolver,\n IExtendedResolver,\n IAddrSetter,\n ERC165\n{\n using EVMFetcher for EVMFetcher.EVMFetchRequest;\n using BytesUtils for bytes;\n IEVMVerifier public immutable verifier;\n ENS public immutable ens;\n INameWrapper public immutable nameWrapper;\n uint256 public immutable l2ChainId;\n mapping(bytes32 => address) targets;\n uint256 constant COIN_TYPE_ETH = 60;\n uint256 constant RECORD_VERSIONS_SLOT = 0;\n uint256 constant VERSIONABLE_ABIS_SLOT = 1;\n uint256 constant VERSIONABLE_ADDRESSES_SLOT = 2;\n uint256 constant VERSIONABLE_HASHES_SLOT = 3;\n uint256 constant VERSIONABLE_TEXTS_SLOT = 10;\n // To check how old is the value/proof returned and is in the acceptable range\n uint256 constant ACCEPTED_L2_BLOCK_RANGE_LENGTH = 86400;\n string public graphqlUrl;\n\n event TargetSet(bytes name, address target);\n\n function isAuthorised(bytes32 node) internal view returns (bool) {\n // TODO: Add support for\n // trustedETHController\n // trustedReverseRegistrar\n // isApprovedForAll\n // isApprovedFor\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return owner == msg.sender;\n }\n\n /**\n * @dev EIP-5559 - Error to raise when mutations are being deferred to an L2.\n * @param chainId Chain ID to perform the deferred mutation to.\n * @param contractAddress Contract Address at which the deferred mutation should transact with.\n */\n error StorageHandledByL2(uint256 chainId, address contractAddress);\n\n /**\n * @param _verifier The chain verifier address\n * @param _ens The ENS registry address\n * @param _nameWrapper The ENS name wrapper address\n * @param _graphqlUrl The offchain/l2 graphql endpoint url\n * @param _l2ChainId The chainId at which the resolver resolves data from\n */\n constructor(\n IEVMVerifier _verifier,\n ENS _ens,\n INameWrapper _nameWrapper,\n string memory _graphqlUrl,\n uint256 _l2ChainId\n ) {\n require(\n address(_nameWrapper) != address(0),\n \"Name Wrapper address must be set\"\n );\n require(\n address(_verifier) != address(0),\n \"Verifier address must be set\"\n );\n require(address(_ens) != address(0), \"Registry address must be set\");\n verifier = _verifier;\n ens = _ens;\n nameWrapper = _nameWrapper;\n graphqlUrl = _graphqlUrl;\n l2ChainId = _l2ChainId;\n }\n\n /**\n * @dev inherits from EVMFetchTarget\n */\n function getAcceptedL2BlockRangeLength()\n public\n pure\n override\n returns (uint256)\n {\n return ACCEPTED_L2_BLOCK_RANGE_LENGTH;\n }\n\n /**\n * Set target address to verify against\n * @param name The encoded name to query.\n * @param target The L2 resolver address to verify against.\n */\n function setTarget(bytes calldata name, address target) external {\n (bytes32 node, ) = getTarget(name);\n require(\n isAuthorised(node),\n \"Not authorized to set target for this node\"\n );\n targets[node] = target;\n emit TargetSet(name, target);\n emit MetadataChanged(name, graphqlUrl);\n }\n\n /**\n * @dev Returns the L2 target address that can answer queries for `name`.\n * @param name DNS encoded ENS name to query\n * @return node The node of the name\n * @return target The L2 resolver address to verify against.\n */\n function getTarget(\n bytes memory name\n ) public view returns (bytes32 node, address target) {\n return _getTarget(name, 0);\n }\n\n function _getTarget(\n bytes memory name,\n uint256 offset\n ) private view returns (bytes32 node, address target) {\n uint256 len = name.readUint8(offset);\n node = bytes32(0);\n if (len > 0) {\n bytes32 label = name.keccak(offset + 1, len);\n (node, target) = _getTarget(name, offset + len + 1);\n node = keccak256(abi.encodePacked(node, label));\n if (targets[node] != address(0)) {\n return (node, targets[node]);\n }\n } else {\n return (bytes32(0), address(0));\n }\n return (node, target);\n }\n\n /**\n * @dev Resolve and verify a record stored in l2 target address. It supports subname by fetching target recursively to the nearest parent.\n * @param name DNS encoded ENS name to query\n * @param data The actual calldata\n * @return result result of the call\n */\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory result) {\n require(data.length >= 4, \"param data too short\");\n\n (, address target) = _getTarget(name, 0);\n bytes4 selector = bytes4(data);\n\n if (selector == IAddrResolver.addr.selector) {\n bytes32 node = abi.decode(data[4:], (bytes32));\n return _addr(node, target);\n }\n if (selector == IAddressResolver.addr.selector) {\n (bytes32 node, uint256 cointype) = abi.decode(\n data[4:],\n (bytes32, uint256)\n );\n return _addr(node, cointype, target);\n }\n if (selector == ITextResolver.text.selector) {\n (bytes32 node, string memory key) = abi.decode(\n data[4:],\n (bytes32, string)\n );\n return bytes(_text(node, key, target));\n }\n if (selector == IContentHashResolver.contenthash.selector) {\n bytes32 node = abi.decode(data[4:], (bytes32));\n return _contenthash(node, target);\n }\n\n // None selector has been found it reverts\n revert(\"invalid selector\");\n }\n\n /**\n * @dev Resolve and throws an EIP 3559 compliant error\n * @param name DNS encoded ENS name to query\n * @param _addr The actual calldata\n * @return result result of the call\n */\n function setAddr(\n bytes calldata name,\n address _addr\n ) external view returns (bytes memory result) {\n (, address target) = _getTarget(name, 0);\n _writeDeferral(target);\n }\n\n function _addr(\n bytes32 node,\n address target\n ) private view returns (bytes memory) {\n EVMFetcher\n .newFetchRequest(verifier, target)\n .getStatic(RECORD_VERSIONS_SLOT)\n .element(node)\n .getDynamic(VERSIONABLE_ADDRESSES_SLOT)\n .ref(0)\n .element(node)\n .element(COIN_TYPE_ETH)\n .fetch(this.addrCallback.selector, \"\"); // recordVersions\n }\n\n function addrCallback(\n bytes[] memory values,\n bytes memory\n ) external pure returns (bytes memory) {\n return abi.encode(address(bytes20(values[1])));\n }\n\n function _addr(\n bytes32 node,\n uint256 coinType,\n address target\n ) private view returns (bytes memory) {\n EVMFetcher\n .newFetchRequest(verifier, target)\n .getStatic(RECORD_VERSIONS_SLOT)\n .element(node)\n .getDynamic(VERSIONABLE_ADDRESSES_SLOT)\n .ref(0)\n .element(node)\n .element(coinType)\n .fetch(this.addrCoinTypeCallback.selector, \"\");\n }\n\n function addrCoinTypeCallback(\n bytes[] memory values,\n bytes memory\n ) external pure returns (bytes memory) {\n return abi.encode(values[1]);\n }\n\n function _text(\n bytes32 node,\n string memory key,\n address target\n ) private view returns (bytes memory) {\n EVMFetcher\n .newFetchRequest(verifier, target)\n .getStatic(RECORD_VERSIONS_SLOT)\n .element(node)\n .getDynamic(VERSIONABLE_TEXTS_SLOT)\n .ref(0)\n .element(node)\n .element(key)\n .fetch(this.textCallback.selector, \"\");\n }\n\n function textCallback(\n bytes[] memory values,\n bytes memory\n ) external pure returns (bytes memory) {\n return abi.encode(string(values[1]));\n }\n\n function _contenthash(\n bytes32 node,\n address target\n ) private view returns (bytes memory) {\n EVMFetcher\n .newFetchRequest(verifier, target)\n .getStatic(RECORD_VERSIONS_SLOT)\n .element(node)\n .getDynamic(VERSIONABLE_HASHES_SLOT)\n .ref(0)\n .element(node)\n .fetch(this.contenthashCallback.selector, \"\");\n }\n\n function contenthashCallback(\n bytes[] memory values,\n bytes memory\n ) external pure returns (bytes memory) {\n return abi.encode(values[1]);\n }\n\n /**\n * @notice Get metadata about the L1 Resolver\n * @dev This function provides metadata about the L1 Resolver, including its name, coin type, GraphQL URL, storage type, and encoded information.\n * @param name The domain name in format (dnsEncoded)\n * @return graphqlUrl The GraphQL URL used by the resolver\n */\n function metadata(\n bytes calldata name\n ) external view returns (string memory) {\n return (graphqlUrl);\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n interfaceId == type(ITargetResolver).interfaceId ||\n interfaceId == type(IMetadataResolver).interfaceId ||\n interfaceId == type(IAddrSetter).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _writeDeferral(address target) internal view {\n revert StorageHandledByL2(l2ChainId, target);\n }\n}\n" + }, + "contracts/RollupMock.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.25;\n\ncontract RollupMock {\n event DataFinalized(\n uint256 indexed lastBlockFinalized,\n bytes32 indexed startingRootHash,\n bytes32 indexed finalRootHash,\n bool withProof\n );\n\n uint256 public currentL2BlockNumber;\n mapping(uint256 blockNumber => bytes32 stateRootHash)\n public stateRootHashes;\n\n constructor(uint256 _currentL2BlockNumber, bytes32 _currentStateRootHash) {\n currentL2BlockNumber = _currentL2BlockNumber;\n stateRootHashes[currentL2BlockNumber] = _currentStateRootHash;\n\n emit DataFinalized(\n _currentL2BlockNumber,\n _currentStateRootHash,\n _currentStateRootHash,\n false\n );\n }\n\n function setCurrentStateRoot(\n uint256 _currentL2BlockNumber,\n bytes32 _currentStateRootHash\n ) external {\n currentL2BlockNumber = _currentL2BlockNumber;\n stateRootHashes[currentL2BlockNumber] = _currentStateRootHash;\n\n emit DataFinalized(\n _currentL2BlockNumber,\n _currentStateRootHash,\n _currentStateRootHash,\n false\n );\n }\n}\n" + }, + "linea-state-verifier/contracts/EVMFetcher.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.25;\n\nimport {IEVMVerifier} from \"./IEVMVerifier.sol\";\nimport {EVMFetchTarget} from \"./EVMFetchTarget.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\ninterface IEVMGateway {\n function getStorageSlots(\n address addr,\n bytes32[] memory commands,\n bytes[] memory constants\n ) external pure returns (bytes memory witness);\n}\n\nuint8 constant FLAG_DYNAMIC = 0x01;\nuint8 constant OP_CONSTANT = 0x00;\nuint8 constant OP_BACKREF = 0x20;\nuint8 constant OP_END = 0xff;\n\n/**\n * @dev A library to facilitate requesting storage data proofs from contracts, possibly on a different chain.\n * See l1-verifier/test/TestL1.sol for example usage.\n */\nlibrary EVMFetcher {\n uint256 constant MAX_COMMANDS = 32;\n uint256 constant MAX_CONSTANTS = 32; // Must not be greater than 32\n\n using Address for address;\n\n error TooManyCommands(uint256 max);\n error CommandTooLong();\n error InvalidReference(uint256 value, uint256 max);\n error OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n );\n\n struct EVMFetchRequest {\n IEVMVerifier verifier;\n address target;\n bytes32[] commands;\n uint256 operationIdx;\n bytes[] constants;\n }\n\n /**\n * @dev Creates a request to fetch the value of multiple storage slots from a contract via CCIP-Read, possibly from\n * another chain.\n * Supports dynamic length values and slot numbers derived from other retrieved values.\n * @param verifier An instance of a verifier contract that can provide and verify the storage slot information.\n * @param target The address of the contract to fetch storage proofs for.\n */\n function newFetchRequest(\n IEVMVerifier verifier,\n address target\n ) internal pure returns (EVMFetchRequest memory) {\n bytes32[] memory commands = new bytes32[](MAX_COMMANDS);\n bytes[] memory constants = new bytes[](MAX_CONSTANTS);\n assembly {\n mstore(commands, 0) // Set current array length to 0\n mstore(constants, 0)\n }\n return EVMFetchRequest(verifier, target, commands, 0, constants);\n }\n\n /**\n * @dev Starts describing a new fetch request.\n * Paths specify a series of hashing operations to derive the final slot ID.\n * See https://docs.soliditylang.org/en/v0.8.17/internals/layout_in_storage.html for details on how Solidity\n * lays out storage variables.\n * @param request The request object being operated on.\n * @param baseSlot The base slot ID that forms the root of the path.\n */\n function getStatic(\n EVMFetchRequest memory request,\n uint256 baseSlot\n ) internal pure returns (EVMFetchRequest memory) {\n bytes32[] memory commands = request.commands;\n uint256 commandIdx = commands.length;\n if (commandIdx > 0 && request.operationIdx < 32) {\n // Terminate previous command\n _addOperation(request, OP_END);\n }\n assembly {\n mstore(commands, add(commandIdx, 1)) // Increment command array length\n }\n if (request.commands.length > MAX_COMMANDS) {\n revert TooManyCommands(MAX_COMMANDS);\n }\n request.operationIdx = 0;\n _addOperation(request, 0);\n _addOperation(request, _addConstant(request, abi.encode(baseSlot)));\n return request;\n }\n\n /**\n * @dev Starts describing a new fetch request.\n * Paths specify a series of hashing operations to derive the final slot ID.\n * See https://docs.soliditylang.org/en/v0.8.17/internals/layout_in_storage.html for details on how Solidity\n * lays out storage variables.\n * @param request The request object being operated on.\n * @param baseSlot The base slot ID that forms the root of the path.\n */\n function getDynamic(\n EVMFetchRequest memory request,\n uint256 baseSlot\n ) internal pure returns (EVMFetchRequest memory) {\n bytes32[] memory commands = request.commands;\n uint256 commandIdx = commands.length;\n if (commandIdx > 0 && request.operationIdx < 32) {\n // Terminate previous command\n _addOperation(request, OP_END);\n }\n assembly {\n mstore(commands, add(commandIdx, 1)) // Increment command array length\n }\n if (request.commands.length > MAX_COMMANDS) {\n revert TooManyCommands(MAX_COMMANDS);\n }\n request.operationIdx = 0;\n _addOperation(request, FLAG_DYNAMIC);\n _addOperation(request, _addConstant(request, abi.encode(baseSlot)));\n return request;\n }\n\n /**\n * @dev Adds a `uint256` element to the current path.\n * @param request The request object being operated on.\n * @param el The element to add.\n */\n function element(\n EVMFetchRequest memory request,\n uint256 el\n ) internal pure returns (EVMFetchRequest memory) {\n if (request.operationIdx >= 32) {\n revert CommandTooLong();\n }\n _addOperation(request, _addConstant(request, abi.encode(el)));\n return request;\n }\n\n /**\n * @dev Adds a `bytes32` element to the current path.\n * @param request The request object being operated on.\n * @param el The element to add.\n */\n function element(\n EVMFetchRequest memory request,\n bytes32 el\n ) internal pure returns (EVMFetchRequest memory) {\n if (request.operationIdx >= 32) {\n revert CommandTooLong();\n }\n _addOperation(request, _addConstant(request, abi.encode(el)));\n return request;\n }\n\n /**\n * @dev Adds an `address` element to the current path.\n * @param request The request object being operated on.\n * @param el The element to add.\n */\n function element(\n EVMFetchRequest memory request,\n address el\n ) internal pure returns (EVMFetchRequest memory) {\n if (request.operationIdx >= 32) {\n revert CommandTooLong();\n }\n _addOperation(request, _addConstant(request, abi.encode(el)));\n return request;\n }\n\n /**\n * @dev Adds a `bytes` element to the current path.\n * @param request The request object being operated on.\n * @param el The element to add.\n */\n function element(\n EVMFetchRequest memory request,\n bytes memory el\n ) internal pure returns (EVMFetchRequest memory) {\n if (request.operationIdx >= 32) {\n revert CommandTooLong();\n }\n _addOperation(request, _addConstant(request, el));\n return request;\n }\n\n /**\n * @dev Adds a `string` element to the current path.\n * @param request The request object being operated on.\n * @param el The element to add.\n */\n function element(\n EVMFetchRequest memory request,\n string memory el\n ) internal pure returns (EVMFetchRequest memory) {\n if (request.operationIdx >= 32) {\n revert CommandTooLong();\n }\n _addOperation(request, _addConstant(request, bytes(el)));\n return request;\n }\n\n /**\n * @dev Adds a reference to a previous fetch to the current path.\n * @param request The request object being operated on.\n * @param idx The index of the previous fetch request, starting at 0.\n */\n function ref(\n EVMFetchRequest memory request,\n uint8 idx\n ) internal pure returns (EVMFetchRequest memory) {\n if (request.operationIdx >= 32) {\n revert CommandTooLong();\n }\n if (idx > request.commands.length || idx > 31) {\n revert InvalidReference(idx, request.commands.length);\n }\n _addOperation(request, OP_BACKREF | idx);\n return request;\n }\n\n /**\n * @dev Initiates the fetch request.\n * Calling this function terminates execution; clients that implement CCIP-Read will make a callback to\n * `callback` with the results of the operation.\n * @param callbackId A callback function selector on this contract that will be invoked via CCIP-Read with the result of the lookup.\n * The function must have a signature matching `(bytes[] memory values, bytes callbackData)` with a return type matching the call in which\n * this function was invoked. Its return data will be returned as the return value of the entire CCIP-read operation.\n * @param callbackData Extra data to supply to the callback.\n */\n function fetch(\n EVMFetchRequest memory request,\n bytes4 callbackId,\n bytes memory callbackData\n ) internal view {\n if (request.commands.length > 0 && request.operationIdx < 32) {\n // Terminate last command\n _addOperation(request, OP_END);\n }\n\n revert OffchainLookup(\n address(this),\n request.verifier.gatewayURLs(),\n abi.encodeCall(\n IEVMGateway.getStorageSlots,\n (request.target, request.commands, request.constants)\n ),\n EVMFetchTarget.getStorageSlotsCallback.selector,\n abi.encode(\n request.verifier,\n request.target,\n request.commands,\n request.constants,\n callbackId,\n callbackData\n )\n );\n }\n\n function _addConstant(\n EVMFetchRequest memory request,\n bytes memory value\n ) private pure returns (uint8 idx) {\n bytes[] memory constants = request.constants;\n idx = uint8(constants.length);\n assembly {\n mstore(constants, add(idx, 1)) // Increment constant array length\n }\n constants[idx] = value;\n }\n\n function _addOperation(\n EVMFetchRequest memory request,\n uint8 op\n ) private pure {\n uint256 commandIdx = request.commands.length - 1;\n request.commands[commandIdx] =\n request.commands[commandIdx] |\n (bytes32(bytes1(op)) >> (8 * request.operationIdx++));\n }\n}\n" + }, + "linea-state-verifier/contracts/EVMFetchTarget.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.25;\n\nimport {IEVMVerifier} from \"./IEVMVerifier.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\n/**\n * @dev Callback implementation for users of `EVMFetcher`. If you use `EVMFetcher`, your contract must\n * inherit from this contract in order to handle callbacks correctly.\n */\nabstract contract EVMFetchTarget {\n using Address for address;\n\n error ResponseLengthMismatch(uint256 actual, uint256 expected);\n\n /**\n * @dev Internal callback function invoked by CCIP-Read in response to a `getStorageSlots` request.\n */\n function getStorageSlotsCallback(\n bytes calldata response,\n bytes calldata extradata\n ) external returns (bytes memory) {\n bytes memory proof = abi.decode(response, (bytes));\n (\n IEVMVerifier verifier,\n address addr,\n bytes32[] memory commands,\n bytes[] memory constants,\n bytes4 callback,\n bytes memory callbackData\n ) = abi.decode(\n extradata,\n (IEVMVerifier, address, bytes32[], bytes[], bytes4, bytes)\n );\n\n bytes[] memory values = verifier.getStorageValues(\n addr,\n commands,\n constants,\n proof,\n getAcceptedL2BlockRangeLength()\n );\n if (values.length != commands.length) {\n revert ResponseLengthMismatch(values.length, commands.length);\n }\n bytes memory ret = address(this).functionCall(\n abi.encodeWithSelector(callback, values, callbackData)\n );\n assembly {\n return(add(ret, 32), mload(ret))\n }\n }\n\n /**\n * @dev The child contract has to return an accepted L2 block range used by the verifier\n * to verify that the block number verified is in the accepted block range.\n */\n function getAcceptedL2BlockRangeLength()\n public\n view\n virtual\n returns (uint256);\n}\n" + }, + "linea-state-verifier/contracts/IEVMVerifier.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.25;\n\ninterface IEVMVerifier {\n function gatewayURLs() external view returns (string[] memory);\n\n function getStorageValues(\n address target,\n bytes32[] memory commands,\n bytes[] memory constants,\n bytes memory proof,\n uint256 acceptedL2BlockRangeLength\n ) external view returns (bytes[] memory values);\n}\n" + }, + "linea-state-verifier/contracts/lib/Mimc.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\n\n// Copyright 2023 Consensys Software Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Code generated by gnark DO NOT EDIT\npragma solidity 0.8.25;\n\n/**\n * @title Library to perform MiMC hashing\n * @author ConsenSys Software Inc.\n * @custom:security-contact security-report@linea.build\n */\nlibrary Mimc {\n /**\n * Thrown when the data is not provided\n */\n error DataMissing();\n\n /**\n * Thrown when the data is not purely in 32 byte chunks\n */\n error DataIsNotMod32();\n\n uint256 constant FR_FIELD =\n 8444461749428370424248824938781546531375899335154063827935233455917409239041;\n /**\n * @notice Performs a MiMC hash on the data provided\n * @param _msg The data to be hashed\n * @dev Only data that has length modulus 32 is hashed, reverts otherwise\n * @return mimcHash The computed MiMC hash\n */\n function hash(\n bytes calldata _msg\n ) external pure returns (bytes32 mimcHash) {\n if (_msg.length == 0) {\n revert DataMissing();\n }\n\n if (_msg.length % 0x20 != 0) {\n revert DataIsNotMod32();\n }\n\n assembly {\n let chunks := div(add(_msg.length, 0x1f), 0x20)\n\n for {\n let i := 0\n } lt(i, chunks) {\n i := add(i, 1)\n } {\n let offset := add(_msg.offset, mul(i, 0x20))\n let chunk := calldataload(offset)\n\n let r := encrypt(mimcHash, chunk)\n mimcHash := addmod(\n addmod(mimcHash, r, FR_FIELD),\n chunk,\n FR_FIELD\n )\n }\n\n function encrypt(h, chunk) -> output {\n let frField := FR_FIELD\n let tmpSum := 0\n\n tmpSum := addmod(\n addmod(chunk, h, frField),\n 6780559962679281898511952483033644312910028090361101779689089025541625982996,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 2327326745520207001136649348523057964841679868424949608370212081331899020358,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 6201177823658417253260885485467023993767823924255470286063250782233002635405,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 3401276671970505639801802718275229999176446092725813928949571059366811327963,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 796636033841689627732941016044857384234234277501564259311815186813195010627,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 159507412325830262114089631199386481336725966652415909300570415682233424809,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 1669348614406363339435491723584591316524711695667693315027811919444714635748,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 2220664510675218580883672035712942523468288190837741520497926350441362544422,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 1294712289478715410717626660893541311126892630747701030449280341780183665665,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 6758843230175145783288330173723849603007070607311612566540600202723911987180,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 6271650829101108787041306415787253036818921034903891854433479166754956001513,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 8037654458661109859150348337922011363549131313762043865209663327750426111866,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 2450972517788523786981910980516860147992539249204314270739451472218657823669,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 2707650969937705465351357815756127556801434183777713569980595073268026256128,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 7874262417209200618473337039194351886630571503697269268624099887104149796259,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 3089899920017810079637556867207463807565125948241456751227734590626249857937,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 8231877132811199596376758288825197494440517476607659739835166243301765860904,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 4889925300033981791993403687473437637164964770774352761851347729331041993593,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 506118690894045980182310960875885680782486421163823930266542078948815948062,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 4773308728424659273056201947330432214661646691949138677097247858746575076542,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 6610301125072219342086627276930551094394509958433369744427479834611436778066,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 8062913614098409973923064402439991628739389434149534836396892159147794104642,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 2576406140423312875091927795739341819101209176346955562285186911769083519728,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 6247267546819369987508590432055536928557259658317014243676640822343115627202,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 2354620213005699835215298236574714075068230025566107498090395819138978823906,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 1012123997779098542887516673253442986051441272786218052382513879552027657616,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 220252773286234814215172180118321537145064642853938490221604200051823270477,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 2306037967476458159399202685728266972768173510335885477997450635969358782263,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 5906000615460106310157278190403974694555979202144571560620360962365001056276,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 8029952345415718287377564183334920026617762793749604843629313086537726648143,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 6806091261750378774545720021859645013630360296898036304733359077422908323188,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 3791365032107216523624488143755156784159183778414385385850652127088602339940,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 7713951866326004273632564650741019619975760271948208739458822610304231437565,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 2159153222189174173490067225063044363535871059524538695070191871847470955412,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 3459892854150586819083449948613048924207735017129514254460829121652786324530,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 8165919441562399076732808928206069494664474480220235797297111305840352207764,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 5067127638759272574597184239140007718698192996511162583428330546781376830321,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 7564926180046670501077982861476967417487855218354401587881011340975488196742,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 4793316512087044382791577380686883286681140325373390439122763061600650301139,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 12025027725022723723984202199185080936456585195449250668991990971241927925,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 5056480146405086811789505170440731715530475328844870175949109998024731067467,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 3850822128034659558863504800917443538100103152464488164345952697508772708155,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 5490569542353168488797150359760203713598401616662275350850844170956899716180,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 6809916892509991991280249336166027496157481609693382555884367500846199028644,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 6102228360565846712478499570512196976845845959851353003471378423251561935785,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 7957411254301481793006532646538815862020547208300835763521138686017052464640,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 7577948604138385646013244290592520699579040577712519004775644201729392063846,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 6025758357861563690691793181574484773095829890586160167641973490103511417496,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 2004214547184552249779883547311284063339374005887218065319674453115808726850,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 1316449090346410801845183915381769525990226349513436734911941391785200212382,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 4556285572033080226119128815763547597118327635770271287655822355222839175285,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 2369904002063218534853867482545647755243877244064168179905450676831047307618,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 7451702566176584025980909730992154118931318734166468698682947787653334803016,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 1329300832483899103910420486510886619321904846687482243968569167489052205690,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 3238521361072472828313630322811653086792441312858682853521070248794222258735,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 3475214489590830586915334473771293324307275731565327099797069845161869229357,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 4274287601159036159363576568654710230919275259553081321690187920135177947814,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 6938336600682072955973769075275160235517201022692151378695173193891386346405,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 3998198747256139339077883878547228988120873864712400941893285440315291004215,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 6699213631756936754252081929574788294275116402464654263316543921533804167968,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 6962236729635042756258761323749531146700535903704299930132981735734543600942,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n tmpSum := addmod(\n addmod(output, h, frField),\n 6961288456480688271133399693659146309378114560595485436408179085016705585674,\n frField\n )\n output := mulmod(tmpSum, tmpSum, frField)\n output := mulmod(output, output, frField)\n output := mulmod(output, output, frField)\n output := mulmod(\n mulmod(output, output, frField),\n tmpSum,\n frField\n )\n\n output := addmod(output, h, frField)\n }\n }\n }\n}\n" + }, + "linea-state-verifier/contracts/lib/SparseMerkleProof.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity 0.8.25;\n\nimport {Mimc} from \"./Mimc.sol\";\n\n/**\n * @title Library to perform SparseMerkleProof actions using the MiMC hashing algorithm\n * @author ConsenSys Software Inc.\n * @custom:security-contact security-report@linea.build\n */\nlibrary SparseMerkleProof {\n using Mimc for *;\n\n /**\n * The Account struct represents the state of the account including the storage root, nonce, balance and codesize\n * @dev This is mapped directly to the output of the storage proof\n */\n struct Account {\n uint64 nonce;\n uint256 balance;\n bytes32 storageRoot;\n bytes32 mimcCodeHash;\n bytes32 keccakCodeHash;\n uint64 codeSize;\n }\n\n /**\n * Represents the leaf structure in both account and storage tries\n * @dev This is mapped directly to the output of the storage proof\n */\n struct Leaf {\n uint256 prev;\n uint256 next;\n bytes32 hKey;\n bytes32 hValue;\n }\n\n /**\n * Thrown when expected bytes length is incorrect\n */\n error WrongBytesLength(uint256 expectedLength, uint256 bytesLength);\n\n /**\n * Thrown when the length of bytes is not in exactly 32 byte chunks\n */\n error LengthNotMod32();\n\n /**\n * Thrown when the leaf index is higher than the tree depth\n */\n error MaxTreeLeafIndexExceed();\n\n /**\n * Thrown when the length of the unformatted proof is not provided exactly as expected (UNFORMATTED_PROOF_LENGTH)\n */\n error WrongProofLength(uint256 expectedLength, uint256 actualLength);\n\n uint256 internal constant TREE_DEPTH = 40;\n uint256 internal constant UNFORMATTED_PROOF_LENGTH = 42;\n bytes32 internal constant ZERO_HASH = 0x0;\n uint256 internal constant MAX_TREE_LEAF_INDEX = 2 ** TREE_DEPTH - 1;\n\n /**\n * @notice Formats input, computes root and returns true if it matches the provided merkle root\n * @param _rawProof Raw sparse merkle tree proof\n * @param _leafIndex Index of the leaf\n * @param _root Sparse merkle root\n * @return If the computed merkle root matches the provided one\n */\n function verifyProof(\n bytes[] calldata _rawProof,\n uint256 _leafIndex,\n bytes32 _root\n ) external pure returns (bool) {\n if (_rawProof.length != UNFORMATTED_PROOF_LENGTH) {\n revert WrongProofLength(UNFORMATTED_PROOF_LENGTH, _rawProof.length);\n }\n\n (\n bytes32 nextFreeNode,\n bytes32 leafHash,\n bytes32[] memory proof\n ) = _formatProof(_rawProof);\n return _verify(proof, leafHash, _leafIndex, _root, nextFreeNode);\n }\n\n /**\n * @notice Hash a value using MIMC hash\n * @param _input Value to hash\n * @return {bytes32} Mimc hash\n */\n function mimcHash(bytes calldata _input) external pure returns (bytes32) {\n return Mimc.hash(_input);\n }\n\n /**\n * @notice Get leaf\n * @param _encodedLeaf Encoded leaf bytes (prev, next, hKey, hValue)\n * @return Leaf Formatted leaf struct\n */\n function getLeaf(\n bytes calldata _encodedLeaf\n ) external pure returns (Leaf memory) {\n return _parseLeaf(_encodedLeaf);\n }\n\n /**\n * @notice Get account\n * @param _encodedAccountValue Encoded account value bytes (nonce, balance, storageRoot, mimcCodeHash, keccakCodeHash, codeSize)\n * @return Account Formatted account struct\n */\n function getAccount(\n bytes calldata _encodedAccountValue\n ) external pure returns (Account memory) {\n return _parseAccount(_encodedAccountValue);\n }\n\n /**\n * @notice Hash account value\n * @param _value Encoded account value bytes (nonce, balance, storageRoot, mimcCodeHash, keccakCodeHash, codeSize)\n * @return {bytes32} Account value hash\n */\n function hashAccountValue(\n bytes calldata _value\n ) external pure returns (bytes32) {\n Account memory account = _parseAccount(_value);\n (bytes32 msb, bytes32 lsb) = _splitBytes32(account.keccakCodeHash);\n return\n Mimc.hash(\n abi.encode(\n account.nonce,\n account.balance,\n account.storageRoot,\n account.mimcCodeHash,\n lsb,\n msb,\n account.codeSize\n )\n );\n }\n\n /**\n * @notice Hash storage value\n * @param _value Encoded storage value bytes\n * @return {bytes32} Storage value hash\n */\n function hashStorageValue(bytes32 _value) external pure returns (bytes32) {\n (bytes32 msb, bytes32 lsb) = _splitBytes32(_value);\n return Mimc.hash(abi.encodePacked(lsb, msb));\n }\n\n /**\n * @notice Parse leaf value\n * @param _encodedLeaf Encoded leaf bytes (prev, next, hKey, hValue)\n * @return {Leaf} Formatted leaf struct\n */\n function _parseLeaf(\n bytes calldata _encodedLeaf\n ) private pure returns (Leaf memory) {\n if (_encodedLeaf.length != 128) {\n revert WrongBytesLength(128, _encodedLeaf.length);\n }\n return abi.decode(_encodedLeaf, (Leaf));\n }\n\n /**\n * @notice Parse account value\n * @param _value Encoded account value bytes (nonce, balance, storageRoot, mimcCodeHash, keccakCodeHash, codeSize)\n * @return {Account} Formatted account struct\n */\n function _parseAccount(\n bytes calldata _value\n ) private pure returns (Account memory) {\n if (_value.length != 192) {\n revert WrongBytesLength(192, _value.length);\n }\n return abi.decode(_value, (Account));\n }\n\n /**\n * @notice Split bytes32 into two bytes32 taking most significant bits and least significant bits\n * @param _b bytes to split\n * @return msb Most significant bits\n * @return lsb Least significant bits\n */\n function _splitBytes32(\n bytes32 _b\n ) private pure returns (bytes32 msb, bytes32 lsb) {\n assembly {\n msb := shr(128, _b)\n lsb := and(_b, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\n }\n }\n\n /**\n * @notice Format proof\n * @param _rawProof Non formatted proof array\n * @return (bytes32, bytes32, bytes32[]) NextFreeNode, leafHash and formatted proof array\n */\n function _formatProof(\n bytes[] calldata _rawProof\n ) private pure returns (bytes32, bytes32, bytes32[] memory) {\n uint256 rawProofLength = _rawProof.length;\n uint256 formattedProofLength = rawProofLength - 2;\n\n bytes32[] memory proof = new bytes32[](formattedProofLength);\n\n if (_rawProof[0].length != 0x40) {\n revert WrongBytesLength(0x40, _rawProof[0].length);\n }\n\n bytes32 nextFreeNode = bytes32(_rawProof[0][:32]);\n bytes32 leafHash = Mimc.hash(_rawProof[rawProofLength - 1]);\n\n for (uint256 i = 1; i < formattedProofLength; ) {\n proof[formattedProofLength - i] = Mimc.hash(_rawProof[i]);\n unchecked {\n ++i;\n }\n }\n\n // If the sibling leaf (_rawProof[formattedProofLength]) is equal to zero bytes we don't hash it\n if (_isZeroBytes(_rawProof[formattedProofLength])) {\n proof[0] = ZERO_HASH;\n } else {\n proof[0] = Mimc.hash(_rawProof[formattedProofLength]);\n }\n\n return (nextFreeNode, leafHash, proof);\n }\n\n /**\n * @notice Check if bytes contain only zero byte elements\n * @param _data Bytes to be checked\n * @return isZeroBytes true if bytes contain only zero byte elements, false otherwise\n */\n function _isZeroBytes(\n bytes calldata _data\n ) private pure returns (bool isZeroBytes) {\n if (_data.length % 0x20 != 0) {\n revert LengthNotMod32();\n }\n\n isZeroBytes = true;\n assembly {\n let dataStart := _data.offset\n\n for {\n let currentPtr := dataStart\n } lt(currentPtr, add(dataStart, _data.length)) {\n currentPtr := add(currentPtr, 0x20)\n } {\n let dataWord := calldataload(currentPtr)\n\n if eq(iszero(dataWord), 0) {\n isZeroBytes := 0\n break\n }\n }\n }\n }\n\n /**\n * @notice Computes merkle root from proof and compares it to the provided root\n * @param _proof Sparse merkle tree proof\n * @param _leafHash Leaf hash\n * @param _leafIndex Index of the leaf\n * @param _root Sparse merkle root\n * @param _nextFreeNode Next free node\n * @return If the computed merkle root matches the provided one\n */\n function _verify(\n bytes32[] memory _proof,\n bytes32 _leafHash,\n uint256 _leafIndex,\n bytes32 _root,\n bytes32 _nextFreeNode\n ) private pure returns (bool) {\n bytes32 computedHash = _leafHash;\n uint256 currentIndex = _leafIndex;\n\n if (_leafIndex > MAX_TREE_LEAF_INDEX) {\n revert MaxTreeLeafIndexExceed();\n }\n\n for (uint256 height; height < TREE_DEPTH; ++height) {\n if ((currentIndex >> height) & 1 == 1)\n computedHash = Mimc.hash(\n abi.encodePacked(_proof[height], computedHash)\n );\n else\n computedHash = Mimc.hash(\n abi.encodePacked(computedHash, _proof[height])\n );\n }\n\n return\n Mimc.hash(abi.encodePacked(_nextFreeNode, computedHash)) == _root;\n }\n}\n" + }, + "linea-state-verifier/contracts/LineaProofHelper.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.25;\nimport {SparseMerkleProof} from \"./lib/SparseMerkleProof.sol\";\n\nuint256 constant LAST_LEAF_INDEX = 41;\n\nstruct AccountProof {\n bytes value;\n bytes[] proofRelatedNodes;\n}\n\nstruct StorageProof {\n bytes32 value;\n bytes[] proofRelatedNodes;\n}\n\nstruct AccountProofStruct {\n address key;\n uint256 leafIndex;\n AccountProof proof;\n}\n\nstruct StorageProofStruct {\n bytes32 key;\n uint256 leafIndex;\n StorageProof proof;\n bool initialized;\n}\n\nuint8 constant OP_CONSTANT = 0x00;\nuint8 constant OP_BACKREF = 0x20;\nuint8 constant FLAG_DYNAMIC = 0x01;\n\nlibrary LineaProofHelper {\n error UnknownOpcode(uint8);\n error InvalidSlotSize(uint256 size);\n\n function executeOperation(\n bytes1 operation,\n bytes[] memory constants,\n bytes[] memory values\n ) private pure returns (bytes memory) {\n uint8 opcode = uint8(operation) & 0xe0;\n uint8 operand = uint8(operation) & 0x1f;\n\n if (opcode == OP_CONSTANT) {\n return constants[operand];\n } else if (opcode == OP_BACKREF) {\n return values[operand];\n } else {\n revert UnknownOpcode(opcode);\n }\n }\n\n function computeFirstSlot(\n bytes32 command,\n bytes[] memory constants,\n bytes[] memory values\n ) private pure returns (bool isDynamic, uint256 slot) {\n uint8 flags = uint8(command[0]);\n isDynamic = (flags & FLAG_DYNAMIC) != 0;\n\n bytes memory slotData = executeOperation(command[1], constants, values);\n require(slotData.length == 32, \"First path element must be 32 bytes\");\n slot = uint256(bytes32(slotData));\n\n for (uint256 j = 2; j < 32 && command[j] != 0xff; j++) {\n bytes memory index = executeOperation(\n command[j],\n constants,\n values\n );\n slot = uint256(keccak256(abi.encodePacked(index, slot)));\n }\n }\n\n function getDynamicValue(\n uint256 slot,\n uint256 proofIdx,\n StorageProofStruct[] memory storageProofs,\n SparseMerkleProof.Account memory account\n ) private pure returns (bytes memory value, uint256 newProofIdx) {\n if (!storageProofs[proofIdx].initialized) {\n return (\"\", proofIdx++);\n }\n verifyStorageProof(\n account,\n storageProofs[proofIdx].leafIndex,\n storageProofs[proofIdx].proof.proofRelatedNodes,\n storageProofs[proofIdx].proof.value,\n bytes32(slot)\n );\n uint256 firstValue = uint256(storageProofs[proofIdx++].proof.value);\n if (firstValue & 0x01 == 0x01) {\n // Long value: first slot is `length * 2 + 1`, following slots are data.\n slot = uint256(keccak256(abi.encodePacked(slot)));\n value = new bytes(firstValue >> 1);\n uint256 off;\n while (off < value.length) {\n verifyStorageProof(\n account,\n storageProofs[proofIdx].leafIndex,\n storageProofs[proofIdx].proof.proofRelatedNodes,\n storageProofs[proofIdx].proof.value,\n bytes32(slot++)\n );\n off += 32;\n bytes32 temp = storageProofs[proofIdx++].proof.value;\n assembly {\n mstore(add(value, off), temp)\n }\n }\n return (value, proofIdx);\n } else {\n uint256 length = (firstValue & 0xFF) >> 1;\n return (sliceBytes(abi.encode(firstValue), 0, length), proofIdx);\n }\n }\n\n function sliceBytes(\n bytes memory data,\n uint256 start,\n uint256 length\n ) public pure returns (bytes memory) {\n require(start + length <= data.length, \"sliceBytes: out of range\");\n\n bytes memory result = new bytes(length);\n for (uint256 i = 0; i < length; i++) {\n result[i] = data[i + start];\n }\n\n return result;\n }\n\n function verifyAccountProof(\n address target,\n AccountProofStruct memory accountProof,\n bytes32 stateRoot\n ) private pure returns (bool) {\n // Verify the target contract first against the account proof's last leaf node's hkey\n bytes32 targetHash = SparseMerkleProof.mimcHash(abi.encode(target));\n SparseMerkleProof.Leaf memory accountLeaf = SparseMerkleProof.getLeaf(\n accountProof.proof.proofRelatedNodes[LAST_LEAF_INDEX]\n );\n bytes32 hKey = accountLeaf.hKey;\n\n require(targetHash == hKey, \"LineaProofHelper: wrong target\");\n\n // Verify the account's proof itself\n bool accountProofVerified = SparseMerkleProof.verifyProof(\n accountProof.proof.proofRelatedNodes,\n accountProof.leafIndex,\n stateRoot\n );\n\n bytes32 hAccountValue = SparseMerkleProof.hashAccountValue(\n accountProof.proof.value\n );\n\n require(\n accountProofVerified && accountLeaf.hValue == hAccountValue,\n \"LineaProofHelper: invalid account proof\"\n );\n\n return true;\n }\n\n function verifyStorageProof(\n SparseMerkleProof.Account memory account,\n uint256 leafIndex,\n bytes[] memory proof,\n bytes32 value,\n bytes32 key\n ) private pure {\n bool storageProofVerified = SparseMerkleProof.verifyProof(\n proof,\n leafIndex,\n account.storageRoot\n );\n\n SparseMerkleProof.Leaf memory storageLeaf = SparseMerkleProof.getLeaf(\n proof[LAST_LEAF_INDEX]\n );\n\n // Verify the key\n bytes32 hKey = SparseMerkleProof.hashStorageValue(key);\n\n // Verify the storage value\n bytes32 hValue = SparseMerkleProof.hashStorageValue(value);\n require(\n storageProofVerified &&\n storageLeaf.hKey == hKey &&\n storageLeaf.hValue == hValue,\n \"LineaProofHelper: invalid storage proof\"\n );\n }\n\n function getStorageValues(\n address target,\n bytes32[] memory commands,\n bytes[] memory constants,\n bytes32 stateRoot,\n AccountProofStruct memory accountProof,\n StorageProofStruct[] memory storageProofs\n ) internal pure returns (bytes[] memory values) {\n require(\n commands.length <= storageProofs.length,\n \"LineaProofHelper: commands number > storage proofs number\"\n );\n verifyAccountProof(target, accountProof, stateRoot);\n SparseMerkleProof.Account memory account = SparseMerkleProof.getAccount(\n accountProof.proof.value\n );\n uint256 proofIdx = 0;\n values = new bytes[](commands.length);\n for (uint256 i = 0; i < commands.length; i++) {\n bytes32 command = commands[i];\n (bool isDynamic, uint256 slot) = computeFirstSlot(\n command,\n constants,\n values\n );\n if (!isDynamic) {\n if (!storageProofs[proofIdx].initialized) {\n values[i] = abi.encode(0);\n proofIdx++;\n } else {\n verifyStorageProof(\n account,\n storageProofs[proofIdx].leafIndex,\n storageProofs[proofIdx].proof.proofRelatedNodes,\n storageProofs[proofIdx].proof.value,\n bytes32(slot)\n );\n\n values[i] = abi.encode(\n storageProofs[proofIdx++].proof.value\n );\n\n if (values[i].length > 32) {\n revert InvalidSlotSize(values[i].length);\n }\n }\n } else {\n (values[i], proofIdx) = getDynamicValue(\n slot,\n proofIdx,\n storageProofs,\n account\n );\n }\n }\n }\n}\n" + }, + "linea-state-verifier/contracts/LineaSparseProofVerifier.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.25;\n\nimport {IEVMVerifier} from \"./IEVMVerifier.sol\";\nimport {StorageProofStruct, AccountProofStruct, LineaProofHelper} from \"./LineaProofHelper.sol\";\n\ninterface IRollup {\n function stateRootHashes(\n uint256 l2blockNumber\n ) external view returns (bytes32);\n\n function currentL2BlockNumber() external view returns (uint256);\n}\n\ncontract LineaSparseProofVerifier is IEVMVerifier {\n string[] public _gatewayURLs;\n address public _rollup;\n\n constructor(string[] memory urls, address rollup) {\n _gatewayURLs = urls;\n _rollup = rollup;\n }\n\n function getStorageValues(\n address target,\n bytes32[] memory commands,\n bytes[] memory constants,\n bytes memory proof,\n uint256 acceptedL2BlockRangeLength\n ) external view returns (bytes[] memory values) {\n (\n uint256 blockNo,\n AccountProofStruct memory accountProof,\n StorageProofStruct[] memory storageProofs\n ) = abi.decode(\n proof,\n (uint256, AccountProofStruct, StorageProofStruct[])\n );\n\n // Check that the L2 block number used is a recent one and is part of the range accepted\n uint256 currentL2BlockNumber = IRollup(_rollup).currentL2BlockNumber();\n require(\n (currentL2BlockNumber <= acceptedL2BlockRangeLength &&\n blockNo <= currentL2BlockNumber) ||\n (blockNo >= currentL2BlockNumber - acceptedL2BlockRangeLength),\n \"LineaSparseProofVerifier: block not in range accepted\"\n );\n\n bytes32 stateRoot = IRollup(_rollup).stateRootHashes(blockNo);\n require(\n stateRoot != bytes32(0),\n \"LineaSparseProofVerifier: invalid state root\"\n );\n\n return\n LineaProofHelper.getStorageValues(\n target,\n commands,\n constants,\n stateRoot,\n accountProof,\n storageProofs\n );\n }\n\n function gatewayURLs() external view override returns (string[] memory) {\n return _gatewayURLs;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "viaIR": true, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file