Skip to content

Lesson 9: Has anyone tried refactoring code to not emit RequestedRaffleWinner event? #1858

Answered by othaime-en
atenger asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @atenger and @PatrickAlphaC I think I cracked it. Okay so we know i_vrfCoordinater.requestRandomWords() method emits an event called RandomWordsRequested It is emitted in our Raffle contract but our contract doesn't have an event declaration for this said event. So i figured, what if I initialized/declared this RandomWordsRequested event in my raffle contract similar to the one in the VRFCoordinatorV2Mock. I mean we already know it is emitted (the first event at index 0), we just need to sort of catch it right? So I added this code in my raffle contract event sections

  event RandomWordsRequested(
    bytes32 indexed keyHash,
    uint256 requestId,
    uint256 preSeed,
    uint64 inde…

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@PatrickAlphaC
Comment options

@atenger
Comment options

Comment options

You must be logged in to vote
6 replies
@adityabhattad2021
Comment options

@othaime-en
Comment options

@adityabhattad2021
Comment options

@atenger
Comment options

@othaime-en
Comment options

Answer selected by PatrickAlphaC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants