DotnsPopLens
Inherits: IDotnsPopLens
Title: DotnsPopLens
Read-only view over PoP identity data.
Stateless beyond the protocol registry it holds, and never mints or settles. It composes
each field from the contract that owns it: names from the owner's LabelStore and the
controller's pending queue, ownership from the registry, chat keys and links from the PoP
resolver, and label classification from PopRules. The registry is the single ownership
authority: it delegates a tokenised name to the registrar and owns a subname directly, so a
device name, which is a subname, resolves the same way as a personhood name. Living outside
the controller keeps the controller within the contract-size limit. Deployed as a plain
contract through the CREATE3 factory, so its address is deterministic and it can be redeployed
on a read change without touching stored state.
Note: security-contact: admin@parity.io
Constants
_protocolRegistry
Protocol-level address registry used to resolve every sibling contract.
IDotnsProtocolRegistry internal immutable _protocolRegistry
Functions
constructor
Binds the lens to the protocol registry it reads through.
constructor(IDotnsProtocolRegistry registry) ;
Parameters
| Name | Type | Description |
|---|---|---|
registry | IDotnsProtocolRegistry | Protocol registry resolving the controller, registrar, store factory, PoP resolver, and PopRules. |
protocolRegistry
The protocol registry the lens resolves siblings through.
function protocolRegistry() external view override returns (address registry);
Returns
| Name | Type | Description |
|---|---|---|
registry | address | The protocol registry address. |
namesOf
Lists the gateway-issued names currently owned by user: device names and
personhood names together.
Reads the user's LabelStore labels and pending claims, keeps the ones the gateway
issued, and re-checks each against the registry owner so a name transferred away drops out
and a name transferred in shows under its current owner. Ordering follows the store then
the pending queue. An offset past the end returns an empty array rather than reverting,
and a short return means the slice ended. A gateway name transferred before it settles has
its label in no store, so it cannot appear here and is reachable only by node via
Note:
function: nameDetailByNode. Gas grows with the account's holdings, so call it
off-chain. A page holds at most DotnsConstants.MAX_PAGE_SIZE entries, and the pending
portion covers up to that many staged claims.
A name is listed only when @custom:function IDotnsPopController.isPopIssued confirms the
gateway minted it, so a public registration is never listed, even one spelled joseph42,
and neither is a subname stored as joseph.42 outside the gateway. Among issued names the
label shape tells the kinds apart: a device name carries its separator and a personhood
name doesn't. Identities minted before provenance was recorded have none to confirm, so
they are not listed and are re-issued through the gateway.
function namesOf(
address user,
uint256 offset,
uint256 limit
)
external
view
override
returns (Name[] memory names);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | Account whose names are listed. |
offset | uint256 | Start index into the filtered sequence. |
limit | uint256 | Maximum entries to return. |
Returns
| Name | Type | Description |
|---|---|---|
names | Name[] | Page of the account's gateway-issued names; see @custom:struct Name. |
nameCountOf
Counts the gateway-issued names currently owned by user.
Uses the same ownership-verified read as @custom:function namesOf; counting scans the account's holdings, so gas grows with them. Call it off-chain.
function nameCountOf(address user) external view override returns (uint256 count);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | Account whose names are counted. |
Returns
| Name | Type | Description |
|---|---|---|
count | uint256 | Number of gateway-issued names currently owned. |
nameDetail
Returns the full on-chain record for a name given its label string.
Resolves the node internally, so a caller holding only the string needs no namehash
implementation. Never reverts on an unknown name: absent fields read as zero or empty.
This overload can populate personhoodNode because it holds the label and so its labelhash.
function nameDetail(string calldata name) external view override returns (NameDetail memory);
Parameters
| Name | Type | Description |
|---|---|---|
name | string | Bare label without the TLD. A device name carries its separator and resolves here too, to its stem beneath its numeric container. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | NameDetail | detail The name's record; see @custom:struct NameDetail. |
nameDetailByNode
Returns the full on-chain record for a name given its node.
The node cannot be inverted to its labelhash, so personhoodNode is populated only
when the label is independently resolvable from the node and reads zero otherwise; every
other field is resolved directly. Never reverts on an unknown node.
function nameDetailByNode(bytes32 node) external view override returns (NameDetail memory);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | namehash of the name. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | NameDetail | detail The name's record; see @custom:struct NameDetail. |
profileOf
Returns an account-level summary of a user's PoP state.
O(1) facts only; the name count is read separately via @custom:function nameCountOf because it scans the account's holdings. Never reverts.
function profileOf(address user) external view override returns (PopProfile memory profile);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | Account being summarised. |
Returns
| Name | Type | Description |
|---|---|---|
profile | PopProfile | The account summary; see @custom:struct PopProfile. |
_belongsToListing
Whether label belongs in the listing: a name the gateway issued.
Whether a name is an identity at all is provenance, so the listing is gated on
Note:
function: IDotnsPopController.isPopIssued: characters alone would admit a public
registration spelled joseph42, which passes the single-label shape check yet was never
issued by the gateway. The label shape then confirms it is one of the two kinds the gateway
issues, a device name with its separator or a personhood name without one. A device name is
a subname and a personhood name is a tokenised second-level name, and the callers resolve
ownership through the registry, which covers both. Provenance is keyed by text, so a
subname a user created under a name they own does not enter the listing unless the
controller issued it.
function _belongsToListing(string memory label) internal view returns (bool);
_countNames
Counts the gateway-issued names currently owned by user.
Walks the user's LabelStore (settled names) then their pending claims, keeping only
entries that belong to the listing and are still owned by user in the registry. A pending
entry already written into the store by a sibling flow is skipped so it is not counted
twice.
function _countNames(address user) internal view returns (uint256 count);
_pageNames
Returns a page of user's owned gateway-issued names.
Same ownership-verified walk as @custom:function _countNames, in the same order
(store then pending), skipping the first offset matches and returning up to limit
entries. limit is clamped to DotnsConstants.MAX_PAGE_SIZE to bound the memory and the
scan.
function _pageNames(
address user,
uint256 offset,
uint256 limit
)
internal
view
returns (Name[] memory names);
_ownedBy
Whether node is a name currently owned by user.
Reads the registry, which is the single ownership authority for both a tokenised name (it delegates to the registrar) and a subname (an explicit record owner). A node with no record returns the zero address, so a missing name yields false and the read stays total.
function _ownedBy(bytes32 node, address user) internal view returns (bool);
_detail
Gathers a name's record from the registry, registrar, PoP resolver, and PopRules.
Reads defensively so an unminted or unsettled name yields zeroed fields instead of
reverting. personhoodNode is left for the caller because it needs the labelhash, which is
recoverable from the label string but not from the node alone. requiredTier classifies the
label shape, so knownLabel supplies the label for an unsettled name the node cannot
recover, letting classification run before the detail is returned; it is ignored when the
label is otherwise recoverable, and an empty knownLabel leaves an unrecoverable label
unclassified.
function _detail(
bytes32 node,
string memory knownLabel
)
internal
view
returns (NameDetail memory detail);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | The name's node. |
knownLabel | string | Label the caller already holds, used only when the node cannot recover it. |
_pendingClaims
Reads a bounded page of user's pending claims from the controller.
The listings scan this page in memory; it holds up to DotnsConstants.MAX_PAGE_SIZE
staged claims, which the reads document as their pending-portion bound.
function _pendingClaims(address user)
internal
view
returns (IDotnsPopController.PendingClaim[] memory claims);
_controller
Resolves the PoP controller via the protocol registry.
function _controller() internal view returns (IDotnsPopController);
_registrar
Resolves the registrar via the protocol registry.
function _registrar() internal view returns (IDotnsRegistrar);
_registry
Resolves the registry via the protocol registry.
function _registry() internal view returns (IDotnsRegistry);
_nodeOf
Derives the node a name resolves to, whether tokenised or a device-name subname.
A device name is stem beneath its numeric container, so it hashes as a subnode; any
other name hashes as a second-level label under the TLD.
function _nodeOf(string memory label) internal view returns (bytes32 node);
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label without the TLD, e.g. alice or alice.01. |
Returns
| Name | Type | Description |
|---|---|---|
node | bytes32 | The node the name resolves to. |
_storeFactory
Resolves the store factory via the protocol registry.
function _storeFactory() internal view returns (IStoreFactory);
_popResolver
Resolves the PoP resolver via the protocol registry.
function _popResolver() internal view returns (IDotnsPopResolver);
_popRules
Resolves the PopRules contract via the protocol registry.
function _popRules() internal view returns (IPopRules);