Skip to content
Branch: master
Find file Copy path
3 contributors

Users who have contributed to this file

@decanus @yuanfeiz @hgedia
38 lines (31 sloc) 1.01 KB
pragma solidity >=0.4.24;
import "./ENS.sol";
* A registrar that allocates subdomains to the first person to claim them, but
* expires registrations a fixed period after they're initially claimed.
contract TestRegistrar {
uint constant registrationPeriod = 4 weeks;
ENS public ens;
bytes32 public rootNode;
mapping (bytes32 => uint) public expiryTimes;
* Constructor.
* @param ensAddr The address of the ENS registry.
* @param node The node that this registrar administers.
constructor(ENS ensAddr, bytes32 node) public {
ens = ensAddr;
rootNode = node;
* Register a name that's not currently registered
* @param label The hash of the label to register.
* @param owner The address of the new owner.
function register(bytes32 label, address owner) public {
require(expiryTimes[label] < now);
expiryTimes[label] = now + registrationPeriod;
ens.setSubnodeOwner(rootNode, label, owner);
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.