Control the liquidity


I created a token with 10B total supply, but when I put it on metamask I had all the supply in it,

Is it possible to control the supply, for example having 10B total supply, but we want first to have only 1M supply available, and when we want more we go to the contract to extract more, is it possible to do that and how ?

if it's not possible does that means that I'll have to store those 10B in a ledger key, and transfer to metamask the amount I want available and keep the rest in the ledger key in a safe place ? what's the best practice in here to secure as much as possible the total supply ?

Thank you

we can do it with locked variable in the contract.

1 Like

can you explain in depth how can I proceed please ? how do I set up this locked variable ? and after that I guess I'll have to export the contract ?

Hi, welcome to the community! :wave:

I think you can lock the token just like asato said above, and maybe next time, you can set a capacity of total supply to 10B at first, and only mint 1M at first.

1 Like

The token I created was just for testing, I can still do it again, how can I set up the mint at the token creation ?

The mint means that when I'll create and transfer the token the max capacity will be at 10B but I will receive only 1M right ? and once done I save the contract and each time I want more I mint again ?

What can I add here to be able to mint only 200m for example and keep the rest on the contract ?

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;

import "";

contract Token is ERC20 {

    constructor () public ERC20("Token", "TKN") {
        _mint(msg.sender, 1000000 * (10 ** uint256(decimals())));

Maybe you can have a look at this contract: ERC20Capped.sol | OpenZeppelin