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);
}
}