Hello OpenZeppelin Community,
I am new to blockchain development and now trying out to use the ERC20 token contract. When executing the OpenZeppeling ERC20 example from the documentation (https://docs.openzeppelin.com/contracts/3.x/erc20) i run into the following issue once I execute “truffle migrate”:
TypeError: Cannot read property 'address' of undefined
at Contract (C:\Users\kyril\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\contract\lib\contract\index.js:31:1)
at TruffleContract (C:\Users\kyril\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\contract\lib\contract\constructorMethods.js:205:1)
at module.exports (C:\Users\kyril\Desktop\ethereum\GoldToken\migrations\2_deploy_contracts.js:4:19)
at Migration._load (C:\Users\kyril\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\Migration.js:54:1)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Migration.run (C:\Users\kyril\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\Migration.js:171:1)
at Object.runMigrations (C:\Users\kyril\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:150:1)
at Object.runFrom (C:\Users\kyril\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:110:1)
at Object.runAll (C:\Users\kyril\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:114:1)
at Object.run (C:\Users\kyril\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:79:1)
at runMigrations (C:\Users\kyril\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:269:1)
at C:\Users\kyril\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:231:1
Environment
Truffle v5.1.54 (core: 5.1.54)
Solidity - 0.7.5 (solc-js)
Node v12.19.0
Web3.js v1.2.9
Before migrating the contract i have created a one-klick blockchain in ganache on the localhost, which i have set also in the truffle-config.js.
This is the contract, that im using:
// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.5;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract GLDToken is ERC20 {
constructor(uint256 initialSupply) public ERC20("Gold", "GLD") {
_mint(msg.sender, initialSupply);
}
}
And my 2_deploy_contracts.js looks like this:
var SimpleToken = artifacts.require("SimpleToken");
module.exports = function(deployer) {
deployer.deploy(SimpleToken(10000));
};
I would be very grateful for any help!
Best Regards,
Kyrill