Sparkn

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

Functionity not implemented as described

Summary

The functionality as described in the comment not implemented.

Vulnerability Details

deployProxyAndDistribute is used to deploy and distribute rewards once they are allowed by owner to host contest through setContest.

function deployProxyAndDistribute(bytes32 contestId, address implementation, bytes calldata data)
public
returns (address)
{
bytes32 salt = _calculateSalt(msg.sender, contestId, implementation);
if (saltToCloseTime[salt] == 0) revert ProxyFactory__ContestIsNotRegistered();
@-> // can set close time to current time and end it immediately if organizer wish
if (saltToCloseTime[salt] > block.timestamp) revert ProxyFactory__ContestIsNotClosed();
address proxy = _deployProxy(msg.sender, contestId, implementation);
_distribute(proxy, data);
return proxy;
}

Here focus on this Natspec:

// can set close time to current time and end it immediately if organizer wish

The function was supposed to allow the functionality to set the close time as current timestamp but it is never implemented.

That is why the codebase should be changed to:

- function deployProxyAndDistribute(bytes32 contestId, address implementation, bytes calldata data)
+ function deployProxyAndDistribute(bytes32 contestId, address implementation, bytes calldata data, bool endContest)
public
returns (address)
{
bytes32 salt = _calculateSalt(msg.sender, contestId, implementation);
if (saltToCloseTime[salt] == 0) revert ProxyFactory__ContestIsNotRegistered();
// can set close time to current time and end it immediately if organizer wish
if (saltToCloseTime[salt] > block.timestamp) revert ProxyFactory__ContestIsNotClosed();
+ if(endContest){
+ saltToCloseTime[salt] = block.timestamp
+ }
address proxy = _deployProxy(msg.sender, contestId, implementation);
_distribute(proxy, data);
return proxy;
}

Impact

Functionality not implemented as described.

Tools Used

VS Code

Recommendations

Shown above.

Support

FAQs

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