Mystery Box

First Flight #25
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Invalid

Perhaps a good approach would be to add a receive function to the protocol.

Summary

A receive function that is automatically called when Ether is sent to the contract. It logs the sender’s address and the amount received.

  1. Using the receive function can be more gas-efficient compared to other methods of handling Ether transfers, as it is a simple and direct way to accept funds.

  2. Error Handling: If a contract does not have a receive function and Ether is sent to it without data, the transaction will fail. Therefore, including a receive function can help prevent such failures.

Add receive function

receive() external payable {
emit Received(msg.sender, msg.value);
}
Updates

Appeal created

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!