No Event Emitted in enterRaffle()
Function on Player Multi-Entry Into Raffle
The enterRaffle()
function in the original smart contract does not emit an event when a player tries to enter the raffle multiple times. This is a bug because it could make it difficult for users and developers to track the behavior of the contract and detect any potential issues.
Let's say a user tries to enter the raffle multiple times with the same address. The enterRaffle()
function will allow this and add the address to the players
array multiple times. However, because the function does not emit an event when a duplicate is found, the user will not be notified that they are trying to enter the raffle multiple times. This could potentially lead to confusion and misunderstanding.
Remix, PhindAI, Foundry
To mitigate this issue, the enterRaffle()
function should emit an event when a player tries to enter the raffle multiple times. This can be done by adding an emit
statement in the function. Here's an example of how this could be done:
In this modified version of the enterRaffle()
function, the function emits a RaffleEnter
event for each address in the newPlayers
array. The event includes the address of the player and a boolean indicating whether the address is a duplicate. This provides feedback to the user that they are trying to enter the raffle multiple times and makes the contract's behavior more transparent and easier to track.
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.