RewardToken
Inherits: ContextUpgradeable, AccessControlDefaultAdminRulesUpgradeable, IERC20Errors, IERC20Metadata
The supply-side reward accounting portion of the protocol. A lender's balance is measured in two parts: a static balance and a dynamic "supply factor". Their true balance is the product of the two values. The dynamic portion is then able to be used to distribute interest accrued to the lender.
State Variables
ION
RewardTokenStorageLocation
EIP712_REVISION
EIP712_DOMAIN
PERMIT_TYPEHASH
Functions
_getRewardTokenStorage
_initialize
_burn
Parameters
Name | Type | Description |
---|---|---|
|
| to burn tokens from |
|
| to send underlying tokens to |
|
| to burn |
_burnNormalized
Parameters
Name | Type | Description |
---|---|---|
|
| to decrease balance of |
|
| of normalized tokens to burn |
_mint
Parameters
Name | Type | Description |
---|---|---|
|
| to mint tokens to |
|
| address to transfer underlying tokens from |
|
| of reward tokens to mint |
_mintNormalized
Parameters
Name | Type | Description |
---|---|---|
|
| to increase balance of |
|
| of normalized tokens to mint |
_mintToTreasury
This function does not perform any rounding checks.
Parameters
Name | Type | Description |
---|---|---|
|
| of tokens to mint to treasury |
approve
Parameters
Name | Type | Description |
---|---|---|
|
| to approve |
|
| to approve |
_approve
Parameters
Name | Type | Description |
---|---|---|
|
| of tokens |
|
| of tokens |
|
| to approve |
_spendAllowance
Spends allowance
transfer
Can only be called by owner of the tokens
Parameters
Name | Type | Description |
---|---|---|
|
| transfer to |
|
| to transfer |
transferFrom
For use with approve()
Parameters
Name | Type | Description |
---|---|---|
|
| to transfer from |
|
| to transfer to |
|
| to transfer |
_transfer
permit
implements the permit function as for https://github.com/ethereum/EIPs/blob/8a34d644aacf0f9f8f00815307fd7dd5da07655f/EIPS/eip-2612.md
Parameters
Name | Type | Description |
---|---|---|
|
| The owner of the funds |
|
| The spender |
|
| The amount |
|
| The deadline timestamp, type(uint256).max for max deadline |
|
| Signature param |
|
| Signature param |
|
| Signature param |
allowance
Returns current allowance
Parameters
Name | Type | Description |
---|---|---|
|
| of tokens |
|
| of tokens |
nonces
_useNonce
Consumes a nonce. Returns the current value and increments nonce.
_setSupplyFactor
updateTreasury
Updates the treasury address
Parameters
Name | Type | Description |
---|---|---|
|
| address of new treasury |
underlying
Address of underlying asset
decimals
Decimals of the position asset
balanceOf
Current claim of the underlying token inclusive of interest to be accrued.
Parameters
Name | Type | Description |
---|---|---|
|
| to get balance of |
balanceOfUnaccrued
Current claim of the underlying token without accounting for interest to be accrued.
normalizedBalanceOf
Accounting is done in normalized balances
Parameters
Name | Type | Description |
---|---|---|
|
| to get normalized balance of |
name
Name of the position asset
symbol
Symbol of the position asset
treasury
Current treasury address
totalSupplyUnaccrued
Total claim of the underlying asset belonging to lenders not inclusive of the new interest to be accrued.
totalSupply
Total claim of the underlying asset belonging to lender inclusive of the new interest to be accrued.
normalizedTotalSupplyUnaccrued
normalizedTotalSupply
Normalized total supply.
supplyFactorUnaccrued
supplyFactor
Current supply factor
calculateRewardAndDebtDistribution
Events
MintToTreasury
TreasuryUpdate
Errors
InvalidBurnAmount
Cannot burn amount whose normalized value is less than zero.
InvalidMintAmount
Cannot mint amount whose normalized value is less than zero.
InvalidUnderlyingAddress
InvalidTreasuryAddress
InvalidSender
Indicates a failure with the token sender
. Used in transfers.
Parameters
Name | Type | Description |
---|---|---|
|
| Address whose tokens are being transferred. |
InvalidReceiver
Indicates a failure with the token receiver
. Used in transfers.
Parameters
Name | Type | Description |
---|---|---|
|
| Address to which tokens are being transferred. |
SelfTransfer
Cannot transfer the token to address self
ERC2612ExpiredSignature
Signature cannot be submitted after deadline
has passed. Designed to mitigate replay attacks.
ERC2612InvalidSigner
signer
does not match the owner
of the tokens. owner
did not approve.
InsufficientBalance
Indicates an error related to the current balance
of a sender
. Used in transfers.
Parameters
Name | Type | Description |
---|---|---|
|
| Address whose token balance is insufficient. |
|
| Current balance for the interacting account. |
|
| Minimum amount required to perform a transfer. |