Complete the code to declare a receive function that accepts Ether.
receive() external [1] {}The receive function must be marked payable to accept Ether.
Complete the code to declare a fallback function that can receive Ether.
fallback() external [1] {}The fallback function must be marked payable to accept Ether sent without data.
Fix the error in the fallback function declaration to accept Ether.
fallback() external [1] {}Only payable fallback functions can accept Ether.
Fill both blanks to create a receive function that logs an event when Ether is received.
event Received(address sender, uint amount); receive() external [1] { emit Received(msg.sender, msg.[2]); }
The receive function must be payable to accept Ether, and msg.value gives the amount of Ether sent.
Fill all three blanks to create a fallback function that forwards received Ether to a payable address.
fallback() external [1] { address payable recipient = payable(msg.sender); (bool success, ) = recipient.call{value: msg.[2]([3]); require(success, "Transfer failed."); }
The fallback function must be payable to receive Ether. msg.value is the amount sent, and "" represents empty call data.