错误:Could not compile source code. 测试以太坊代币发行

个人博客:sulenn

出错:粘贴https://www.ethereum.org/token#the-code中代码至Ethereum Wallet时报错

 Could not compile source code. 
 Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
    function TokenERC20(
    ^ (Relevant source part starts here and spans across multiple lines).

在这里插入图片描述出错原因:solidity版本更新,其中合约中构造函数定义的方法发生了变化,具体可参考https://solidity.readthedocs.io/en/v0.4.24/contracts.html#creating-contracts
修改:将代码中function TokenERC20改成constructor即可
以太坊模拟发行代币可参考https://www.jianshu.com/p/410198814516https://ethfans.org/topics/118
模拟代币发行对网络有一定要求

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值