Solidity smart contract function in function

by Cheng Kao   Last Updated October 09, 2019 13:28 PM

I tried to write a smart contract like...

There are two function of a contract.

first function make confirmation of condition , second function if all condition done , then make a new contract.

The first function work well , but when I put the second function in first contract like...

contract TheContract {

function first_fun(uint _parameter) public payable{ // something set second_fun(); }

function second_fun()public returns(address){ Another another_contract_address = new Another (); return address(another_contract_address); } } contract Another{ //other thing } I refer and follow the way...

1.function in function:

Cannot call contract's function in Remix

2.contract create contract:

Deploy contract from contract in Solidity

As follow people's way to use , but it still get wrong.

Error as follow: transact to first_fun errored:VM Exception while processing transaction: invalid opcode

Tool:Remix Ethereum IDE Solidity version :0.5.12+ Environment: Web3 Provider

Related Questions

Problem understanding the owner assignment

Updated June 15, 2019 05:28 AM

Issue in insertion to an array inside a struct

Updated September 28, 2017 06:28 AM