truffle编译输出警告:不推荐调用不带“emit”前缀的事件。
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);
答案 0 :(得分:0)
修复是删除zeppelin-solidity并重新安装版本zeppelin-solidity 1.8.0
npm install --save zeppelin-solidity@1.8.0
答案 1 :(得分:0)
这与 pragma solidity; 版本有关。从^ 0.4.21开始,如果未使用" emit"调用事件,编译器将发出警告。关键字明确。
答案 2 :(得分:0)
我试图更新....但无济于事:
~/D/S/z/h/MyToken ❯❯❯ npm install --save zeppelin-solidity@1.8.0
+ zeppelin-solidity@1.8.0
updated 1 package in 2.197s
[tom@13inch.local:~/Dropbox/Sites/zld.awaken.guru/hackernoon/MyToken]
~/D/S/z/h/MyToken ❯❯❯ truffle develop
Truffle Develop started at http://127.0.0.1:9545/
...
truffle(develop)> test
Compiling ./contracts/Migrations.sol...
Compiling ./contracts/NuZilan.sol...
Compiling zeppelin-solidity/contracts/math/SafeMath.sol...
Compilation warnings encountered:
/Users/tom/Dropbox/Sites/zld.awaken.guru/hackernoon/MyToken/contracts/NuZilan.sol:64:9: Warning: Invoking events without "emit" prefix is deprecated.
Transfer(address(0), msg.sender, totalSupply);
^-------------------------------------------^
这是一个刚刚初始化的项目(今天),包看起来像:
{
"name": "MyToken",
"version": "1.0.0",
"description": "",
"main": "truffle-config.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"ethereumjs-tx": "^1.3.4",
"zeppelin-solidity": "^1.8.0"
}
}