Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it “abstract” is sufficient

// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";

contract MyCollectible is ERC721URIStorage {
    uint256 public tokenCounter;
    constructor () ERC721 ("Hennessy", "Hen"){
        tokenCounter = 0;
    }

    function createCollectible(string memory tokenURI) public returns (uint256) {
        uint256 newItemId = tokenCounter;
        _safeMint(msg.sender, newItemId);
        _setTokenURI(newItemId, tokenURI);
        tokenCounter = tokenCounter + 1;
        return newItemId;
    }

}

I am continuing to run into the issue of:

CompilerError: solc returned the following errors

"Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.

I have removed public from the constructor (used to be constructor () public ERC721 ("Hennessy","HEN")) however, the warning is continuing to pop up, example below:

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/PausableMock.sol:11:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor () public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/payment/PullPayment.sol:28:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor () internal {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/PullPaymentMock.sol:9:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor () public payable { }

(these warnings run about 40 lines)

Some help would be lovely!

Hi, to make sure we have all the details to be able to offer a better help can you include what command were you running when the CompilerError: solc returned the following errors appeared? and Look into the errors and see if any of those is not a Warning and include it too.

For more guidance on how to improve your question you can check this guide.

Apologies,

I was running the command:

brownie run scripts/simple_collectible/deploy_simple.py --network rinkeby

Below is the whole list of errors:

Compiling contracts...
  Solc version: 0.7.6
  Optimizer: Enabled  Runs: 200
  EVM Version: Istanbul
CompilerError: solc returned the following errors:

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/access/Ownable.sol:26:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor () internal {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/token/ERC20/ERC20.sol:55:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (string memory name_, string memory symbol_) public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/GSN/GSNRecipientERC20Fee.sol:33:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(string memory name, string memory symbol) public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/GSN/GSNRecipientERC20Fee.sol:121:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(string memory name, string memory symbol) public ERC20(name, symbol) { }
    ^----------------------------------------------------------------------------------^

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/GSN/GSNRecipientSignature.sol:26:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(address trustedSigner) public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/access/TimelockController.sol:57:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(uint256 minDelay, address[] memory proposers, address[] memory executors) public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/drafts/EIP712.sol:48:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(string memory name, string memory version) internal {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/drafts/ERC20Permit.sol:34:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(string memory name) internal EIP712(name, "1") {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/introspection/ERC165.sol:24:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor () internal {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/AccessControlMock.sol:8:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor() public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ArraysImpl.sol:12:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (uint256[] memory array) public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/EIP712External.sol:9:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(string memory name, string memory version) public EIP712(name, version) {}
    ^------------------------------------------------------------------------------------^

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/token/ERC1155/ERC1155.sol:55:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (string memory uri_) public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC1155BurnableMock.sol:8:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(string memory uri) public ERC1155(uri) { }
    ^----------------------------------------------------^

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC1155Mock.sol:12:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (string memory uri) public ERC1155(uri) {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/utils/Pausable.sol:32:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor () internal {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC1155PausableMock.sol:9:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(string memory uri) public ERC1155Mock(uri) { }
    ^--------------------------------------------------------^

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC1155ReceiverMock.sol:17:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC165/ERC165InterfacesSupported.sol:32:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor () public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC165/ERC165InterfacesSupported.sol:53:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (bytes4[] memory interfaceIds) public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC20BurnableMock.sol:8:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/token/ERC20/ERC20Capped.sol:19:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (uint256 cap_) internal {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC20CappedMock.sol:8:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (string memory name, string memory symbol, uint256 cap)
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC20DecimalsMock.sol:8:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (string memory name, string memory symbol, uint8 decimals) public ERC20(name, symbol) {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC20Mock.sol:9:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC20PausableMock.sol:9:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC20PermitMock.sol:8:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC20SnapshotMock.sol:9:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/token/ERC721/ERC721.sol:93:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (string memory name_, string memory symbol_) public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC721BurnableMock.sol:8:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(string memory name, string memory symbol) public ERC721(name, symbol) { }
    ^-----------------------------------------------------------------------------------^

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC721GSNRecipientMock.sol:14:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(string memory name, string memory symbol, address trustedSigner)
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC721Mock.sol:12:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }
    ^------------------------------------------------------------------------------------^

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC721PausableMock.sol:12:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }
    ^------------------------------------------------------------------------------------^

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC721ReceiverMock.sol:13:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (bytes4 retval, bool reverts) public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/token/ERC777/ERC777.sol:69:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ERC777Mock.sol:11:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/GSNRecipientERC20FeeMock.sol:9:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(string memory name, string memory symbol) public GSNRecipientERC20Fee(name, symbol) { }
    ^-------------------------------------------------------------------------------------------------^

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/GSNRecipientSignatureMock.sol:9:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor(address trustedSigner) public GSNRecipientSignature(trustedSigner) { }
    ^--------------------------------------------------------------------------------^

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/PausableMock.sol:11:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor () public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/payment/PullPayment.sol:28:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor () internal {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/PullPaymentMock.sol:9:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor () public payable { }
    ^-------------------------------^

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/utils/ReentrancyGuard.sol:38:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor () internal {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/ReentrancyMock.sol:11:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor () public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/mocks/SafeERC20Helper.sol:101:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (IERC20 token) public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/payment/PaymentSplitter.sol:43:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (address[] memory payees, uint256[] memory shares_) public payable {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/payment/escrow/RefundEscrow.sol:30:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
    constructor (address payable beneficiary_) public {
    ^ (Relevant source part starts here and spans across multiple lines).

contracts/OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/payment/escrow/RefundEscrow.sol:83:9: TypeError: Member "sendValue" not found or not visible after argument-dependent lookup in address payable.
        beneficiary().sendValue(address(this).balance);
        ^---------------------^

TypeError "sendValue" is the only other error coming up.

The error you show refers to

openzeppelin-contracts@3.4.0

But your very first message uses

pragma solidity 0.8.10;

There is an inconsistency here. Your could be using:

  • solidity 0.6.x + openzeppelin/contracts 3.x.x
  • solidity 0.7.x + openzeppelin/contracts 3.x.x-solc.7
  • solidity 0.8.x + openzeppelin/contracts 4.x.x

I encourage you use the last !

1 Like