Alt - TestToken Script

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

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

import "@openzeppelin contracts/access/Ownable.sol";

contract BitKuy is ERC20, Ownable {

uint256 private constant MAX_SUPPLY = 21_000_000 10*18;

constructor() ERC20("TestToken", "TEST") {

uint256 initialSupply = 1_000_000 10*18; // Minting 1,000,000 tokens initially

_mint(msg.sender, initialSupply);

}

function mint(address to, uint256 amount) public onlyOwner {

require(totalSupply() + amount <= MAX_SUPPLY, "TestToken: Max supply exceeded");

_mint(to, amount);

}

}

Loading...
highlight
Collect this post to permanently own it.
My Web3 Article logo
Subscribe to My Web3 Article and never miss a post.