IDotnsContentResolver

Git Source

Title: Dotns Content Resolver

Defines storage and retrieval for content hash, text records, and operator approvals for DotNS nodes. @dev Content hash and text records point to off-chain content such as IPFS CIDs or future schemes; interpretation is handled off-chain. Operator approvals allow third parties to manage records on behalf of the owner.

Note: security-contact: admin@parity.io

Functions

setContenthash

Sets the content hash for a node.

The caller must own the node in the DotNS registry or be an approved operator, otherwise @custom:reverts NotAuthorised. Content hashes are opaque bytes (e.g. an IPFS CID); the resolver stores them as-is and never interprets the payload. Emits

Note: emits: ContentHashUpdated on every successful write.

function setContenthash(bytes32 node, bytes calldata hash) external;

Parameters

NameTypeDescription
nodebytes32The node whose content hash is being set.
hashbytesOpaque content hash bytes.

contenthash

Returns the content hash associated with a node.

function contenthash(bytes32 node) external view returns (bytes memory hash);

Parameters

NameTypeDescription
nodebytes32The node to query.

Returns

NameTypeDescription
hashbytesThe stored content hash bytes, or empty if unset.

setText

Sets a text record for a node.

The caller must own the node in the DotNS registry or be an approved operator, otherwise @custom:reverts NotAuthorised. Text records are arbitrary key/value strings (e.g. avatar, url, description). Emits @custom:emits TextUpdated on every successful write.

function setText(bytes32 node, string calldata key, string calldata value) external;

Parameters

NameTypeDescription
nodebytes32The node whose text record is being set.
keystringText record key (e.g., "ipfs", "avatar").
valuestringText record value.

text

Returns a text record for a node.

function text(bytes32 node, string calldata key) external view returns (string memory value);

Parameters

NameTypeDescription
nodebytes32The node to query.
keystringText record key.

Returns

NameTypeDescription
valuestringStored text value, or empty string if unset.

setApprovalForAll

Enable or disable approval for a third party ("operator") to manage all of msg.sender's nodes.

Emits @custom:emits ApprovalForAll whenever the approval flag is written, including idempotent writes that do not change the stored value.

function setApprovalForAll(address operator, bool approved) external;

Parameters

NameTypeDescription
operatoraddressAddress to authorise or revoke.
approvedboolTrue to approve, false to revoke.

isApprovedForAll

Query if an address is an approved operator for another address.

function isApprovedForAll(address owner, address operator) external view returns (bool);

Parameters

NameTypeDescription
owneraddressThe owner of the nodes.
operatoraddressThe address acting on behalf of the owner.

Returns

NameTypeDescription
<none>boolTrue if operator is approved, false otherwise.

Events

ContentHashUpdated

Emitted when a node's content hash is updated.

event ContentHashUpdated(bytes32 indexed node, bytes hash);

Parameters

NameTypeDescription
nodebytes32The node whose content hash was updated.
hashbytesThe new content hash bytes.

TextUpdated

Emitted when a node's text record is updated.

event TextUpdated(bytes32 indexed node, string indexed key, string value);

Parameters

NameTypeDescription
nodebytes32The node whose text record was updated.
keystringThe text record key.
valuestringThe new text record value.

ApprovalForAll

Emitted when an operator is approved or revoked.

event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

Parameters

NameTypeDescription
owneraddressThe owner of the nodes.
operatoraddressThe operator address.
approvedboolTrue if approved, false if revoked.

Errors

NotAuthorised

Thrown when the caller is not authorised to modify a node.

error NotAuthorised(bytes32 node, address caller);

Parameters

NameTypeDescription
nodebytes32The node being modified.
calleraddressThe address attempting the modification.