The following Smart Contract is supposed to simply send any ethers received back to the sender:
pragma solidity ^0.4.0;
contract ExampleSmartContract {
function() payable {
msg.sender.transfer(msg.value);
}
}
I published the contract to the Rinkeby Test Network. When I tried to send 1 Ether from my Account to the address of the Smart Contract, I expected to get 1 Ether back.
However, when trying to send one ether to the smart contract, I get the following error message in MetaMask:
Does anybody know how to write the contract in such a way that it sends any ethers received back to the sender?