Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 1,479 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Prove And Claim ... | 21644790 | 3 days ago | IN | 0 ETH | 0.0046042 | ||||
Prove And Claim ... | 21639548 | 4 days ago | IN | 0 ETH | 0.02024114 | ||||
Prove And Claim ... | 21633533 | 5 days ago | IN | 0 ETH | 0.02168962 | ||||
Prove And Claim ... | 21607721 | 9 days ago | IN | 0 ETH | 0.0062934 | ||||
Prove And Claim ... | 21607487 | 9 days ago | IN | 0 ETH | 0.00658458 | ||||
Prove And Claim ... | 21604981 | 9 days ago | IN | 0 ETH | 0.00854169 | ||||
Prove And Claim ... | 21586654 | 11 days ago | IN | 0 ETH | 0.01264379 | ||||
Prove And Claim ... | 21584717 | 12 days ago | IN | 0 ETH | 0.00290549 | ||||
Prove And Claim ... | 21572702 | 13 days ago | IN | 0 ETH | 0.04325101 | ||||
Prove And Claim ... | 21548360 | 17 days ago | IN | 0 ETH | 0.01871239 | ||||
Prove And Claim ... | 21524483 | 20 days ago | IN | 0 ETH | 0.03296664 | ||||
Prove And Claim ... | 21511760 | 22 days ago | IN | 0 ETH | 0.01294434 | ||||
Prove And Claim ... | 21502749 | 23 days ago | IN | 0 ETH | 0.01865305 | ||||
Prove And Claim ... | 21501983 | 23 days ago | IN | 0 ETH | 0.01757313 | ||||
Prove And Claim ... | 21481856 | 26 days ago | IN | 0 ETH | 0.0160681 | ||||
Prove And Claim ... | 21479060 | 26 days ago | IN | 0 ETH | 0.02556757 | ||||
Prove And Claim ... | 21457482 | 30 days ago | IN | 0 ETH | 0.03164764 | ||||
Prove And Claim ... | 21455399 | 30 days ago | IN | 0 ETH | 0.03537627 | ||||
Prove And Claim ... | 21443991 | 31 days ago | IN | 0 ETH | 0.08454029 | ||||
Prove And Claim | 21426475 | 34 days ago | IN | 0 ETH | 0.03259683 | ||||
Prove And Claim ... | 21420773 | 35 days ago | IN | 0 ETH | 0.02603889 | ||||
Prove And Claim ... | 21418699 | 35 days ago | IN | 0 ETH | 0.03857234 | ||||
Prove And Claim | 21408404 | 36 days ago | IN | 0 ETH | 0.02608716 | ||||
Prove And Claim ... | 21381475 | 40 days ago | IN | 0 ETH | 0.19143396 | ||||
Prove And Claim ... | 21357386 | 43 days ago | IN | 0 ETH | 0.02524932 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x6BD6e91a...3296707Aa The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
DNSRegistrar
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "@ensdomains/buffer/contracts/Buffer.sol"; import "../dnssec-oracle/BytesUtils.sol"; import "../dnssec-oracle/DNSSEC.sol"; import "../dnssec-oracle/RRUtils.sol"; import "../registry/ENSRegistry.sol"; import "../root/Root.sol"; import "../resolvers/profiles/AddrResolver.sol"; import "./DNSClaimChecker.sol"; import "./PublicSuffixList.sol"; import "./IDNSRegistrar.sol"; /** * @dev An ENS registrar that allows the owner of a DNS name to claim the * corresponding name in ENS. */ contract DNSRegistrar is IDNSRegistrar, IERC165 { using BytesUtils for bytes; using Buffer for Buffer.buffer; using RRUtils for *; ENS public immutable ens; DNSSEC public immutable oracle; PublicSuffixList public suffixes; address public immutable previousRegistrar; address public immutable resolver; // A mapping of the most recent signatures seen for each claimed domain. mapping(bytes32 => uint32) public inceptions; error NoOwnerRecordFound(); error PermissionDenied(address caller, address owner); error PreconditionNotMet(); error StaleProof(); error InvalidPublicSuffix(bytes name); struct OwnerRecord { bytes name; address owner; address resolver; uint64 ttl; } event Claim( bytes32 indexed node, address indexed owner, bytes dnsname, uint32 inception ); event NewPublicSuffixList(address suffixes); constructor( address _previousRegistrar, address _resolver, DNSSEC _dnssec, PublicSuffixList _suffixes, ENS _ens ) { previousRegistrar = _previousRegistrar; resolver = _resolver; oracle = _dnssec; suffixes = _suffixes; emit NewPublicSuffixList(address(suffixes)); ens = _ens; } /** * @dev This contract's owner-only functions can be invoked by the owner of the ENS root. */ modifier onlyOwner() { Root root = Root(ens.owner(bytes32(0))); address owner = root.owner(); require(msg.sender == owner); _; } function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner { suffixes = _suffixes; emit NewPublicSuffixList(address(suffixes)); } /** * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs. * @param name The name to claim, in DNS wire format. * @param input A chain of signed DNS RRSETs ending with a text record. */ function proveAndClaim( bytes memory name, DNSSEC.RRSetWithSignature[] memory input ) public override { (bytes32 rootNode, bytes32 labelHash, address addr) = _claim( name, input ); ens.setSubnodeOwner(rootNode, labelHash, addr); } function proveAndClaimWithResolver( bytes memory name, DNSSEC.RRSetWithSignature[] memory input, address resolver, address addr ) public override { (bytes32 rootNode, bytes32 labelHash, address owner) = _claim( name, input ); if (msg.sender != owner) { revert PermissionDenied(msg.sender, owner); } ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0); if (addr != address(0)) { if (resolver == address(0)) { revert PreconditionNotMet(); } bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash)); // Set the resolver record AddrResolver(resolver).setAddr(node, addr); } } function supportsInterface( bytes4 interfaceID ) external pure override returns (bool) { return interfaceID == type(IERC165).interfaceId || interfaceID == type(IDNSRegistrar).interfaceId; } function _claim( bytes memory name, DNSSEC.RRSetWithSignature[] memory input ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) { (bytes memory data, uint32 inception) = oracle.verifyRRSet(input); // Get the first label uint256 labelLen = name.readUint8(0); labelHash = name.keccak(1, labelLen); bytes memory parentName = name.substring( labelLen + 1, name.length - labelLen - 1 ); // Make sure the parent name is enabled parentNode = enableNode(parentName); bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash)); if (!RRUtils.serialNumberGte(inception, inceptions[node])) { revert StaleProof(); } inceptions[node] = inception; bool found; (addr, found) = DNSClaimChecker.getOwnerAddress(name, data); if (!found) { revert NoOwnerRecordFound(); } emit Claim(node, addr, name, inception); } function enableNode(bytes memory domain) public returns (bytes32 node) { // Name must be in the public suffix list. if (!suffixes.isPublicSuffix(domain)) { revert InvalidPublicSuffix(domain); } return _enableNode(domain, 0); } function _enableNode( bytes memory domain, uint256 offset ) internal returns (bytes32 node) { uint256 len = domain.readUint8(offset); if (len == 0) { return bytes32(0); } bytes32 parentNode = _enableNode(domain, offset + len + 1); bytes32 label = domain.keccak(offset + 1, len); node = keccak256(abi.encodePacked(parentNode, label)); address owner = ens.owner(node); if (owner == address(0) || owner == previousRegistrar) { if (parentNode == bytes32(0)) { Root root = Root(ens.owner(bytes32(0))); root.setSubnodeOwner(label, address(this)); ens.setResolver(node, resolver); } else { ens.setSubnodeRecord( parentNode, label, address(this), resolver, 0 ); } } else if (owner != address(this)) { revert PreconditionNotMet(); } return node; } }
// SPDX-License-Identifier: BSD-2-Clause pragma solidity ^0.8.4; /** * @dev A library for working with mutable byte buffers in Solidity. * * Byte buffers are mutable and expandable, and provide a variety of primitives * for appending to them. At any time you can fetch a bytes object containing the * current contents of the buffer. The bytes object should not be stored between * operations, as it may change due to resizing of the buffer. */ library Buffer { /** * @dev Represents a mutable buffer. Buffers have a current value (buf) and * a capacity. The capacity may be longer than the current value, in * which case it can be extended without the need to allocate more memory. */ struct buffer { bytes buf; uint capacity; } /** * @dev Initializes a buffer with an initial capacity. * @param buf The buffer to initialize. * @param capacity The number of bytes of space to allocate the buffer. * @return The buffer, for chaining. */ function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) { if (capacity % 32 != 0) { capacity += 32 - (capacity % 32); } // Allocate space for the buffer data buf.capacity = capacity; assembly { let ptr := mload(0x40) mstore(buf, ptr) mstore(ptr, 0) let fpm := add(32, add(ptr, capacity)) if lt(fpm, ptr) { revert(0, 0) } mstore(0x40, fpm) } return buf; } /** * @dev Initializes a new buffer from an existing bytes object. * Changes to the buffer may mutate the original value. * @param b The bytes object to initialize the buffer with. * @return A new buffer. */ function fromBytes(bytes memory b) internal pure returns(buffer memory) { buffer memory buf; buf.buf = b; buf.capacity = b.length; return buf; } function resize(buffer memory buf, uint capacity) private pure { bytes memory oldbuf = buf.buf; init(buf, capacity); append(buf, oldbuf); } /** * @dev Sets buffer length to 0. * @param buf The buffer to truncate. * @return The original buffer, for chaining.. */ function truncate(buffer memory buf) internal pure returns (buffer memory) { assembly { let bufptr := mload(buf) mstore(bufptr, 0) } return buf; } /** * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed * the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @param len The number of bytes to copy. * @return The original buffer, for chaining. */ function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) { require(len <= data.length); uint off = buf.buf.length; uint newCapacity = off + len; if (newCapacity > buf.capacity) { resize(buf, newCapacity * 2); } uint dest; uint src; assembly { // Memory address of the buffer data let bufptr := mload(buf) // Length of existing buffer data let buflen := mload(bufptr) // Start address = buffer address + offset + sizeof(buffer length) dest := add(add(bufptr, 32), off) // Update buffer length if we're extending it if gt(newCapacity, buflen) { mstore(bufptr, newCapacity) } src := add(data, 32) } // Copy word-length chunks while possible for (; len >= 32; len -= 32) { assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } // Copy remaining bytes unchecked { uint mask = (256 ** (32 - len)) - 1; assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } } return buf; } /** * @dev Appends a byte string to a buffer. Resizes if doing so would exceed * the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @return The original buffer, for chaining. */ function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) { return append(buf, data, data.length); } /** * @dev Appends a byte to the buffer. Resizes if doing so would exceed the * capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @return The original buffer, for chaining. */ function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) { uint off = buf.buf.length; uint offPlusOne = off + 1; if (off >= buf.capacity) { resize(buf, offPlusOne * 2); } assembly { // Memory address of the buffer data let bufptr := mload(buf) // Address = buffer address + sizeof(buffer length) + off let dest := add(add(bufptr, off), 32) mstore8(dest, data) // Update buffer length if we extended it if gt(offPlusOne, mload(bufptr)) { mstore(bufptr, offPlusOne) } } return buf; } /** * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would * exceed the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @param len The number of bytes to write (left-aligned). * @return The original buffer, for chaining. */ function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) { uint off = buf.buf.length; uint newCapacity = len + off; if (newCapacity > buf.capacity) { resize(buf, newCapacity * 2); } unchecked { uint mask = (256 ** len) - 1; // Right-align data data = data >> (8 * (32 - len)); assembly { // Memory address of the buffer data let bufptr := mload(buf) // Address = buffer address + sizeof(buffer length) + newCapacity let dest := add(bufptr, newCapacity) mstore(dest, or(and(mload(dest), not(mask)), data)) // Update buffer length if we extended it if gt(newCapacity, mload(bufptr)) { mstore(bufptr, newCapacity) } } } return buf; } /** * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed * the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @return The original buffer, for chhaining. */ function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) { return append(buf, bytes32(data), 20); } /** * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed * the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @return The original buffer, for chaining. */ function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) { return append(buf, data, 32); } /** * @dev Appends a byte to the end of the buffer. Resizes if doing so would * exceed the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @param len The number of bytes to write (right-aligned). * @return The original buffer. */ function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) { uint off = buf.buf.length; uint newCapacity = len + off; if (newCapacity > buf.capacity) { resize(buf, newCapacity * 2); } uint mask = (256 ** len) - 1; assembly { // Memory address of the buffer data let bufptr := mload(buf) // Address = buffer address + sizeof(buffer length) + newCapacity let dest := add(bufptr, newCapacity) mstore(dest, or(and(mload(dest), not(mask)), data)) // Update buffer length if we extended it if gt(newCapacity, mload(bufptr)) { mstore(bufptr, newCapacity) } } return buf; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "../dnssec-oracle/DNSSEC.sol"; import "../dnssec-oracle/BytesUtils.sol"; import "../dnssec-oracle/RRUtils.sol"; import "../utils/HexUtils.sol"; import "@ensdomains/buffer/contracts/Buffer.sol"; library DNSClaimChecker { using BytesUtils for bytes; using HexUtils for bytes; using RRUtils for *; using Buffer for Buffer.buffer; uint16 constant CLASS_INET = 1; uint16 constant TYPE_TXT = 16; function getOwnerAddress( bytes memory name, bytes memory data ) internal pure returns (address, bool) { // Add "_ens." to the front of the name. Buffer.buffer memory buf; buf.init(name.length + 5); buf.append("\x04_ens"); buf.append(name); for ( RRUtils.RRIterator memory iter = data.iterateRRs(0); !iter.done(); iter.next() ) { if (iter.name().compareNames(buf.buf) != 0) continue; bool found; address addr; (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset); if (found) { return (addr, true); } } return (address(0x0), false); } function parseRR( bytes memory rdata, uint256 idx, uint256 endIdx ) internal pure returns (address, bool) { while (idx < endIdx) { uint256 len = rdata.readUint8(idx); idx += 1; bool found; address addr; (addr, found) = parseString(rdata, idx, len); if (found) return (addr, true); idx += len; } return (address(0x0), false); } function parseString( bytes memory str, uint256 idx, uint256 len ) internal pure returns (address, bool) { // TODO: More robust parsing that handles whitespace and multiple key/value pairs if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x' return str.hexToAddress(idx + 4, idx + len); } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "../dnssec-oracle/DNSSEC.sol"; interface IDNSRegistrar { function proveAndClaim( bytes memory name, DNSSEC.RRSetWithSignature[] memory input ) external; function proveAndClaimWithResolver( bytes memory name, DNSSEC.RRSetWithSignature[] memory input, address resolver, address addr ) external; }
pragma solidity ^0.8.4; interface PublicSuffixList { function isPublicSuffix(bytes calldata name) external view returns (bool); }
pragma solidity ^0.8.4; library BytesUtils { error OffsetOutOfBoundsError(uint256 offset, uint256 length); /* * @dev Returns the keccak-256 hash of a byte range. * @param self The byte string to hash. * @param offset The position to start hashing at. * @param len The number of bytes to hash. * @return The hash of the byte range. */ function keccak( bytes memory self, uint256 offset, uint256 len ) internal pure returns (bytes32 ret) { require(offset + len <= self.length); assembly { ret := keccak256(add(add(self, 32), offset), len) } } /* * @dev Returns a positive number if `other` comes lexicographically after * `self`, a negative number if it comes before, or zero if the * contents of the two bytes are equal. * @param self The first bytes to compare. * @param other The second bytes to compare. * @return The result of the comparison. */ function compare( bytes memory self, bytes memory other ) internal pure returns (int256) { return compare(self, 0, self.length, other, 0, other.length); } /* * @dev Returns a positive number if `other` comes lexicographically after * `self`, a negative number if it comes before, or zero if the * contents of the two bytes are equal. Comparison is done per-rune, * on unicode codepoints. * @param self The first bytes to compare. * @param offset The offset of self. * @param len The length of self. * @param other The second bytes to compare. * @param otheroffset The offset of the other string. * @param otherlen The length of the other string. * @return The result of the comparison. */ function compare( bytes memory self, uint256 offset, uint256 len, bytes memory other, uint256 otheroffset, uint256 otherlen ) internal pure returns (int256) { if (offset + len > self.length) { revert OffsetOutOfBoundsError(offset + len, self.length); } if (otheroffset + otherlen > other.length) { revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length); } uint256 shortest = len; if (otherlen < len) shortest = otherlen; uint256 selfptr; uint256 otherptr; assembly { selfptr := add(self, add(offset, 32)) otherptr := add(other, add(otheroffset, 32)) } for (uint256 idx = 0; idx < shortest; idx += 32) { uint256 a; uint256 b; assembly { a := mload(selfptr) b := mload(otherptr) } if (a != b) { // Mask out irrelevant bytes and check again uint256 mask; if (shortest - idx >= 32) { mask = type(uint256).max; } else { mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1); } int256 diff = int256(a & mask) - int256(b & mask); if (diff != 0) return diff; } selfptr += 32; otherptr += 32; } return int256(len) - int256(otherlen); } /* * @dev Returns true if the two byte ranges are equal. * @param self The first byte range to compare. * @param offset The offset into the first byte range. * @param other The second byte range to compare. * @param otherOffset The offset into the second byte range. * @param len The number of bytes to compare * @return True if the byte ranges are equal, false otherwise. */ function equals( bytes memory self, uint256 offset, bytes memory other, uint256 otherOffset, uint256 len ) internal pure returns (bool) { return keccak(self, offset, len) == keccak(other, otherOffset, len); } /* * @dev Returns true if the two byte ranges are equal with offsets. * @param self The first byte range to compare. * @param offset The offset into the first byte range. * @param other The second byte range to compare. * @param otherOffset The offset into the second byte range. * @return True if the byte ranges are equal, false otherwise. */ function equals( bytes memory self, uint256 offset, bytes memory other, uint256 otherOffset ) internal pure returns (bool) { return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset); } /* * @dev Compares a range of 'self' to all of 'other' and returns True iff * they are equal. * @param self The first byte range to compare. * @param offset The offset into the first byte range. * @param other The second byte range to compare. * @return True if the byte ranges are equal, false otherwise. */ function equals( bytes memory self, uint256 offset, bytes memory other ) internal pure returns (bool) { return self.length == offset + other.length && equals(self, offset, other, 0, other.length); } /* * @dev Returns true if the two byte ranges are equal. * @param self The first byte range to compare. * @param other The second byte range to compare. * @return True if the byte ranges are equal, false otherwise. */ function equals( bytes memory self, bytes memory other ) internal pure returns (bool) { return self.length == other.length && equals(self, 0, other, 0, self.length); } /* * @dev Returns the 8-bit number at the specified index of self. * @param self The byte string. * @param idx The index into the bytes * @return The specified 8 bits of the string, interpreted as an integer. */ function readUint8( bytes memory self, uint256 idx ) internal pure returns (uint8 ret) { return uint8(self[idx]); } /* * @dev Returns the 16-bit number at the specified index of self. * @param self The byte string. * @param idx The index into the bytes * @return The specified 16 bits of the string, interpreted as an integer. */ function readUint16( bytes memory self, uint256 idx ) internal pure returns (uint16 ret) { require(idx + 2 <= self.length); assembly { ret := and(mload(add(add(self, 2), idx)), 0xFFFF) } } /* * @dev Returns the 32-bit number at the specified index of self. * @param self The byte string. * @param idx The index into the bytes * @return The specified 32 bits of the string, interpreted as an integer. */ function readUint32( bytes memory self, uint256 idx ) internal pure returns (uint32 ret) { require(idx + 4 <= self.length); assembly { ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF) } } /* * @dev Returns the 32 byte value at the specified index of self. * @param self The byte string. * @param idx The index into the bytes * @return The specified 32 bytes of the string. */ function readBytes32( bytes memory self, uint256 idx ) internal pure returns (bytes32 ret) { require(idx + 32 <= self.length); assembly { ret := mload(add(add(self, 32), idx)) } } /* * @dev Returns the 32 byte value at the specified index of self. * @param self The byte string. * @param idx The index into the bytes * @return The specified 32 bytes of the string. */ function readBytes20( bytes memory self, uint256 idx ) internal pure returns (bytes20 ret) { require(idx + 20 <= self.length); assembly { ret := and( mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000 ) } } /* * @dev Returns the n byte value at the specified index of self. * @param self The byte string. * @param idx The index into the bytes. * @param len The number of bytes. * @return The specified 32 bytes of the string. */ function readBytesN( bytes memory self, uint256 idx, uint256 len ) internal pure returns (bytes32 ret) { require(len <= 32); require(idx + len <= self.length); assembly { let mask := not(sub(exp(256, sub(32, len)), 1)) ret := and(mload(add(add(self, 32), idx)), mask) } } function memcpy(uint256 dest, uint256 src, uint256 len) private pure { // Copy word-length chunks while possible for (; len >= 32; len -= 32) { assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } // Copy remaining bytes unchecked { uint256 mask = (256 ** (32 - len)) - 1; assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } } } /* * @dev Copies a substring into a new byte string. * @param self The byte string to copy from. * @param offset The offset to start copying at. * @param len The number of bytes to copy. */ function substring( bytes memory self, uint256 offset, uint256 len ) internal pure returns (bytes memory) { require(offset + len <= self.length); bytes memory ret = new bytes(len); uint256 dest; uint256 src; assembly { dest := add(ret, 32) src := add(add(self, 32), offset) } memcpy(dest, src, len); return ret; } // Maps characters from 0x30 to 0x7A to their base32 values. // 0xFF represents invalid characters in that range. bytes constant base32HexTable = hex"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F"; /** * @dev Decodes unpadded base32 data of up to one word in length. * @param self The data to decode. * @param off Offset into the string to start at. * @param len Number of characters to decode. * @return The decoded data, left aligned. */ function base32HexDecodeWord( bytes memory self, uint256 off, uint256 len ) internal pure returns (bytes32) { require(len <= 52); uint256 ret = 0; uint8 decoded; for (uint256 i = 0; i < len; i++) { bytes1 char = self[off + i]; require(char >= 0x30 && char <= 0x7A); decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]); require(decoded <= 0x20); if (i == len - 1) { break; } ret = (ret << 5) | decoded; } uint256 bitlen = len * 5; if (len % 8 == 0) { // Multiple of 8 characters, no padding ret = (ret << 5) | decoded; } else if (len % 8 == 2) { // Two extra characters - 1 byte ret = (ret << 3) | (decoded >> 2); bitlen -= 2; } else if (len % 8 == 4) { // Four extra characters - 2 bytes ret = (ret << 1) | (decoded >> 4); bitlen -= 4; } else if (len % 8 == 5) { // Five extra characters - 3 bytes ret = (ret << 4) | (decoded >> 1); bitlen -= 1; } else if (len % 8 == 7) { // Seven extra characters - 4 bytes ret = (ret << 2) | (decoded >> 3); bitlen -= 3; } else { revert(); } return bytes32(ret << (256 - bitlen)); } /** * @dev Finds the first occurrence of the byte `needle` in `self`. * @param self The string to search * @param off The offset to start searching at * @param len The number of bytes to search * @param needle The byte to search for * @return The offset of `needle` in `self`, or 2**256-1 if it was not found. */ function find( bytes memory self, uint256 off, uint256 len, bytes1 needle ) internal pure returns (uint256) { for (uint256 idx = off; idx < off + len; idx++) { if (self[idx] == needle) { return idx; } } return type(uint256).max; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; pragma experimental ABIEncoderV2; abstract contract DNSSEC { bytes public anchors; struct RRSetWithSignature { bytes rrset; bytes sig; } event AlgorithmUpdated(uint8 id, address addr); event DigestUpdated(uint8 id, address addr); function verifyRRSet( RRSetWithSignature[] memory input ) external view virtual returns (bytes memory rrs, uint32 inception); function verifyRRSet( RRSetWithSignature[] memory input, uint256 now ) public view virtual returns (bytes memory rrs, uint32 inception); }
pragma solidity ^0.8.4; import "./BytesUtils.sol"; import "@ensdomains/buffer/contracts/Buffer.sol"; /** * @dev RRUtils is a library that provides utilities for parsing DNS resource records. */ library RRUtils { using BytesUtils for *; using Buffer for *; /** * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'. * @param self The byte array to read a name from. * @param offset The offset to start reading at. * @return The length of the DNS name at 'offset', in bytes. */ function nameLength( bytes memory self, uint256 offset ) internal pure returns (uint256) { uint256 idx = offset; while (true) { assert(idx < self.length); uint256 labelLen = self.readUint8(idx); idx += labelLen + 1; if (labelLen == 0) { break; } } return idx - offset; } /** * @dev Returns a DNS format name at the specified offset of self. * @param self The byte array to read a name from. * @param offset The offset to start reading at. * @return ret The name. */ function readName( bytes memory self, uint256 offset ) internal pure returns (bytes memory ret) { uint256 len = nameLength(self, offset); return self.substring(offset, len); } /** * @dev Returns the number of labels in the DNS name at 'offset' in 'self'. * @param self The byte array to read a name from. * @param offset The offset to start reading at. * @return The number of labels in the DNS name at 'offset', in bytes. */ function labelCount( bytes memory self, uint256 offset ) internal pure returns (uint256) { uint256 count = 0; while (true) { assert(offset < self.length); uint256 labelLen = self.readUint8(offset); offset += labelLen + 1; if (labelLen == 0) { break; } count += 1; } return count; } uint256 constant RRSIG_TYPE = 0; uint256 constant RRSIG_ALGORITHM = 2; uint256 constant RRSIG_LABELS = 3; uint256 constant RRSIG_TTL = 4; uint256 constant RRSIG_EXPIRATION = 8; uint256 constant RRSIG_INCEPTION = 12; uint256 constant RRSIG_KEY_TAG = 16; uint256 constant RRSIG_SIGNER_NAME = 18; struct SignedSet { uint16 typeCovered; uint8 algorithm; uint8 labels; uint32 ttl; uint32 expiration; uint32 inception; uint16 keytag; bytes signerName; bytes data; bytes name; } function readSignedSet( bytes memory data ) internal pure returns (SignedSet memory self) { self.typeCovered = data.readUint16(RRSIG_TYPE); self.algorithm = data.readUint8(RRSIG_ALGORITHM); self.labels = data.readUint8(RRSIG_LABELS); self.ttl = data.readUint32(RRSIG_TTL); self.expiration = data.readUint32(RRSIG_EXPIRATION); self.inception = data.readUint32(RRSIG_INCEPTION); self.keytag = data.readUint16(RRSIG_KEY_TAG); self.signerName = readName(data, RRSIG_SIGNER_NAME); self.data = data.substring( RRSIG_SIGNER_NAME + self.signerName.length, data.length - RRSIG_SIGNER_NAME - self.signerName.length ); } function rrs( SignedSet memory rrset ) internal pure returns (RRIterator memory) { return iterateRRs(rrset.data, 0); } /** * @dev An iterator over resource records. */ struct RRIterator { bytes data; uint256 offset; uint16 dnstype; uint16 class; uint32 ttl; uint256 rdataOffset; uint256 nextOffset; } /** * @dev Begins iterating over resource records. * @param self The byte string to read from. * @param offset The offset to start reading at. * @return ret An iterator object. */ function iterateRRs( bytes memory self, uint256 offset ) internal pure returns (RRIterator memory ret) { ret.data = self; ret.nextOffset = offset; next(ret); } /** * @dev Returns true iff there are more RRs to iterate. * @param iter The iterator to check. * @return True iff the iterator has finished. */ function done(RRIterator memory iter) internal pure returns (bool) { return iter.offset >= iter.data.length; } /** * @dev Moves the iterator to the next resource record. * @param iter The iterator to advance. */ function next(RRIterator memory iter) internal pure { iter.offset = iter.nextOffset; if (iter.offset >= iter.data.length) { return; } // Skip the name uint256 off = iter.offset + nameLength(iter.data, iter.offset); // Read type, class, and ttl iter.dnstype = iter.data.readUint16(off); off += 2; iter.class = iter.data.readUint16(off); off += 2; iter.ttl = iter.data.readUint32(off); off += 4; // Read the rdata uint256 rdataLength = iter.data.readUint16(off); off += 2; iter.rdataOffset = off; iter.nextOffset = off + rdataLength; } /** * @dev Returns the name of the current record. * @param iter The iterator. * @return A new bytes object containing the owner name from the RR. */ function name(RRIterator memory iter) internal pure returns (bytes memory) { return iter.data.substring( iter.offset, nameLength(iter.data, iter.offset) ); } /** * @dev Returns the rdata portion of the current record. * @param iter The iterator. * @return A new bytes object containing the RR's RDATA. */ function rdata( RRIterator memory iter ) internal pure returns (bytes memory) { return iter.data.substring( iter.rdataOffset, iter.nextOffset - iter.rdataOffset ); } uint256 constant DNSKEY_FLAGS = 0; uint256 constant DNSKEY_PROTOCOL = 2; uint256 constant DNSKEY_ALGORITHM = 3; uint256 constant DNSKEY_PUBKEY = 4; struct DNSKEY { uint16 flags; uint8 protocol; uint8 algorithm; bytes publicKey; } function readDNSKEY( bytes memory data, uint256 offset, uint256 length ) internal pure returns (DNSKEY memory self) { self.flags = data.readUint16(offset + DNSKEY_FLAGS); self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL); self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM); self.publicKey = data.substring( offset + DNSKEY_PUBKEY, length - DNSKEY_PUBKEY ); } uint256 constant DS_KEY_TAG = 0; uint256 constant DS_ALGORITHM = 2; uint256 constant DS_DIGEST_TYPE = 3; uint256 constant DS_DIGEST = 4; struct DS { uint16 keytag; uint8 algorithm; uint8 digestType; bytes digest; } function readDS( bytes memory data, uint256 offset, uint256 length ) internal pure returns (DS memory self) { self.keytag = data.readUint16(offset + DS_KEY_TAG); self.algorithm = data.readUint8(offset + DS_ALGORITHM); self.digestType = data.readUint8(offset + DS_DIGEST_TYPE); self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST); } function isSubdomainOf( bytes memory self, bytes memory other ) internal pure returns (bool) { uint256 off = 0; uint256 counts = labelCount(self, 0); uint256 othercounts = labelCount(other, 0); while (counts > othercounts) { off = progress(self, off); counts--; } return self.equals(off, other, 0); } function compareNames( bytes memory self, bytes memory other ) internal pure returns (int256) { if (self.equals(other)) { return 0; } uint256 off; uint256 otheroff; uint256 prevoff; uint256 otherprevoff; uint256 counts = labelCount(self, 0); uint256 othercounts = labelCount(other, 0); // Keep removing labels from the front of the name until both names are equal length while (counts > othercounts) { prevoff = off; off = progress(self, off); counts--; } while (othercounts > counts) { otherprevoff = otheroff; otheroff = progress(other, otheroff); othercounts--; } // Compare the last nonequal labels to each other while (counts > 0 && !self.equals(off, other, otheroff)) { prevoff = off; off = progress(self, off); otherprevoff = otheroff; otheroff = progress(other, otheroff); counts -= 1; } if (off == 0) { return -1; } if (otheroff == 0) { return 1; } return self.compare( prevoff + 1, self.readUint8(prevoff), other, otherprevoff + 1, other.readUint8(otherprevoff) ); } /** * @dev Compares two serial numbers using RFC1982 serial number math. */ function serialNumberGte( uint32 i1, uint32 i2 ) internal pure returns (bool) { unchecked { return int32(i1) - int32(i2) >= 0; } } function progress( bytes memory body, uint256 off ) internal pure returns (uint256) { return off + 1 + body.readUint8(off); } /** * @dev Computes the keytag for a chunk of data. * @param data The data to compute a keytag for. * @return The computed key tag. */ function computeKeytag(bytes memory data) internal pure returns (uint16) { /* This function probably deserves some explanation. * The DNSSEC keytag function is a checksum that relies on summing up individual bytes * from the input string, with some mild bitshifting. Here's a Naive solidity implementation: * * function computeKeytag(bytes memory data) internal pure returns (uint16) { * uint ac; * for (uint i = 0; i < data.length; i++) { * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i); * } * return uint16(ac + (ac >> 16)); * } * * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations; * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's * large words work in our favour. * * The code below works by treating the input as a series of 256 bit words. It first masks out * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`. * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're * effectively summing 16 different numbers with each EVM ADD opcode. * * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together. * It does this using the same trick - mask out every other value, shift to align them, add them together. * After the first addition on both accumulators, there's enough room to add the two accumulators together, * and the remaining sums can be done just on ac1. */ unchecked { require(data.length <= 8192, "Long keys not permitted"); uint256 ac1; uint256 ac2; for (uint256 i = 0; i < data.length + 31; i += 32) { uint256 word; assembly { word := mload(add(add(data, 32), i)) } if (i + 32 > data.length) { uint256 unused = 256 - (data.length - i) * 8; word = (word >> unused) << unused; } ac1 += (word & 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >> 8; ac2 += (word & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF); } ac1 = (ac1 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) + ((ac1 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16); ac2 = (ac2 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) + ((ac2 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16); ac1 = (ac1 << 8) + ac2; ac1 = (ac1 & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) + ((ac1 & 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >> 32); ac1 = (ac1 & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) + ((ac1 & 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >> 64); ac1 = (ac1 & 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) + (ac1 >> 128); ac1 += (ac1 >> 16) & 0xFFFF; return uint16(ac1); } } }
pragma solidity >=0.8.4; interface ENS { // Logged when the owner of a node assigns a new owner to a subnode. event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner); // Logged when the owner of a node transfers ownership to a new account. event Transfer(bytes32 indexed node, address owner); // Logged when the resolver for a node changes. event NewResolver(bytes32 indexed node, address resolver); // Logged when the TTL of a node changes event NewTTL(bytes32 indexed node, uint64 ttl); // Logged when an operator is added or removed. event ApprovalForAll( address indexed owner, address indexed operator, bool approved ); function setRecord( bytes32 node, address owner, address resolver, uint64 ttl ) external; function setSubnodeRecord( bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl ) external; function setSubnodeOwner( bytes32 node, bytes32 label, address owner ) external returns (bytes32); function setResolver(bytes32 node, address resolver) external; function setOwner(bytes32 node, address owner) external; function setTTL(bytes32 node, uint64 ttl) external; function setApprovalForAll(address operator, bool approved) external; function owner(bytes32 node) external view returns (address); function resolver(bytes32 node) external view returns (address); function ttl(bytes32 node) external view returns (uint64); function recordExists(bytes32 node) external view returns (bool); function isApprovedForAll( address owner, address operator ) external view returns (bool); }
pragma solidity >=0.8.4; import "./ENS.sol"; /** * The ENS registry contract. */ contract ENSRegistry is ENS { struct Record { address owner; address resolver; uint64 ttl; } mapping(bytes32 => Record) records; mapping(address => mapping(address => bool)) operators; // Permits modifications only by the owner of the specified node. modifier authorised(bytes32 node) { address owner = records[node].owner; require(owner == msg.sender || operators[owner][msg.sender]); _; } /** * @dev Constructs a new ENS registry. */ constructor() public { records[0x0].owner = msg.sender; } /** * @dev Sets the record for a node. * @param node The node to update. * @param owner The address of the new owner. * @param resolver The address of the resolver. * @param ttl The TTL in seconds. */ function setRecord( bytes32 node, address owner, address resolver, uint64 ttl ) external virtual override { setOwner(node, owner); _setResolverAndTTL(node, resolver, ttl); } /** * @dev Sets the record for a subnode. * @param node The parent node. * @param label The hash of the label specifying the subnode. * @param owner The address of the new owner. * @param resolver The address of the resolver. * @param ttl The TTL in seconds. */ function setSubnodeRecord( bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl ) external virtual override { bytes32 subnode = setSubnodeOwner(node, label, owner); _setResolverAndTTL(subnode, resolver, ttl); } /** * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node. * @param node The node to transfer ownership of. * @param owner The address of the new owner. */ function setOwner( bytes32 node, address owner ) public virtual override authorised(node) { _setOwner(node, owner); emit Transfer(node, owner); } /** * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node. * @param node The parent node. * @param label The hash of the label specifying the subnode. * @param owner The address of the new owner. */ function setSubnodeOwner( bytes32 node, bytes32 label, address owner ) public virtual override authorised(node) returns (bytes32) { bytes32 subnode = keccak256(abi.encodePacked(node, label)); _setOwner(subnode, owner); emit NewOwner(node, label, owner); return subnode; } /** * @dev Sets the resolver address for the specified node. * @param node The node to update. * @param resolver The address of the resolver. */ function setResolver( bytes32 node, address resolver ) public virtual override authorised(node) { emit NewResolver(node, resolver); records[node].resolver = resolver; } /** * @dev Sets the TTL for the specified node. * @param node The node to update. * @param ttl The TTL in seconds. */ function setTTL( bytes32 node, uint64 ttl ) public virtual override authorised(node) { emit NewTTL(node, ttl); records[node].ttl = ttl; } /** * @dev Enable or disable approval for a third party ("operator") to manage * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event. * @param operator Address to add to the set of authorized operators. * @param approved True if the operator is approved, false to revoke approval. */ function setApprovalForAll( address operator, bool approved ) external virtual override { operators[msg.sender][operator] = approved; emit ApprovalForAll(msg.sender, operator, approved); } /** * @dev Returns the address that owns the specified node. * @param node The specified node. * @return address of the owner. */ function owner( bytes32 node ) public view virtual override returns (address) { address addr = records[node].owner; if (addr == address(this)) { return address(0x0); } return addr; } /** * @dev Returns the address of the resolver for the specified node. * @param node The specified node. * @return address of the resolver. */ function resolver( bytes32 node ) public view virtual override returns (address) { return records[node].resolver; } /** * @dev Returns the TTL of a node, and any records associated with it. * @param node The specified node. * @return ttl of the node. */ function ttl(bytes32 node) public view virtual override returns (uint64) { return records[node].ttl; } /** * @dev Returns whether a record has been imported to the registry. * @param node The specified node. * @return Bool if record exists */ function recordExists( bytes32 node ) public view virtual override returns (bool) { return records[node].owner != address(0x0); } /** * @dev Query if an address is an authorized operator for another address. * @param owner The address that owns the records. * @param operator The address that acts on behalf of the owner. * @return True if `operator` is an approved operator for `owner`, false otherwise. */ function isApprovedForAll( address owner, address operator ) external view virtual override returns (bool) { return operators[owner][operator]; } function _setOwner(bytes32 node, address owner) internal virtual { records[node].owner = owner; } function _setResolverAndTTL( bytes32 node, address resolver, uint64 ttl ) internal { if (resolver != records[node].resolver) { records[node].resolver = resolver; emit NewResolver(node, resolver); } if (ttl != records[node].ttl) { records[node].ttl = ttl; emit NewTTL(node, ttl); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "./profiles/IVersionableResolver.sol"; abstract contract ResolverBase is ERC165, IVersionableResolver { mapping(bytes32 => uint64) public recordVersions; function isAuthorised(bytes32 node) internal view virtual returns (bool); modifier authorised(bytes32 node) { require(isAuthorised(node)); _; } /** * Increments the record version associated with an ENS node. * May only be called by the owner of that node in the ENS registry. * @param node The node to update. */ function clearRecords(bytes32 node) public virtual authorised(node) { recordVersions[node]++; emit VersionChanged(node, recordVersions[node]); } function supportsInterface( bytes4 interfaceID ) public view virtual override returns (bool) { return interfaceID == type(IVersionableResolver).interfaceId || super.supportsInterface(interfaceID); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "../ResolverBase.sol"; import "./IAddrResolver.sol"; import "./IAddressResolver.sol"; abstract contract AddrResolver is IAddrResolver, IAddressResolver, ResolverBase { uint256 private constant COIN_TYPE_ETH = 60; mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses; /** * Sets the address associated with an ENS node. * May only be called by the owner of that node in the ENS registry. * @param node The node to update. * @param a The address to set. */ function setAddr( bytes32 node, address a ) external virtual authorised(node) { setAddr(node, COIN_TYPE_ETH, addressToBytes(a)); } /** * Returns the address associated with an ENS node. * @param node The ENS node to query. * @return The associated address. */ function addr( bytes32 node ) public view virtual override returns (address payable) { bytes memory a = addr(node, COIN_TYPE_ETH); if (a.length == 0) { return payable(0); } return bytesToAddress(a); } function setAddr( bytes32 node, uint256 coinType, bytes memory a ) public virtual authorised(node) { emit AddressChanged(node, coinType, a); if (coinType == COIN_TYPE_ETH) { emit AddrChanged(node, bytesToAddress(a)); } versionable_addresses[recordVersions[node]][node][coinType] = a; } function addr( bytes32 node, uint256 coinType ) public view virtual override returns (bytes memory) { return versionable_addresses[recordVersions[node]][node][coinType]; } function supportsInterface( bytes4 interfaceID ) public view virtual override returns (bool) { return interfaceID == type(IAddrResolver).interfaceId || interfaceID == type(IAddressResolver).interfaceId || super.supportsInterface(interfaceID); } function bytesToAddress( bytes memory b ) internal pure returns (address payable a) { require(b.length == 20); assembly { a := div(mload(add(b, 32)), exp(256, 12)) } } function addressToBytes(address a) internal pure returns (bytes memory b) { b = new bytes(20); assembly { mstore(add(b, 32), mul(a, exp(256, 12))) } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; /** * Interface for the legacy (ETH-only) addr function. */ interface IAddrResolver { event AddrChanged(bytes32 indexed node, address a); /** * Returns the address associated with an ENS node. * @param node The ENS node to query. * @return The associated address. */ function addr(bytes32 node) external view returns (address payable); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; /** * Interface for the new (multicoin) addr function. */ interface IAddressResolver { event AddressChanged( bytes32 indexed node, uint256 coinType, bytes newAddress ); function addr( bytes32 node, uint256 coinType ) external view returns (bytes memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface IVersionableResolver { event VersionChanged(bytes32 indexed node, uint64 newVersion); function recordVersions(bytes32 node) external view returns (uint64); }
pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; contract Controllable is Ownable { mapping(address => bool) public controllers; event ControllerChanged(address indexed controller, bool enabled); modifier onlyController() { require( controllers[msg.sender], "Controllable: Caller is not a controller" ); _; } function setController(address controller, bool enabled) public onlyOwner { controllers[controller] = enabled; emit ControllerChanged(controller, enabled); } }
pragma solidity ^0.8.4; import "../registry/ENS.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Controllable.sol"; contract Root is Ownable, Controllable { bytes32 private constant ROOT_NODE = bytes32(0); bytes4 private constant INTERFACE_META_ID = bytes4(keccak256("supportsInterface(bytes4)")); event TLDLocked(bytes32 indexed label); ENS public ens; mapping(bytes32 => bool) public locked; constructor(ENS _ens) public { ens = _ens; } function setSubnodeOwner( bytes32 label, address owner ) external onlyController { require(!locked[label]); ens.setSubnodeOwner(ROOT_NODE, label, owner); } function setResolver(address resolver) external onlyOwner { ens.setResolver(ROOT_NODE, resolver); } function lock(bytes32 label) external onlyOwner { emit TLDLocked(label); locked[label] = true; } function supportsInterface( bytes4 interfaceID ) external pure returns (bool) { return interfaceID == INTERFACE_META_ID; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; library HexUtils { /** * @dev Attempts to parse bytes32 from a hex string * @param str The string to parse * @param idx The offset to start parsing at * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string. */ function hexStringToBytes32( bytes memory str, uint256 idx, uint256 lastIdx ) internal pure returns (bytes32 r, bool valid) { uint256 hexLength = lastIdx - idx; if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) { revert("Invalid string length"); } valid = true; assembly { // check that the index to read to is not past the end of the string if gt(lastIdx, mload(str)) { revert(0, 0) } function getHex(c) -> ascii { // chars 48-57: 0-9 if and(gt(c, 47), lt(c, 58)) { ascii := sub(c, 48) leave } // chars 65-70: A-F if and(gt(c, 64), lt(c, 71)) { ascii := add(sub(c, 65), 10) leave } // chars 97-102: a-f if and(gt(c, 96), lt(c, 103)) { ascii := add(sub(c, 97), 10) leave } // invalid char ascii := 0xff } let ptr := add(str, 32) for { let i := idx } lt(i, lastIdx) { i := add(i, 2) } { let byte1 := getHex(byte(0, mload(add(ptr, i)))) let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1))))) // if either byte is invalid, set invalid and break loop if or(eq(byte1, 0xff), eq(byte2, 0xff)) { valid := false break } let combined := or(shl(4, byte1), byte2) r := or(shl(8, r), combined) } } } /** * @dev Attempts to parse an address from a hex string * @param str The string to parse * @param idx The offset to start parsing at * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string. */ function hexToAddress( bytes memory str, uint256 idx, uint256 lastIdx ) internal pure returns (address, bool) { if (lastIdx - idx < 40) return (address(0x0), false); (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx); return (address(uint160(uint256(r))), valid); } }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 1200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_previousRegistrar","type":"address"},{"internalType":"address","name":"_resolver","type":"address"},{"internalType":"contract DNSSEC","name":"_dnssec","type":"address"},{"internalType":"contract PublicSuffixList","name":"_suffixes","type":"address"},{"internalType":"contract ENS","name":"_ens","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes","name":"name","type":"bytes"}],"name":"InvalidPublicSuffix","type":"error"},{"inputs":[],"name":"NoOwnerRecordFound","type":"error"},{"inputs":[{"internalType":"uint256","name":"offset","type":"uint256"},{"internalType":"uint256","name":"length","type":"uint256"}],"name":"OffsetOutOfBoundsError","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"PermissionDenied","type":"error"},{"inputs":[],"name":"PreconditionNotMet","type":"error"},{"inputs":[],"name":"StaleProof","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"bytes","name":"dnsname","type":"bytes"},{"indexed":false,"internalType":"uint32","name":"inception","type":"uint32"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"suffixes","type":"address"}],"name":"NewPublicSuffixList","type":"event"},{"inputs":[{"internalType":"bytes","name":"domain","type":"bytes"}],"name":"enableNode","outputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ens","outputs":[{"internalType":"contract ENS","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"inceptions","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract DNSSEC","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"previousRegistrar","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"name","type":"bytes"},{"components":[{"internalType":"bytes","name":"rrset","type":"bytes"},{"internalType":"bytes","name":"sig","type":"bytes"}],"internalType":"struct DNSSEC.RRSetWithSignature[]","name":"input","type":"tuple[]"}],"name":"proveAndClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"name","type":"bytes"},{"components":[{"internalType":"bytes","name":"rrset","type":"bytes"},{"internalType":"bytes","name":"sig","type":"bytes"}],"internalType":"struct DNSSEC.RRSetWithSignature[]","name":"input","type":"tuple[]"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"address","name":"addr","type":"address"}],"name":"proveAndClaimWithResolver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resolver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract PublicSuffixList","name":"_suffixes","type":"address"}],"name":"setPublicSuffixList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"suffixes","outputs":[{"internalType":"contract PublicSuffixList","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100c95760003560e01c806329d56630116100815780636f9512211161005b5780636f951221146101e55780637dc0d1d014610206578063ab14ec591461022d57600080fd5b806329d566301461019857806330349ebe146101ab5780633f15457f146101be57600080fd5b806306963218116100b257806306963218146101355780631ecfc4111461014a57806325916d411461015d57600080fd5b806301ffc9a7146100ce57806304f3bcec146100f6575b600080fd5b6100e16100dc366004611a75565b610254565b60405190151581526020015b60405180910390f35b61011d7f000000000000000000000000f142b308cf687d4358410a4cb885513b30a4202581565b6040516001600160a01b0390911681526020016100ed565b610148610143366004611cb7565b6102ed565b005b610148610158366004611d40565b6104df565b61018361016b366004611d5d565b60016020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016100ed565b6101486101a6366004611d76565b610656565b60005461011d906001600160a01b031681565b61011d7f00000000000000000000000000000000000c2e074ec69a0dfb2997ba6c7d2e1e81565b6101f86101f3366004611dda565b61072a565b6040519081526020016100ed565b61011d7f0000000000000000000000000fc3152971714e5ed7723fafa650f86a4baf30c581565b61011d7f00000000000000000000000058774bb8acd458a640af0b88238369a167546ef281565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102e757507fffffffff0000000000000000000000000000000000000000000000000000000082167f2f43542800000000000000000000000000000000000000000000000000000000145b92915050565b60008060006102fc87876107f8565b91945092509050336001600160a01b0382161461035b576040517fe03f60240000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03821660248201526044015b60405180910390fd5b6040516305ef2c7f60e41b815260048101849052602481018390526001600160a01b0382811660448301528681166064830152600060848301527f00000000000000000000000000000000000c2e074ec69a0dfb2997ba6c7d2e1e1690635ef2c7f09060a401600060405180830381600087803b1580156103db57600080fd5b505af11580156103ef573d6000803e3d6000fd5b505050506001600160a01b038416156104d6576001600160a01b03851661042957604051633c584f1360e21b815260040160405180910390fd5b604080516020810185905290810183905260009060600160408051808303601f190181529082905280516020909101207fd5fa2b00000000000000000000000000000000000000000000000000000000008252600482018190526001600160a01b03878116602484015290925087169063d5fa2b0090604401600060405180830381600087803b1580156104bc57600080fd5b505af11580156104d0573d6000803e3d6000fd5b50505050505b50505050505050565b6040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000c2e074ec69a0dfb2997ba6c7d2e1e6001600160a01b0316906302571be390602401602060405180830381865afa158015610547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056b9190611e0f565b90506000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d19190611e0f565b9050336001600160a01b038216146105e857600080fd5b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0385169081179091556040519081527f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba89060200160405180910390a1505050565b600080600061066585856107f8565b6040517f06ab592300000000000000000000000000000000000000000000000000000000815260048101849052602481018390526001600160a01b03828116604483015293965091945092507f00000000000000000000000000000000000c2e074ec69a0dfb2997ba6c7d2e1e909116906306ab5923906064016020604051808303816000875af11580156106fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107229190611e2c565b505050505050565b600080546040517f4f89059e0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690634f89059e90610774908590600401611e95565b602060405180830381865afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b59190611ea8565b6107ed57816040517f396e24b80000000000000000000000000000000000000000000000000000000081526004016103529190611e95565b6102e7826000610a35565b60008060008060007f0000000000000000000000000fc3152971714e5ed7723fafa650f86a4baf30c56001600160a01b031663bdf95fef876040518263ffffffff1660e01b815260040161084c9190611eca565b600060405180830381865afa158015610869573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108919190810190611f4f565b909250905060006108a28882610e58565b60ff1690506108b388600183610e7c565b945060006108e66108c5836001611ffc565b6001848c516108d4919061200f565b6108de919061200f565b8b9190610ea0565b90506108f18161072a565b965060008787604051602001610911929190918252602082015260400190565b60408051808303601f190181529181528151602092830120600081815260019093529082205490925063ffffffff16850360030b121561097d576040517f2dd6a7af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600160205260408120805463ffffffff191663ffffffff87161790556109a88b87610f22565b9097509050806109e4576040517f6260f6f800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b866001600160a01b0316827f87db02a0e483e2818060eddcbb3488ce44e35aff49a70d92c2aa6c8046cf01e28d88604051610a20929190612022565b60405180910390a35050505050509250925092565b600080610a428484610e58565b60ff16905080600003610a595750600090506102e7565b6000610a7985610a698487611ffc565b610a74906001611ffc565b610a35565b90506000610a93610a8b866001611ffc565b879085610e7c565b604080516020810185905290810182905290915060600160408051601f198184030181529082905280516020909101206302571be360e01b82526004820181905294506000906001600160a01b037f00000000000000000000000000000000000c2e074ec69a0dfb2997ba6c7d2e1e16906302571be390602401602060405180830381865afa158015610b2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4e9190611e0f565b90506001600160a01b0381161580610b9757507f00000000000000000000000058774bb8acd458a640af0b88238369a167546ef26001600160a01b0316816001600160a01b0316145b15610e255782610d6a576040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000c2e074ec69a0dfb2997ba6c7d2e1e6001600160a01b0316906302571be390602401602060405180830381865afa158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d9190611e0f565b6040517f8cb8ecec000000000000000000000000000000000000000000000000000000008152600481018590523060248201529091506001600160a01b03821690638cb8ecec90604401600060405180830381600087803b158015610c9157600080fd5b505af1158015610ca5573d6000803e3d6000fd5b50506040517f1896f70a000000000000000000000000000000000000000000000000000000008152600481018990526001600160a01b037f000000000000000000000000f142b308cf687d4358410a4cb885513b30a42025811660248301527f00000000000000000000000000000000000c2e074ec69a0dfb2997ba6c7d2e1e169250631896f70a9150604401600060405180830381600087803b158015610d4c57600080fd5b505af1158015610d60573d6000803e3d6000fd5b5050505050610e4e565b6040516305ef2c7f60e41b815260048101849052602481018390523060448201526001600160a01b037f000000000000000000000000f142b308cf687d4358410a4cb885513b30a4202581166064830152600060848301527f00000000000000000000000000000000000c2e074ec69a0dfb2997ba6c7d2e1e1690635ef2c7f09060a401600060405180830381600087803b158015610e0857600080fd5b505af1158015610e1c573d6000803e3d6000fd5b50505050610e4e565b6001600160a01b0381163014610e4e57604051633c584f1360e21b815260040160405180910390fd5b5050505092915050565b6000828281518110610e6c57610e6c61204a565b016020015160f81c905092915050565b8251600090610e8b8385611ffc565b1115610e9657600080fd5b5091016020012090565b8251606090610eaf8385611ffc565b1115610eba57600080fd5b60008267ffffffffffffffff811115610ed557610ed5611ab7565b6040519080825280601f01601f191660200182016040528015610eff576020820181803683370190505b50905060208082019086860101610f17828287611030565b509095945050505050565b600080610f42604051806040016040528060608152602001600081525090565b610f5a85516005610f539190611ffc565b8290611086565b5060408051808201909152600581527f045f656e730000000000000000000000000000000000000000000000000000006020820152610f9a9082906110fd565b50610fa581866110fd565b506000610fb28582611125565b90505b8051516020820151101561101f578151610fd890610fd283611186565b906111a7565b60000361101157600080610ff5878460a001518560c00151611300565b92509050811561100e5794506001935061102992505050565b50505b61101a81611373565b610fb5565b5060008092509250505b9250929050565b602081106110685781518352611047602084611ffc565b9250611054602083611ffc565b915061106160208261200f565b9050611030565b905182516020929092036101000a6000190180199091169116179052565b6040805180820190915260608152600060208201526110a6602083612060565b156110ce576110b6602083612060565b6110c190602061200f565b6110cb9083611ffc565b91505b6020808401839052604051808552600081529081840101818110156110f257600080fd5b604052509192915050565b60408051808201909152606081526000602082015261111e8383845161145b565b9392505050565b6111736040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526102e781611373565b602081015181516060916102e79161119e9082611531565b84519190610ea0565b60006111b38383611593565b156111c0575060006102e7565b60008060008060006111d38860006115b1565b905060006111e28860006115b1565b90505b8082111561120e578593506111fa898761160e565b95508161120681612082565b9250506111e5565b8181111561123757849250611223888661160e565b94508061122f81612082565b91505061120e565b600082118015611250575061124e89878a88611632565b155b1561128557859350611262898761160e565b9550849250611271888661160e565b945061127e60018361200f565b9150611237565b8560000361129d5760001996505050505050506102e7565b846000036112b457600196505050505050506102e7565b6112f36112c2856001611ffc565b6112cc8b87610e58565b60ff168a6112db876001611ffc565b6112e58d89610e58565b8e949392919060ff16611667565b9998505050505050505050565b6000805b828410156113645760006113188686610e58565b60ff169050611328600186611ffc565b94506000806113388888856117e5565b9250905081156113505793506001925061136b915050565b61135a8388611ffc565b9650505050611304565b5060009050805b935093915050565b60c0810151602082018190528151511161138a5750565b600061139e82600001518360200151611531565b82602001516113ad9190611ffc565b82519091506113bc9082611839565b61ffff1660408301526113d0600282611ffc565b82519091506113df9082611839565b61ffff1660608301526113f3600282611ffc565b82519091506114029082611861565b63ffffffff166080830152611418600482611ffc565b825190915060009061142a9083611839565b61ffff16905061143b600283611ffc565b60a08401819052915061144e8183611ffc565b60c0909301929092525050565b604080518082019091526060815260006020820152825182111561147e57600080fd5b835151600061148d8483611ffc565b905085602001518111156114af576114af866114aa836002612099565b61188b565b8551805183820160200191600091808511156114c9578482525b505050602086015b6020861061150957805182526114e8602083611ffc565b91506114f5602082611ffc565b905061150260208761200f565b95506114d1565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b6000815b83518110611545576115456120b0565b60006115518583610e58565b60ff169050611561816001611ffc565b61156b9083611ffc565b91508060000361157b5750611581565b50611535565b61158b838261200f565b949350505050565b60008151835114801561111e575061111e83600084600087516118a8565b6000805b835183106115c5576115c56120b0565b60006115d18585610e58565b60ff1690506115e1816001611ffc565b6115eb9085611ffc565b9350806000036115fb575061111e565b611606600183611ffc565b9150506115b5565b600061161a8383610e58565b60ff16611628836001611ffc565b61111e9190611ffc565b600061164b8383848651611646919061200f565b610e7c565b61165d8686878951611646919061200f565b1495945050505050565b85516000906116768688611ffc565b11156116aa576116868587611ffc565b8751604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b83516116b68385611ffc565b11156116ea576116c68284611ffc565b8451604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b84808310156116f65750815b60208789018101908587010160005b838110156117ca578251825180821461179a5760006020611726858961200f565b106117345750600019611770565b600187611742866020611ffc565b61174c919061200f565b611757906008612099565b6117629060026121aa565b61176c919061200f565b1990505b60006117808383168584166121b6565b905080156117975797506117db9650505050505050565b50505b6117a5602086611ffc565b94506117b2602085611ffc565b935050506020816117c39190611ffc565b9050611705565b506117d585896121b6565b93505050505b9695505050505050565b6000806117f28585611861565b63ffffffff1663613d30781461180d5750600090508061136b565b61182d61181b856004611ffc565b6118258587611ffc565b8791906118cb565b91509150935093915050565b8151600090611849836002611ffc565b111561185457600080fd5b50016002015161ffff1690565b8151600090611871836004611ffc565b111561187c57600080fd5b50016004015163ffffffff1690565b81516118978383611086565b506118a283826110fd565b50505050565b60006118b5848484610e7c565b6118c0878785610e7c565b149695505050505050565b60008060286118da858561200f565b10156118eb5750600090508061136b565b6000806118f9878787611907565b909890975095505050505050565b60008080611915858561200f565b905080604014158015611929575080602814155b8061193e575061193a600282612060565b6001145b156119a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610352565b6001915085518411156119b757600080fd5b611a08565b6000603a8210602f831116156119d45750602f190190565b604782106040831116156119ea57506036190190565b60678210606083111615611a0057506056190190565b5060ff919050565b60208601855b85811015611a6a57611a258183015160001a6119bc565b611a376001830184015160001a6119bc565b60ff811460ff83141715611a5057600095505050611a6a565b60049190911b1760089590951b9490941793600201611a0e565b505050935093915050565b600060208284031215611a8757600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461111e57600080fd5b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611af057611af0611ab7565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611b1f57611b1f611ab7565b604052919050565b600067ffffffffffffffff821115611b4157611b41611ab7565b50601f01601f191660200190565b600082601f830112611b6057600080fd5b8135611b73611b6e82611b27565b611af6565b818152846020838601011115611b8857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112611bb657600080fd5b8135602067ffffffffffffffff80831115611bd357611bd3611ab7565b8260051b611be2838201611af6565b9384528581018301938381019088861115611bfc57600080fd5b84880192505b85831015611c9357823584811115611c1a5760008081fd5b88016040818b03601f1901811315611c325760008081fd5b611c3a611acd565b8783013587811115611c4c5760008081fd5b611c5a8d8a83870101611b4f565b825250908201359086821115611c705760008081fd5b611c7e8c8984860101611b4f565b81890152845250509184019190840190611c02565b98975050505050505050565b6001600160a01b0381168114611cb457600080fd5b50565b60008060008060808587031215611ccd57600080fd5b843567ffffffffffffffff80821115611ce557600080fd5b611cf188838901611b4f565b95506020870135915080821115611d0757600080fd5b50611d1487828801611ba5565b9350506040850135611d2581611c9f565b91506060850135611d3581611c9f565b939692955090935050565b600060208284031215611d5257600080fd5b813561111e81611c9f565b600060208284031215611d6f57600080fd5b5035919050565b60008060408385031215611d8957600080fd5b823567ffffffffffffffff80821115611da157600080fd5b611dad86838701611b4f565b93506020850135915080821115611dc357600080fd5b50611dd085828601611ba5565b9150509250929050565b600060208284031215611dec57600080fd5b813567ffffffffffffffff811115611e0357600080fd5b61158b84828501611b4f565b600060208284031215611e2157600080fd5b815161111e81611c9f565b600060208284031215611e3e57600080fd5b5051919050565b60005b83811015611e60578181015183820152602001611e48565b50506000910152565b60008151808452611e81816020860160208601611e45565b601f01601f19169290920160200192915050565b60208152600061111e6020830184611e69565b600060208284031215611eba57600080fd5b8151801515811461111e57600080fd5b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611f4157888303603f1901855281518051878552611f1588860182611e69565b91890151858303868b0152919050611f2d8183611e69565b968901969450505090860190600101611ef1565b509098975050505050505050565b60008060408385031215611f6257600080fd5b825167ffffffffffffffff811115611f7957600080fd5b8301601f81018513611f8a57600080fd5b8051611f98611b6e82611b27565b818152866020838501011115611fad57600080fd5b611fbe826020830160208601611e45565b809450505050602083015163ffffffff81168114611fdb57600080fd5b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b808201808211156102e7576102e7611fe6565b818103818111156102e7576102e7611fe6565b6040815260006120356040830185611e69565b905063ffffffff831660208301529392505050565b634e487b7160e01b600052603260045260246000fd5b60008261207d57634e487b7160e01b600052601260045260246000fd5b500690565b60008161209157612091611fe6565b506000190190565b80820281158282048414176102e7576102e7611fe6565b634e487b7160e01b600052600160045260246000fd5b600181815b808511156121015781600019048211156120e7576120e7611fe6565b808516156120f457918102915b93841c93908002906120cb565b509250929050565b600082612118575060016102e7565b81612125575060006102e7565b816001811461213b576002811461214557612161565b60019150506102e7565b60ff84111561215657612156611fe6565b50506001821b6102e7565b5060208310610133831016604e8410600b8410161715612184575081810a6102e7565b61218e83836120c6565b80600019048211156121a2576121a2611fe6565b029392505050565b600061111e8383612109565b81810360008312801583831316838312821617156121d6576121d6611fe6565b509291505056fea2646970667358221220cfdfb6d1279817f31cba3a4d94621dfc051060fc2ac60424bd477a23a28c37d164736f6c63430008110033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.