ensdomains / ens-contracts

The core contracts of the ENS protocol
https://ens.domains/
MIT License
565 stars 384 forks source link

No arguments passed to the base constructor error #336

Closed pikonha closed 6 months ago

pikonha commented 6 months ago

I've imported the following contracts from this repository downloaded by Foundry.

import "@ens-contracts/registry/ENSRegistry.sol";
import {PublicResolver, INameWrapper} from "@ens-contracts/resolvers/PublicResolver.sol";
import "@ens-contracts/reverseRegistrar/ReverseRegistrar.sol";

The problem is that whenever I want to deploy it I receive the error No arguments passed to the base constructor. Specify the arguments or mark "ReverseRegistrar" as abstract.. I was able to fix it by modifying root/Controllable.sol like so:

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/access/Ownable.sol";

contract Controllable is Ownable {
    mapping(address => bool) public controllers;

    event ControllerChanged(address indexed controller, bool enabled);

    + constructor() Ownable(msg.sender) {}

    modifier onlyController() {
        require(controllers[msg.sender], "Controllable: Caller is not a controller");
        _;
    }

    function setController(address controller, bool enabled) public onlyOwner {
        controllers[controller] = enabled;
        emit ControllerChanged(controller, enabled);
    }
}

The same happens with the utils/UniversalResolver.sol. Is this an issue or am I doing something wrong? Notice that I haven't directly imported either of them. Here is my full contract:

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Script, console} from "forge-std/Script.sol";

import "../src/Helper.sol";
import "@ens-contracts/registry/ENSRegistry.sol";
import "@ens-contracts/reverseRegistrar/ReverseRegistrar.sol";
import {PublicResolver, INameWrapper} from "@ens-contracts/resolvers/PublicResolver.sol";

contract PublicResolverScript is Script, ENSHelper {
    function run() external {
        uint256 privateKey = vm.envUint("PRIVATE_KEY");
        address publicKey = vm.addr(privateKey);
        vm.startBroadcast(privateKey);

        ENSRegistry registry = new ENSRegistry();
        ReverseRegistrar registrar = new ReverseRegistrar(registry);

        // .reverse
        registry.setSubnodeOwner(rootNode, labelhash("reverse"), publicKey);
        // addr.reverse
        registry.setSubnodeOwner(namehash("reverse"), labelhash("addr"), address(registrar));

        PublicResolver resolver = new PublicResolver(registry, INameWrapper(publicKey), publicKey, address(registrar));
        registrar.setDefaultResolver(address(resolver));

        // .eth
        registry.setSubnodeRecord(rootNode, labelhash("eth"), publicKey, address(resolver), 100000);
        // public.eth
        registry.setSubnodeRecord(namehash("eth"), labelhash("public"), publicKey, address(resolver), 100000);

        vm.stopBroadcast();
    }
}
VargaElod23 commented 6 months ago

@pikonha You are specifying a solidity version >0.5 when they restricted inheritance calls. That was my source of error too. The target compiler for end-contracts is 0.4.8 which doesn't have this check thus doesn't throw the error.

pikonha commented 6 months ago

I really don't wanna set the compiler version to 0.4.8 on my project, do you? I've tried downloading the contracts from your branch but it doesn't seem to be available.

pikonha commented 6 months ago

fixed in this issue