Created
July 14, 2022 22:01
-
-
Save JuanXavier/9f33252d879e463a97d9ca0368bc74f6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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.0; | |
| import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; | |
| import '@openzeppelin/contracts/access/AccessControl.sol'; | |
| /** | |
| * @title RewardToken | |
| * @author Damn Vulnerable DeFi (https://damnvulnerabledefi.xyz) | |
| * @dev A mintable ERC20 with 2 decimals to issue rewards | |
| */ | |
| contract RewardToken is ERC20, AccessControl { | |
| bytes32 public constant MINTER_ROLE = keccak256('MINTER_ROLE'); | |
| constructor() ERC20('Reward Token', 'RWT') { | |
| _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); | |
| _setupRole(MINTER_ROLE, msg.sender); | |
| } | |
| function mint(address to, uint256 amount) external { | |
| require(hasRole(MINTER_ROLE, msg.sender)); | |
| _mint(to, amount); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment