// SPDX-License-Identifier: MIT LICENSE /* Follow/Subscribe Youtube, Github, IM, Tiktok for more amazing content!! @Net2Dev ███╗░░██╗███████╗████████╗██████╗░██████╗░███████╗██╗░░░██╗ ████╗░██║██╔════╝╚══██╔══╝╚════██╗██╔══██╗██╔════╝██║░░░██║ ██╔██╗██║█████╗░░░░░██║░░░░░███╔═╝██║░░██║█████╗░░╚██╗░██╔╝ ██║╚████║██╔══╝░░░░░██║░░░██╔══╝░░██║░░██║██╔══╝░░░╚████╔╝░ ██║░╚███║███████╗░░░██║░░░███████╗██████╔╝███████╗░░╚██╔╝░░ ╚═╝░░╚══╝╚══════╝░░░╚═╝░░░╚══════╝╚═════╝░╚══════╝░░░╚═╝░░░ THIS CONTRACT IS AVAILABLE FOR EDUCATIONAL PURPOSES ONLY. YOU ARE SOLELY REPONSIBLE FOR ITS USE. I AM NOT RESPONSIBLE FOR ANY OTHER USE. THIS IS TRAINING/EDUCATIONAL MATERIAL. ONLY USE IT IF YOU AGREE TO THE TERMS SPECIFIED ABOVE. */ import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; pragma solidity ^0.8.7; contract N2D is ERC20, ERC20Burnable, Ownable, AccessControl { using SafeMath for uint256; mapping(address => uint256) private _balances; uint256 private _totalSupply; uint256 private MAXSUP; uint256 constant MAXIMUMSUPPLY=1000000000*10**18; bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); constructor() ERC20("N2D Rewards", "N2DR") { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); } function mint(address to, uint256 amount) external { require(hasRole(MINTER_ROLE, _msgSender()), "Not allowed to mint"); require((MAXSUP+amount)<=MAXIMUMSUPPLY,"Maximum supply has been reached"); _totalSupply = _totalSupply.add(amount); MAXSUP=MAXSUP.add(amount); _balances[to] = _balances[to].add(amount); _mint(to, amount); } function burnFrom(address account, uint256 amount) public override { if (hasRole(MINTER_ROLE, _msgSender())) { _burn(account, amount); } else { super.burnFrom(account, amount); } } function totalSupply() public override view returns (uint256) { return _totalSupply; } function maxSupply() public pure returns (uint256) { return MAXIMUMSUPPLY; } }