In LikeRegistry.sol
, there is no way for users to cancel their "likes." This leads to a situation where the ETH transferred for an unmatched "like" remains locked in the contract indefinitely.
When a user likes another user by calling the likeUser()
function, they are required to transfer at least 1 ETH. However, if the recipient does not reciprocate the like, the ETH remains locked in the contract.
Since there is no function to cancel a "like" or withdraw the locked funds, users may lose access to their ETH.
User A sends 1 ETH to like User B.
User B does not like User A back.
User A cannot recover the 1 ETH since the contract lacks a mechanism to reverse or withdraw unmatched likes.
Locked funds for users who do not receive a reciprocal like.
Users may become reluctant to use the platform due to potential loss of funds.
Reduces the overall utility and user experience of the contract.
Manual review
Add a function to allow users to cancel a "like" and recover their ETH if the like has not resulted in a match:
Ensure that likeAmounts[msg.sender][liked]
is properly initialized and tracked when the user sends ETH to like another user.
Add unit tests to verify that users can successfully cancel unmatched likes and receive refunds.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.