smartcontractkit / chainlink-brownie-contracts

A repository for automatically using the latest chainlink repo from the core chainlink repo.
303 stars 65 forks source link

SubscriptionAPI.sol appears to be missing a ^ symbol, displaying: pragma solidity 0.8.19; #32

Open simon-masterclass opened 2 months ago

simon-masterclass commented 2 months ago

Devs, I'm trying to build a Raffle project implementing chainlink VRF and I'm having trouble compiling with any version of solidity higher than 0.8.19 - I submitted this issue to the Cyfrin team and @PatrickAlphaC but I figured I'd post it here as well.

It appears that the issue is in a Chainlink-Brownie-Contract file related to vrf contracts - specifically one of the inherited contracts.

SubscriptionAPI.sol @chainlink-brownie-contracts/contracts/src/v0.8/vrf/dev/SubscriptionAPI.sol

It appears that the pragma solidity version is missing a "^" (Carot) symbol, thereby hampering the ability to compile with any version of solidity greater than 0.8.19 - which might be intentional or a bug.

Here's the code:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol";
import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol";
import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol";
import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol";
import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol";
import {IVRFSubscriptionV2Plus} from "./interfaces/IVRFSubscriptionV2Plus.sol";

abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscriptionV2Plus {
  using EnumerableSet for EnumerableSet.UintSet;

Is this a bug or a feature? Let me know, thanks!

-Simon

PatrickAlphaC commented 2 months ago

Can you make this an issue in the chainlink repo? This repo just clones the code in that repo.

simon-masterclass commented 2 months ago

@PatrickAlphaC Does it just clone the repo? Because the original Chainlink repo doesn't have a missing ^ as you can see at this link... https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/vrf/dev/SubscriptionAPI.sol NOTE: This "original" chainlink/contracts repo uses version ^0.8.4

Only the Chainlink-brownie-contracts repo seems to have these issues. as you can see at this link... https://github.com/smartcontractkit/chainlink-brownie-contracts/blob/main/contracts/src/v0.8/vrf/dev/SubscriptionAPI.sol

Let me know, thanks. -Simon

PatrickAlphaC commented 2 months ago

@simon-masterclass it uses the "official" package from npm. So whatever they are uploading to NPM is what this package uses.

Also, it looks like both repos have the ^?

simon-masterclass commented 2 months ago

@PatrickAlphaC Oh, that's interesting. It looks like they fixed it. It used to be missing a ^ 🧐 I copied the code in the issue report above (version 0.8.19) directly from the second link in the comment above - but now both are synced up to the same version ^0.8.4 All clear. 👍🏼