I have a contract which creates another contract instance inside its method and returns the contract address as return parameter. When I call the method from JavaScript, I have got transaction hash instead of new contract address. Since the original transaction is not creation of a contract, I cannot retrieve the contract address from transaction receipt.
How can I get address of a contract which is dynamically created by another contract?
0 ·
Comments
Callback method function(err, result) returns transaction hash as result. How can I retrieve return value?
I can store the value in storage in non-constant method and retrieve the value calling a constant method, but is there a better way?
"Q: Get return value from non-constant method from another contract"
"A: The key point is that the calling contract needs to know about the method it intends to call.
See https://github.com/fivedogit/solidity-baby-steps/blob/master/contracts/45_ping.sol
and https://github.com/fivedogit/solidity-baby-steps/blob/master/contracts/45_pong.sol"
.. and maybe a little...
"Q:Can a contract create another contract?"
"A: Yes. See https://github.com/fivedogit/solidity-baby-steps/blob/master/contracts/50_replicator.sol
Note that contracts of a cyclical nature are currently impossible."