Recall & Review
beginner
What does the
transfer function do when sending Ether in Solidity?The
transfer function sends a fixed amount of Ether to an address and throws an error if the transfer fails, reverting the transaction.Click to reveal answer
beginner
How does
send differ from transfer when sending Ether?send sends Ether but returns a boolean indicating success or failure instead of throwing an error. It requires manual error handling.Click to reveal answer
intermediate
What is the main advantage of using
call to send Ether?call is more flexible and forwards all available gas, allowing interaction with contracts that require more gas. It also returns success status and data.Click to reveal answer
advanced
Why should you be careful when using
call to send Ether?Because
call forwards all gas by default, it can lead to reentrancy attacks if not handled properly. Always use checks-effects-interactions pattern.Click to reveal answer
beginner
What happens if
transfer or send fails to send Ether?transfer throws an error and reverts the transaction, while send returns false and requires manual error handling.Click to reveal answer
Which function automatically reverts the transaction if sending Ether fails?
✗ Incorrect
transfer throws an error and reverts the transaction on failure.Which function returns a boolean indicating success or failure when sending Ether?
✗ Incorrect
send returns true or false depending on success.Which method is recommended for sending Ether when you need to forward all gas and handle complex interactions?
✗ Incorrect
call forwards all gas and allows complex interactions.What is a major security risk when using
call to send Ether?✗ Incorrect
Using
call can open the door to reentrancy attacks if not handled carefully.If you want to send Ether and handle failure manually without reverting, which function should you use?
✗ Incorrect
send returns false on failure, allowing manual handling.Explain the differences between
transfer, send, and call when sending Ether in Solidity.Think about error handling and gas forwarding.
You got /4 concepts.
Describe a safe pattern to send Ether using
call to avoid security risks.Focus on security best practices.
You got /4 concepts.