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. An empty hash
deletes the record: its storage is zeroed and the storage deposit released to the
signer of the transaction. Emits @custom: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.
A record reads as unset once the node is cleared (@custom:function IDotnsRegistry.clearRecords) or stops resolving because a name above it was cleared, even though the bytes written before stay in storage.
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). An empty value deletes the record: its storage
is zeroed and the storage deposit released to the signer of the transaction. That also
works for a key a clear has already hidden, which still holds storage until it is
deleted. Emits @custom:emits TextUpdated and @custom:emits TextChanged on every
successful write, a delete included.
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.
A record reads as unset once the node is cleared (@custom:function IDotnsRegistry.clearRecords) or stops resolving because a name above it was cleared, even though the bytes written before stay in storage.
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.
An indexed string is logged only as its keccak256 hash, so this event lets a consumer filter by key but never recover the key. @custom:emits TextChanged is emitted alongside it with the key readable.
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, logged as its hash. |
value | string | The new text record value. |
TextChanged
Emitted with every @custom:emits TextUpdated, carrying the key readably.
The key appears twice: indexed, as a hash to filter on, and in the data, where an
indexer can read it and so list the keys a node has set. The shape matches the ENS
public resolver's TextChanged, so tooling built for it reads this event unchanged.
event TextChanged(bytes32 indexed node, string indexed indexedKey, string key, string value);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | The node whose text record was updated. |
indexedKey | string | The text record key, logged as its hash. |
key | string | The text record key, readable. |
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. |