Ok, then you need to install a new linter or update the one you have to support the newer solidity version. I assume you have downloaded and installed one for atom?
yes, i have linter-solidity 0.5.0
Try to update it or replace with some other linter.
ok with a linter update it works fine. thanks a lot !
Hey Filip,
It seems a lot of things have been updated since this course was put together. Making it hard to follow all the steps required. Getting errors at all stages…now stuck trying to compile truffle.
For anyone that is having problems, I got a reply at the openzeppelin forums:
TLDR: install the latest truffle version, and the latest openzeppelin contracts version, the one in the lesson is outdated.
Hi guys and @filip,
Unfortunately, I’ve been stuck with this lesson for several hours and I get errors such as the following ones:
openzeppelin-solidity/contracts/GSN/Context.sol:16:1: ParserError: Expected pragma, import directive or contract/interface/library definition.
abstract contract Context {
^------^
,openzeppelin-solidity/contracts/utils/Address.sol:57:42: ParserError: Expected ‘;’ but got ‘{’
(bool success, ) = recipient.call{ value: amount }("");
Furthermore, I must say that I find very frustrating adapting to the changes in the different contracts as many things do not correspond to the code in the videoclass due to the fact that two years have gone past since the creation of the course, therefore many contracts shown in the video cannot be found in the packages (for ex. ERC20Detailed and Mintable)
Would it be possible to have a guideline to help novices adapting to these issues, up to here I had no problems but things are getting pretty difficult now.
Thanks a lot for your reply.
Sorry for the late answer
Can you tell me where exactly you are having an issue ?
The videos have been made with solidity 0.5.0 if you are using this version of solidity you need to use the corresponding library.
You can look at this tag on github
If you are using the Libraries version 0.6.0 you will have to change the pragma version in your contract and in the truffle-config.js file.
Let me know if it fixes your issue
Hey thank you for your kind reply!
Yes it has helped me! yuhuuu
Hi, I’m having issues because I’m unable to locate the ERC20Mintable.sol file and related files in the ERC20 Folder I’ve downloaded. I tried both packages openzeppelin-solidity
and @openzeppelin/contracts
but am unable to locate this file?
I’m seeing they removed this file for the most recent package and have come across this:
https://docs.openzeppelin.com/contracts/3.x/api/presets#ERC20PresetMinterPauser
However, I’m not able to figure out how to add a mintable functionality. Any help would be greatly apprecaited!
There is still the mint
function in their documentation.
Maybe you should read their documentation on See ERC20._mint
function to understand how to deploy it, also we explaining it on Ethereum Programming Solidity 201 Course.
Carlos Z.
Hey @filip and @ivan
Please update your videos as openzeppelin library got updated to version 3.
And not ERC20Detailed.sol neither ERC20Mintable files available and I cannot reproduce what you explaining.
installed [email protected]
now new problem with compilation
truffle(develop)> compile
Compiling your contracts...
===========================
TypeError [ERR_INVALID_REPL_INPUT] [ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException` cannot be used in the REPL
at process.<anonymous> (repl.js:227:15)
at process.emit (events.js:228:7)
at process.emit (/usr/lib/node_modules/truffle/build/webpack:/~/source-map-support/source-map-support.js:461:1)
at _addListener (events.js:249:14)
at process.addListener (events.js:297:10)
at Object.<anonymous> (/usr/lib/node_modules/truffle/node_modules/solc/soljson.js:1:1511)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/usr/lib/node_modules/truffle/node_modules/solc/index.js:3:26)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/usr/lib/node_modules/truffle/build/webpack:/external "solc":1:1)
at __webpack_require__ (/usr/lib/node_modules/truffle/build/webpack:/webpack/bootstrap 09dbbf3601c22a042907:19:1)
at Bundled.getBundledSolc (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/compilerSupplier/loadingStrategies/Bundled.js:10:12)
at Bundled.load (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/compilerSupplier/loadingStrategies/Bundled.js:5:1)
at /usr/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/compilerSupplier/index.js:75:1
at new Promise (<anonymous>)
at CompilerSupplier.load (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/compilerSupplier/index.js:49:1)
at /usr/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:214:1
at f (/usr/lib/node_modules/truffle/build/webpack:/~/once/once.js:25:1)
truffle(develop)>
apparently I need to run ```
truffle migrate --reset
after doing npm install [email protected]
all compiling now
Please redo this video. There have been so many changes to the tools that after a few hours I gave up trying to get this to compile. As a student I should not have to google solutions to compiler errors after following the instructions in the video. Thank you.
1-I don’t understand why we added ercdetailed(-name,-symbol,-decimals) in this case
constructor (string memory _name, string memory _symbol, uint8 _decimals)
ERC20Detailed(_name, _symbol, _decimals)
public
{}
2- what does _mint(to, value) function do ?
in the mintable.sol this function is defined as:
function mint(address to, uint256 value) public returns (bool) {
_mint(to, value);
return true;
but how -mint(…,…) works and this function is not defined every well , is it a transfer function ex:
function -mint(…,…) {
to.transfer(value)
} and then it has been called in gametoken.sol
I hope that I can get an answer shortly. Thank’s in advance @filip @thecil
Hey @Oussama, hope you are ok.
ERC20Detailed is a contract that you import from openzeppelin to inherit in your Game contract (GameToken.sol).
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
That contract must be initialized with the parameters that it needs (_name, _symbol, _decimals), so in the constructor of your contract you invoke the ERC20Detailed
function that exist in the ERC20Detailed.sol
contract and then you will automatically create a Token Contract (because the entire logic for a ERC20 is already built in ERC20Detailed.sol
).
_mint(account, amount)
is a internal function in the ERC20Detailed.sol contract, since you inherit the contract into your GameToken.sol, you can access to internal functions of that contract (ERC20Detailed.sol).
You can read more about the ERC20Detailed contract here:
https://docs.openzeppelin.com/contracts/2.x/api/token/erc20#ERC20Detailed
Also here is the contract, be aware, openzeppelin has been updating their contracts, so even when the name is not the same, is basically the same contract but with few security updates.
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
PD: Code line 228 is where the _mint()
function is located
If you have any more questions, please let us know so we can help you!
Carlos Z.