Open RevanthGundala opened 2 years ago
Please share the code of VRFCoordinatorMock
`// SPDX-License-Identifier: MIT
pragma solidity 0.6.6;
import "@chainlink/contracts/src/v0.6/interfaces/LinkTokenInterface.sol";
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
contract VRFCoordinatorMock {
LinkTokenInterface public LINK;
event RandomnessRequest(address indexed sender, bytes32 indexed keyHash, uint256 indexed seed);
constructor(address linkAddress) public {
LINK = LinkTokenInterface(linkAddress);
}
function onTokenTransfer(address sender, uint256 fee, bytes memory _data)
public
onlyLINK
{
(bytes32 keyHash, uint256 seed) = abi.decode(_data, (bytes32, uint256));
emit RandomnessRequest(sender, keyHash, seed);
}
function callBackWithRandomness(
bytes32 requestId,
uint256 randomness,
address consumerContract
) public {
VRFConsumerBase v;
bytes memory resp = abi.encodeWithSelector(v.rawFulfillRandomness.selector, requestId, randomness);
uint256 b = 206000;
require(gasleft() >= b, "not enough gas for consumer");
(bool success,) = consumerContract.call(resp);
}
modifier onlyLINK() {
require(msg.sender == address(LINK), "Must use LINK token");
_;
}
}`
The code seem to be ok, which is the result on console when you do brownie compile
?
also change the name folder from test, to tests.
Dude check out here for the solution :) https://github.com/spo0ds/Journey-to-become-a-Blockchain-Engineer/blob/main/Day20/Day20.md
Not sure what the issue could be. I have tried deleting the build folder and compiling and that still did not fix anything. Any help would be appreciated.