Assume I have a contract A:
pragma solidity ^0.4.4;
contract A{
struct St{
uint val;
}
function double(uint a)external returns (uint res){
res= 2*a;
}
}
Let's call the above lines of code block 1.
I deploy contract A. Then I have a contract B that wants to call a function of contract A:
pragma solidity ^0.4.4;
contract B{
uint res;
function call_double(uint val) {
A a=A(0x1);// 0x1 is the address of contract A after it's deployed.
res = a.double(val);
}
}
// how to include this contract abstract when deploying contract B?
contract A{
function double(uint a)external returns (uint res);
struct St{
uint val;
}
}
Let's call the above lines of code block 2.
Question: How can I include contract A when I'm deploying contract B? In other words, how can I deploy block2?
Please note that when I'm using remix, (after I deploy contract A) I put both contract B and abstract of contract A in one page and deploy B, and everything works fine. But it's not clear to me how it's done when Im manually deploying to a private blockchain using web3. Also, it's not clear which ABI I need when I want to interact with contract B.