I'm using Chainlink VRF to get a random number, but I need to keep track of the msg.sender
that calls requestRandomWords
when the fulfillRandomWords
is fired. In other words I need the same msg.sender
inside the fulfillRandomWords
and in my tests it changes. How can I achieve that?
2 Answers
After see the Chainlink docs, I ended up using a mapping
to store the requestId
for a specific address. This allowed me to keep track of the sender.
mapping(uint256 => address) private requestIdToRequester;