2

I have a contract Example, which imports another contract Another. When I try to import the contract and declare it in the code like this:

import './Another.sol'

contract Example {

    Another Another;

}

I get the above type error. The contract definitely exists, and I've done this pattern before, why am I getting this type error?

4

The variable name cannot be the same as the contract name. So the instance of Another cannot be named Another, you must call it another, or something else, like anotherInstance. Annoying problem that I ran into that wasn't documented, so I decided to put this up.

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.