Blockwell

BaseRegistrarImplementation

About

Stats

Public Functions 23
Event Types 9
Code Size 30,142 bytes

Events (9) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
approved
address help
tokenId
uint256 help

ApprovalForAll Event

Parameters help
owner
address help
operator
address help
approved
bool help

ControllerAdded Event

Parameters help
controller
address help

ControllerRemoved Event

Parameters help
controller
address help

NameMigrated Event

Parameters help
id
uint256 help
owner
address help
expires
uint help

NameRegistered Event

Parameters help
id
uint256 help
owner
address help
expires
uint help

NameRenewed Event

Parameters help
id
uint256 help
expires
uint help

OwnershipTransferred Event

Parameters help
previousOwner
address help
newOwner
address help

Transfer Event

Parameters help
from
address help
to
address help
tokenId
uint256 help

INTERFACE_META_ID Constant

bytes4 help
UNKNOWN VALUE

ERC721_ID Constant

bytes4 help
UNKNOWN VALUE

RECLAIM_ID Constant

bytes4 help
UNKNOWN VALUE

GRACE_PERIOD Constant

uint help
90 days

_ERC721_RECEIVED Constant

bytes4 help
0x150b7a02

_INTERFACE_ID_ERC721 Constant

bytes4 help
0x80ac58cd

_INTERFACE_ID_ERC165 Constant

bytes4 help
0x01ffc9a7

ens Variable

address help

baseNode Variable

bytes32 help

controllers Variable

mapping(address => bool) help

expiries Variable

mapping(uint256 => uint) help
Internal Variable

_owner Variable

address help
Internal Variable

_tokenOwner Variable

mapping(uint256 => address) help
Internal Variable

_tokenApprovals Variable

mapping(uint256 => address) help
Internal Variable

_ownedTokensCount Variable

mapping(address => uint256) help
Internal Variable

_operatorApprovals Variable

mapping(address => mapping(address => bool)) help
Internal Variable

_supportedInterfaces Variable

mapping(bytes4 => bool) help
Internal Variable

Functions Expand All Collapse All

Parameters help

Name Type
owner
address help

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
function balanceOf(address owner) public view returns (uint256) {
  require(owner != address(0));
  return _ownedTokensCount[owner];
}

ownerOf keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function ownerOf(uint256 tokenId) public view returns (address) {
  require(expiries[tokenId] > now);
  return super.ownerOf(tokenId);
}

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function approve(address to, uint256 tokenId) public {
  address owner = ownerOf(tokenId);
  require(to != owner);
  require(msg.sender == owner || isApprovedForAll(owner, msg.sender));

  _tokenApprovals[tokenId] = to;
  emit Approval(owner, to, tokenId);
}

getApproved keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view

Requirements help

null
Source Code
function getApproved(uint256 tokenId) public view returns (address) {
  require(_exists(tokenId));
  return _tokenApprovals[tokenId];
}

setApprovalForAll keyboard_arrow_up

Parameters help

Name Type
to
address help
approved
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function setApprovalForAll(address to, bool approved) public {
  require(to != msg.sender);
  _operatorApprovals[msg.sender][to] = approved;
  emit ApprovalForAll(msg.sender, to, approved);
}

isApprovedForAll keyboard_arrow_up

Parameters help

Name Type
owner
address help
operator
address help

Properties

Visibility help public
Mutability help view
Source Code
function isApprovedForAll(address owner, address operator)
  public
  view
  returns (bool)
{
  return _operatorApprovals[owner][operator];
}

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transferFrom(
  address from,
  address to,
  uint256 tokenId
) public {
  require(_isApprovedOrOwner(msg.sender, tokenId));

  _transferFrom(from, to, tokenId);
}

safeTransferFrom keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function safeTransferFrom(
  address from,
  address to,
  uint256 tokenId
) public {
  safeTransferFrom(from, to, tokenId, "");
}

safeTransferFrom keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help
_data
bytes help

Properties

Visibility help public
Mutability help transaction
Source Code
function safeTransferFrom(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) public {
  transferFrom(from, to, tokenId);
  require(_checkOnERC721Received(from, to, tokenId, _data));
}

supportsInterface keyboard_arrow_up

Parameters help

Name Type
interfaceID
bytes4 help

Properties

Visibility help public
Mutability help view
Source Code
function supportsInterface(bytes4 interfaceID) external view returns (bool) {
  return
    interfaceID == INTERFACE_META_ID ||
    interfaceID == ERC721_ID ||
    interfaceID == RECLAIM_ID;
}

owner keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function owner() public view returns (address) {
  return _owner;
}

isOwner keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function isOwner() public view returns (bool) {
  return msg.sender == _owner;
}

renounceOwnership keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null
Source Code
function renounceOwnership() public onlyOwner {
  emit OwnershipTransferred(_owner, address(0));
  _owner = address(0);
}

transferOwnership keyboard_arrow_up

Parameters help

Name Type
newOwner
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null

Requirements help

Source Code
function transferOwnership(address newOwner) public onlyOwner {
  _transferOwnership(newOwner);
}

addController keyboard_arrow_up

Parameters help

Name Type
controller
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null
Source Code
function addController(address controller) external onlyOwner {
  controllers[controller] = true;
  emit ControllerAdded(controller);
}

removeController keyboard_arrow_up

Parameters help

Name Type
controller
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null
Source Code
function removeController(address controller) external onlyOwner {
  controllers[controller] = false;
  emit ControllerRemoved(controller);
}

setResolver keyboard_arrow_up

Parameters help

Name Type
resolver
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null
Source Code
function setResolver(address resolver) external onlyOwner {
  ens.setResolver(baseNode, resolver);
}

nameExpires keyboard_arrow_up

Parameters help

Name Type
id
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function nameExpires(uint256 id) external view returns (uint256) {
  return expiries[id];
}

available keyboard_arrow_up

Parameters help

Name Type
id
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function available(uint256 id) public view returns (bool) {
  // Not available if it's registered here or in its grace period.
  return expiries[id] + GRACE_PERIOD < now;
}

register keyboard_arrow_up

Parameters help

Name Type
id
uint256 help
owner
address help
duration
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function register(
  uint256 id,
  address owner,
  uint256 duration
) external returns (uint256) {
  return _register(id, owner, duration, true);
}

renew keyboard_arrow_up

Parameters help

Name Type
id
uint256 help
duration
uint help

Properties

Visibility help public
Mutability help transaction

Modifiers help

live checks for the following:
UNKNOWN VALUE must be equal to UNKNOWN VALUE
onlyController checks for the following:

Requirements help

Source Code
function renew(uint256 id, uint256 duration)
  external
  live
  onlyController
  returns (uint256)
{
  require(expiries[id] + GRACE_PERIOD >= now); // Name must be registered here or in grace period
  require(expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD); // Prevent future overflow

  expiries[id] += duration;
  emit NameRenewed(id, expiries[id]);
  return expiries[id];
}

reclaim keyboard_arrow_up

Parameters help

Name Type
id
uint256 help
owner
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

live checks for the following:
UNKNOWN VALUE must be equal to UNKNOWN VALUE

Requirements help

null
Source Code
function reclaim(uint256 id, address owner) external live {
  require(_isApprovedOrOwner(msg.sender, id));
  ens.setSubnodeOwner(baseNode, bytes32(id), owner);
}

registerOnly keyboard_arrow_up

Parameters help

Name Type
id
uint256 help
owner
address help
duration
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function registerOnly(
  uint256 id,
  address owner,
  uint256 duration
) external returns (uint256) {
  return _register(id, owner, duration, false);
}

Internal Functions Expand All Collapse All

Internal functions are parts of the contract that can't be used directly, but instead are used by the public functions listed above.

internal BaseRegistrarImplementation._register keyboard_arrow_up

Parameters help

Name Type
id
uint256 help
owner
address help
duration
uint help
updateRegistry
bool help

Properties

Visibility help internal
Mutability help transaction

Modifiers help

live checks for the following:
UNKNOWN VALUE must be equal to UNKNOWN VALUE
onlyController checks for the following:
Source Code
function _register(
  uint256 id,
  address owner,
  uint256 duration,
  bool updateRegistry
) internal live onlyController returns (uint256) {
  require(available(id));
  require(now + duration + GRACE_PERIOD > now + GRACE_PERIOD); // Prevent future overflow

  expiries[id] = now + duration;
  if (_exists(id)) {
    // Name was previously owned, and expired
    _burn(id);
  }
  _mint(owner, id);
  if (updateRegistry) {
    ens.setSubnodeOwner(baseNode, bytes32(id), owner);
  }

  emit NameRegistered(id, owner, now + duration);

  return now + duration;
}

internal Ownable.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  _owner = msg.sender;
  emit OwnershipTransferred(address(0), _owner);
}

internal Ownable._transferOwnership keyboard_arrow_up

Parameters help

Name Type
newOwner
address help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _transferOwnership(address newOwner) internal {
  require(newOwner != address(0));
  emit OwnershipTransferred(_owner, newOwner);
  _owner = newOwner;
}

internal ERC721._exists keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view
Source Code
function _exists(uint256 tokenId) internal view returns (bool) {
  address owner = _tokenOwner[tokenId];
  return owner != address(0);
}

internal ERC721._isApprovedOrOwner keyboard_arrow_up

Parameters help

Name Type
spender
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view
Source Code
function _isApprovedOrOwner(address spender, uint256 tokenId)
  internal
  view
  returns (bool)
{
  address owner = ownerOf(tokenId);
  return (spender == owner ||
    getApproved(tokenId) == spender ||
    isApprovedForAll(owner, spender));
}

internal ERC721._mint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _mint(address to, uint256 tokenId) internal {
  require(to != address(0));
  require(!_exists(tokenId));

  _tokenOwner[tokenId] = to;
  _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

  emit Transfer(address(0), to, tokenId);
}

internal ERC721._burn keyboard_arrow_up

Parameters help

Name Type
owner
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _burn(address owner, uint256 tokenId) internal {
  require(ownerOf(tokenId) == owner);

  _clearApproval(tokenId);

  _ownedTokensCount[owner] = _ownedTokensCount[owner].sub(1);
  _tokenOwner[tokenId] = address(0);

  emit Transfer(owner, address(0), tokenId);
}

internal ERC721._burn keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _burn(uint256 tokenId) internal {
  _burn(ownerOf(tokenId), tokenId);
}

internal ERC721._transferFrom keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _transferFrom(
  address from,
  address to,
  uint256 tokenId
) internal {
  require(ownerOf(tokenId) == from);
  require(to != address(0));

  _clearApproval(tokenId);

  _ownedTokensCount[from] = _ownedTokensCount[from].sub(1);
  _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

  _tokenOwner[tokenId] = to;

  emit Transfer(from, to, tokenId);
}

internal ERC721._checkOnERC721Received keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help
_data
bytes help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _checkOnERC721Received(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal returns (bool) {
  if (!to.isContract()) {
    return true;
  }

  bytes4 retval = IERC721Receiver(to).onERC721Received(
    msg.sender,
    from,
    tokenId,
    _data
  );
  return (retval == _ERC721_RECEIVED);
}

internal ERC721._clearApproval keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _clearApproval(uint256 tokenId) private {
  if (_tokenApprovals[tokenId] != address(0)) {
    _tokenApprovals[tokenId] = address(0);
  }
}

internal ERC165.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
constructor() internal {
  _registerInterface(_INTERFACE_ID_ERC165);
}

internal ERC165._registerInterface keyboard_arrow_up

Parameters help

Name Type
interfaceId
bytes4 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _registerInterface(bytes4 interfaceId) internal {
  require(interfaceId != 0xffffffff);
  _supportedInterfaces[interfaceId] = true;
}