Appearance
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_ROLERole 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) externalInitializes 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
| Name | Type | Description |
|---|---|---|
| name | string | The name of the token |
| symbol | string | The symbol/ticker of the token |
| decimals | uint8 | The number of decimal places for token amounts (typically 18) |
| _hooks | struct IPropsBaseFacet.Hook[] | Array of Hook structs defining callback functions for various operations |
| approvedDiamonds | address[] | Array of addresses that are approved to interact with this contract |
_setName
solidity
function _setName(string name) internal virtualSets the name of the token
Overrides both ERC20MetadataInternal and ERC20PermitInternal implementations Can only be called by the diamond owner or factory
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | The new name to set for the token |
mint
solidity
function mint(address to, uint256 amount) external payableCreates 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
| Name | Type | Description |
|---|---|---|
| to | address | The address to receive the minted tokens |
| amount | uint256 | The amount of tokens to mint |
burn
solidity
function burn(address from, uint256 amount) externalDestroys tokens from a specified address
Reduces the total supply and the address's token balance Implements the IPropsERC20 interface
Parameters
| Name | Type | Description |
|---|---|---|
| from | address | The address from which tokens will be burned |
| amount | uint256 | The 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
| Name | Type | Description |
|---|---|---|
| spender | address | The address authorized to spend the caller's tokens |
| amount | uint256 | The token amount the spender is approved to use |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | A boolean indicating whether the operation succeeded |