ipld-eth-server/vendor/github.com/ethereum/go-ethereum/contracts/ens/contract/FIFSRegistrar.sol
Matt K 5a652190d9 Allow Parity as ingest node (#36)
* Upgrade go-ethereum to v1.8

* Add Node Info for parity nodes

* Upgrade start_private_blockchain to use v1.8
2018-03-07 15:29:21 -06:00

40 lines
1.0 KiB
Solidity

pragma solidity ^0.4.0;
import './AbstractENS.sol';
/**
* A registrar that allocates subdomains to the first person to claim them.
*/
contract FIFSRegistrar {
AbstractENS ens;
bytes32 rootNode;
modifier only_owner(bytes32 subnode) {
var node = sha3(rootNode, subnode);
var currentOwner = ens.owner(node);
if (currentOwner != 0 && currentOwner != msg.sender) throw;
_;
}
/**
* Constructor.
* @param ensAddr The address of the ENS registry.
* @param node The node that this registrar administers.
*/
function FIFSRegistrar(AbstractENS ensAddr, bytes32 node) {
ens = ensAddr;
rootNode = node;
}
/**
* Register a name, or change the owner of an existing registration.
* @param subnode The hash of the label to register.
* @param owner The address of the new owner.
*/
function register(bytes32 subnode, address owner) only_owner(subnode) {
ens.setSubnodeOwner(rootNode, subnode, owner);
}
}