Hello I keep getting this error and I can't seem to fix it, I'm new to all this, but I'm trying to get better. So someone said if you changed the solidity to the newest version it would fix the problem, it didn't. So I hope there's a cool guy, who can help me with the problem. Thanks in advance.

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";

contract PecizeCoin is ERC20 {
    constructor(uint256 initialSupply) public ERC20 ("PecizeCoin", "PCC"){
  • Sorry for the bad setup of the question
    – Coolbogge
    Commented Jun 11, 2021 at 11:48

1 Answer 1


Firstly, it is a warning and not an error.

constructor(uint256 initialSupply) public ERC20 ("PecizeCoin", "PCC")

can be written as

constructor(uint256 initialSupply) ERC20 ("PecizeCoin", "PCC")

for compiler version > 0.7, constructor visibility is not required.

From solidity 0.7 breaking changes:

Visibility (public / internal) is not needed for constructors anymore: To prevent a contract from being created, it can be marked abstract. This makes the visibility concept for constructors obsolete.

Another related question on same topic: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient

  • Oh so you don't need to show that it is public, you just write ERC20? I'm just trying to understand it. Thank you for your help!
    – Coolbogge
    Commented Jun 11, 2021 at 11:58
  • 1
    @Coolbogge no, "public" has no effect and therefore it is not needed and they just removed it after 0.7 to keep everything clean and simple. Constructors are not accessible to the public and also run one time on the deployment -> so using "public" was really misleading
    – Majd TL
    Commented Jun 11, 2021 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.