Christmas Dinner

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

Added Re-SignUp events for better clarification

Summary

When a participant changes their participation status from true to false, and then deposits funds to the contract again, it will emit a NewSignUp event which is technically not true as the user had already Signed up previously and did not refund his funds. It's more like a Re-Signing up.

Impact

Incorrect or missing events can hinder off-chain monitoring and cause issues with integrations

Tools Used

Manual Review

Recommendations

add a new event such as:

event ReSignup(address indexed, uint256 indexed, bool indexed);//added for more clarity

And then change the emission logic of the deposit() and receive() functions for better clarification:

function deposit(address _token, uint256 _amount) external beforeDeadline {
if(!whitelisted[_token]) {
revert NotSupportedToken();
}
if(participant[msg.sender]){
balances[msg.sender][_token] += _amount;
IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
emit GenerousAdditionalContribution(msg.sender, _amount);
} else {
//if-else logic added to emit proper events
if(_hasBalanceInContract(msg.sender)){
emit ReSignup(msg.sender, _amount, true);
}else{
emit NewSignup(msg.sender, _amount, true);
}
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));
}
}
receive() external payable {
//Implemented proper logic as deposit
if(participant[msg.sender]) {
etherBalance[msg.sender] += msg.value;
emit GenerousAdditionalContribution(msg.sender, msg.value);
}else{
//if-else logic added for proper event emissions
if(_hasBalanceInContract(msg.sender)){
emit ReSignup(msg.sender, msg.value, true);
}else{
emit NewSignup(msg.sender, msg.value, true);
}
participant[msg.sender] = true;//added
etherBalance[msg.sender] += msg.value;
//emit NewSignup(msg.sender, msg.value, true);
}
}

So that now if a participant redeposits after changing their status to false it will emit a ReSignupevent making the phenomenon clearer.

Updates

Lead Judging Commences

0xtimefliez Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!