S
S
steph892021-06-14 19:29:10
blockchain
steph89, 2021-06-14 19:29:10

Is it possible to release a certain amount after the release of tokens?

For example: someone buys our tokens and the total number of tokens increases.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Mamonov, 2021-06-14
@steph89

Alternatively, you could use something like this:

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract YourContractName is ERC20{
    address owner;

    constructor() ERC20("Your token name", "YourSymbol") {
         // запоминаем кошелёк, который загружал токен, чтобы только он мог допечатывать деньги
        owner = msg.sender;
    }
    
    function printCoins(uint256 amount) public {
        require(msg.sender == owner, "Forbidden");
        _mint(owner, amount); // зачисляем деньги на кошелёк владельца контракта
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question