25 lines
724 B
Solidity
25 lines
724 B
Solidity
|
|
// SPDX-License-Identifier: MIT
|
||
|
|
pragma solidity ^0.8.20;
|
||
|
|
|
||
|
|
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||
|
|
import "@openzeppelin/contracts/access/AccessControl.sol";
|
||
|
|
|
||
|
|
contract MockMintableToken is ERC20, AccessControl {
|
||
|
|
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
|
||
|
|
|
||
|
|
constructor(string memory name, string memory symbol, uint8 decimals_, address admin)
|
||
|
|
ERC20(name, symbol)
|
||
|
|
{
|
||
|
|
_grantRole(DEFAULT_ADMIN_ROLE, admin);
|
||
|
|
_grantRole(MINTER_ROLE, admin);
|
||
|
|
}
|
||
|
|
|
||
|
|
function mint(address to, uint256 amount) external onlyRole(MINTER_ROLE) {
|
||
|
|
_mint(to, amount);
|
||
|
|
}
|
||
|
|
|
||
|
|
function decimals() public view virtual override returns (uint8) {
|
||
|
|
return 6;
|
||
|
|
}
|
||
|
|
}
|