DatingDapp

AI First Flight #6
Beginner FriendlyFoundrySolidityNFT
EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

H-2: Unmatched likes have no refund, withdraw, or unlike path

Root + Impact

ETH only ever leaves the contract through a mutual match or the owner's fee withdrawal. A like that is never reciprocated has no exit: there is no unlike, no per-user refund, and no expiry. The majority of expected deposits are locked permanently, even after C-1 is fixed.

Description

// src/LikeRegistry.sol — the only outflow paths
function matchRewards(address from, address to) internal {
// only reachable on a mutual like
@> // pays only `rewards` derived from userBalances; no per-liker refund exists
}
​
function withdrawFees() external onlyOwner {
// pays only totalFees to owner
@> // does not cover un-matched like deposits
}
​
receive() external payable {} // accepts ETH, never returns it

Risk

Likelihood: High — a one-sided like is the normal outcome.

Impact: Permanent loss of the sender's ETH whenever a like is not reciprocated.

Proof of Concept

function test_UnmatchedLikeLocked() public {
_mint(alice);
_mint(bob);
vm.deal(alice, 1 ether);
​
vm.prank(alice);
registry.likeUser{value: 1 ether}(bob); // only alice likes
​
// No mutual match, and no function lets alice recover the ETH.
vm.prank(alice);
(bool ok,) = address(registry).call(
abi.encodeWithSignature("withdraw()") // no such function
);
assertFalse(ok);
assertEq(address(registry).balance, 1 ether); // stuck
}

Recommended Mitigation

+function withdrawUnmatched() external {
+ uint256 amount = userBalances[msg.sender];
+ require(amount > 0, "Nothing to withdraw");
+ userBalances[msg.sender] = 0;
+ (bool ok,) = payable(msg.sender).call{value: amount}("");
+ require(ok, "Transfer failed");
+}

Or add an expiry so unclaimed likes can be reclaimed after a deadline.


Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge about 6 hours ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!