Im building a contract that uses two contracts that both use the ERC721 zeppelin contract, when I import the two as such:

import nonFungableWidthAddedFunctionality1.sol;
import nonFungableWidthAddedFunctionality2.sol;

I get the following error:

$PATH DeclarationError: Identifier already declared.
import "./../nonFungableWidthAddedFunctionality2.sol";
$PATH The previous declaration is here:
contract ERC721 {

Both of these contracts need the ERC721 implementation since they are also used separately.

  • 1
    If you just need to call the ERC721 functions from your third contract, you can just import the ERC721 definition, instead of the individual token contracts. – Raghav Sood Aug 1 '18 at 10:51
  • But both the tokens have different implementations and augmentations of the standard ERC721 protocol. – jasper Aug 1 '18 at 11:09
  • 1
    Your solution did work after looking through the ERC721 interface a bit more careful, thank you! – jasper Aug 1 '18 at 12:14

You are declaring contract ERC721 more than once, thus the error.

Essentially, you're doing this:

contract Contract1 {

contract Contract1 {

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.