From f6206e1a8f13e0f6ba6c08be7eb46610e7c840b1 Mon Sep 17 00:00:00 2001 From: JustAnotherDevv Date: Sat, 16 Nov 2024 21:35:27 +0700 Subject: [PATCH] new test file --- contracts/src/Token.sol | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 contracts/src/Token.sol diff --git a/contracts/src/Token.sol b/contracts/src/Token.sol new file mode 100644 index 0000000..3fba69d --- /dev/null +++ b/contracts/src/Token.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; + +contract MyToken is ERC20, Ownable { + uint256 public constant INITIAL_SUPPLY = 1000000 * 10**18; + uint256 public constant MAX_SUPPLY = 10000000 * 10**18; + + constructor() ERC20("ActionToken", "ACT") Ownable(msg.sender) { + _mint(msg.sender, INITIAL_SUPPLY); + } + + function mint(address to, uint256 amount) public onlyOwner { + require(totalSupply() + amount <= MAX_SUPPLY, "Exceeds maximum supply"); + _mint(to, amount); + } + + function burn(uint256 amount) public { + _burn(msg.sender, amount); + } + + function decimals() public pure override returns (uint8) { + return 18; + } +} \ No newline at end of file