All results can be verified by anyone on smart contract on polygonscan.
Each requests to Chainlink has a requestId and a Random Number seed , that it can be seen on each request on logs tab.
To get requestId from Chainlink use read function requestNumberIndexToRequestId with the request counter id, (request counter id is a infinite number that increments on each draw starting from 0), to check if requestId matches the request counter id run the read function requestIdToRequestNumberIndex.
Using requestId from lottery 0 in requestIdToRequestNumberIndex function
You can get the random number info on read function requestNumberIndexToRandomNumber.
Using Lottery ID you get random number from chainlink This is the number which we use to generate the results using modulo math, to check the result you need to check number of players at that draw ID running read function numberOfPlayers function with draw ID.
Getting number of players at the request If for example it had 31 players and randomWords as 32123300067369566142430597366058144063309315440346383261562471505552091797105we will use modulo function to get array position like that:
result = 32123300067369566142430597366058144063309315440346383261562471505552091797105% 31
example on how its done inside the contract:
Getting Raffle with result of chainlink _randomWords and number of players at the draw time to get the ticket ID in the position of array registeredAccts
Get ticket ID position on raffle array >
on registeredsAccts on you check which ticket ID corresponds to which position, this position is the position that get draws on raffle random number, this position changes based on new tickets leaving the array. Example ID 1 on position 1 Inside contract we get the modulo result to find the winner ticket:
Getting winner ticket based on the raffle variable result We then get the owner of that ticket by checking TicketsHistory storage :
using the current draw ID and obtained ticket ID by random result position You can also check previous jackpot winners with read functions getJackpotWinnerByLotteryId or JackpotWinHistory
returns winner ticket infos, returns all zero if not drawed yet returns winner ticket infos, returns all zero if not drawed yet Last winner address with read function OurLastWinner
All the code logic can be seen on smart contracts source code which is well commented, like the buy function in BuyTicket(), and result getter function on fulfillRandomWords() and more.