Maik
Maik

Reputation: 39

Chainlink VRF v2 Fail

I am running script from official instruction

https://docs.chain.link/docs/chainlink-vrf/example-contracts/

when I run topUpSubscription(10000000)

but keep receiving error here

https://rinkeby.etherscan.io/tx/0xceef45073fc882c19c5be5242ee9777ea19b578193d65519fe9bfeed6c2469fc

Upvotes: 0

Views: 311

Answers (1)

Petr Hejda
Petr Hejda

Reputation: 43491

You're trying to invoke the function topUpSubscription() that transfers LINK tokens from your contract to the COORDINATOR address.

// Assumes this contract owns link.
// 1000000000000000000 = 1 LINK
function topUpSubscription(uint256 amount) external onlyOwner {
    LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_subscriptionId));
}

However, your contract doesn't have any LINK tokens. So the transfer fails, causing the main transaction to revert.

You can get testing LINK tokens on their faucet https://faucets.chain.link/rinkeby.

Upvotes: 1

Related Questions