DebtToken
EIP20 Methods
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:
balanceOf
`function balanceOf(address account)`
`function balanceOf(address account)`
Returns the most up to date accumulated debt (principal+interest) of the user.
totalSupply
`function totalSupply()`
`function totalSupply()`
Returns the most up to date total debt accrued by all protocol users for variable rate of debt token.
decimals
function decimals()
function decimals()
Returns decimals of the token contract.
symbol
function symbol()
function symbol()
Returns the symbol of the token contract.
name
function name()
function name()
Returns the name of the token contract.
EIP712 Methods
DOMAIN_SEPARATOR
function DOMAIN_SEPARATOR()
function DOMAIN_SEPARATOR()
Get the domain separator for the token at current chain.
nonces
function nonces(address owner)
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(aTokenAddress, aToken.abi, provider);
await token.nonces(user);
const token = new Contract(aTokenAddress, aToken.abi, provider);
await token.nonces(user);
Shared View Methods (Bend Protocol Methods)
Below are the view methods available for variable debt tokens.
POOL
`function POOL()`
`function POOL()`
Returns the address of the associated Pool for the debt token.
borrowAllowance
function borrowAllowance(address fromUser, address toUser)`
function borrowAllowance(address fromUser, address toUser)`
UNDERLYING_ASSET_ADDRESS
function UNDERLYING_ASSET_ADDRESS()
function UNDERLYING_ASSET_ADDRESS()
Returns the underlying asset of the debt token.
getIncentivesController
function getIncentivesController()
function getIncentivesController()
Returns the address of the Incentives Controller contract
Shared Write Methods (Bend Protocol Methods)
Below are the write methods available for variable debt tokens.
approveDelegation
`function approveDelegation(address delegatee, uint256 amount)`
`function approveDelegation(address delegatee, uint256 amount)`
Sets the amount
of allowance for delegatee
to borrow of a particular debt token.
delegationWithSig
function delegationWithSig(address delegator, address delegatee, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
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.
setIncentivesController
function setIncentivesController(IAaveIncentivesController controller)`
function setIncentivesController(IAaveIncentivesController controller)`
Sets a new Incentives Controller.
WARNING
Only Pool Admin can call this methods. To update Incentives Controller on main Bend market, Governance Proposal must be submitted.
Variable Debt Token Methods
scaledBalanceOf
function scaledBalanceOf(address user)
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.
getScaledUserBalanceAndSupply
function getScaledUserBalanceAndSupply(address user)`
function getScaledUserBalanceAndSupply(address user)`
Returns the scaled balance of the user and the scaled total supply.
scaledTotalSupply
function scaledTotalSupply()
function scaledTotalSupply()
Returns the scaled total supply of the debt token. Represents sum(debt/index)
getPreviousIndex
function getPreviousIndex(address user)
function getPreviousIndex(address user)
Returns last index interest that was accrued to the user's balance (expressed in ray).
pendingBGT
function pendingBGT(address owner)
function pendingBGT(address owner)
Allows you to pass in an address to see how much BGT an individual has earned so far.
claimBGT
function claimBGT(uint256 amount, address recipient)`
function claimBGT(uint256 amount, address recipient)`
Allows you to actually claim your pending BGT.
The amount variable is how much you wish to claim. That number can be equal to or less than the pending amount. The recipient address is who you want to receive the BGT. Whether that is to your own wallet, or to another wallet.
Note Once you claim the BGT, it can no longer be transferred so you want to make sure it goes to the correct wallet.