In the LikeRegistry
contract, the userBalances
mapping is never updated with the funds sent by users during the likeUser
function execution. As a result, users' balances remain at 0, and the reward mechanism in the matchRewards function fails to properly distribute funds. This leads to an ineffective contract where ETH is sent to the contract but never tracked or distributed and is locked forever.
The contract defines a userBalances mapping to track user balances:
However, in the likeUser
function, when a user likes another user, the contract does not update userBalances with the ETH sent. As a result, user balances are never incremented with the funds sent to the contract. The matchRewards function is intended to handle reward distribution but always operates with 0 balances for the users because userBalances was never updated.
Step-by-Step Explanation and Proof
Deploy Contracts:
Setup Users (Alice and Bob):
Alice and Bob each mint a profile NFT from SoulboundProfileNFT and fund both with 1 ETH.
Alice calls likeUser(bobAddress) with 1 ETH.
Bob calls likeUser(aliceAddress) with 1 ETH.
The contract's balance becomes 2 ETH.
Mutual like detected; matchRewards is triggered.
userBalances[alice] = 0 (never updated after sending ETH).
userBalances[bob] = 0.
During matchRewards:
totalRewards = 0 + 0 = 0.
matchingFees = 0 (10% of 0).
rewards = 0; nothing sent to MultiSig.
After matchRewards:
userBalances[alice] and userBalances[bob] remain 0.
Contract balance is still 2 ETH (ETH not distributed).
Conclusion:
The userBalances stay at 0 because the contract fails to credit the sent ETH to userBalances.
The 2 ETH remains in the contract, proving the bug.
Output:
High severity: No funds are tracked for users, preventing the reward mechanism from working.
High severity: MultiSigWallet
receives no funds, making it useless.
Critical severity: Users are unable to withdraw or access the rewards they should have received.
High severity: Funds are locked forever in LikeRegistry
contract.
Manual code review
Solidity test framework
Likelihood: High, always. Impact: High, loss of funds
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.