Complete the code to check if the sender has enough balance before proceeding.
require(balances[msg.sender] >= [1], "Insufficient balance");
The require statement checks if the sender's balance is at least the amount they want to send.
Complete the code to update the sender's balance after the check.
balances[msg.sender] [1]= amount;We subtract the amount from the sender's balance to reflect the transfer.
Fix the error in the interaction step to send Ether safely.
(bool success, ) = payable(recipient).[1]{value: amount}(""); require(success, "Transfer failed.");
Using call is the recommended way to send Ether safely and handle failures.
Fill both blanks to complete the Checks-Effects-Interactions pattern safely.
require(balances[msg.sender] >= [1], "Not enough balance"); balances[msg.sender] [2]= amount;
First, check the sender has enough amount. Then subtract amount from their balance.
Fill all three blanks to complete the full Checks-Effects-Interactions pattern.
require(balances[msg.sender] >= [1], "Insufficient funds"); balances[msg.sender] [2]= [1]; balances[recipient] [3]= [1];
Check sender has enough amount, subtract it from sender, then add it to recipient.