If one person decides to enter themselves and more than one other address (and of course pays the entry fees for those other people), a person in control of one of those other addresses can get a refund for the amount paid by the original entering person. If you enter for someone and then maybe have a falling out with them or they lose their private keys, the person entering the raffle won't be able to get a refund for that entry.
I wrote this test to demonstrate that one player can take the refund paid to enter them - playerOne enters three people and then playerTwo takes the money playerOne paid:
Run this test and it will pass even though playerTwo is getting a refund for playerOne's money
Some entries are not refundable in the way you would expect. You could argue that maybe the players sent their money to entering player to enter for them. But maybe they didn't do that way and it was just a friend entering for multiple people (or even multiple entries for themself, but they might lose the key for one of the addresses). Most people would expect you could refund either all of your entry or maybe none of your entry, not part of it.
Foundry
VS Code
You can create a mapping of the address of the person who called enterRaffle to an array of the addresses they entered. Then you push all the addresses they entered to that mapping in enterRaffle and finally you put a check at the beginning of refund that the address they are trying to get a refund for is in msg.sender's array in that mapping...see below changes:
Add a mapping variable:
Add a custom error:
Add a line to the first for loop in enterRaffle to push all addresses entered to the new mapping:
Add the following function:
Add the following check to the refund function after playerAddress is defined:
Funds are locked to no one. If someone gets the refund issue, they also got this issue. IMPACT: High Likelihood: High
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.