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

feat(RNGChainlinkV2): add Chainlink VRF V2 #22

Merged
merged 12 commits into from Feb 4, 2022

Conversation

PierrickGT
Copy link
Contributor

No description provided.

@linear
Copy link

linear bot commented Feb 3, 2022

@PierrickGT PierrickGT force-pushed the pool-1996-chainlink-20-implementation branch from 5e1682e to 086757a Compare February 4, 2022 00:09
@PierrickGT PierrickGT force-pushed the pool-1996-chainlink-20-implementation branch from 086757a to 1c0e920 Compare February 4, 2022 00:22

import "./RNGInterface.sol";
import "./interfaces/RNGInterface.sol";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep in mind that this is a breaking change for any dependencies. Keep the same, even if it makes you twitch!

Try to touch as little as possible!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: 701badd

RequestConfig public sRequestConfig;

/// @notice Chainlink VRF subscription request id
uint256 public sRequestId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We store the most recent Chainlink VRF request id to compare it with the request id passed to the fulfillRandomWords fallback function.
If it doesn't match, the transaction will revert.

require(_requestId == sRequestId, "RNGChainLink/requestId-incorrect");

_requestConfig.numWords
);

sRequestId = _vrfRequestId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

sRequestConfig.keyHash = _keyhash;

emit KeyHashSet(_keyhash);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to setting the keyhash, you'll want to add setters for each of the fields in RequestConfig.

Or you could just add a setRequestConfig function. It's prob easiest, even if info gets repeated. You already have a RequestConfigSet event too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: 21e2671

@PierrickGT PierrickGT force-pushed the pool-1996-chainlink-20-implementation branch from 21e2671 to c1a3331 Compare February 4, 2022 22:24
@PierrickGT PierrickGT force-pushed the pool-1996-chainlink-20-implementation branch from c1a3331 to 35cdaf9 Compare February 4, 2022 23:30
@PierrickGT PierrickGT merged commit 83ea1f0 into master Feb 4, 2022
@PierrickGT PierrickGT deleted the pool-1996-chainlink-20-implementation branch February 4, 2022 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants