Compile Error in pragma solidity 0.8.0 and others

2.8k views Asked by At

When I try to compile my bep20 smart contract it says:

ParserError: Invalid token. --> bep-20.sol:6:53: | 6 | constructor(uint256 initialSupply) public ERC20(“MilkyWayGalaxy”, “MILKYGAL”) { | ^

I use the pragma solidity ^0.8.0; but the latest edition is pragma solidity ^0.8.4;. I have tried on all versions and still doesn't work.

Can someone help me resolve this problem?

1

There are 1 answers

1
Petr Hejda On

You need to use the regular quote " or apostrophe ' characters, your snippet is using the left quote . It's probably caused by copying from a website that replaces regular quotes to left quotes as a security measure.

Also, Solidity 0.8 will throw a warning for using visibility modifier on a constructor. Remove the public visiblity modifier.

constructor(uint256 initialSupply) ERC20("MilkyWayGalaxy", "MILKYGAL") {