Home > Blockchain >  Suitable for external create contract whether to support internal call
Suitable for external create contract whether to support internal call

Time:09-17

Ask A newbie question, the intelligent contracts on ETH internal create contract B is deployed automatically (by calling the function to create A contract B) onto the chain of independent address;
In addition, the function of B contracts after the deployment, can be called outside a function call interface (such as through the web3)?

I tried to use the following way to deploy the Test, but the returned contract address (val_T) after loading the NewContract,

Pragma solidity ^ 0.4.24;

Contract Test {
Uint value;
The function to the add (uint a, uint b) public returns (uint) {
Value=https://bbs.csdn.net/topics/a+b;
return a + b;
}
}


Pragma solidity ^ 0.4.24;

The import "./test. Sol ";

Contract NewContract {
The Test of public val_T;

Public function createAndCallContract () returns (address addr, uint result) {
The Test t=new Test ();
Val_T=t;
Return (t, t.a dd (1, 2));
}
}
  • Related