Open vaasanthk opened 1 year ago
What is the issue here? VRFCoordinatorV2Interface
is implemented by VRFCoordinatorV2Mock
, look at the interface do you see addSubscription
as a function, I don't, but what I do see is createSubscription
and addConsumer
.
Now if we take a look at the VRFCoordinatorV2Mock
contract I can see an implementation of where we override the following methods:
There is no addSubscription
method, when you add your consumer (addConsumer
) there is an additional parameter to specify your subscriptionId, that is what you would use if you want to add your Raffle as a consumer to the result generated by the VRFCoordinatorV2.
All you need to do is replace addSubscription with addConsumer and you should be good, I don't know where you are writing this code in the wider context so it may not work depending on the context.
I apologize for not specifying the problem more explicitly. When I run the deploy script from the 01-deploy-raffle.js file after cloning the repository, this error appears, and when I run the test script, I get InvalidConsumer(). Upon researching the discussion group, I discovered that I should use addConsumer() instead of addSubscription(), which I thought might have been a mistake. Therefore, I created an issue ticket for this.
I believe addConsumer
is correct, in my code I have used that method.
Thanks! Can you make a pull request to fix?
Thanks, i was having the same issue.
This error is caused by the following line.
await vrfCoordinatorV2Mock.addSubscription(subscriptionId, raffle.address)
. Please change it toawait vrfCoordinatorV2Mock.addConsumer(subscriptionId, raffle.address)