diff --git a/lib/modules/ens/contracts/ENS.sol b/lib/modules/ens/contracts/ENS.sol index 61e0edac..4a8a6e23 100644 --- a/lib/modules/ens/contracts/ENS.sol +++ b/lib/modules/ens/contracts/ENS.sol @@ -15,12 +15,12 @@ interface ENS { event NewTTL(bytes32 indexed node, uint64 ttl); - function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public; - function setResolver(bytes32 node, address resolver) public; - function setOwner(bytes32 node, address owner) public; - function setTTL(bytes32 node, uint64 ttl) public; - function owner(bytes32 node) public view returns (address); - function resolver(bytes32 node) public view returns (address); - function ttl(bytes32 node) public view returns (uint64); + function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external; + function setResolver(bytes32 node, address resolver) external; + function setOwner(bytes32 node, address owner) external; + function setTTL(bytes32 node, uint64 ttl) external; + function owner(bytes32 node) external view returns (address); + function resolver(bytes32 node) external view returns (address); + function ttl(bytes32 node) external view returns (uint64); } diff --git a/lib/modules/ens/contracts/ENSRegistry.sol b/lib/modules/ens/contracts/ENSRegistry.sol index c843586c..b918458d 100644 --- a/lib/modules/ens/contracts/ENSRegistry.sol +++ b/lib/modules/ens/contracts/ENSRegistry.sol @@ -23,7 +23,7 @@ contract ENSRegistry is ENS { /** * @dev Constructs a new ENS registrar. */ - function ENSRegistry() public { + constructor() public { records[0x0].owner = msg.sender; } @@ -33,7 +33,7 @@ contract ENSRegistry is ENS { * @param owner The address of the new owner. */ function setOwner(bytes32 node, address owner) public only_owner(node, owner) { - Transfer(node, owner); + emit Transfer(node, owner); records[node].owner = owner; } @@ -44,8 +44,8 @@ contract ENSRegistry is ENS { * @param owner The address of the new owner. */ function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public only_owner(node, owner) { - var subnode = sha3(node, label); - NewOwner(node, label, owner); + bytes32 subnode = keccak256(abi.encodePacked(node, label)); + emit NewOwner(node, label, owner); records[subnode].owner = owner; } @@ -55,7 +55,7 @@ contract ENSRegistry is ENS { * @param resolver The address of the resolver. */ function setResolver(bytes32 node, address resolver) public only_owner(node, 0x0) { - NewResolver(node, resolver); + emit NewResolver(node, resolver); records[node].resolver = resolver; } @@ -65,7 +65,7 @@ contract ENSRegistry is ENS { * @param ttl The TTL in seconds. */ function setTTL(bytes32 node, uint64 ttl) public only_owner(node, 0x0) { - NewTTL(node, ttl); + emit NewTTL(node, ttl); records[node].ttl = ttl; } diff --git a/lib/modules/ens/contracts/FIFSRegistrar.sol b/lib/modules/ens/contracts/FIFSRegistrar.sol index d1d4924a..77acbbdf 100644 --- a/lib/modules/ens/contracts/FIFSRegistrar.sol +++ b/lib/modules/ens/contracts/FIFSRegistrar.sol @@ -11,7 +11,7 @@ contract FIFSRegistrar { bytes32 rootNode; modifier only_owner(bytes32 subnode) { - bytes32 node = sha3(rootNode, subnode); + bytes32 node = keccak256(abi.encodePacked(rootNode, subnode)); address currentOwner = ens.owner(node); require(currentOwner == 0 || currentOwner == msg.sender); _; @@ -22,7 +22,7 @@ contract FIFSRegistrar { * @param ensAddr The address of the ENS registry. * @param node The node that this registrar administers. */ - function FIFSRegistrar(ENS ensAddr, bytes32 node) public { + constructor(ENS ensAddr, bytes32 node) public { ens = ensAddr; rootNode = node; } diff --git a/test_apps/test_app/app/contracts/ENS.sol b/test_apps/test_app/app/contracts/ENS.sol index 61e0edac..4a8a6e23 100644 --- a/test_apps/test_app/app/contracts/ENS.sol +++ b/test_apps/test_app/app/contracts/ENS.sol @@ -15,12 +15,12 @@ interface ENS { event NewTTL(bytes32 indexed node, uint64 ttl); - function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public; - function setResolver(bytes32 node, address resolver) public; - function setOwner(bytes32 node, address owner) public; - function setTTL(bytes32 node, uint64 ttl) public; - function owner(bytes32 node) public view returns (address); - function resolver(bytes32 node) public view returns (address); - function ttl(bytes32 node) public view returns (uint64); + function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external; + function setResolver(bytes32 node, address resolver) external; + function setOwner(bytes32 node, address owner) external; + function setTTL(bytes32 node, uint64 ttl) external; + function owner(bytes32 node) external view returns (address); + function resolver(bytes32 node) external view returns (address); + function ttl(bytes32 node) external view returns (uint64); } diff --git a/test_apps/test_app/app/contracts/ENSRegistry.sol b/test_apps/test_app/app/contracts/ENSRegistry.sol index 37917c81..b918458d 100644 --- a/test_apps/test_app/app/contracts/ENSRegistry.sol +++ b/test_apps/test_app/app/contracts/ENSRegistry.sol @@ -23,7 +23,7 @@ contract ENSRegistry is ENS { /** * @dev Constructs a new ENS registrar. */ - function ENSRegistry() public { + constructor() public { records[0x0].owner = msg.sender; } @@ -33,7 +33,7 @@ contract ENSRegistry is ENS { * @param owner The address of the new owner. */ function setOwner(bytes32 node, address owner) public only_owner(node, owner) { - Transfer(node, owner); + emit Transfer(node, owner); records[node].owner = owner; } @@ -44,8 +44,8 @@ contract ENSRegistry is ENS { * @param owner The address of the new owner. */ function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public only_owner(node, owner) { - var subnode = keccak256(node, label); - NewOwner(node, label, owner); + bytes32 subnode = keccak256(abi.encodePacked(node, label)); + emit NewOwner(node, label, owner); records[subnode].owner = owner; } @@ -55,7 +55,7 @@ contract ENSRegistry is ENS { * @param resolver The address of the resolver. */ function setResolver(bytes32 node, address resolver) public only_owner(node, 0x0) { - NewResolver(node, resolver); + emit NewResolver(node, resolver); records[node].resolver = resolver; } @@ -65,7 +65,7 @@ contract ENSRegistry is ENS { * @param ttl The TTL in seconds. */ function setTTL(bytes32 node, uint64 ttl) public only_owner(node, 0x0) { - NewTTL(node, ttl); + emit NewTTL(node, ttl); records[node].ttl = ttl; } diff --git a/test_apps/test_app/app/contracts/FIFSRegistrar.sol b/test_apps/test_app/app/contracts/FIFSRegistrar.sol index d1d4924a..77acbbdf 100644 --- a/test_apps/test_app/app/contracts/FIFSRegistrar.sol +++ b/test_apps/test_app/app/contracts/FIFSRegistrar.sol @@ -11,7 +11,7 @@ contract FIFSRegistrar { bytes32 rootNode; modifier only_owner(bytes32 subnode) { - bytes32 node = sha3(rootNode, subnode); + bytes32 node = keccak256(abi.encodePacked(rootNode, subnode)); address currentOwner = ens.owner(node); require(currentOwner == 0 || currentOwner == msg.sender); _; @@ -22,7 +22,7 @@ contract FIFSRegistrar { * @param ensAddr The address of the ENS registry. * @param node The node that this registrar administers. */ - function FIFSRegistrar(ENS ensAddr, bytes32 node) public { + constructor(ENS ensAddr, bytes32 node) public { ens = ensAddr; rootNode = node; }