TrashToken Contract Documentation
Overview
The TrashToken contract is an ERC20 token named "TrashToken" (TRASH). This token is used within the TRASH ecosystem and follows the ERC20 standard. The contract restricts the minting of tokens to only authorized ecosystem operators through the use of the Permissions contract. The governance model and permissions are managed via a registry that is passed during initialization.
Inherited Contracts
- ERC20Upgradeable: Provides the functionality of the ERC20 token standard with upgradeable features.
- Permissions: Provides role-based access control, ensuring only authorized roles can mint tokens.
- Initializable: Enables the contract to be initialized with specific values.
Functions
initialize(address _registryAddress)
- Description: Initializes the TrashToken contract by setting the registry address and initializing the ERC20 token.
- Parameters:
_registryAddress: The address of the registry store that manages permissions.- Reverts:
CantSetZeroAddress: If the provided registry address is the zero address.
mintTo(address recipient, uint256 amount)
- Description: Mints a specified amount of TrashToken (TRASH) to a recipient's address. Only ecosystem operators can mint tokens.
- Parameters:
recipient: The address to receive the minted tokens.amount: The amount of tokens to mint.- Reverts:
InvalidRecipient: If the recipient address is the zero address.- Modifiers:
onlyEcosystemOperator: Ensures that only authorized ecosystem operators can call this function.
mint(uint256 amount)
- Description: Mints a specified amount of TrashToken (TRASH) to the caller's address. Only ecosystem operators can mint tokens.
- Parameters:
amount: The amount of tokens to mint.- Modifiers:
onlyEcosystemOperator: Ensures that only authorized ecosystem operators can call this function.
Supporting Contracts
Permissions
- Description: Provides role-based access control to ensure that only authorized ecosystem operators can mint TrashToken.
IRegistryStore
- Description: This interface is used to interact with the registry that stores the addresses of authorized ecosystem operators, governance, and other roles in the system.
Errors
- CantSetZeroAddress: Thrown when a zero address is provided where a valid address is required.
- NotValidMinter: Thrown when an unauthorized minter attempts to mint tokens.
- InvalidRecipient: Thrown when the recipient address is the zero address.
Conclusion
The TrashToken contract provides a secure mechanism for minting tokens within the TRASH ecosystem. Only authorized ecosystem operators are allowed to mint tokens, ensuring that the supply of tokens is controlled and governed by the roles defined in the permissions contract.