DatingDapp

First Flight #33
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

A user may lose their funds if someone they liked does not like them back.

Description: To like someone, the user must deposit at least 1 ETH into the smart contract. But if the other person does not like them back, this amount will be locked in the smart contract with no way to withdraw it.

Impact: A user may lose their funds if someone they liked does not like them back.

Recommended Mitigation: The smart contract LikeRegistry should allow users to unlike and withdraw their funds if they have not been matched.

+ event unLiked(address indexed liker, address indexed liked, uint256 refund);
+ function unlikeUser(address liked) external payable {
+ require(likes[msg.sender][liked], "Not yet liked");
+ require(!likes[liked][msg.sender], "Not yet matched");
+ likes[msg.sender][liked] = false;
+ uint256 refund = userBalances[msg.sender];
+ userBalances[msg.sender] = 0;
+ (bool success,) = payable(msg.sender).call{value: refund}("");
+ require(success, "Transfer failed");
+ emit unLiked(msg.sender, liked, refund);
+ }
Updates

Appeal created

n0kto Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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