Skip to content

Solidity API

PropsERC20

This contract provides a complete ERC20 implementation for the Diamond standard

Extends the base ERC20 functionality with metadata, permit capabilities, and additional features Designed to work specifically within the Diamond architecture as a facet

MINTER_ROLE

solidity
bytes32 MINTER_ROLE

Role identifier for accounts with minting privileges

Constant used by the access control system to manage minting permissions

init

solidity
function init(string name, string symbol, uint8 decimals, struct IPropsBaseFacet.Hook[] _hooks, address[] approvedDiamonds) external

Initializes the ERC20 token with required metadata and configurations

Sets up the token with proper name, symbol, decimals, hooks and approves necessary diamonds This can only be called once by the diamond owner or factory

Parameters

NameTypeDescription
namestringThe name of the token
symbolstringThe symbol/ticker of the token
decimalsuint8The number of decimal places for token amounts (typically 18)
_hooksstruct IPropsBaseFacet.Hook[]Array of Hook structs defining callback functions for various operations
approvedDiamondsaddress[]Array of addresses that are approved to interact with this contract

_setName

solidity
function _setName(string name) internal virtual

Sets the name of the token

Overrides both ERC20MetadataInternal and ERC20PermitInternal implementations Can only be called by the diamond owner or factory

Parameters

NameTypeDescription
namestringThe new name to set for the token

mint

solidity
function mint(address to, uint256 amount) external payable

Creates new tokens and assigns them to the specified address

Only callable by accounts with the MINTER_ROLE or the diamond itself Increases the total supply and the recipient's balance

Parameters

NameTypeDescription
toaddressThe address to receive the minted tokens
amountuint256The amount of tokens to mint

burn

solidity
function burn(address from, uint256 amount) external

Destroys tokens from a specified address

Reduces the total supply and the address's token balance Implements the IPropsERC20 interface

Parameters

NameTypeDescription
fromaddressThe address from which tokens will be burned
amountuint256The amount of tokens to burn

approve

solidity
function approve(address spender, uint256 amount) public returns (bool)

Approves a spender to transfer tokens on behalf of the caller

Overrides ERC20Base.approve and IPropsERC20.approve This will be removed once the ERC20Base.approve is fixed

Parameters

NameTypeDescription
spenderaddressThe address authorized to spend the caller's tokens
amountuint256The token amount the spender is approved to use

Return Values

NameTypeDescription
[0]boolA boolean indicating whether the operation succeeded