0

I'm using truffle to create a contract that extends another contract in a GitHub repository e.g.

contract Consumer is Chainlinked {

}

My first problem is that I an unable to import directly from a Github repository as is suggested here https://remix.readthedocs.io/en/latest/tutorial_import.html

import "https://github.com/smartcontractkit/chainlink/solidity/contracts/Chainlink.sol";

results in the error

Error: Could not find https://github.com/smartcontractkit/chainlink/solidity/contracts/Chainlink.sol from any sources; imported from /home/software/ib/oracle/contracts/Consumer.sol

So I've copied the file locally. My second problem is that the imported files import a number of other files such as

import "solidity-cborutils/contracts/CBOR.sol";

These don't resolve locally, so I get an error during compile. Now I could copy all dependencies locally as well, but this seems horribly ineffecient and error prone.

Is there a better way of doing this?

1

I've just looked at it for the first time. I think I would be inclined to follow their instructions here: https://docs.chain.link/v1.0/docs/getting-started#section-creating-a-new-chainlinked-project

They show a few ways to do it that will result in local files to import, with the possibility of pulling updates from time to time.

I would incline toward keeping the files local in any case.

Hope it helps.

  • Thanks. That works for this particular Chainlink project. In general I assume this is just one of the approaches to contract reuse . – trajan Feb 28 at 4:26
  • 1
    I'm not too fussy about how the files arrive but I'm in favor of local copies when working with smart contracts. Thanks for accepting my answer. – Rob Hitchens - B9lab Feb 28 at 5:04

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.