"Visibility for constructor is ignored" error migrating a simple ERC20 constructor

Hi @Altaergo,

_From: https://docs.soliditylang.org/en/v0.7.5/070-breaking-changes.html#functions-and-events_

  • Visibility ( public / external ) 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.

I assume that you are actually compiling with Solidity 0.7?

As you are inheriting from OpenZeppelin Contracts, then you may be better to have a pragma solidity that is at least as narrow as what you are inheriting. See: Simple ERC20 token example.

3 Likes