Adding tokens to existing contract

Hi, I have a token in ethereum and I have a code of it. I know I can add more token by creating a new contract and add more token to existing contract.
Question is: Can any random person do the same if he doesn’t have code? It seems to be a case as one of my client’s contract been compromised and someone is adding more token to it and reaping profit. He is complaining that his token code is hacked and he is losing money due to that.
Can anyone shed a light?

1 Like

Hi @Raghav_Lyon,

I understand your question as:
Can anyone mint tokens from an ERC20 token contract?

The answer is that it depends what restrictions (e.g. access control) there are to calling the mint function.

If ERC20Mintable was used, then only accounts with the MinterRole can call mint.

If there is no access control like the following example, then any account can call mint

contract MyToken is ERC20 {
    function mint(uint256 amount) public {
        // any account can mint tokens
    }
}

Hi, First I apologies for the late reply.
I have tried the same but I didn’t understand how does that work.

Let me explain what I am trying to achieve and my client’s worry is.
There is a contract with 3 billion tokens and it has some market value in dollars. He noticed that some extra 338 million tokens have appeared in the chain. According to him the code isn’t secured, it has been compromised and someone manage to break in and add his own tokens.

Question here is: Can anyone add more tokens to existing contract? I have tried doing that I always get new contract. If I can add more tokens then how can it be done without creating a new contract.
Second: Is there anyway I can destroy the tokens?
If I can pointed to some example, it would be great.

Thank you.

1 Like

Hey @Raghav_Lyon, can you share a link to the token contract, as well as the extra 338 million tokens, so we can help troubleshoot the issue? From what you are saying, it is unclear to me whether a) someone deployed a new ERC20 with the same ticker, or b) someone managed to mint additional tokens from your contract.

1 Like

Hi Santiago,
Can I send you information in separate message?

//Rags

1 Like

Replied via DM. @Raghav_Lyon please share the solution here if it works for you!

1 Like

Hi @spalladino,
I understand the transactions and it was verified by client too.
In regard to the code, I didn’t have code but I am in process of creating a new contract which can be updated too (via proxy).
I am already getting help from @abcoathup in regard to that.
Thank you again for your help.

//rags

1 Like