0

1- Whenever I deploy this contract to check the address from where the 'mint' is deploying, it does not show me the 'contact address' for the mint inside of the log. 2- In 'MyContract' I am keeping track of 2 values, 'wallet' & 'token' to use the function from the 'ERC20Token' I need to know the address from where that contract is deployed. 3- When I check the log it shows me the history of the transaction but not the address of 'ERC20Token' contract.

pragma solidity >=0.7.0 <0.9.0;

contract ERC20Token{
    string public name;
    mapping (address => uint256) public balances;
    
    function mint() public {
        balances[tx.origin] ++;
    }
}

contract MyContract {
    address payable wallet;
    address public token;
    
    constructor(address payable _wallet, address _token) public {
        wallet=_wallet;
        token=_token;
    }
    fallback()external payable{
        buyTonken();
    }
      function buyTonken() public payable {
          ERC20Token _token = ERC20Token(address(token));
          _token.mint();
          wallet.transfer(msg.value);
  }
  
}

  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 26 '21 at 16:51
  • in the function 'buyToken' the i am encoding the token passed thru the contructor, The value i need to see in the console when the event is successful is the new '_token' passed to the address on 'buyToken'. – Miguelangel weill Nov 05 '21 at 17:34

0 Answers0