From 37d973f42d290e74f799970b97c0d0f1bd56b1b8 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Wed, 23 May 2018 07:30:11 -0600 Subject: [PATCH] Expose APMNamehash (#310) --- contracts/apm/APMNamehash.sol | 12 ++++++++++++ test/mocks/APMNamehash.sol | 11 ----------- test/mocks/APMNamehashWrapper.sol | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 contracts/apm/APMNamehash.sol delete mode 100644 test/mocks/APMNamehash.sol diff --git a/contracts/apm/APMNamehash.sol b/contracts/apm/APMNamehash.sol new file mode 100644 index 000000000..bca84e6fb --- /dev/null +++ b/contracts/apm/APMNamehash.sol @@ -0,0 +1,12 @@ +pragma solidity ^0.4.18; + +import "../ens/ENSConstants.sol"; + + +contract APMNamehash is ENSConstants { + bytes32 constant public APM_NODE = keccak256(ETH_TLD_NODE, keccak256("aragonpm")); + + function apmNamehash(string name) internal pure returns (bytes32) { + return keccak256(APM_NODE, keccak256(name)); + } +} diff --git a/test/mocks/APMNamehash.sol b/test/mocks/APMNamehash.sol deleted file mode 100644 index b2b4a614d..000000000 --- a/test/mocks/APMNamehash.sol +++ /dev/null @@ -1,11 +0,0 @@ -pragma solidity ^0.4.18; - - -contract APMNamehash { - bytes32 constant public ETH_NODE = keccak256(bytes32(0), keccak256("eth")); - bytes32 constant public APM_NODE = keccak256(ETH_NODE, keccak256("aragonpm")); - - function apmNamehash(string name) internal pure returns (bytes32) { - return keccak256(APM_NODE, keccak256(name)); - } -} diff --git a/test/mocks/APMNamehashWrapper.sol b/test/mocks/APMNamehashWrapper.sol index 6a87e290e..f9656e1a3 100644 --- a/test/mocks/APMNamehashWrapper.sol +++ b/test/mocks/APMNamehashWrapper.sol @@ -1,6 +1,6 @@ pragma solidity 0.4.18; -import "./APMNamehash.sol"; +import "../../contracts/apm/APMNamehash.sol"; contract APMNamehashWrapper is APMNamehash { @@ -8,7 +8,7 @@ contract APMNamehashWrapper is APMNamehash { function getAPMNamehash(string name) public returns (bytes32 hash) { hash = apmNamehash(name); - LogHash("eth node", ETH_NODE); + LogHash("eth node", ETH_TLD_NODE); LogHash("aragonpm.eth", APM_NODE); LogHash(name, hash); return hash;