Lets say you have this erc20 token already made, what's the safest way to no longer allow the mint and burn functions to work? Is there a better solution than creating a smart contract, updating the token admin to that contract, then using the selfdestruct() function to render that contract useless?
Here's code:
import '@openzeppelin/[email protected]/token/ERC20/ERC20.sol';
contract Token is ERC20 {
address public admin;
constructor(string memory name, string memory symbol) ERC20(name, symbol) {
admin = msg.sender;
}
function updateAdmin(address updateadmin) external {
require(msg.sender == admin, 'only admin');
admin = updateadmin;
}
function mint(address to, uint amount) external {
require(msg.sender == admin, 'fail, admin only');
_mint(to, amount);
}
function burn(address owner, uint amount) external {
require(msg.sender == admin, 'fail, admin only');
_burn(owner, amount);
}
}