1

I was following these steps in order to use Chainlink on Kovan testnet. when I've finished the configuration (truffle-config.js, npm install to get all the dependencies, etc.) and I've compiled the contracts and all is working. But when I was doing:

truffle migrate --network kovan

I got an error about it couldn't find the module @chainlink/contracts/truffle/v0.4/LinkToken. I've tried to find a solution on Internet but I didn't find anything.

enter image description here

3 Answers 3

2

There are you need to change require lines as below.

const { LinkToken } = require('../node_modules/@chainlink/contracts/src/v0.4/LinkToken.sol')
const { Oracle } = require('../node_modules/@chainlink/contracts/src/v0.6/Oracle.sol')

Hope it will help you.

0
1

Thanks a lot, that helped a lot. But...

enter image description here

Now I'm getting this error (Chainlink is driving me crazy...). ¿Unexpected identifier? I also tried to change that line to v6.0, but there's no LinkToken.sol file in v6.0 folder (that file only exists in v4.0). So that didn't work either.

I don't know... Maybe something about the compiler? But I can't change the compiler either. I need to use compiler 0.6.6.

1

In order to use @chainlink/contracts with truffle you should use the truffle unbox or change the @chainlink/contracts version to 0.1.9.

Ethers and Truffle contract artifacts are no longer published in further versions.

1
  • Finally I changed the project to Hardhat. Much better. Thanks!
    – Joncarre
    Dec 22, 2021 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.