PatrickAlphaC / hardhat-fund-me-fcc

82 stars 183 forks source link

check funder is already in funders array or not #79

Closed byte14 closed 1 year ago

byte14 commented 1 year ago

Right now, if the player enter raffle multiple times, then player address is pushed into the s_funders multiple times. So checking whether player is already in the array and pushing player only after if player is not in the array by adding: if (s_addressToAmountFunded[msg.sender] == 0) { s_funders.push(msg.sender);

With this, we are still allowing to enter the same player to enter multiple times but it won't store the player address multiple times.

PatrickAlphaC commented 1 year ago

We actually want the player address to be stored multiple times if they enter multiple times, otherwise each additional entry won't give them a better chance of winning!