Christmas Dinner

First Flight #31
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: low
Valid

No way for Participant to Sign Up Friends

Summary

Documentation indicates that participants can sign up friends, however, this is not possible. The signup mechanism in deposit() only allows the msg.sender to register. I.e. There is no way for participant to register his friends.

Impact

Each group of friends that intends to join the party will have to sign up individually. This could potentially dissuade and lower attendance/use of the protocol.

Tools Used

Manual Review

Recommendations

Implement the below function that allows a user to sign up friends:

function depositFriends(address _token, uint256 _amount, address[] calldata _friends) external beforeDeadline {\
if (!whitelisted[_token]) {
revert NotSupportedToken();
}
// Handle deposit for the sender
if (participant[msg.sender]) {
balances[msg.sender][_token] += _amount;
IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
emit GenerousAdditionalContribution(msg.sender, _amount);
} else {
participant[msg.sender] = true;
balances[msg.sender][_token] += _amount;
IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
emit NewSignup(msg.sender, _amount, getParticipationStatus(msg.sender));
}
// Handle batch signup for friends
for (uint256 i = 0; i < _friends.length; i++) {
address friend = _friends[i];
// Skip if the friend is already a participant
if (participant[friend]) {
continue;
}
// Register the friend as a participant
participant[friend] = true;
// Emit an event to indicate the friend has been signed up
emit NewSignup(friend, 0, getParticipationStatus(friend));
}
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Deposit function lacks functionality

Support

FAQs

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

Give us feedback!