Comment on page
DebtToken
Debt tokens are interest-accruing tokens that are minted and burned on
borrow
and repay
, representing the debt owed by the token holder. There are 2 types of debt tokens:- Stable Debt Tokens: represent a debt to the protocol with stable interest rate.
- Variable Debt Tokens: represent a debt to the protocol with variable interest rate.
Debt tokens are not transferable.
The s/vToken value is pegged 1:1 to the value of underlying borrowed asset and represents the current total amount owed to the protocol i.e. principal debt + interest accrued.
Although debt tokens are modelled on the ERC20/EIP20 standard, they are non-transferrable. Therefore they do not implement any of the standard ERC20/EIP20 functions relating to
transfer()
and allowance()
.Following are the standard EIP20 methods that are implemented for the debt tokens:
function balanceOf(address account)
Returns the most up to date accumulated debt (principal+interest) of the user.
function totalSupply()
Returns the most up to date total debt accrued by all protocol users for that specific type (stable or variable rate) of debt token.
function decimals()
Returns decimals of the token contract.
function symbol()
Returns the symbol of the token contract.
function name()
Returns the name of the token contract.
function DOMAIN_SEPARATOR()
Get the domain separator for the token at current chain.
function nonces(address owner)
Returns the nonce value for address specified as parameter. This is the nonce used when calling
permit()
const token = new Contract(aTokenAddres, aToken.abi, provider);
await token.nonces(user);
Below are the view methods available for both type, stable and variable, of debt tokens.
function POOL()
Returns the address of the associated Pool for the debt token.
function borrowAllowance(address fromUser, address toUser)
function UNDERLYING_ASSET_ADDRESS()
Returns the underlying asset of the debt token.
function getIncentivesController()
Returns the address of the Incentives Controller contract
Below are the write methods available for both type, stable and variable, of debt tokens.
function approveDelegation(address delegatee, uint256 amount)
Sets the
amount
of allowance for delegatee
to borrow of a particular debt token.function delegationWithSig(address delegator, address delegatee, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
Sets the
value
of allowance for delegatee
to borrow of a particular debt token via permit function.function setIncentivesController(IAaveIncentivesController controller)
Sets a new Incentives Controller.
Only Pool Admin can call this methods. To update Incentives Controller on main Aave market, Governance Proposal must be submitted.
function getAverageStableRate()
Returns the average stable rate across all the stable rate debt in the protocol as
uint256
.function getUserLastUpdated(address user)
Returns the timestamp of the last action taken by
user
as uint40
.function getUserStableRate(address user)
Returns the stable rate of
user
as uint256
.function getSupplyData()
Returns the principal, the total supply, the average stable rate and the timestamp for the last update.
Return Values
Type | Description |
---|---|
uint256 | The principal stable debt issued |
uint256 | The total stable debt for the reserve across all users. Based on avg stable rate. |
uint256 | The average stable debt rate across all users. |
uint40 | The timestamp of the last update on total supply of stable debt token. |
function getTotalSupplyAndAvgRate()
Returns the total supply and average stable rate of the token.
Return Values
Type | Description |
---|---|
uint256 | total debt token supply. (includes principal + cumulated interest) |
uint256 | average stable rate |
function getTotalSupplyLastUpdated()
Returns the timestamp of the last update of the total supply in
uint40
.function principalBalanceOf(address user)
Returns the principal debt balance of the user since the last burn/mint action.
function scaledBalanceOf(address user)
Returns the scaled debt balance of
user
. The scaled balance is the sum of all the updated stored balance divided by the reserve's liquidity index at the moment of the update.function getScaledUserBalanceAndSupply(address user)
Returns the scaled balance of the user and the scaled total supply.
function scaledTotalSupply()
Returns the scaled total supply of the debt token. Represents sum(debt/index)
function getPreviousIndex(address user)
Returns last index interest that was accrued to the user's balance (expressed in ray).
Last modified 1yr ago