Skip to content

Solidity smart contract not working on local development network but working fine on goerli testnet #1870

Answered by Nlferu
usmanfarooq91 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @usmanfarooq91

You have incorrect VRFCoordinatorMock.sol contract implemented under your contracts/test folder.

Correct this function in it as below:

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);
    }

You are just missing uint256 fee there currently and rest of your code is correct and this will work. Not sure how could you get this contract incorrectly tho as you should copy it from repo and don't touch it :p

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@usmanfarooq91
Comment options

@Nlferu
Comment options

Answer selected by usmanfarooq91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants