Created
April 3, 2024 14:55
-
-
Save arturmartins/9b92ff77390d05a46d70355dd6f21e2b to your computer and use it in GitHub Desktop.
Chainlink Bootcamp - Day 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.19; | |
import "@openzeppelin/[email protected]/token/ERC20/ERC20.sol"; | |
import "@openzeppelin/[email protected]/access/AccessControl.sol"; | |
contract Token is ERC20, AccessControl { | |
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); | |
constructor() ERC20("Chainlink Bootcamp 2024 Token", "CLBoot24") { | |
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender); | |
_grantRole(MINTER_ROLE, msg.sender); | |
} | |
function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) { | |
_mint(to, amount); | |
} | |
function decimals() public pure override returns (uint8) { | |
return 2; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment