Is it possible to mint ERC20 tokens that are created in a parent contract, from a child contract? If so how is it implemented?

Thank you in advance!

1 Answer 1


It's about access control and an appropriate function to call.

In the parent contract, you will need a mint or issueTokens() function (to avoid name conflict/confusion).

function issueTokens(who, quantity) external onlyChildren ... { ... }

Notice the onlyChildren modifier. That would control access so only trusted contracts are allowed to call the function.

Something like ...

modifier onlyChildren {
  require( isChild[msg.sender], "don't know you" );

Relies on a mapping that knows which contracts to trust.

mapping(address => bool) public isChild;

That relies on keeping track of deployed contracts:

Child child = new Child();
isChild[address(child)] = true;

Hope it helps.

  • So lets say I created mintNewToken function with proper checks and modifiers. In child contract, i'd call PARENTCONTRACT.mintNewToken(who, amount)?
    – Medici
    Aug 16, 2021 at 21:40
  • Correct. The child would use an interface and it would know who the parent is because it's msg.sender in the constructor context. So, roughly ParentInterface(myParent).doSomething() Aug 17, 2021 at 0:00
  • Thanks for accepting my answer ;-) Aug 17, 2021 at 6:02

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.