IDotnsContentResolver
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
| Name | Type | Description |
|---|---|---|
node | bytes32 | The node whose content hash is being set. |
hash | bytes | Opaque content hash bytes. |
contenthash
Returns the content hash associated with a node.
function contenthash(bytes32 node) external view returns (bytes memory hash);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | The node to query. |
Returns
| Name | Type | Description |
|---|---|---|
hash | bytes | The 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
| Name | Type | Description |
|---|---|---|
node | bytes32 | The node whose text record is being set. |
key | string | Text record key (e.g., "ipfs", "avatar"). |
value | string | Text record value. |
text
Returns a text record for a node.
function text(bytes32 node, string calldata key) external view returns (string memory value);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | The node to query. |
key | string | Text record key. |
Returns
| Name | Type | Description |
|---|---|---|
value | string | Stored 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
| Name | Type | Description |
|---|---|---|
operator | address | Address to authorise or revoke. |
approved | bool | True 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
| Name | Type | Description |
|---|---|---|
owner | address | The owner of the nodes. |
operator | address | The address acting on behalf of the owner. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True 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
| Name | Type | Description |
|---|---|---|
node | bytes32 | The node whose content hash was updated. |
hash | bytes | The 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
| Name | Type | Description |
|---|---|---|
node | bytes32 | The node whose text record was updated. |
key | string | The text record key. |
value | string | The new text record value. |
ApprovalForAll
Emitted when an operator is approved or revoked.
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | The owner of the nodes. |
operator | address | The operator address. |
approved | bool | True 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
| Name | Type | Description |
|---|---|---|
node | bytes32 | The node being modified. |
caller | address | The address attempting the modification. |