I'm trying to write a simple aggregator for aave, (I couldn't find a good example for one which uses aave V2)

So I decided to cheat, and piece meal things together off of Polycats Github

I noticied they're importing contracts directly from github like so:

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/access/Ownable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/token/ERC20/SafeERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/utils/Pausable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/utils/ReentrancyGuard.sol";

When I try to do something similar in my project I get an error:

Source "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/token/ERC20/SafeERC20.sol" not found: File import callback not supported

I'm aware I can Import directly from the NPM packages. However, I'm curious on how to do this.

  1. How can I import contracts in a similar fashion?
  2. How does this work, e.g (Does the import only occur during migration)?
  • 1
    Depends on the tooling remix.ethereum.org does support importing from a github link.
    – Ismael
    Jul 27 at 2:14

Your Answer

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

Browse other questions tagged or ask your own question.