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

[Bug]: VRFv2Consumer.sol sample has incorrect import #1833

Open
Hotmanics opened this issue Mar 21, 2024 · 3 comments · May be fixed by #1834
Open

[Bug]: VRFv2Consumer.sol sample has incorrect import #1833

Hotmanics opened this issue Mar 21, 2024 · 3 comments · May be fixed by #1834
Assignees
Labels
bug Something isn't working in progress

Comments

@Hotmanics
Copy link

Describe the bug

When copying the sample code for VRFv2Consumer, the import for VRFCoordinatorV2Mock is incorrect, as presumably, the location of it has changed recently.

To Reproduce

  1. Go to 'https://docs.chain.link/vrf/v2/subscription/examples/get-a-random-number#analyzing-the-contract'
  2. Copy the code snippet into a file on your local machine.
  3. Attempt to compile the smart contract.
  4. Receive compiler error for the import.

URLs

Expected behavior

The ability to copy the code and have it compile

Additional context

No response

@Hotmanics Hotmanics added bug Something isn't working triage labels Mar 21, 2024
@Hotmanics Hotmanics linked a pull request Mar 21, 2024 that will close this issue
@aelmanaa aelmanaa self-assigned this Mar 22, 2024
@aelmanaa
Copy link
Collaborator

Hi @Hotmanics

which version of the @chainlink/contracts NPM package are you using? If you are using v1.0.0 then it's still beta.

If you use v0.8.0 then it will work fine . Example with Remix IDE:

  1. Open the link that you shared: https://docs.chain.link/vrf/v2/subscription/examples/get-a-random-number#analyzing-the-contract
  2. Go below the contract and click on "Open in Remix"
  3. The following link will open and you'll notice the version is pinned to the imports.
import {VRFCoordinatorV2Interface} from "@chainlink/contracts@0.8.0/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import {VRFConsumerBaseV2} from "@chainlink/contracts@0.8.0/src/v0.8/vrf/VRFConsumerBaseV2.sol";
import {ConfirmedOwner} from "@chainlink/contracts@0.8.0/src/v0.8/shared/access/ConfirmedOwner.sol";

@Hotmanics
Copy link
Author

@aelmanaa I am actually installing the github repo as a library in foundry through
forge install smartcontractkit/chainlink --no-commit.

@aelmanaa
Copy link
Collaborator

@aelmanaa I am actually installing the github repo as a library in foundry through

forge install smartcontractkit/chainlink --no-commit.

Thanks @Hotmanics !
Yes indeed foundry by default installs the latest GitHub main branch ( if you don't specify a release tag or a commit id).

We are currently working on adapting all our examples to work with the latest version. This PR will fix this issue. Also we will add callouts to explain how to install the latest npm version using npm,yarn, and foundry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants