Smart Contracts
Contracts
TldClaimManager

TldClaimManager

Git Source (opens in a new tab)

Author: Sam Ward

Inherits: OwnableUpgradeable, ITldClaimManager, HasLabelValidator, HasUsdOracle

This contract is for managing the TLDs that can be claimed TLD managers can add allowed TLDs that can be minted by address

State Variables

isNodeRegistered

mapping(bytes32 => bool) public isNodeRegistered;

allowedTldManager

mapping(address => bool) public allowedTldManager;

tldClaimantMap

mapping(bytes32 => address) public tldClaimantMap;

tldProviderMap

mapping(bytes32 => address) public tldProviderMap;

handshakeTldContract

IHandshakeTld public handshakeTldContract;

handshakeWalletPayoutAddress

address public handshakeWalletPayoutAddress;

defaultRegistrationStrategy

ISldRegistrationStrategy public defaultRegistrationStrategy;

mintPriceInDollars

uint256 public mintPriceInDollars;

Functions

constructor

constructor();

init

function init(
    ILabelValidator _validator,
    address _owner,
    IHandshakeTld _tld,
    ISldRegistrationStrategy _strategy,
    IPriceOracle _oracle,
    uint256 _mintPriceInDollars,
    address _handshakeWalletPayoutAddress
) public initializer;

canClaim

Helper function to check if an address can claim a TLD

This function is public so that it can be used by UI if required.

function canClaim(address _addr, bytes32 _namehash) public view returns (bool _canClaim);

Parameters

NameTypeDescription
_addraddressaddress of the claimant
_namehashbytes32Namehash of the TLD label. Use namehash library.

Returns

NameTypeDescription
_canClaimboolReturn bool value

setHandshakeTldContract

function setHandshakeTldContract(IHandshakeTld _tld) external onlyOwner;

updatePriceOracle

Update the chainlink price oracle.

Probably should never need updating.

function updatePriceOracle(IPriceOracle _oracle) public onlyOwner;

Parameters

NameTypeDescription
_oracleIPriceOracleAddress of the internal price oracle (this proxies to chainlink in current instance)

updateMintPrice

Update the mint price in dollars

Can be updated by contract owner

function updateMintPrice(uint256 _priceInDollarDecimals) public onlyOwner;

Parameters

NameTypeDescription
_priceInDollarDecimalsuint256Price in dollars

claimTld

This function calls through to the TLD NFT contract and registers TLD NFT.

Only whitelisted TLDs can be claimed/minted

function claimTld(string calldata _domain, address _addr) external payable;

Parameters

NameTypeDescription
_domainstringstring domain TLD
_addraddress

addTldAndClaimant

This function adds addresses / domains to whitelist. Only one address per TLD

Can be removed from the whitelist by using address(0). Both arrays should be the same size

function addTldAndClaimant(address[] calldata _addr, string[] calldata _domain) external onlyAuthorisedTldManager;

Parameters

NameTypeDescription
_addraddress[]Addresses of the wallets allowed to claim
_domainstring[]string representation of the domains that will be claimed

updateAllowedTldManager

This function adds addresses that are allowed to add TLD claimers

Only can be ran by the contract owner

function updateAllowedTldManager(address _addr, bool _allowed) external onlyOwner;

Parameters

NameTypeDescription
_addraddressAddress of a wallet allowed to add TLD claimers
_allowedbooltrue/false. Wallets can be removed by using false

updateLabelValidator

Update the label validator contract. This just contains a function that checks the label is acceptable

This should implement the ILabelValidator interface. Can only be run from the contract owner wallet

function updateLabelValidator(ILabelValidator _validator) public onlyOwner;

Parameters

NameTypeDescription
_validatorILabelValidatorAddress of the label validator. This can be updated in the future if required.

getMintPriceInWei

function getMintPriceInWei() public view returns (uint256);

onlyAuthorisedTldManager

modifier onlyAuthorisedTldManager();