Replies: 1 comment 2 replies
-
The below is the function that calculates the winner function fulfillRandomWords(uint256 /* requestId */, uint256[] memory randomWords) internal override {
uint256 indexOfWinner = randomWords[0] % s_listOfParticipants.length;
address payable addressOfWinner = s_listOfParticipants[indexOfWinner];
s_recentWinner = addressOfWinner;
emit winnerSelectedAndPayed(addressOfWinner, address(this).balance);
s_listOfParticipants = new address payable[](0);
s_lastTimeStamp = block.timestamp;
s_raffleState = RaffleState.OPEN;
(bool success,) = addressOfWinner.call{value: address(this).balance}("");
if (!success) revert Lottery__TransferringToWinnerFailed();
} This line of code |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all 👋🏼
setting
additionalEnterances
other than3
or9
fails the test with following logHow the expectedWinner is calculated?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions