> For the complete documentation index, see [llms.txt](https://calnix.gitbook.io/eth-dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://calnix.gitbook.io/eth-dev/foundry/importing-contracts.md).

# Importing Contracts

Foundry is able to grab directly from github.

Example: You want to use the IERC20.sol interface provided by Yield at: <https://github.com/yieldprotocol/yield-utils-v2/blob/main/contracts/token/IERC20.sol>

### **Get dependencies**

#### **First we need to download the repo into our dependencies folder (lib):**

```bash
forge install yieldprotocol/yield-utils-v2
```

![organization/repo](https://1628544884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTgomzlmn9NrxUY0OQ3cD%2Fuploads%2FjI23nY7UmpAVwyE3G3PQ%2Fimage.png?alt=media\&token=ac27e480-3ee7-4a1d-927c-7f2ce24df7d5)

Forge will install the repo into our project directory (repo can be found inside lib)

![lib](https://1628544884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTgomzlmn9NrxUY0OQ3cD%2Fuploads%2FfShlHuXDFrAwb9J8OIRE%2Fimage.png?alt=media\&token=2d9b843f-4894-4d4d-b29b-34e328a62a44)

.**gitmodules** will be updated to reflect the dependencies:

![.gitignore](https://1628544884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTgomzlmn9NrxUY0OQ3cD%2Fuploads%2FTTWxzK6JXyQfcUDpRo9b%2Fimage.png?alt=media\&token=4ad13269-f79b-4a32-8ae2-b6f6417b31b6)

#### Run forge remappings to check how forge is mapping out your dependencies

> forge remappings

![](https://1628544884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTgomzlmn9NrxUY0OQ3cD%2Fuploads%2FnpHOAF28emyFOQDau8n7%2Fimage.png?alt=media\&token=a6445a74-04ab-4194-843c-b8b120eb148d)

yield-utils-v2/ is mapped to directory lib/yield-utils-v2/contracts

This informs us how to craft our import statement.

### Craft import statement&#x20;

```solidity
// points to lib/yield-utils-v2/contracts/token/IERC20.sol
import "yield-utils-v2/token/IERC20.sol";
```

![](https://1628544884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTgomzlmn9NrxUY0OQ3cD%2Fuploads%2FOImaqBS2B3eojIxXCANx%2Fimage.png?alt=media\&token=1a1dc3bb-6385-4776-81b6-8427dacc7d66)

#### Now when **forge build** is run, there should not be any issues.
