代码契约:
pragma solidity <0.7.0;
contract contr{
function money()public payable{
msg.sender.transfer(5 ether);
}
}
ABI合同:[{"inputs":[],"name":"money","outputs":[],"stateMutability":"payable","type":"function"}]
我这样从geth控制台调用这个函数:control .money。sendTransaction({:乙。accounts[0], value: 50000000000000000000})
也可以这样调用:control .money。sendTransaction({:乙。accounts[0], to: control .address, value: 50000000000000000000})错误不会改变
в
https://github.com/ethereum/go-ethereum/issues/20760#issue-580263987
您必须将"payable": "true"
添加到ABI中。