Why does Child Contract Have Separate Address?

I have a parent and a child contract.
(1) Why do my parent contract and child have different addresses?
(2) Who is the owner of the child contract? How do I tell?

Is emitting an event the easiest way to get the child address?

await deployer.deploy(myContract);

import "./MyToken.sol";

contract MyContract is ERC721, Ownable {

	MyToken private myToken;

	constructor() ERC721("MyContract", "MC") {
		myToken = new MyToken(address(this));
	}
}

I don't know what you want to know but every contract has it own address, that's how it works.
Just look up the address and you will see the creator and the transaction hash of this transaction.

1 Like

To get the child's token address you can use: address(myToken)

1 Like