Complete the code to make the function accept Ether payments.
function deposit() public [1] {
// Function body
}The payable keyword allows the function to receive Ether.
Complete the code to access the amount of Ether sent to the function.
function deposit() public payable {
uint amount = [1];
}msg.value holds the amount of Ether (in wei) sent with the transaction.
Fix the error in the function declaration to allow receiving Ether.
function receiveFunds() public [1] {
// Accept Ether
}Only functions marked payable can receive Ether.
Fill both blanks to create a payable fallback function that accepts Ether.
fallback() [1] [2] { // fallback logic }
The fallback function must be external and payable to accept Ether.
Fill all three blanks to create a payable receive function that accepts Ether and updates balance.
mapping(address => uint) public balances; receive() external [1] { balances[msg.sender] [2]= [3]; }
The receive function must be marked payable to accept Ether. The balance is updated by adding (+=) the amount sent (msg.value).
