Skip to content

Latest commit

 

History

History
1986 lines (1322 loc) · 38.8 KB

index.md

File metadata and controls

1986 lines (1322 loc) · 38.8 KB

Solidity API

Unauthorised

error Unauthorised(bytes32 node, address addr)

IncompatibleParent

error IncompatibleParent()

IncorrectTokenType

error IncorrectTokenType()

LabelMismatch

error LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash)

LabelTooShort

error LabelTooShort()

LabelTooLong

error LabelTooLong(string label)

IncorrectTargetOwner

error IncorrectTargetOwner(address owner)

CannotUpgrade

error CannotUpgrade()

OperationProhibited

error OperationProhibited(bytes32 node)

NameIsNotWrapped

error NameIsNotWrapped()

NameIsStillExpired

error NameIsStillExpired()

NameWrapper

ens

contract ENS ens

registrar

contract IBaseRegistrar registrar

metadataService

contract IMetadataService metadataService

names

mapping(bytes32 => bytes) names

name

string name

GRACE_PERIOD

uint64 GRACE_PERIOD

ETH_NODE

bytes32 ETH_NODE

ETH_LABELHASH

bytes32 ETH_LABELHASH

ROOT_NODE

bytes32 ROOT_NODE

upgradeContract

contract INameWrapperUpgrade upgradeContract

MAX_EXPIRY

uint64 MAX_EXPIRY

_userNodes

mapping(address => struct EnumerableSet.Bytes32Set) _userNodes

constructor

constructor(contract ENS _ens, contract IBaseRegistrar _registrar, contract IMetadataService _metadataService) public

initialize

function initialize(contract ENS _ens, contract IBaseRegistrar _registrar, contract IMetadataService _metadataService) public

_init

function _init(contract ENS _ens, contract IBaseRegistrar _registrar, contract IMetadataService _metadataService) internal

supportsInterface

function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)

ownerOf

function ownerOf(uint256 id) public view returns (address owner)

Gets the owner of a name

Parameters

Name Type Description
id uint256 Label as a string of the .eth domain to wrap

Return Values

Name Type Description
owner address The owner of the name

getData

function getData(uint256 id) public view returns (address owner, uint32 fuses, uint64 expiry)

Gets the data for a name

Parameters

Name Type Description
id uint256 Namehash of the name

Return Values

Name Type Description
owner address Owner of the name
fuses uint32 Fuses of the name
expiry uint64 Expiry of the name

setMetadataService

function setMetadataService(contract IMetadataService _metadataService) public

Set the metadata service. Only the owner can do this

Parameters

Name Type Description
_metadataService contract IMetadataService The new metadata service

uri

function uri(uint256 tokenId) public view returns (string)

Get the metadata uri

Parameters

Name Type Description
tokenId uint256 The id of the token

Return Values

Name Type Description
[0] string string uri of the metadata service

setUpgradeContract

function setUpgradeContract(contract INameWrapperUpgrade _upgradeAddress) public

Set the address of the upgradeContract of the contract. only admin can do this

The default value of upgradeContract is the 0 address. Use the 0 address at any time to make the contract not upgradable.

Parameters

Name Type Description
_upgradeAddress contract INameWrapperUpgrade address of an upgraded contract

onlyTokenOwner

modifier onlyTokenOwner(bytes32 node)

Checks if msg.sender is the owner or approved by the owner of a name

Parameters

Name Type Description
node bytes32 namehash of the name to check

canModifyName

function canModifyName(bytes32 node, address addr) public view returns (bool)

Checks if owner or approved by owner

Parameters

Name Type Description
node bytes32 namehash of the name to check
addr address which address to check permissions for

Return Values

Name Type Description
[0] bool whether or not is owner or approved

wrapETH2LD

function wrapETH2LD(string label, address wrappedOwner, uint16 ownerControlledFuses, address resolver) public

Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract

Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar

Parameters

Name Type Description
label string Label as a string of the .eth domain to wrap
wrappedOwner address Owner of the name in this contract
ownerControlledFuses uint16 Initial owner-controlled fuses to set
resolver address Resolver contract address

registerAndWrapETH2LD

function registerAndWrapETH2LD(string label, address wrappedOwner, uint256 duration, address resolver, uint16 ownerControlledFuses) external returns (uint256 registrarExpiry)

Registers a new .eth second-level domain and wraps it. Only callable by authorised controllers.

Parameters

Name Type Description
label string The label to register (Eg, 'foo' for 'foo.eth').
wrappedOwner address The owner of the wrapped name.
duration uint256 The duration, in seconds, to register the name for.
resolver address The resolver address to set on the ENS registry (optional).
ownerControlledFuses uint16 Initial owner-controlled fuses to set

Return Values

Name Type Description
registrarExpiry uint256 The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.

renew

function renew(uint256 tokenId, uint256 duration) external returns (uint256 expires)

Renews a .eth second-level domain.

Only callable by authorised controllers.

Parameters

Name Type Description
tokenId uint256 The hash of the label to register (eg, keccak256('foo'), for 'foo.eth').
duration uint256 The number of seconds to renew the name for.

Return Values

Name Type Description
expires uint256 The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.

wrap

function wrap(bytes name, address wrappedOwner, address resolver) public

Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain

Can be called by the owner in the registry or an authorised caller in the registry

Parameters

Name Type Description
name bytes The name to wrap, in DNS format
wrappedOwner address Owner of the name in this contract
resolver address Resolver contract

unwrapETH2LD

function unwrapETH2LD(bytes32 labelhash, address registrant, address controller) public

Unwraps a .eth domain. e.g. vitalik.eth

Can be called by the owner in the wrapper or an authorised caller in the wrapper

Parameters

Name Type Description
labelhash bytes32 Labelhash of the .eth domain
registrant address Sets the owner in the .eth registrar to this address
controller address Sets the owner in the registry to this address

unwrap

function unwrap(bytes32 parentNode, bytes32 labelhash, address controller) public

Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain

Can be called by the owner in the wrapper or an authorised caller in the wrapper

Parameters

Name Type Description
parentNode bytes32 Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')
labelhash bytes32 Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')
controller address Sets the owner in the registry to this address

setFuses

function setFuses(bytes32 node, uint16 ownerControlledFuses) public returns (uint32)

Sets fuses of a name

Parameters

Name Type Description
node bytes32 Namehash of the name
ownerControlledFuses uint16 Owner-controlled fuses to burn

Return Values

Name Type Description
[0] uint32 Old fuses

extendExpiry

function extendExpiry(bytes32 parentNode, bytes32 labelhash, uint64 expiry) public returns (uint64)

Extends expiry for a name

Parameters

Name Type Description
parentNode bytes32 Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')
labelhash bytes32 Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')
expiry uint64 When the name will expire in seconds since the Unix epoch

Return Values

Name Type Description
[0] uint64 New expiry

upgrade

function upgrade(bytes name, bytes extraData) public

Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain

Can be called by the owner or an authorised caller

Parameters

Name Type Description
name bytes The name to upgrade, in DNS format
extraData bytes Extra data to pass to the upgrade contract

setChildFuses

function setChildFuses(bytes32 parentNode, bytes32 labelhash, uint32 fuses, uint64 expiry) public

/* @notice Sets fuses of a name that you own the parent of. Can also be called by the owner of a .eth name

Parameters

Name Type Description
parentNode bytes32 Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')
labelhash bytes32 Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')
fuses uint32 Fuses to burn
expiry uint64 When the name will expire in seconds since the Unix epoch

setSubnodeOwner

function setSubnodeOwner(bytes32 parentNode, string label, address owner, uint32 fuses, uint64 expiry) public returns (bytes32 node)

Sets the subdomain owner in the registry and then wraps the subdomain

Parameters

Name Type Description
parentNode bytes32 Parent namehash of the subdomain
label string Label of the subdomain as a string
owner address New owner in the wrapper
fuses uint32 Initial fuses for the wrapped subdomain
expiry uint64 When the name will expire in seconds since the Unix epoch

Return Values

Name Type Description
node bytes32 Namehash of the subdomain

setSubnodeRecord

function setSubnodeRecord(bytes32 parentNode, string label, address owner, address resolver, uint64 ttl, uint32 fuses, uint64 expiry) public returns (bytes32 node)

Sets the subdomain owner in the registry with records and then wraps the subdomain

Parameters

Name Type Description
parentNode bytes32 parent namehash of the subdomain
label string label of the subdomain as a string
owner address new owner in the wrapper
resolver address resolver contract in the registry
ttl uint64 ttl in the registry
fuses uint32 initial fuses for the wrapped subdomain
expiry uint64 When the name will expire in seconds since the Unix epoch

Return Values

Name Type Description
node bytes32 Namehash of the subdomain

setRecord

function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) public

Sets records for the name in the ENS Registry

Parameters

Name Type Description
node bytes32 Namehash of the name to set a record for
owner address New owner in the registry
resolver address Resolver contract
ttl uint64 Time to live in the registry

setResolver

function setResolver(bytes32 node, address resolver) public

Sets resolver contract in the registry

Parameters

Name Type Description
node bytes32 namehash of the name
resolver address the resolver contract

setTTL

function setTTL(bytes32 node, uint64 ttl) public

Sets TTL in the registry

Parameters

Name Type Description
node bytes32 Namehash of the name
ttl uint64 TTL in the registry

operationAllowed

modifier operationAllowed(bytes32 node, uint32 fuseMask)

Allows an operation only if none of the specified fuses are burned.

Parameters

Name Type Description
node bytes32 The namehash of the name to check fuses on.
fuseMask uint32 A bitmask of fuses that must not be burned.

_checkCanCallSetSubnodeOwner

function _checkCanCallSetSubnodeOwner(bytes32 parentNode, bytes32 subnode) internal view

Check whether a name can call setSubnodeOwner/setSubnodeRecord

Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt and checks whether the owner of the subdomain is 0x0 for creating or already exists for replacing a subdomain. If either conditions are true, then it is possible to call setSubnodeOwner

Parameters

Name Type Description
parentNode bytes32 Namehash of the parent name to check
subnode bytes32 Namehash of the subname to check

allFusesBurned

function allFusesBurned(bytes32 node, uint32 fuseMask) public view returns (bool)

Checks all Fuses in the mask are burned for the node

Parameters

Name Type Description
node bytes32 Namehash of the name
fuseMask uint32 The fuses you want to check

Return Values

Name Type Description
[0] bool Boolean of whether or not all the selected fuses are burned

isWrapped

function isWrapped(bytes32 node) public view returns (bool)

Checks if a name is wrapped

Parameters

Name Type Description
node bytes32 Namehash of the name

Return Values

Name Type Description
[0] bool Boolean of whether or not the name is wrapped

isWrapped

function isWrapped(bytes32 parentNode, bytes32 labelhash) public view returns (bool)

Checks if a name is wrapped in a more gas efficient way

Parameters

Name Type Description
parentNode bytes32 Namehash of the name
labelhash bytes32 Namehash of the name

Return Values

Name Type Description
[0] bool Boolean of whether or not the name is wrapped

onERC721Received

function onERC721Received(address to, address, uint256 tokenId, bytes data) public returns (bytes4)

_preTransferCheck

function _preTransferCheck(uint256 id, uint32 fuses, uint64 expiry) internal view returns (bool)

_clearOwnerAndFuses

function _clearOwnerAndFuses(address owner, uint32 fuses, uint64 expiry) internal view returns (address, uint32)

_makeNode

function _makeNode(bytes32 node, bytes32 labelhash) private pure returns (bytes32)

_addLabel

function _addLabel(string label, bytes name) internal pure returns (bytes ret)

_mint

function _mint(bytes32 node, address owner, uint32 fuses, uint64 expiry) internal

_wrap

function _wrap(bytes32 node, bytes name, address wrappedOwner, uint32 fuses, uint64 expiry) internal

_storeNameAndWrap

function _storeNameAndWrap(bytes32 parentNode, bytes32 node, string label, address owner, uint32 fuses, uint64 expiry) internal

_saveLabel

function _saveLabel(bytes32 parentNode, bytes32 node, string label) internal returns (bytes)

_updateName

function _updateName(bytes32 parentNode, bytes32 node, string label, address owner, uint32 fuses, uint64 expiry) internal

_checkParentFusesAndExpiry

function _checkParentFusesAndExpiry(bytes32 parentNode, bytes32 node, uint32 fuses, uint64 expiry) internal view returns (uint64)

_checkParentFuses

function _checkParentFuses(bytes32 node, uint32 fuses, uint32 parentFuses) internal pure

_normaliseExpiry

function _normaliseExpiry(uint64 expiry, uint64 oldExpiry, uint64 maxExpiry) internal pure returns (uint64)

_wrapETH2LD

function _wrapETH2LD(string label, address wrappedOwner, uint32 fuses, uint64 expiry, address resolver) private

_unwrap

function _unwrap(bytes32 node, address owner) private

_setFuses

function _setFuses(bytes32 node, address owner, uint32 fuses, uint64 oldExpiry, uint64 expiry) internal

_setData

function _setData(bytes32 node, address owner, uint32 fuses, uint64 expiry) internal

_canFusesBeBurned

function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure

_checkFusesAreSettable

function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure

_isWrapped

function _isWrapped(bytes32 node) internal view returns (bool)

safeTransferFrom

function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes data) public virtual

safeBatchTransferFrom

function safeBatchTransferFrom(address from, address to, uint256[] ids, uint256[] amounts, bytes data) public virtual

_updateNodeOwner

function _updateNodeOwner(address from, address to, uint256 id) internal

userNodeSet

function userNodeSet(address user) public view returns (bytes32[])

userDomains

function userDomains(address user) public view returns (string[])

_burn

function _burn(uint256 tokenId) internal

BulkRenewal

ETH_NAMEHASH

bytes32 ETH_NAMEHASH

ens

contract ENS ens

constructor

constructor(contract ENS _ens) public

getController

function getController() internal view returns (contract Web3RegistrarController)

rentPrice

function rentPrice(string[] names, uint256 duration) external view returns (uint256 total)

renewAll

function renewAll(string[] names, uint256 duration) external payable

supportsInterface

function supportsInterface(bytes4 interfaceID) external pure returns (bool)

IFiatPriceOracle

priceInFiat

function priceInFiat(string name, uint256 expires, uint256 duration) external view returns (struct IPriceOracle.Price)

INameWhitelist

isReserved

function isReserved(string label) external view returns (bool)

isLabelValid

function isLabelValid(string label) external view returns (bool)

CommitmentTooNew

error CommitmentTooNew(bytes32 commitment)

CommitmentTooOld

error CommitmentTooOld(bytes32 commitment)

NameNotAvailable

error NameNotAvailable(string name)

DurationTooShort

error DurationTooShort(uint256 duration)

ResolverRequiredWhenDataSupplied

error ResolverRequiredWhenDataSupplied()

UnexpiredCommitmentExists

error UnexpiredCommitmentExists(bytes32 commitment)

InsufficientValue

error InsufficientValue()

Unauthorised

error Unauthorised(bytes32 node)

MaxCommitmentAgeTooLow

error MaxCommitmentAgeTooLow()

MaxCommitmentAgeTooHigh

error MaxCommitmentAgeTooHigh()

Web3RegistrarController

A registrar controller for registering and renewing names at fixed cost.

MIN_REGISTRATION_DURATION

uint256 MIN_REGISTRATION_DURATION

ETH_NODE

bytes32 ETH_NODE

MAX_EXPIRY

uint64 MAX_EXPIRY

base

contract BaseRegistrarImplementation base

prices

contract IFiatPriceOracle prices

minCommitmentAge

uint256 minCommitmentAge

maxCommitmentAge

uint256 maxCommitmentAge

reverseRegistrar

contract ReverseRegistrar reverseRegistrar

nameWrapper

contract INameWrapper nameWrapper

commitments

mapping(bytes32 => uint256) commitments

NameRegistered

event NameRegistered(string name, bytes32 label, address owner, uint256 baseCost, uint256 premium, uint256 expires)

NameRenewed

event NameRenewed(string name, bytes32 label, uint256 cost, uint256 expires)

nameWhitelist

contract INameWhitelist nameWhitelist

validLen

uint256 validLen

LabelStatus

enum LabelStatus {
  Valid,
  TooShort,
  Reserved,
  IllegalChar,
  Locked,
  Registered,
  SoldOut
}

ADMIN_ROLE

bytes32 ADMIN_ROLE

constructor

constructor(contract BaseRegistrarImplementation _base, contract IFiatPriceOracle _prices, uint256 _minCommitmentAge, uint256 _maxCommitmentAge, contract ReverseRegistrar _reverseRegistrar, contract INameWrapper _nameWrapper) public

initialize

function initialize(contract BaseRegistrarImplementation _base, contract IFiatPriceOracle _prices, uint256 _minCommitmentAge, uint256 _maxCommitmentAge, contract ReverseRegistrar _reverseRegistrar, contract INameWrapper _nameWrapper, address _admin) public

_init

function _init(contract BaseRegistrarImplementation _base, contract IFiatPriceOracle _prices, uint256 _minCommitmentAge, uint256 _maxCommitmentAge, contract ReverseRegistrar _reverseRegistrar, contract INameWrapper _nameWrapper) internal

rentPrice

function rentPrice(string name, uint256 duration) public view returns (struct IPriceOracle.Price price)

valid

function valid(string name) public view returns (bool)

available

function available(string name) public view returns (bool)

makeCommitment

function makeCommitment(string name, address owner, uint256 duration, bytes32 secret, address resolver, bytes[] data, bool reverseRecord, uint16 ownerControlledFuses) public pure returns (bytes32)

makeCommitment

function makeCommitment(string name, address owner, uint256 duration, bytes32 secret, address resolver, bytes[] data, bool reverseRecord, uint16 ownerControlledFuses, uint64 wrapperExpiry) public pure returns (bytes32)

commit

function commit(bytes32 commitment) public

register

function register(string name, address owner, uint256 duration, bytes32 secret, address resolver, bytes[] data, bool reverseRecord, uint16 ownerControlledFuses, uint64 wrapperExpiry) public payable

register

function register(string name, address owner, uint256 duration, bytes32 secret, address resolver, bytes[] data, bool reverseRecord, uint16 ownerControlledFuses) public payable

_register

function _register(string name, address owner, uint256 duration, bytes32 secret, address resolver, bytes[] data, bool reverseRecord, uint16 ownerControlledFuses) internal returns (uint256)

renew

function renew(string name, uint256 duration) external payable

withdraw

function withdraw() public

supportsInterface

function supportsInterface(bytes4 interfaceID) public pure returns (bool)

_consumeCommitment

function _consumeCommitment(string name, uint256 duration, bytes32 commitment) internal

_setRecords

function _setRecords(address resolverAddress, bytes32 label, bytes[] data) internal

_setReverseRecord

function _setReverseRecord(string name, address resolver, address owner) internal

rentPriceInFiat

function rentPriceInFiat(string name, uint256 duration) public view returns (struct IPriceOracle.Price price)

labelStatus

function labelStatus(string _label) public view returns (enum Web3RegistrarController.LabelStatus)

renewWithFiat

function renewWithFiat(string name, uint256 duration, uint32 fuses, uint64 wrapperExpiry) public

registerWithFiat

function registerWithFiat(string name, address owner, uint256 duration, bytes32 secret, address resolver, bytes[] data, bool reverseRecord, uint16 fuses, uint64 wrapperExpiry) public

setCommitmentAge

function setCommitmentAge(uint256 _minCommitmentAge, uint256 _maxCommitmentAge) public

setNameWhitelist

function setNameWhitelist(contract INameWhitelist _nameWhitelist) public

setPriceOracle

function setPriceOracle(contract IFiatPriceOracle _prices) public

setValidLen

function setValidLen(uint256 _len) public

addAdmin

function addAdmin(address addr) public

ICNameWrapper

tokenCount

function tokenCount() external view returns (uint256)

NameWhitelist

ZERO_WIDTH_SPACE

bytes ZERO_WIDTH_SPACE

CHAR_WHITE_LIST

string CHAR_WHITE_LIST

EMOJI_WHITE_LIST

string EMOJI_WHITE_LIST

whiteList

mapping(string => bool) whiteList

specialNames

mapping(bytes32 => bool) specialNames

constructor

constructor() public

checkIfZeroNotPresent

function checkIfZeroNotPresent(string _name) public pure returns (bool)

checkContainBytes

function checkContainBytes(string toCheck, bytes toFind) public pure returns (bool)

isLabelValid

function isLabelValid(string _label) public view returns (bool)

isInWhiteList

function isInWhiteList(string toCheck) public view returns (bool)

isReserved

function isReserved(string label) public view returns (bool)

setSpecialName

function setSpecialName(bytes32 name, bool isSpecial) public

setSpecialNameBatch

function setSpecialNameBatch(bytes32[] names, bool isSpecial) public

setWhiteList

function setWhiteList(string char, bool isWhite) public

setWhiteListBatch

function setWhiteListBatch(string chars, bool isWhite) public

keccak

function keccak(string str) private pure returns (bytes32)

CNSPublicResolver

COIN_TYPE_CFX

uint256 COIN_TYPE_CFX

constructor

constructor(contract ENS _ens, contract INameWrapper wrapperAddress, address _trustedETHController, address _trustedReverseRegistrar) public

setAddr

function setAddr(bytes32 node, address a) external virtual

Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry.

Parameters

Name Type Description
node bytes32 The node to update.
a address The address to set.

addr

function addr(bytes32 node) public view virtual returns (address payable)

Returns the address associated with an ENS node.

Parameters

Name Type Description
node bytes32 The ENS node to query.

Return Values

Name Type Description
[0] address payable The associated address.

CNSUtil

ens

contract ENS ens

baseRegistrar

contract IBaseRegistrar baseRegistrar

constructor

constructor(address _ens, address _base) public

addr

function addr(bytes32 node) public view returns (address)

addr

function addr(bytes32 node, uint256 coinType) public view returns (bytes)

addrBatch

function addrBatch(bytes32[] nodes) public view returns (address[])

ownerOf

function ownerOf(uint256 tokenId) public view returns (address)

setENS

function setENS(address _ens) public

setBaseRegistrar

function setBaseRegistrar(address _base) public

Strings

slice

struct slice {
  uint256 _len;
  uint256 _ptr;
}

toSlice

function toSlice(string self) internal pure returns (struct Strings.slice)

keccak

function keccak(struct Strings.slice self) internal pure returns (bytes32 ret)

empty

function empty(struct Strings.slice self) internal pure returns (bool)

rfindPtr

function rfindPtr(uint256 selflen, uint256 selfptr, uint256 needlelen, uint256 needleptr) private pure returns (uint256)

rsplit

function rsplit(struct Strings.slice self, struct Strings.slice needle, struct Strings.slice token) internal pure returns (struct Strings.slice)

Namehash

namehash

function namehash(string name) internal pure returns (bytes32 hash)

ReverseRecords

ens

contract ENS ens

registrar

contract ReverseRegistrar registrar

ADDR_REVERSE_NODE

bytes32 ADDR_REVERSE_NODE

constructor

constructor(contract ENS _ens) public

The constructor takes ENS registry address

getNames

function getNames(address[] addresses) external view returns (string[] r)

Read only function to return ens name only if both forward and reverse resolution are set *

node

function node(address addr) private pure returns (bytes32)

sha3HexAddress

function sha3HexAddress(address addr) private pure returns (bytes32 ret)

Lock

unlockTime

uint256 unlockTime

owner

address payable owner

Withdrawal

event Withdrawal(uint256 amount, uint256 when)

NewPriceOracle

event NewPriceOracle(address oracle)

names

struct EnumerableStringSet.StringSet names

constructor

constructor(uint256 _unlockTime) public payable

withdraw

function withdraw() public

addName

function addName(string name) public

removeName

function removeName(string name) public

containsName

function containsName(string name) public view returns (bool)

getNames

function getNames() public view returns (string[])

EnumerableStringSet

Set

struct Set {
  string[] _values;
  mapping(string => uint256) _indexes;
}

_add

function _add(struct EnumerableStringSet.Set set, string value) private returns (bool)

_Add a value to a set. O(1).

Returns true if the value was added to the set, that is if it was not already present._

_remove

function _remove(struct EnumerableStringSet.Set set, string value) private returns (bool)

_Removes a value from a set. O(1).

Returns true if the value was removed from the set, that is if it was present._

_contains

function _contains(struct EnumerableStringSet.Set set, string value) private view returns (bool)

Returns true if the value is in the set. O(1).

_length

function _length(struct EnumerableStringSet.Set set) private view returns (uint256)

Returns the number of values on the set. O(1).

_at

function _at(struct EnumerableStringSet.Set set, uint256 index) private view returns (string)

_Returns the value stored at position index in the set. O(1).

Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed.

Requirements:

  • index must be strictly less than {length}._

_values

function _values(struct EnumerableStringSet.Set set) private view returns (string[])

_Return the entire set in an array

WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that this function has an unbounded cost, and using it as part of a state-changing function may render the function uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block._

_values

function _values(struct EnumerableStringSet.Set set, uint256 start, uint256 limit) private view returns (string[])

StringSet

struct StringSet {
  struct EnumerableStringSet.Set _inner;
}

add

function add(struct EnumerableStringSet.StringSet set, string value) internal returns (bool)

_Add a value to a set. O(1).

Returns true if the value was added to the set, that is if it was not already present._

remove

function remove(struct EnumerableStringSet.StringSet set, string value) internal returns (bool)

_Removes a value from a set. O(1).

Returns true if the value was removed from the set, that is if it was present._

contains

function contains(struct EnumerableStringSet.StringSet set, string value) internal view returns (bool)

Returns true if the value is in the set. O(1).

length

function length(struct EnumerableStringSet.StringSet set) internal view returns (uint256)

Returns the number of values in the set. O(1).

at

function at(struct EnumerableStringSet.StringSet set, uint256 index) internal view returns (string)

_Returns the value stored at position index in the set. O(1).

Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed.

Requirements:

  • index must be strictly less than {length}._

values

function values(struct EnumerableStringSet.StringSet set) internal view returns (string[])

_Return the entire set in an array

WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that this function has an unbounded cost, and using it as part of a state-changing function may render the function uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block._

values

function values(struct EnumerableStringSet.StringSet set, uint256 start, uint256 limit) internal view returns (string[])

Proxy1967

constructor

constructor(address logic, bytes data) public

implementation

function implementation() public view returns (address)

upgradeTo

function upgradeTo(address newImplementation) public

CFXPriceOracle

value

int256 value

constructor

constructor(int256 _value) public

set

function set(int256 _value) public

latestAnswer

function latestAnswer() public view returns (int256)

AggregatorInterface

latestAnswer

function latestAnswer() external view returns (int256)

StablePriceOracle

price1Letter

uint256 price1Letter

price2Letter

uint256 price2Letter

price3Letter

uint256 price3Letter

price4Letter

uint256 price4Letter

price5Letter

uint256 price5Letter

fiatPrice1Letter

uint256 fiatPrice1Letter

fiatPrice2Letter

uint256 fiatPrice2Letter

fiatPrice3Letter

uint256 fiatPrice3Letter

fiatPrice4Letter

uint256 fiatPrice4Letter

fiatPrice5Letter

uint256 fiatPrice5Letter

usdOracle

contract AggregatorInterface usdOracle

RentPriceChanged

event RentPriceChanged(uint256[] prices, uint8 priceType)

constructor

constructor(contract AggregatorInterface _usdOracle, uint256[] _rentPrices) public

price

function price(string name, uint256 expires, uint256 duration) external view returns (struct IPriceOracle.Price)

Returns the price to register or renew a name.

Parameters

Name Type Description
name string The name being registered or renewed.
expires uint256 When the name presently expires (0 if this is a new registration).
duration uint256 How long the name is being registered or extended for, in seconds.

Return Values

Name Type Description
[0] struct IPriceOracle.Price base premium tuple of base price + premium price

priceInFiat

function priceInFiat(string name, uint256 expires, uint256 duration) external view returns (struct IPriceOracle.Price)

premium

function premium(string name, uint256 expires, uint256 duration) external view returns (uint256)

Returns the pricing premium in wei.

_premium

function _premium(string name, uint256 expires, uint256 duration) internal view virtual returns (uint256)

Returns the pricing premium in internal base units.

attoUSDToWei

function attoUSDToWei(uint256 amount) internal view returns (uint256)

weiToAttoUSD

function weiToAttoUSD(uint256 amount) internal view returns (uint256)

supportsInterface

function supportsInterface(bytes4 interfaceID) public view virtual returns (bool)

setRentPrice

function setRentPrice(uint256[] _rentPrices) public

setFiatRentPrice

function setFiatRentPrice(uint256[] _rentPrices) public