I have two contracts (i.e. contractA, contractB) located in different files (i.e, contractA.sol, contractB.sol) to deploy. The contractB is dependent on contractA. In contractB.sol,

import "contractA";

The contractA has been deployed successfully to Testnet with Ethereum Wallet by putting source of contractA in tab "SOLIDITY CONTRACT SOURCE CODE". When contractB was deployed, Ethereum Wallet complained:

Could not compile source code. Source "contractA.sol" not found.

How to fix it?


You should be able to just include the source for contractA in the tab with contractB's source. For instance:

contract A {

contract B {
    A a;
    function B(address _a) {
        a = A(_a);

When you compile and go to deploy, just make sure you select B. (And make sure that the A code is identical to what you've already deployed.)

That said, the command line Solidity compiler handles import instructions quite nicely, as does the Javascript implementation. (See https://github.com/ethereum/solc-js)

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.