ApplicationERC20
Inherits: ERC20, ERC20Burnable, AccessControl, IProtocolToken, IZeroAddressError, ReentrancyGuard, ITokenEvents, IApplicationEvents
Author: @ShaneDuncan602, @oscarsernarosero, @TJ-Everett, @Palmerg4
This is an example implementation that App Devs should use.
During deployment _tokenName _tokenSymbol _tokenAdmin are set in constructor
State Variables
TOKEN_ADMIN_ROLE
handlerAddress
Functions
constructor
Constructor sets params
Parameters
Name | Type | Description |
---|---|---|
_name | string | Name of the token |
_symbol | string | Symbol of the token |
_tokenAdmin | address | Token Admin address |
mint
Function mints new tokens.
Parameters
Name | Type | Description |
---|---|---|
to | address | recipient address |
amount | uint256 | number of tokens to mint |
transfer
TRANSFER FUNCTION GROUP START
*This is overridden from IERC20-transfer. It handles all fees/discounts and then uses ERC20 _transfer to do the actual transfers Requirements:
to
cannot be the zero address.- the caller must have a balance of at least
amount
.*
transferFrom
*This is overridden from IERC20-transferFrom. It handles all fees/discounts and then uses ERC20 _transfer to do the actual transfers
Emits an event indicating the updated allowance. This is not
required by the EIP. See the note at the beginning of .
NOTE: Does not update the allowance if the current allowance
is the maximum uint256
.
Requirements:
from
andto
cannot be the zero address.from
must have a balance of at leastamount
.- the caller must have allowance for
from
’s tokens of at leastamount
.*
_handleFees
This transfers all the P2P transfer fees to the individual fee sinks
Parameters
Name | Type | Description |
---|---|---|
from | address | sender address |
amount | uint256 | number of tokens being transferred |
_beforeTokenTransfer
TRANSFER FUNCTION GROUP END
Function called before any token transfers to confirm transfer is within rules of the protocol
Parameters
Name | Type | Description |
---|---|---|
from | address | sender address |
to | address | recipient address |
amount | uint256 | number of tokens to be transferred |
getHandlerAddress
Rule Processor Module Check
This function returns the handler address
Returns
Name | Type | Description |
---|---|---|
<none> | address | handlerAddress |
connectHandlerToToken
This function does not check for zero address. Zero address is a valid address for this function’s purpose.
Function to connect Token to previously deployed Handler contract
Parameters
Name | Type | Description |
---|---|---|
_deployedHandlerAddress | address | address of the currently deployed Handler Address |