Official Go implementation of the Ethereum protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-ethereum/contracts/ens/contract/FIFSRegistrar.sol

36 lines
1007 B

6 years ago
pragma solidity ^0.5.0;
6 years ago
import "./ENS.sol";
/**
* A registrar that allocates subdomains to the first person to claim them.
*/
contract FIFSRegistrar {
6 years ago
ENS ens;
bytes32 rootNode;
6 years ago
modifier only_owner(bytes32 label) {
address currentOwner = ens.owner(keccak256(abi.encodePacked(rootNode, label)));
require(currentOwner == address(0x0) || currentOwner == msg.sender);
_;
}
/**
* Constructor.
* @param ensAddr The address of the ENS registry.
* @param node The node that this registrar administers.
*/
6 years ago
constructor(ENS ensAddr, bytes32 node) public {
ens = ensAddr;
rootNode = node;
}
/**
* Register a name, or change the owner of an existing registration.
6 years ago
* @param label The hash of the label to register.
* @param owner The address of the new owner.
*/
6 years ago
function register(bytes32 label, address owner) public only_owner(label) {
ens.setSubnodeOwner(rootNode, label, owner);
}
6 years ago
}