Skip to content

Instantly share code, notes, and snippets.

Created October 31, 2019 19:52
What would you like to do?
contract Registrar is Owned {
ENS public ens;
mapping(address=>boolean) public controllers;
constructor(ENS _ens) public {
ens = _ens;
setController(msg.sender, true);
function setController(address controller, boolean isController) ownerOnly {
controllers[controller] = isController;
modifier controllerOnly {
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) controllerOnly {
require(ens.owner(keccak256(abi.encodePacked(node, label))) == address(0));
ens.setSubnodeOwner(node, label, owner);
function setResolver(bytes32 node, address resolver) controllerOnly {
ens.setResolver(node, resolver);
function setTTL(bytes32 node, uint ttl) controllerOnly {
ens.setTTL(node, ttl);
function setOwner(bytes32 node, address owner) controllerOnly {
ens.setOwner(node, owner);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment