Single transaction ens deployment example, circular reference?
steveruckdashel opened this issue · 3 comments
steveruckdashel commented
I'm attempting to deploy ENS to a private network. I'm running into issues with the documented process for using a single transaction deploy. I'm curious if there's something minor I'm missing or if the example needs to be tweaked slightly?
Here's a link to the documentation section I'm using: https://github.com/ensdomains/docs/blob/master/deploying-ens-on-a-private-chain.md#deploying-ens-in-a-single-transaction
Here's the relevant error output:
$MYPATH/contracts/TestDependancies.sol:6:1: DeclarationError: Identifier already declared.
import "@ensdomains/resolver/contracts/PublicResolver.sol";
^---------------------------------------------------------^
@ensdomains/ens/contracts/ReverseRegistrar.sol:5:1: The previous declaration is here:
contract NameResolver {
^ (Relevant source part starts here and spans across multiple lines).
Compilation failed. See above.
Truffle v5.0.13 (core: 5.0.13)
Node v14.2.0
Contract text:
pragma solidity ^0.5.0;
import "@ensdomains/ens/contracts/ENSRegistry.sol";
import "@ensdomains/ens/contracts/FIFSRegistrar.sol";
import "@ensdomains/ens/contracts/ReverseRegistrar.sol";
import "@ensdomains/resolver/contracts/PublicResolver.sol";
// Construct a set of test ENS contracts.
contract TestDependencies {
bytes32 constant TLD_LABEL = keccak256("eth");
bytes32 constant RESOLVER_LABEL = keccak256("resolver");
bytes32 constant REVERSE_REGISTRAR_LABEL = keccak256("reverse");
bytes32 constant ADDR_LABEL = keccak256("addr");
ENSRegistry public ens;
FIFSRegistrar public fifsRegistrar;
ReverseRegistrar public reverseRegistrar;
PublicResolver public publicResolver;
function namehash(bytes32 node, bytes32 label) public pure returns (bytes32) {
return keccak256(abi.encodePacked(node, label));
}
constructor() public {
ens = new ENSRegistry();
publicResolver = new PublicResolver(ens);
// Set up the resolver
bytes32 resolverNode = namehash(bytes32(0), RESOLVER_LABEL);
ens.setSubnodeOwner(bytes32(0), RESOLVER_LABEL, address(this));
ens.setResolver(resolverNode, address(publicResolver));
publicResolver.setAddr(resolverNode, address(publicResolver));
// Create a FIFS registrar for the TLD
fifsRegistrar = new FIFSRegistrar(ens, namehash(bytes32(0), TLD_LABEL));
ens.setSubnodeOwner(bytes32(0), TLD_LABEL, address(fifsRegistrar));
// Construct a new reverse registrar and point it at the public resolver
reverseRegistrar = new ReverseRegistrar(ens, Resolver(address(publicResolver)));
// Set up the reverse registrar
ens.setSubnodeOwner(bytes32(0), REVERSE_REGISTRAR_LABEL, address(this));
ens.setSubnodeOwner(namehash(bytes32(0), REVERSE_REGISTRAR_LABEL), ADDR_LABEL, address(reverseRegistrar));
}
}
xiaoyue2019 commented
I encountered the same problem, how to solve it
xiaoyue2019 commented
为了部署我注释了反向注册功能