Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to send 1 ether using the transfer method.
Blockchain / Solidity
payable(msg.sender).[1](1 ether);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using send instead of transfer without checking return value.
✗ Incorrect
The transfer method sends Ether and reverts on failure.
2fill in blank
mediumComplete the code to send 0.5 ether using the send method and check success.
Blockchain / Solidity
bool success = payable(receiver).[1](0.5 ether);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not checking the boolean result of send.
✗ Incorrect
The send method returns a boolean indicating success or failure.
3fill in blank
hardFix the error in sending Ether using call and check for success.
Blockchain / Solidity
(bool sent, ) = payable(receiver).[1]{value: amount}(''); require(sent, 'Failed to send Ether');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using transfer or send with call syntax.
✗ Incorrect
The call method is the recommended way to send Ether with gas forwarding and returns success status.
4fill in blank
hardFill both blanks to send Ether safely using call and handle failure.
Blockchain / Solidity
([1], ) = payable(receiver).[2]{value: msg.value}(''); require([1], 'Send failed');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using transfer or send with call syntax.
✗ Incorrect
Use call to send Ether and store the success boolean in sent.
5fill in blank
hardFill all three blanks to create a function that sends Ether using call and reverts on failure.
Blockchain / Solidity
function sendEther(address payable receiver) public payable { (bool [1], bytes memory [2]) = receiver.[3]{value: msg.value}(''); require([1], 'Failed to send Ether'); } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using send or transfer instead of call in this pattern.
✗ Incorrect
Use call to send Ether, capture success and data, and require success.