truffle compile outputs Warning: Invoking events without "emit" prefix is deprecated.
Compilation warnings encountered:
zeppelin-solidity/contracts/token/ERC20/BasicToken.sol:38:5: Warning:
Invoking events without "emit" prefix is deprecated.
Transfer(msg.sender, _to, _value);
Fix was by removing zeppelin-solidity and reinstalling version zeppelin-solidity 1.8.0
npm install --save zeppelin-solidity#1.8.0
This is related to the pragma solidity; version. From ^0.4.21, compiler will issue a warning if events are not called with "emit" keyword explicitly.
emit Transfer(msg.sender, _to, _value);
This should work.
Related
Uncaught Error: Callback was already called.
at /home/blockchain/master/node_modules/merkle-patricia-tree/node_modules/async/lib/async.js:43:36
at WriteStream. (node_modules/merkle-patricia-tree/node_modules/async/lib/async.js:358:17)
at WriteStream.destroy (node_modules/level-ws/level-ws.js:140:8)
at finish (internal/streams/writable.js:670:14)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
at runNextTicks (internal/process/task_queues.js:62:3)
at processImmediate (internal/timers.js:434:9)
Found out this to be a problem with node v14.x and ganache-cli v6.12.2 (ganache-core: 2.13.2).
Installing node v13.9.0 solved the issue for me.
in my case, reinstalling ganache-cli fixed it for me.
Install the latest version 7.0.3 of ganache instead ganache-cli
npm install --save-dev ganache
in code just use
const ganache = require('ganache');
const web3 = new Web3(ganache.provider());
I am trying to compile my smart contracts using truffle pet-shop. I have the following contract in directory election/contracts/election.sol ;
pragma solidity >=0.4.0 <0.6.0;
contract Election{
string public candidate;
constructor() public{
candidate="Zeeshan";
}
}
The migration file to deploy contracts in directory election/migrations/2_deploy_contracts1.js is as follows;
var Election1=artifacts.require("election.sol");
module.export=function(deployer){
deployer.deploy(Election1)
};
I am using the following command to migrate the contracts:
truffle migrate
And I am getting the following results:
Compiling your contracts...
===========================
> Compiling .\contracts\Election.sol
> Compiling .\contracts\election.sol
> Artifacts written to D:\Notes\BCS\Semester 8\FYP\Practise Coding\dapp university 2 hr video code\election\build\contracts
> Compiled successfully using:
- solc: 0.5.8+commit.23d335f2.Emscripten.clang
Starting migrations...
======================
> Network name: 'development'
> Network id: 5777
> Block gas limit: 0x6691b7
2_deploy_contracts1.js
======================
Error: Error: Migration D:\Notes\BCS\Semester 8\FYP\Practise Coding\dapp university 2 hr video code\election\migrations\2_deploy_contracts1.js invalid or does not take any parameters
at Object.run (C:\Users\mk141\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-migrate\index.js:92:1)
at process._tickCallback (internal/process/next_tick.js:68:7)
Truffle v5.0.30 (core: 5.0.30)
Node v10.16.1
Its also compiling Election.sol because I renamed election.sol to Election.sol and it stores election.sol in cache perhaps.
As you can see above its giving Error:Migration 2_deploy_contracts invalid or does not take any parameters at Object.run() and i don't know how to resolve it.
I was making a mistake in 2_deploy_contracts1.js file. There is module.exports instead of module.export. So the new 2_deploy_contracts1.js file will be;
var Election1=artifacts.require("election.sol");
module.exports=function(deployer){
deployer.deploy(Election1)
};
Also, I was using the following command to migrate again;
truffle migrate
Instead, I should use the following command if I am migrating again;
truffle migrate --reset
We use this command because we already migrated our smart contracts in the built folder. This command will remove all previously migrated files in the built folder and add new migrated files of smart contracts.
In the require function you need to check the name of your contract like Election.sol and check for any typos
I'm executing below command:
abigen --sol helloworld.sol --pkg main --out helloworld.go
But getting below error:
Failed to build Solidity contract: exec: "solc": executable file not found in $PATH
When I check echo $PATH, solcjs is present.
echo $PATH
/home/edureka/go/bin:/usr/local/go/bin:/home/edureka/.local/share/umake/bin:/home/edureka/bin:/home/edureka/.local/bin:/home/edureka/.nvm/versions/node/v6.11.4/bin:/home/edureka/go/bin:/usr/local/go/bin:/home/edureka/.local/share/umake/bin:/home/edureka/bin:/home/edureka/.local/bin:/home/edureka/.local/share/umake/bin:/home/edureka/bin:/home/edureka/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/edureka/.nvm/versions/node/v6.11.4/bin/solcjs
How I can solve this error?
You have to install solc not solcjs.
https://solidity.readthedocs.io/en/v0.4.24/installing-solidity.html
The comandline options of solcjs are not compatible with solc and tools (such as geth) expecting the behaviour of solc will not work with solcjs.
You have to install a binary package - https://solidity.readthedocs.io/en/v0.4.24/installing-solidity.html#binary-packages
You should install solc. Check here.
This is mostly due to solc specific version not in your path.
To see which version of solc
solc --version
where is your solc installed ?
whereis solc
Add the output of the above command to your PATH.
export PATH=$PATH:{output_from_above_command}
This should resolve your solc not present in the PATH issue.
Please note that you need specific version tag. 0.7.6 or 0.8.0 etc... Any typos will not pick correctly.
I am trying to reproduce the DAO attack that happened on Ethereum, however, I was not able to compile the DAO code. The current stable version of truffle does not support specifying a solc version.
I used the 5.0.0 beta 1 version for truffle, which supports specifying a solc version.
When compiling the DAO code, I get this error.
TypeError: Error parsing E:/Desktop/MetaCoin/contracts/DAO.sol: solc.compileStandard is not a function
at Object.parseImports (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-compile\parser.js:49:1)
at Object.getImports (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:332:1)
at Promise.all.then.results (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:305:1)
at <anonymous>
Any idea guys?
As of Truffle 5.0.0 beta -0, you can specify a solcjs version.
I have just tried it in my project and it works. Be sure to make the version number a string and use the following code:
module.exports = {
networks: {
... etc ...
},
compilers: {
solc: {
version: <string> // ex: "0.4.20". (Default: Truffle's installed solc)
}
}
};
What is an argument to set authentication method to legacy authentication method in MySQLInstallerConsole?
What I currently use
MySQLInstallerConsole install server;$dbVersion;X64:*:passwd=SomePassword;openfirewall=true;serverid=1;enable_tcpip=true;port=3306;datadir=SomeDir; -silent
But I can figure out what is an argument for legacy method...
try
MySQLInstallerConsole Community install server;$dbVersion;X64;*;passwd=SomePassword;openfirewall=true;serverid=1;enable_tcpip=true;port=3306;datadir=SomeDir; -silent