Skip to content

Commit

Permalink
feat: combine roles
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenvaleri committed Jul 22, 2024
1 parent 90a84e4 commit 5a742ec
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions contracts/PToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,21 @@ import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";

contract PToken is ERC20, AccessControl, Pausable {
bytes32 public constant PAUSE_ROLE = keccak256("PAUSE_ROLE");
bytes32 public constant MINT_ROLE = keccak256("MINT_ROLE");
bytes32 public constant BURN_ROLE = keccak256("BURN_ROLE");
bytes32 public constant SUPPLY_ADMIN = keccak256("SUPPLY_ADMIN");

constructor(string memory _name, string memory _symbol, uint8 _decimals)
ERC20(_name, _symbol, _decimals)
AccessControl()
{
_grantRole(PAUSE_ROLE, msg.sender);
_grantRole(MINT_ROLE, msg.sender);
_grantRole(BURN_ROLE, msg.sender);
_grantRole(SUPPLY_ADMIN, msg.sender);
}

function mint(address to, uint256 value) public virtual onlyRole(MINT_ROLE) {
function mint(address to, uint256 value) public virtual onlyRole(SUPPLY_ADMIN) {
_mint(to, value);
}

function burn(address from, uint256 value) public virtual onlyRole(BURN_ROLE) {
function burn(address from, uint256 value) public virtual onlyRole(SUPPLY_ADMIN) {
_burn(from, value);
}

Expand Down

0 comments on commit 5a742ec

Please sign in to comment.