我试图将eth从智能合约发送到合约所有者的地址,但徒劳无功。这是我的合约功能:
function ownerDebit(uint amount) public payable onlyOwner returns(bool status){
status = owner.send(amount);
return status;
}
我正在使用NodeJS和Web3JS与该合同进行交互:
contract.methods.ownerDebit(10000000000000000).call().then(function(response){
console.log(response);
});
console.log中的响应为“ true”。
但是我帐户中的eth保持不变。
任何建议都会有所帮助!
答案 0 :(得分:0)
address(this)用于获取合同的地址。
status = address(this).transfer(owner, amount)