I have a smart contract that imports another, and I'm wondering how to deploy them to a testnet.

Right now, one contract imports the other locally;

import "./firstContract.sol"

contract secondContract is firstContract {

What would I chance the import "./firstContract.sol" line to once the first contract is deployed to a testnet via remix, and I want to deploy the second contract?

I found some documentation on it but it doesn't quite have what I'm looking for.


You misunderstand inheritance.

In this arrangement, the source code of firstContract.sol is rolled up and included in secondContract.sol. You deploy secondContract. The end.

Communication with another deployed contract is a separate concept that would not include is DeployedContract. Have a look at this for a concise example of how that would work in case it's closer to what you have in mind. Creating a function that calls another contract

Hope it helps.

  • I was able to figure out what I wanted to do with the help of your answer. What I was looking to do was have the second contract inherit the first one, then I just needed to deploy the second contract. Jan 31 '19 at 5:38

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.