I tried to follow this tutorial and saw that his ERC20 constructor looks totally different.
pragma solidity >=0.7.0 <0.9.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
contract myToken is ERC20PresetMinterPauser {
constructor() ERC20PresetMinterPauser("myToken", "MYT") {
}
}
The OpenZeppelin 4.x ERC20’s constructor looks like this:
contract GLDToken is ERC20 {
constructor(uint256 initialSupply) ERC20("Gold", "GLD") {
_mint(msg.sender, initialSupply);
}
}
It seems that this line constructor(uint256 initialSupply) ERC20("Gold", "GLD") {
is not entirely necessary. Is that a return type? Is that a ERC20 object being constructed with its own “Gold”, “GLD” parameters? Where is that constructor?