I have a DApp that wants to use a token I have deployed has a form of payment.

The problem I'm facing is making that DApp be able to ask the Token contract to mint some of its tokens, and then send them to an address.

They have the Minter role solutions and permission systems in the OpenZeppelin library but none of them seem to address the problem of the token already existing, and then accepting some outside contracts as an allowed Minters.

Pretty much, what I am looking to do is:

contract MyToken is ERC20 {
  function mintSomeTokensForDApp(address _receiver) {
    // Mint X tokens and then sends them to the receiver

contract DApp {
  MyToken token public; // Can also just be the address of the token

  constructor() {
    token = new MyToken();

  function sendToken(address _receiver) {


I can feel that there is something missing here, as if it was possible anyone could just contact all Token contracts out there and just ask for a million of tokens to be minted and sent. However I assume that there is a way to make the Token contract say "I will accept requests from address with this kind of X", what that X is what I'm stuck about right now.

Any guidance would be greatly appreciated.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.