Error: Cannot send value to non-payable function GETH
I call the money (payable) function and pass the money. Error.
Code contract:
pragma solidity <0.7.0;
contract contr{
function money()public payable{
msg.sender.transfer(5 ether);
}
}
ABI contract: [{"inputs":[],"name":"money","outputs":[],"stateMutability":"payable","type":"function"}]
I call the function from the geth console this way: contr.money.sendTransaction({from: eth.accounts[0], value: 50000000000000000000})
also called like this: contr.money.sendTransaction({from: eth.accounts[0], to: contr.address, value: 50000000000000000000}) The error does not chang
Ответы (1 шт):
Автор решения: green_tea
→ Ссылка
Решено:
Var getData = contr.payinsurence_fee.getData()
eth.sendTransaction ({from: adr, to: adr contract, value: count, data: getData})
