VariableDebtToken
Implements a variable debt token to track the borrowing positions of users at variable rate mode
Transfer and approve functionalities are disabled since its a non-transferable token
DEBT_TOKEN_REVISION
constructor
Constructor.
Parameters
Name | Type | Description |
---|---|---|
pool | contract IPool | The address of the Pool contract |
initialize
Initializes the debt token.
Parameters
Name | Type | Description |
---|---|---|
initializingPool | contract IPool | |
underlyingAsset | address | The address of the underlying asset of this xToken (E.g. WETH for pWETH) |
incentivesController | contract IRewardController | The smart contract managing potential incentives distribution |
debtTokenDecimals | uint8 | The decimals of the debtToken, same as the underlying asset's |
debtTokenName | string | The name of the token |
debtTokenSymbol | string | The symbol of the token |
params | bytes | A set of encoded parameters for additional initialization |
getRevision
Returns the revision number of the contract
Needs to be defined in the inherited class as a constant.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The revision number |
balanceOf
mint
Mints debt token to the onBehalfOf
address
Parameters
Name | Type | Description |
---|---|---|
user | address | The address receiving the borrowed underlying, being the delegatee in case of credit delegate, or same as |
onBehalfOf | address | The address receiving the debt tokens |
amount | uint256 | The amount of debt being minted |
index | uint256 | The variable debt index of the reserve |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | True if the previous balance of the user is 0, false otherwise |
[1] | uint256 | The scaled total debt of the reserve |
burn
Burns user variable debt
In some instances, a burn transaction will emit a mint event if the amount to burn is less than the interest that the user accrued
Parameters
Name | Type | Description |
---|---|---|
from | address | The address from which the debt will be burned |
amount | uint256 | The amount getting burned |
index | uint256 | The variable debt index of the reserve |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The scaled total debt of the reserve |
totalSupply
_EIP712BaseId
Returns the user readable name of signing domain (e.g. token name)
Return Values
Name | Type | Description |
---|---|---|
[0] | string | The name of the signing domain |
transfer
Being non transferrable, the debt token does not implement any of the standard ERC20 functions for transfer and allowance.
allowance
approve
transferFrom
increaseAllowance
decreaseAllowance
UNDERLYING_ASSET_ADDRESS
Returns the address of the underlying asset of this debtToken (E.g. WETH for variableDebtWETH)
Return Values
Name | Type | Description |
---|---|---|
[0] | address | The address of the underlying asset |