github.com/aerth/aquachain@v1.4.1/contracts/ens/contract/FIFSRegistrar.sol (about)

     1  pragma solidity ^0.4.0;
     2  
     3  import './AbstractENS.sol';
     4  
     5  /**
     6   * A registrar that allocates subdomains to the first person to claim them.
     7   */
     8  contract FIFSRegistrar {
     9      AbstractENS ens;
    10      bytes32 rootNode;
    11  
    12      modifier only_owner(bytes32 subnode) {
    13          var node = sha3(rootNode, subnode);
    14          var currentOwner = ens.owner(node);
    15  
    16          if (currentOwner != 0 && currentOwner != msg.sender) throw;
    17  
    18          _;
    19      }
    20  
    21      /**
    22       * Constructor.
    23       * @param ensAddr The address of the ENS registry.
    24       * @param node The node that this registrar administers.
    25       */
    26      function FIFSRegistrar(AbstractENS ensAddr, bytes32 node) {
    27          ens = ensAddr;
    28          rootNode = node;
    29      }
    30  
    31      /**
    32       * Register a name, or change the owner of an existing registration.
    33       * @param subnode The hash of the label to register.
    34       * @param owner The address of the new owner.
    35       */
    36      function register(bytes32 subnode, address owner) only_owner(subnode) {
    37          ens.setSubnodeOwner(rootNode, subnode, owner);
    38      }
    39  }