Missing function implementation at VRFCoordinatorV2Mock contract
itsmehdi97 opened this issue · 4 comments
Description
I'm using VRFCoordinatorV2Mock
in my project.
When I try to compile I get this error:
TypeError: Contract "VRFCoordinatorV2Mock" should be marked as abstract.
--> contracts/test/VRFCoordinatorV2Mock.sol:9:1:
|
9 | contract VRFCoordinatorV2Mock is VRFCoordinatorV2Interface {
| ^ (Relevant source part starts here and spans across multiple lines).
Note: Missing implementation:
--> @chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol:124:3:
|
124 | function pendingRequestExists(uint64 subId) external view returns (bool);
This is because pendingRequestExists
has not been implemented on the mock contract.
I would like to contribute a PR that adds the implementation as follows:
function pendingRequestExists(uint64 subId) external view returns (bool) {
revert("not implemented");
}
Is this ok or I'm missing something?
Your Environment
Ubuntu with Brownie v1.19.1
Solc version: 0.8.16
Basic Information
n/a
Steps to Reproduce
- Copy
contracts/test/VRFCoordinatorV2Mock.sol
file intocontracts/
directory - Run
brownie compile
Additional Information
n/a
@itsmehdi97, which version of the @chainlink/contracts
package you have installed in your project? The pendingRequestExists
function in the VRFCoordinatorV2Mock
contract is implemented in the meantime, here & here.
@andrejrakic I copied the contract from here
Ah, I see. Feel free then to open a PR referencing this issue and ping someone from the Team to review it. Thanks @itsmehdi97
@itsmehdi97 a better, more durable way to address this could be to just follow the pattern from hardhat-starter-kit where we just import the official Chainlink mocks rather than copying the entire file. This would help keep this code DRY as well.
If that works locally for you @itsmehdi97 , then that would be a great PR on this issue.
@PatrickAlphaC - fyi just in case you see any other challenges with this approach, since I'm not familiar with the brownie environment.