I zipped and placed here at this git repo:
It is the only file there in the repository for the zipped truffle js file
I hope to hear back at your convenience for further help. Thank you.
I zipped and placed here at this git repo:
It is the only file there in the repository for the zipped truffle js file
I hope to hear back at your convenience for further help. Thank you.
Can you try installing truffle with
sudo npm install -g truffle
Iām sorry. I need all the code, not just the truffle config file.
Everythign works for me until truffle> compile
once I do truffle>migrate i receive following error
/usr/local/lib/node_modules/truffle/build/cli.bundled.js:255331
throw new Error(āCould not find artifacts for " + import_path + " from any sourcesā);
^
Error: Could not find artifacts for ./gameToken from any sources
at Resolver.require (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:255331:9)
at Object.require (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:417750:38)
at ResolverIntercept.require (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:594974:32)
at /home/ether/Documents/SimpleGame/solidity/migrations/2_deploy_token.js:1:23
at ContextifyScript.Script.runInContext (vm.js:59:29)
at ContextifyScript.Script.runInNewContext (vm.js:65:15)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:457504:14
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
truffle(develop)>
Please post your code.
gametoken.sol
pragma solidity 0.5.0;
import āopenzeppelin-solidity/contracts/token/ERC20/ERC20.solā;
import āopenzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.solā;
contract GameToken is ERC20, ERC20Detailed {
constructor (string memory _name, string memory _symbol, uint8 _decimals)
ERC20Detailed(_name, _symbol, _decimals)
public
{}
function mint(address _to, uint256 _value) public returns(bool) {
_mint(_to, _value);
return true;
}
}
2_deploy_token.sol
var Token = artifacts.require("./gameToken.sol");
module.exports = function(deployer) {
deployer.deploy(Token, āGameTokenā, āGTā, 0);
};
Looks like your are missing a capital G in GameToken in the migration file. Your contract is called GameToken, needs to be the same in migrations file.
i have to rename gameToken.sol to GameToken.sol?
No, just edit your migration file to say
var Token = artifacts.require("./GameToken.sol");
great this worked
i was referring to ("./gameToken.sol") because the file is called gameToken.sol and not GameToken.sol
thatshwy
thank you
Truffle reads the name of the contract as you write it in the code, not the file name. I should have made this clearer in the videos.
thanks for clarifying thatswhy i wasnt sure
good to know
Hi Filip, now I can execute the compile, thx!
Graciassss
@filip When I want to compile in truffle, I get errors on the version, can I change the compiler version somewhere since the contracts ars also 0.5.2 version:
truffle(develop)> compile
Compiling .\contracts\GameToken.solā¦
Compiling .\contracts\Migrations.solā¦
Compiling openzeppelin-solidity/contracts/token/ERC20/ERC20.solā¦
Compiling openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.solā¦
Compiling openzeppelin-solidity\contracts\math\SafeMath.solā¦
Compiling openzeppelin-solidity\contracts\token\ERC20\IERC20.solā¦openzeppelin-solidity/contracts/token/ERC20/IERC20.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.5.2;
^---------------------^
,openzeppelin-solidity/contracts/math/SafeMath.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.5.2;
^---------------------^
,openzeppelin-solidity/contracts/token/ERC20/ERC20.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.5.2;
^---------------------^
,openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.5.2;
^---------------------^
,/C/temp/GameProgrammingERC20/contracts/GameToken.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity 0.5.2;
^--------------------^
Compilation failed. See above.
[EDIT] I solved it by forcing truffle to use a specific compiler version. You can change it (in windows) inside the file ātruffle-config.jsā that is inside your project folder. At the end of the file you can specify the sol compiler version. I changed it to 0.5.2 and when I then try to compile it in truffle develop, it will download the compiler and compilation goes well this time.
hi, i got following error
how to solve the problem ?
Truffle v5.0.1 (core: 5.0.1)
Solidity v0.5.0 (solc-js)
Node v8.15.1
I would try first of all to run truffle compile to see if it works. The error message you are showing seems to be from a linter, not truffle. So try that and let me know.
iāve run it as you mentioned but nothing changed. if the message comes from linter how to debug then ?
What do you mean nothing changed? Did it compile in truffle or not? Even if it did, the error message would not disappear. Thatās step 2.
i meant, yes it compiled in truffle but the error still apears