Hi!
I am trying to create a token.
pragma solidity ^0.5.16;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract Token is ERC20 {
address public minter;
event MinterChanged(address indexed from, address to);
constructor ( ) public payable ERC20 ("name", "symbol") {
minter = msg.sender;
}
function ....
.....
}
While compiling in truffle I got: "Wrong argument count for modifier invocation: 2 arguments given but expected 0." Speaking about the arguments "name" and "symbol" in the constructor.
I can compile it without giving a name, but I don´t know how to do it otherwise.
Hope someone can help me,
You seem to be using the older Solidity and OpenZeppelin Contracts versions. Use the latest versions and Solidity 0.8.
Check out Contracts Wizard for more help.
2 Likes
Thank you!
I changed my truffle-config.js to this:
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 7545,
network_id: "*" // Match any network id
},
develop: {
port: 8545
}
},
compilers: {
solc: {
version: "^0.8.0"
}
}
};
But, I am still having some trouble with the version of the imports of open zeppelin. I tried changing open zeppelin version with
npm install @openzeppelin/contracts
But I am still having version issues.
Thanks a lot!
I fixed it at last with:
npm install @openzeppelin/contracts@4.0.0
Thank you for letting me know the version problem!