How to transfer 40% of total supply of an ERC20 to an address after deploying the token?

HI, I want to divide my total supply in different parts. So how i can divide my total supply in percentages like:
20%, 23.67% and remaining percentage.

Thanks in advance

1 Like

Hi @hussammustafa,

If I understand correctly, you have an ERC20 token where the total supply was minted to the deployer of the contract.

You can transfer from the deployer account any amount of tokens you hold to any other account by calling transfer on the token.

The recipient could be an externally owned account or a contract. You can even lock the tokens for a period of time using TokenTimelock.

Yes, you are right but i want to share in percentages like 67.25 % of total supply. How i can do that ?

1 Like

Hi @hussammustafa,

You can interact with your token programmatically.
You can calculate in JavaScript what amount of tokens a certain percentage is of the total supply and then transfer that amount to the address that you want.

What if i want to do all this in solidity while creating contract?

1 Like

Hi @hussammustafa,

In the constructor of your ERC20 you can mint different amounts of tokens to different accounts. You should create a unit test to check that the amounts and percentages are as require, as well as manually checking on a public testnet.

        _mint(recipientA, 10000 * (10 ** uint256(decimals())));
        _mint(recipientB, 20000 * (10 ** uint256(decimals())));
        _mint(recipientC, 10000 * (10 ** uint256(decimals())));

Hi @hussammustafa,

Checking to see if you needed more information?