DotnsPopLens

Git Source

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 registrar, chat keys and links from the PoP resolver, and label classification from PopRules. Living outside the controller keeps the controller within the contract-size limit and keeps the registrar the single source of ownership truth. 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

NameTypeDescription
registryIDotnsProtocolRegistryProtocol 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

NameTypeDescription
registryaddressThe protocol registry address.

liteNamesOf

Lists the lite-person names currently owned by user.

Reads the user's LabelStore labels and pending claims, keeps the lite-person shaped ones, 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.

function liteNamesOf(
    address user,
    uint256 offset,
    uint256 limit
)
    external
    view
    override
    returns (Name[] memory names);

Parameters

NameTypeDescription
useraddressAccount whose lite names are listed.
offsetuint256Start index into the filtered sequence.
limituint256Maximum entries to return.

Returns

NameTypeDescription
namesName[]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, keeping base-shaped labels instead of lite-shaped ones.

function fullNamesOf(
    address user,
    uint256 offset,
    uint256 limit
)
    external
    view
    override
    returns (Name[] memory names);

Parameters

NameTypeDescription
useraddressAccount whose full names are listed.
offsetuint256Start index into the filtered sequence.
limituint256Maximum entries to return.

Returns

NameTypeDescription
namesName[]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

NameTypeDescription
useraddressAccount whose lite names are counted.

Returns

NameTypeDescription
countuint256Number 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

NameTypeDescription
useraddressAccount whose full names are counted.

Returns

NameTypeDescription
countuint256Number 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

NameTypeDescription
namestringBare DNS label (no TLD).

Returns

NameTypeDescription
<none>NameDetaildetail 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

NameTypeDescription
nodebytes32namehash of the name.

Returns

NameTypeDescription
<none>NameDetaildetail 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

NameTypeDescription
useraddressAccount being summarised.

Returns

NameTypeDescription
profilePopProfileThe account summary; see @custom:struct PopProfile.

_matchesShape

Whether label belongs in the lite listing (wantLite) or the full listing.

A lite-person label is a single label with two trailing digits; a full-person label is any other single label. The two sets are disjoint and together cover every single label, so one predicate drives both listings.

function _matchesShape(string memory label, bool wantLite) internal pure returns (bool);

_countNames

Counts the names currently owned by user that match the requested shape.

Walks the user's LabelStore (settled names) then their pending claims, keeping only shape matches 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 matching the requested shape.

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 minted name currently owned by user.

Guards the ownerOf call with exists so a missing token returns false rather than reverting, keeping the listing reads total.

function _ownedBy(
    IDotnsRegistrar registrar,
    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 and is skipped for an empty label.

function _detail(bytes32 node) internal view returns (NameDetail memory detail);

_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);

_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);