我正在从官方文档中学习Solidity,并在我创建简单硬币的练习中进行叠加:
pragma solidity ^0.4.20; // should actually be 0.4.21
contract Coin {
// The keyword "public" makes those variables
// readable from outside.
address public minter;
mapping (address => uint) public balances;
// Events allow light clients to react on
// changes efficiently.
event Sent(address from, address to, uint amount);
// This is the constructor whose code is
// run only when the contract is created.
function Coin() public {
minter = msg.sender;
}
function mint(address receiver, uint amount) public {
if (msg.sender != minter) return;
balances[receiver] += amount;
}
function send(address receiver, uint amount) public {
if (balances[msg.sender] < amount) return;
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Sent(msg.sender, receiver, amount);
}
}
当我尝试编译时,我在最后一行遇到语法错误: 发出已发送(msg.sender,接收方,金额);
我尝试在Remix和VS Code中编译它但得到了相同的错误消息。
有人可以帮我吗?
答案 0 :(得分:1)