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

So I’m currently trying to make a crypto test coin and I ran into a problem. When I compile this code:

pragma solidity ^0.8.0;

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

contract DaBabyCoin is ERC20 {
    constructor (uint256 initialSupply) public ERC20 ("DaBaby Coin", "DaCoin"){
        _mint(msg.sender, initialSupply);
    }
}


I get this message:
image

I’m not the greatest at programming so I don’t really understand this warning and I’ve done research about it but nothing said how I could make it “abstract” which seems to be the problem. The thread I read seemed to have helped the person trying to migrate but I didn’t really understand much

I’m using Remix with solidity in an injected web3 environment and it’s my first time with it. What I need help with is what can I change in the code so that the warning will go away as well as a short explanation as to why this happened so I can learn from it because it’s been a genuine pain in the ass to look up

Hello there,

It's warning you because it doesn't need to be public

contract DaBabyCoin is ERC20 {
    constructor (uint256 initialSupply) ERC20 ("DaBaby Coin", "DaCoin"){
        _mint(msg.sender, initialSupply);
    }
}

You should also include a license identifier at the top

// SPDX-License-Identifier: Unlicensed

I recommend to get started you should follow the tutorial over at OpenZeppelin Upgrades: Step by Step Tutorial for Hardhat

You don't need to understand 100%, but doing it will get you up and running.

Afterwards follow

To learn more!

1 Like

Thanks you so much. I’ll definitely check out the tutorial :+1: