Simplified version of my contracts works
MyContract
await contract.methods.info().call()Works indicating that there is no error in theMyContractitself.
Launchpad
- There is no issues when launching
MyContractusing launchpad contract since I get address to a newly published contract.
The problem is that when I call the contract created with Launchpad contract in JavaScript I get the following error
Uncaught (in promise) Error: Couldn't decode uint256 from ABI: 0x
contract MyContract {
function info() external view returns(uint min, uint max) {
return(1, 2);
}
}
contract Launchpad {
function launch() public returns(address) {
MyContract myContractAddress = new MyContract();
return myContractAddress;
}
}
launch, there's no way for you to get back the address of the new contract. The typical solution is to log an event and read that from JavaScript. – user19510 May 09 '18 at 12:50pureto the declaration of functionlaunch. – goodvibration May 09 '18 at 12:51pureorview, in which case, you can indeed obtain the return value on the off-chain side without any decoding required. So as I mentioned on the previous comment, just addpure(which you can, since the function does not access any global variables). – goodvibration May 09 '18 at 12:52fooholds a hash of the transaction receipt, which you need to decode. And by the way, since you do not emit an event which containsmyContractAddressin thelaunchfunction, this value is not going to be available to you even after you decode the hash. – goodvibration May 09 '18 at 12:56