我调用钱(应付)函数并传递钱。错误。
代码合约:
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 控制台调用函数: contr.money.sendTransaction({from: eth.accounts[0], value: 50000000000000000000})
也这样调用: contr.money.sendTransaction({from: eth.accounts[0], to: contr.address, value: 50000000000000000000}) 错误不会改变