I have very little experience with solidity.
I need to create an ERC20 token that will be as simple as possible, with the following properties:
- I must be able to burn some whenever I want
- I must be able to mint some whenever I want
- It must not have bugs such as backdoors / reentrance issues / race conditions, etc.
Does this code look good? It works great for me on my private testnet, I'm just wondering if there are any obvious bugs/issues you guys can see? Thanks in advance! Planning to deploy it on Ethereum mainnet using the Remix online IDE.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract Token is ERC20, ERC20Burnable, Ownable {
constructor() ERC20("MyToken", "MYTOK") {
_mint(msg.sender, 1000 * (10 ** uint256(decimals())));
}
function decimals() public pure override returns (uint8) {
return 6;
}
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
}