I am writing some contract code by using Solidity on Remix.

enter image description here

As you can see, TreasureBox contract creates Gold contract and it calls take() method on Gold contract. But I can check that TreasureBox contract is deployed only even I executed profit() method. How to handle and check the contract created by originally executed contract ? Does anyone have an idea ?

pragma solidity ^0.4.24;

contract Gold {
    bool public isTaken = false;

    function take() public {
        isTaken = true;

contract TreasureBox {
    Gold g;

    constructor() public {
        g = new Gold();

    function profit() public {

1 Answer 1


First, If you want to know the address of the Gold contract just make g public.

Also, you can include another function in TreasureBox to read the variables in the Gold contract.

for instance:

function check_g() public view returns(bool){
    return g.isTaken()

So you can monitor what is going on in the instance of Gold created.

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.