Go-Ethereum

將 ETH 發送到測試網上的合約時出錯

  • July 16, 2017

我正在嘗試將 ETH 發送到我剛剛創建的合約中,但我遇到了錯誤

pragma solidity ^0.4.6;
contract Owned {
   modifier only_owner {
       if (msg.sender != owner) return; _;
   }

   event NewOwner(address indexed old, address indexed current);

   function setOwner(address _new) only_owner { NewOwner(owner, _new); owner = _new; }

   address public owner = msg.sender;
}

在此處輸入圖像描述

有人知道發生了什麼嗎?

我認為任何接受 Ether 的函式都應該設置為“payable”

在此處閱讀更多資訊:https ://solidity.readthedocs.io/en/develop/contracts.html

引用自:https://ethereum.stackexchange.com/questions/21345