diff options
Diffstat (limited to 'contracts/ens/contract/FIFSRegistrar.sol')
-rw-r--r-- | contracts/ens/contract/FIFSRegistrar.sol | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/contracts/ens/contract/FIFSRegistrar.sol b/contracts/ens/contract/FIFSRegistrar.sol index 51629c2b6..19287408f 100644 --- a/contracts/ens/contract/FIFSRegistrar.sol +++ b/contracts/ens/contract/FIFSRegistrar.sol @@ -1,20 +1,17 @@ -pragma solidity ^0.4.0; +pragma solidity ^0.5.0; -import './AbstractENS.sol'; +import "./ENS.sol"; /** * A registrar that allocates subdomains to the first person to claim them. */ contract FIFSRegistrar { - AbstractENS ens; + ENS 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; - + modifier only_owner(bytes32 label) { + address currentOwner = ens.owner(keccak256(abi.encodePacked(rootNode, label))); + require(currentOwner == address(0x0) || currentOwner == msg.sender); _; } @@ -23,17 +20,17 @@ contract FIFSRegistrar { * @param ensAddr The address of the ENS registry. * @param node The node that this registrar administers. */ - function FIFSRegistrar(AbstractENS ensAddr, bytes32 node) { + constructor(ENS ensAddr, bytes32 node) public { 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 label 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); + function register(bytes32 label, address owner) public only_owner(label) { + ens.setSubnodeOwner(rootNode, label, owner); } -} +}
\ No newline at end of file |