DineroERC20.sol

General Overview

The DineroERC20.sol contract is an extension of the standard ERC20 token, incorporating additional features for minting and burning tokens in a permissioned manner. It achieves this by implementing access control mechanisms, which are governed by the MINTER_ROLE and BURNER_ROLE. These roles are crucial, as only accounts assigned with them are authorized to mint or burn tokens, respectively.

This controlled approach to token supply management is made possible through the integration of OpenZeppelin's AccessControlDefaultAdminRules contract.

Technical Overview

Inherits: ERC20, AccessControlDefaultAdminRules

Author: redactedcartel.finance

State Variables

MINTER_ROLE

bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

BURNER_ROLE

bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");

Functions

constructor

constructor(string memory _name, string memory _symbol, uint8 _decimals, address _admin, uint48 _initialDelay)
    AccessControlDefaultAdminRules(_initialDelay, _admin)
    ERC20(_name, _symbol, _decimals);

Parameters

NameTypeDescription
_namestringToken name
_symbolstringToken symbol
_decimalsuint8Token decimals
_adminaddressAdmin address
_initialDelayuint48Delay required to schedule the acceptance of a access control transfer started

mint

Mints tokens to an address

Only callable by minters

function mint(address _to, uint256 _amount) external onlyRole(MINTER_ROLE);

Parameters

NameTypeDescription
_toaddressAddress to mint tokens to
_amountuint256Amount of tokens to mint

burn

Burns tokens from an address

Only callable by burners

function burn(address _from, uint256 _amount) external onlyRole(BURNER_ROLE);

Parameters

NameTypeDescription
_fromaddressAddress to burn tokens from
_amountuint256Amount of tokens to burn