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
lite username, which is a subname, resolves the same way as a full-person 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. |
liteNamesOf
Lists the lite-person names currently owned by user.
Reads the user's LabelStore labels and pending claims, keeps the gateway-issued
ones carrying a separator, and re-checks each against registrar.ownerOf 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 @custom: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 name that merely resembles a lite label is not listed: neither a
public registration spelled joseph42 nor a subname stored as joseph.42. Among issued
names the separator is what marks a lite one, since provenance covers full-person names
too. Identities minted before provenance was recorded have none to confirm, so they are
not listed and are re-issued through the gateway.
function liteNamesOf(
address user,
uint256 offset,
uint256 limit
)
external
view
override
returns (Name[] memory names);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | Account whose lite 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 lite names; see @custom:struct Name. |
fullNamesOf
Lists the full-person names currently owned by user.
Same ownership-verified read as @custom:function liteNamesOf, and the same provenance requirement: a name is listed only when the gateway minted it. It keeps the labels without a separator, which is the form the gateway issues a full-person name in. A public registration is not an identity and appears in neither listing, so the two together cover what the gateway issued rather than everything the account holds.
function fullNamesOf(
address user,
uint256 offset,
uint256 limit
)
external
view
override
returns (Name[] memory names);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | Account whose full 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 full names; see @custom:struct Name. |
liteNameCountOf
Counts the lite-person names currently owned by user.
Uses the same ownership-verified read as @custom:function liteNamesOf; counting scans the account's holdings, so gas grows with them. Call it off-chain.
function liteNameCountOf(address user) external view override returns (uint256 count);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | Account whose lite names are counted. |
Returns
| Name | Type | Description |
|---|---|---|
count | uint256 | Number of lite names currently owned. |
fullNameCountOf
Counts the full-person names currently owned by user.
Uses the same ownership-verified read as @custom:function fullNamesOf; counting scans the account's holdings, so gas grows with them. Call it off-chain.
function fullNameCountOf(address user) external view override returns (uint256 count);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | Account whose full names are counted. |
Returns
| Name | Type | Description |
|---|---|---|
count | uint256 | Number of full 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 fullClaim 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 lite label carries its separator and resolves here too, since the node is the hash of the whole string. |
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 fullClaim 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; lite and full name counts are read separately via
Note: function: liteNameCountOf and @custom:function fullNameCountOf because those scan 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 lite listing (wantLite) or the full listing.
Two questions and one guard the caller already applied. Whether a name is an identity at all is provenance, so each listing is gated on
Note:
function: IDotnsPopController.isPopIssued: characters alone would admit a public
registration spelled joseph42, which reads as a full-person name and is not one. Which
kind of identity it is, lite or full, is spelling: a lite name carries its separator and a
full-person name does not, and provenance covers both. A lite name is a subname and a
full-person name is a tokenised second-level name, and the callers resolve ownership through
the registry, which covers both, so both listings reach their names. Provenance is keyed by
text, so a subname a user created under a name they own does not enter a listing unless
the controller issued it. The two listings together cover the names the gateway issued and
user holds, one kind each, rather than everything the account holds.
function _belongsToListing(string memory label, bool wantLite) internal view returns (bool);
_countNames
Counts the names currently owned by user that belong to the requested listing.
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 on the registrar. A pending
entry already written into the store by a sibling flow is skipped so it is not counted
twice.
function _countNames(address user, bool wantLite) internal view returns (uint256 count);
_pageNames
Returns a page of user's owned names belonging to the requested listing.
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,
bool wantLite
)
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 registrar, PoP resolver, and PopRules.
Reads defensively so an unminted or unsettled name yields zeroed fields instead of
reverting. fullClaim is left for the caller because it needs the labelhash, which is
recoverable from the label string but not from the node alone. tier classifies the label
shape, so knownLabel supplies the label for a pending subname 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 lite subname.
A lite 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);