DatingDapp

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

Missing Deposit Mechanism in `LikeRegistry.sol` Prevents Getting Dating Funds

Summary

The contract documentation states:

"If the like is mutual, all their previous like payments (minus a 10% fee) are pooled into a shared multisig wallet."

However, there is no mechanism for users to deposit funds into the contract. As a result, userBalances remains empty, and the multisig wallet will never receive any funds, making the intended functionality ineffective.

Vulnerability Details

In src/LikeRegistry.sol, the contract maintains a mapping:

mapping(address => uint256) public userBalances;

The function matchRewards attempts to access userBalances to retrieve user balances:

uint256 matchUserOne = userBalances[from];
uint256 matchUserTwo = userBalances[to];

However, there is no function that allows users to deposit funds into userBalances. Without a way to update this mapping, the balance always remains zero, rendering the dating funds distribution mechanism non-functional.

Impact

  • Users cannot deposit funds to update userBalances, making it impossible to participate in the intended payment flow.

  • The multisig wallet never receives any funds, preventing users from benefiting from mutual likes.

  • The core feature of like payments is ineffective, as no transactions occur.

Tools Used

Manual code review

Recommendations

To fix this issue, implement a receive function that allows users to deposit funds into the contract while preventing unintended deposits:

receive() external payable {
require(msg.value > 0, "Deposit must be greater than zero");
userBalances[msg.sender] += msg.value;
}

This ensures that users can fund their accounts, allowing matchRewards to function as intended.

Updates

Appeal created

n0kto Lead Judge 5 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding_likeUser_no_userBalances_updated

Likelihood: High, always. Impact: High, loss of funds

Support

FAQs

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