I am playing around with Solidity 0.6.1 and trying to build a simple funds forwarder. So ETH is sent to the contract and it sends the funds to another address.
I deployed it to Ropsten. But every time I send ETH to the contract address the transaction fails due to
Warning! Error encountered during contract execution [Out of gas]
Here is my contract
pragma solidity ^0.6.1;
contract testFallback {
address payable public addr = 0x...;
receive() external payable {
if (msg.value > 0) {
if (!addr.send(address(this).balance)) revert();
}
}
}
and an example of a failed transaction.
I have tried using the
fallback() external payable
function as well. I have been reading up on it here but I am unsure. why my contract cannot accept and then forward the ETH i=I send it. Thanks for your help.