I deployed VrfTest contract and imported it. But remix keeps saying below error. Did I do the wrong way to import? VrfTest contract is in the same folder in remix.

DeclarationError: Identifier not found or not unique.
  --> contracts/SampleERC721.sol:21:5:
21 |     VrfTest public vrfContract;
   |     ^^^^^^^
import "./VrfTest.sol";

contract BullBear is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable, KeeperCompatibleInterface {
    VrfTest public vrfContract;

    constructor(uint updateInterval, address _priceFeed, VrfTest _addrVrfContract) ERC721("Bull&Bear", "BBTK") {
        vrfContract = _addrVrfContract;

  • 1
    Is there a contract named VrfTest in the VrfTest.sol file that you are importing and is the VrfTest.sol file in the same directory as your BullBear contract? Commented Sep 13, 2022 at 4:19
  • VrtTest.sol file is in the same directory with BullBear contract but I realized that contract name wasn't VrfTest in the VrfTest.sol. Thank you so much :)
    – Shift_that
    Commented Sep 13, 2022 at 5:52

1 Answer 1


When importing a .sol file, we are importing everything declared in it, even multiple contracts, libraries, etc.

If the .sol file does not contain a contract with the name of the file, we cannot try to use the contract inside that .sol file with the name of the .sol file. We need to either change the name of the contract inside the .sol file to be the same name as the file or use the correct name of the contract while importing.

You can also use this syntax to import specific things by changing their name if needed to avoid collision with other import names, and import a set of the things declared in the .sol file and not everything:

import {VrfTest as VrfTest2, add as func, Point} from "./Foo.sol";

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.