Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: low
Valid

The protocol doesn't enforce organizers/sponsors to send tokens to their own contest Proxy

Summary

The protocol doesn't enforce organizers/sponsors to send tokens to their own contest Proxy.

Vulnerability Details

The protocol states that organizers and sponsors should fund their own contest, but nowhere in the code is this enforced. Meaning that the contest can be created, the users (winners) can do what the organizer needs them to do, but never pay them anything.

Imagine the following.

  1. Alice (organizer) wants to create a contest for a specific task she needs done.

  2. The owner of the ProxyFactory calls setContest.

  3. The contest is live.

  4. Bob (user/winner) does the task that the contest requires and expects to be paid. At this point there are no tokens in the Proxy, but Bob isn't worried as he expects that Alice or some sponsor will fund the Proxy.

  5. The contest finishes and the closeTime is reached, but the Proxy still doesn't have any funds.

  6. Bob did the work, but won't be paid for his work.

Impact

The winners won't be awarded any tokens for their work.

Tools Used

Manual review

Recommendations

In setContest add some logic that transfers some initial tokens to the Proxy address from either the organizer or one of the sponsors.

// Add the the last two arguments
function setContest(address organizer, bytes32 contestId, uint256 closeTime,
address implementation, address initialToken, uint256 initialFunds)
public
onlyOwner
{
if (organizer == address(0) || implementation == address(0)) revert ProxyFactory__NoZeroAddress();
if (closeTime > block.timestamp + MAX_CONTEST_PERIOD || closeTime < block.timestamp) {
revert ProxyFactory__CloseTimeNotInRange();
}
bytes32 salt = _calculateSalt(organizer, contestId, implementation);
if (saltToCloseTime[salt] != 0) revert ProxyFactory__ContestIsAlreadyRegistered();
saltToCloseTime[salt] = closeTime;
// Add the following lines
address proxyAddress = getProxyAddress(salt, implementation);
IERC20 token = IERC20(initialToken);
token.safeTransferFrom(organizer, proxyAddress, initialFunds);
emit SetContest(organizer, contestId, closeTime, implementation);
}

Support

FAQs

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