Error
預期的令牌分號得到’標識符’傳輸(msg.sender,_to,_value);
function transfer(address _to, uint256 _value) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check the overflows if (frozenaccount[msg.sender]) throw; // Check if frozen balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value // add the same to the recipient Transfer(msg.sender, _to, _value); (right here error!) // notify anyone listening that this transfer took place }
所有程式碼 https://gist.github.com/Sexstasy/86e8b243422aef64c3182fbd0ef1671e
您在前一行缺少分號。
正確的程式碼:
function transfer(address _to, uint256 _value) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check the overflows if (frozenaccount[msg.sender]) throw; // Check if frozen balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value; // add the same to the recipient Transfer(msg.sender, _to, _value); // notify anyone listening that this transfer took place }
您應該使用 require 或 assert 而不是 throw,並使用 safemath 庫