e7d1867964
* contracts/ens: update public resolver solidity code * contracts/ens: update public resolver, update go bindings * update build * fix ens.sol * contracts/ens: change contract interface * contracts/ens: implement public resolver changes * contracts/ens: added ENSRegistry contract * contracts/ens: reinstate old contract code * contracts/ens: update README.md * contracts/ens: added test coverage for fallback contract * contracts/ens: added support for fallback contract * contracts/ens: removed unused contract code * contracts/ens: add todo and decode multicodec stub * add encode * vendor: add ipfs cid libraries * contracts/ens: cid sanity tests * contracts/ens: more cid sanity checks * contracts/ens: wip integration * wip * Revert "vendor: add ipfs cid libraries" This reverts commit 29d9b6b294ded903a1065d96c8149119713cfd12. * contracts/ens: removed multiformats dependencies * contracts/ens: added decode tests * contracts/ens: added eip spec test, minor changes to exiting tests * contracts/ens: moved cid decoding to own file * contracts/ens: added unit test to encode hash to content hash * contracts/ens: removed unused code * contracts/ens: fix ens tests to use cid decode and encode * contracts/ens: adjust swarm multicodecs after pr merge * contracts/ens: fix linter error * constracts/ens: address PR comments * cmd, contracts: make peoples lives easier * contracts/ens: fix linter error * contracts/ens: address PR comments
36 lines
1007 B
Solidity
36 lines
1007 B
Solidity
pragma solidity ^0.5.0;
|
|
|
|
import "./ENS.sol";
|
|
|
|
/**
|
|
* A registrar that allocates subdomains to the first person to claim them.
|
|
*/
|
|
contract FIFSRegistrar {
|
|
ENS ens;
|
|
bytes32 rootNode;
|
|
|
|
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.
|
|
*/
|
|
constructor(ENS ensAddr, bytes32 node) public {
|
|
ens = ensAddr;
|
|
rootNode = node;
|
|
}
|
|
|
|
/**
|
|
* Register a name, or change the owner of an existing registration.
|
|
* @param label The hash of the label to register.
|
|
* @param owner The address of the new owner.
|
|
*/
|
|
function register(bytes32 label, address owner) public only_owner(label) {
|
|
ens.setSubnodeOwner(rootNode, label, owner);
|
|
}
|
|
} |