Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Chainlink VRF V2 with Direct Funding Method #73

Closed
hantuzun opened this issue Jan 23, 2023 · 0 comments
Closed

Use Chainlink VRF V2 with Direct Funding Method #73

hantuzun opened this issue Jan 23, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@hantuzun
Copy link
Contributor

It's the time to integrate Chainlink VRF.

The documentations are available on:

Here's the example contract getting randomness from Chainlink docs: https://remix.ethereum.org/#url=https://docs.chain.link/samples/VRF/VRFv2DirectFundingConsumer.sol

I suggest asking for the random number once in the startDrawPeriod function and recording a seed for the following reasons:

  • The number draws will be faster. As VRF flows will require 2+ blocks for every number + the cooldown.
  • The code will be simpler.
  • We will know how much LINK to use.

If we agree on this, we'd only need to modify startDrawPeriod() and add fulfillRandomWords(...). fulfillRandomWords(...) could store the random word as a variable. And then we could use that variable and nonces in drawNumber() only by changing the variables we put into the hash functions.

Design considerations:

  • The contract must be resilient to Chainlink VRF failing to call the fulfillRandomWords function.
  • The contract must not change its random number once it is set. Otherwise, advanced players can change the number to increase their chances of winning.

@daggerhashimoto you should review this issue.

@hantuzun hantuzun added the enhancement New feature or request label Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants