Smart Contracts
Contracts
Resolvers
DNSResolver

DNSResolver

Git Source (opens in a new tab)

Inherits: IDNSRecordResolver, IDNSZoneResolver, BaseResolver

State Variables

versionable_zonehashes

mapping(uint256 => mapping(bytes32 => bytes)) private versionable_zonehashes;

versionable_records

mapping(uint256 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes)))) private versionable_records;

versionable_nameEntriesCount

mapping(uint256 => mapping(bytes32 => mapping(bytes32 => uint16))) private versionable_nameEntriesCount;

Functions

setDNSRecords

Set one or more DNS records. Records are supplied in wire-format. Records with the same node/name/resource must be supplied one after the other to ensure the data is updated correctly. For example, if the data was supplied: a.example.com IN A 1.2.3.4 a.example.com IN A 5.6.7.8 www.example.com (opens in a new tab) IN CNAME a.example.com. then this would store the two A records for a.example.com correctly as a single RRSET, however if the data was supplied: a.example.com IN A 1.2.3.4 www.example.com (opens in a new tab) IN CNAME a.example.com. a.example.com IN A 5.6.7.8 then this would store the first A record, the CNAME, then the second A record which would overwrite the first.

function setDNSRecords(bytes32 node, bytes calldata data) external virtual authorised(node);

Parameters

NameTypeDescription
nodebytes32the namehash of the node for which to set the records
databytesthe DNS wire format records to set

dnsRecord

Obtain a DNS record.

function dnsRecord(bytes32 node, bytes32 name, uint16 resource) public view virtual override returns (bytes memory);

Parameters

NameTypeDescription
nodebytes32the namehash of the node for which to fetch the record
namebytes32the keccak-256 hash of the fully-qualified name for which to fetch the record
resourceuint16the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types (opens in a new tab)

Returns

NameTypeDescription
<none>bytesthe DNS record in wire format if present, otherwise empty

hasDNSRecords

Check if a given node has records.

function hasDNSRecords(bytes32 node, bytes32 name) public view virtual returns (bool);

Parameters

NameTypeDescription
nodebytes32the namehash of the node for which to check the records
namebytes32the namehash of the node for which to check the records

setZonehash

setZonehash sets the hash for the zone. May only be called by the owner of that node.

function setZonehash(bytes32 _node, bytes calldata _hash) external virtual authorised(_node);

Parameters

NameTypeDescription
_nodebytes32The node to update.
_hashbytesThe zonehash to set

zonehash

zonehash obtains the hash for the zone.

function zonehash(bytes32 _node) public view virtual override returns (bytes memory);

Parameters

NameTypeDescription
_nodebytes32The node to query.

Returns

NameTypeDescription
<none>bytesThe associated contenthash.

supportsInterface

function supportsInterface(bytes4 interfaceID) public view virtual override returns (bool);

setDNSRRSet

function setDNSRRSet(
    bytes32 node,
    bytes memory name,
    uint16 resource,
    bytes memory data,
    uint256 offset,
    uint256 size,
    bool deleteRecord,
    uint256 version
) private;

incrementVersion

function incrementVersion(bytes32 node) public virtual override authorised(node);