Add VRF starter kit example#45
Open
thodges-gh wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a Chainlink VRF Foundry starter-kit template to
chainlink-vrf-skill, mirroring theexisting data-feeds starter kit, so the skill can hand users a complete, runnable project
instead of an isolated snippet.
Template (
chainlink-vrf-skill/templates/starter-kit/):src/VRFConsumerV2Plus.sol— a VRF v2.5 subscription consumer (VRFConsumerBaseV2Plus,VRFV2PlusClient.RandomWordsRequeststruct withextraArgs,uint256subscription ID,calldatacallback). Based on the Chainlink Foundry Starter KitVRFConsumerV2.solpattern butupgraded to v2.5 — the legacy V2 source the skill explicitly refuses to emit would not compile
against current coordinators.
test/VRFConsumerV2Plus.t.sol— 4 tests against theVRFCoordinatorV2_5Mockshipped with@chainlink/contracts(no vendored mock).script/VRFConsumerV2Plus.s.sol— defaults to Sepolia (live coordinator + 500 gwei key hash,subscription ID via
SUBSCRIPTION_IDenv); on local chains it deploys and funds a mock andwires the consumer end-to-end.
foundry.toml,remappings.txt,.gitignore, and aREADME.mdcovering dependencies, v2.5essentials, default network, and run commands.
chainlink-evm@contracts-v1.5.0imports transitively via versioned
@openzeppelin/contracts@4.9.6/...paths — without it afresh project fails to compile.
Skill (
SKILL.md): added progressive-disclosure and routing entries pointingproject-level/Foundry-starter requests to the template.
Evals (
evals/chainlink-vrf-skill/): added astarter-kitrubric, two functional cases andone trigger-positive case, and the corresponding
promptfooconfig.yamlentries and READMEupdates (10 cases total, 9 smoke-tagged).
Verified in a fresh project with the three documented dependencies installed:
forge test --offlinepasses all 4 tests andforge script ...DeployVRFConsumerV2Plus --offlinedeployssuccessfully.
Justification
The VRF skill could generate consumer snippets but had no scaffolding path, so "give me a
working VRF project I can build and test" requests produced ad-hoc, often non-compiling
projects. A vetted, version-correct starter kit gives users a known-good v2.5 baseline that
builds and tests locally on the first try, keeps generated projects aligned with the skill's
safety defaults (v2.5-only, no invented addresses), and brings VRF to parity with the data-feeds
skill. The included evals guard the behavior against regressions.