I'm trying to interact with a child contract that I host by calling a function from a contract that I hosted via the remix UI.

The code:

```
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;

contract TokenCreator {

    address public owner;
    address public this_address;

    constructor(){
        owner = msg.sender;
        this_address = address(this);
    }

    function createToken(string memory name) public returns ( bool success, OwnedToken tokenAddress){
        return ( true, new OwnedToken(name));
    }

    function changeName(OwnedToken tokenAddress, string memory name) public {
        tokenAddress.changeName(name);
    }

    function isTokenTransferOK(address currentOwner, address newOwner) public pure returns (bool ok) { 
        return keccak256(abi.encodePacked(currentOwner, newOwner))[0] == 0x7f;
    }

}

contract OwnedToken {
    address public owner;
    string public name;
    TokenCreator public creator;

    constructor(string memory _name) {    
        owner = msg.sender;
        creator = TokenCreator(msg.sender);
        name = _name;
    }

    function changeName(string memory newName) public {
        if (msg.sender == address(creator))
            name = newName;
    }

    function transfer(address newOwner) public {
        if (msg.sender != owner) return;
        if (creator.isTokenTransferOK(owner, newOwner))
            owner = newOwner;
    }
}

```

Transaction log to create - TokenCreator

```
 status true Transaction mined and execution succeed
 transaction hash   0xe46bd6f11a844ac57632e8ef41e39ae482e71e62d3f4035d7f0b1c52698afd0a Copy value to clipboard
 contract address   0x7EF2e0048f5bAeDe046f6BF797943daF4ED8CB47 Copy value to clipboard
 from   0x5B38Da6a701c568545dCfcB03FcB875f56beddC4 Copy value to clipboard
 to TokenCreator.(constructor) Copy value to clipboard
 gas    3000000 gas Copy value to clipboard
 transaction cost   1461412 gas Copy value to clipboard
 execution cost 1082212 gas Copy value to clipboard
 hash   0xe46bd6f11a844ac57632e8ef41e39ae482e71e62d3f4035d7f0b1c52698afd0a Copy value to clipboard
 input  0x608...40033 Copy value to clipboard
 decoded input  {} Copy value to clipboard
 decoded output  - Copy value to clipboard
 logs   [] Copy value to clipboard Copy value to clipboard
 value  0 wei 

```

Transaction log to call createToken method from TokenCreator

```
status  true Transaction mined and execution succeed
 transaction hash   0xec6f593ab173ce26e4457f37db4153ee59c571cff921583de8d113ae72fa9eb7 Copy value to clipboard
 from   0x5B38Da6a701c568545dCfcB03FcB875f56beddC4 Copy value to clipboard
 to TokenCreator.createToken(string) 0x7EF2e0048f5bAeDe046f6BF797943daF4ED8CB47 Copy value to clipboard
 gas    3000000 gas Copy value to clipboard
 transaction cost   559834 gas Copy value to clipboard
 execution cost 537794 gas Copy value to clipboard
 hash   0xec6f593ab173ce26e4457f37db4153ee59c571cff921583de8d113ae72fa9eb7 Copy value to clipboard
 input  0x455...00000 Copy value to clipboard
 decoded input  { "string name": "test" } Copy value to clipboard
 decoded output { "0": "bool: success true", "1": "address: tokenAddress 0xD9eC9E840Bb5Df076DBbb488d01485058f421e58" } Copy value to clipboard
 logs   [] Copy value to clipboard Copy value to clipboard
 value  0 wei 

```

It even shows that 2 contracts were hosted when I click on the method, but it doesn't show up in the UI and I can't find anything in the logs that makes me access the child contract.

[![2 contracts deployed after call method createToken](https://i.stack.imgur.com/52pjg.png)](https://i.stack.imgur.com/52pjg.png)

---

Sorry if it wasn't very clear and generated a lot of visual pollution. The code in question is the first on Solidity's official website:
<https://docs.soliditylang.org/en/v0.8.4/contracts.html>

We all more or less know how to host contracts through the Remix IDE Interface, but in my specific case, the code had a function that generated another smart contract and it wasn't showing up in the list of contracts hosted in the Remix IDE interface. And what's wrong?

When I call the "CreateToken" method of the TokenCreator contract it returns the address of the generated contract yes, however, you need to pull it by the "At Address" button, but what I didn't know is that you need to have the option of your selected contract for it to probably get the "ABI" of the contract.

[![Select the respective contract before to click "At Address" Button](https://i.stack.imgur.com/52pjg.png)](https://i.stack.imgur.com/52pjg.png)