I am attempting to create a smart contract that uses contracts from the iden3 library. I am using the Remix IDE.


My issue is that the contract I need (IdentityBase.sol) has several relative dependencies:

import {IOnchainCredentialStatusResolver} from "../interfaces/IOnchainCredentialStatusResolver.sol";
import {IState} from "../interfaces/IState.sol";
import {IdentityLib} from "../lib/IdentityLib.sol";
import {SmtLib} from "../lib/SmtLib.sol";

// /**
//  * @dev Contract managing onchain identity
//  */
abstract contract IdentityBase is IOnchainCredentialStatusResolver {

When I try to compile my custom Contract (BasicContract.sol), I see a bunch of errors related to these relative imports. For example:

ParserError: Source "@iden3/contracts/lib/SmtLib.sol" not found: Deferred import
 --> @iden3/contracts/lib/IdentityLib.sol:5:1:
5 | import {SmtLib} from "../lib/SmtLib.sol";

In other words, the error seems to be occurring when the compiler is looking for these nested, relative imports. enter image description here

How can I import these contracts?

1 Answer 1


This turned out to be unrelated to the relative imports.

The issue was that the first import in my list (openzeppelin) was using the wrong compiler version.

I changed this:

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

To this (source):

import "@openzeppelin/[email protected]/access/OwnableUpgradeable.sol";

Once this was fixed, all of the other compiler errors went away. This seems like a tricky Remix bug.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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