Inheriting the OZ ERC-20 token contract - I go to compile and I get a constructor visibility error

Hey There! :grinning:

I'm working on a tutorial by Dapp University - (https://www.youtube.com/watch?v=xWFba_9QYmc&list=PLS5SEs8ZftgUNcUVXtn2KXiE1Ui9B5UrY&index=2)

In this tutorial we're building an decentralized bank application, and in the code its having me import and inherit the OpenZeppelin ERC-20 contract as a base structure.

When compiling the smart contracts, I get a warning and an error.

I'm getting a constructor visibility warning on the ERC-20 OZ Contract that I inherited from.

So my thought was that maybe I'm inheriting a package that's outdated? or my link is bad?

I grabbed a copy of the ERC-20 contract code, and the public visibility modifier is not present in the code. I tried to see if my link was wrong/outdated, and that didn't help.

I redownload the Open Zeppelin contract package - that didn't help.

I'm not sure how I'm going to tackle this warning.

Also:
I'm getting a TypeError: Cannot convert undefined or null to object - which I would try to tackle, but maybe this is my inexperience showing but Its not showing exactly where its coming from? I'm trying to read the traceback and find the error, but I'm not sure how to do that?

If there's a resource(s) that I can learn from I would greatly appreciate that, just trying to shore up my knowledge.

One of the things to note is that in the Tutorial he recommended a specific version of node and truffle.

Node v10.19.0
Truffle v5.1.39
Solidity v0.5.16
Web3.js v1.2.1

This is what I'm using:

I figured out how to use nvm and It was easy to find a way to use a specific version of Node but Truffle I didn't find a way to switch easily so I left it alone, is this going to matter?

I'm new to this so any advice would be greatly appreciated and help on this issue.

Here's the Token contract - since I'm a new user I can't put more than three screenshots, let me know if you need more screenshots.

Token.sol contract:

Again thanks for the help, If there's any resources that might help me out, please link it, I'd love to shore up my knowledge.

Hey @nslee333
since solidity 0.7.0, constructor visibility is not needed anynmore
https://docs.soliditylang.org/en/v0.7.0/070-breaking-changes.html#functions-and-events

Also the TypeError seems to be related to truffle not to the contract

1 Like

Yeah, that's the thing, the ERC-20 OpenZeppelin contract is throwing the warning for the visibility error, but when I went to go see if the constructor has the visibility modifier, it isn't there.

I'm going to see what I can find out, I'll probably update this thread when I figure it out.

Thanks for the help.