BaseRegistrarImplementation contract owns the .eth TLD in the ENS registry and manages .eth name ownership as ERC-721 tokens.
Overview
This contract provides the foundational ownership layer for .eth names:- Names are represented as ERC-721 NFTs (tokenId = keccak256(label))
- Only authorized controllers can register and renew names
- Name owners have full control over their registrations
- Includes a 90-day grace period after expiration
Key Concepts
Controllers
Controllers are authorized addresses that can register and renew names. The registrar owner manages controllers:- Register new names
- Extend the expiry of existing names
- Reduce expiration times
- Change ownership of existing names
- Transfer names they don’t own
Grace Period
The grace period is a 90-day window after expiration:ownerOf()returns the owner (name is not considered expired)available()returns false (name cannot be registered by others)- The owner can renew the name
- After the grace period ends, the name becomes available for registration
Core Functions
register
Registers a new name (controller only).The token ID (keccak256 of the label)
The address that should own the registration
Duration in seconds for the registration
renew
Renews an existing name (controller only).The token ID of the name to renew
Additional duration in seconds to add
available
Checks if a name is available for registration.The token ID to check
true if available, false if registered or in grace period
Source: BaseRegistrarImplementation.sol:101
nameExpires
Returns the expiration timestamp of a name.The token ID to query
reclaim
Reclaims ownership of a name in the ENS registry.The token ID of the name to reclaim
The address to set as owner in the registry
ownerOf
Returns the owner of a name (ERC-721 standard).The token ID to query
Example Usage
Check Name Availability
Reclaim Registry Ownership
Events
NameRegistered
Emitted when a name is registered.NameRenewed
Emitted when a name is renewed.ControllerAdded
Emitted when a controller is added.ControllerRemoved
Emitted when a controller is removed.Integration Notes
Token ID Calculation
The token ID for a name is always:ERC-721 Compatibility
As an ERC-721 contract, names can be:- Transferred using
transferFrom()orsafeTransferFrom() - Approved for transfer using
approve()orsetApprovalForAll() - Queried for ownership using
ownerOf()andbalanceOf()
Grace Period Consideration
When checking expiration, remember thatownerOf() will revert after the grace period ends, but the stored expiry timestamp is when the registration period ends, not when the grace period ends.