Skip to main content

GovernanceERC20

Description

An OpenZeppelin Votes compatible ERC-20 token that can be used for voting and is managed by a DAO.

Implementation

public variable MINT_PERMISSION_ID

The permission identifier to mint new tokens

bytes32 MINT_PERMISSION_ID

public struct MintSettings

struct MintSettings {
address[] receivers;
uint256[] amounts;
}

error MintSettingsArrayLengthMismatch

Thrown if the number of receivers and amounts specified in the mint settings do not match.

error MintSettingsArrayLengthMismatch(uint256 receiversArrayLength, uint256 amountsArrayLength)
InputTypeDescription
receiversArrayLengthuint256The length of the receivers array.
amountsArrayLengthuint256The length of the amounts array.

public function constructor

Calls the initialize function.

constructor(contract IDAO _dao, string _name, string _symbol, struct GovernanceERC20.MintSettings _mintSettings) public
InputTypeDescription
_daocontract IDAOThe managing DAO.
_namestringThe name of the ERC-20 governance token.
_symbolstringThe symbol of the ERC-20 governance token.
_mintSettingsstruct GovernanceERC20.MintSettingsThe token mint settings struct containing the receivers and amounts.

public function initialize

Initializes the contract and mints tokens to a list of receivers.

function initialize(contract IDAO _dao, string _name, string _symbol, struct GovernanceERC20.MintSettings _mintSettings) public
InputTypeDescription
_daocontract IDAOThe managing DAO.
_namestringThe name of the ERC-20 governance token.
_symbolstringThe symbol of the ERC-20 governance token.
_mintSettingsstruct GovernanceERC20.MintSettingsThe token mint settings struct containing the receivers and amounts.

public function supportsInterface

Checks if this or the parent contract supports an interface by its ID.

function supportsInterface(bytes4 _interfaceId) public view virtual returns (bool)
InputTypeDescription
_interfaceIdbytes4The ID of the interface.
Output
0boolReturns true if the interface is supported.

external function mint

Mints tokens to an address.

function mint(address to, uint256 amount) external
InputTypeDescription
toaddressThe address receiving the tokens.
amountuint256The amount of tokens to be minted.

internal function _afterTokenTransfer

function _afterTokenTransfer(address from, address to, uint256 amount) internal

*Move voting power when tokens are transferred.

Emits a {IVotes-DelegateVotesChanged} event.*

© 2024