ERC20Issuance_v1.sol

Git Source

Inherits: IERC20Issuance_v1, ERC20Capped, Ownable

Author: Inverter Network

This contract creates an {ERC20Capped} token with a supply cap and a whitelist-gated functionality to mint and burn tokens.

The contract implements functionalities for:

  • Managing a whitelist of allowed minters.

  • Minting and burning tokens by members of said whitelist.

  • Enforcing a supply cap on minted tokens.

State Variables

allowedMinters

The mapping of allowed minters.

mapping(address => bool) public allowedMinters;

_decimals

The number of decimals of the token.

uint8 internal immutable _decimals;

Functions

onlyMinter

Modifier to guarantee the caller is a minter.

modifier onlyMinter();

constructor

constructor(
    string memory name_,
    string memory symbol_,
    uint8 decimals_,
    uint maxSupply_,
    address initialAdmin_
) ERC20(name_, symbol_) ERC20Capped(maxSupply_) Ownable(initialAdmin_);

decimals

function decimals() public view override returns (uint8);

setMinter

Sets the minting rights of an address.

function setMinter(address _minter, bool _allowed) external onlyOwner;

Parameters

NameTypeDescription

_minter

address

The address of the minter.

_allowed

bool

If the address is allowed to mint or not.

mint

Mints new tokens.

function mint(address _to, uint _amount) external onlyMinter;

Parameters

NameTypeDescription

_to

address

The address of the recipient.

_amount

uint256

The amount of tokens to mint.

burn

Burns tokens.

function burn(address _from, uint _amount) external onlyMinter;

Parameters

NameTypeDescription

_from

address

The address of the owner or approved address.

_amount

uint256

The amount of tokens to burn.

_setMinter

Sets the minting rights of an address.

function _setMinter(address _minter, bool _allowed) internal;

Parameters

NameTypeDescription

_minter

address

The address of the minter.

_allowed

bool

If the address is allowed to mint or not.

Last updated