AToken
EIP20 Methods
All standard EIP20 methods are implemented for aTokens, such as balanceOf
, transfer
, transferFrom
, approve
, totalSupply
etc.
💡 balanceOf
will always return the most up to date balance of the user, which includes their principal balance + the yield generated by the principal balance.
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);
Bend Protocol View Methods
scaledBalanceOf)**
`function scaledBalanceOf(address user)
`function scaledBalanceOf(address user)
Returns the scaled supply 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 aToken.
getPreviousIndex
function getPreviousIndex(address user)
function getPreviousIndex(address user)
Returns last index interest that was accrued to the user's balance (expressed in ray).
getIncentivesController
`function getIncentivesController()`
`function getIncentivesController()`
Returns the address of the Incentives Controller contract
POOL
`function POOL()`
`function POOL()`
Returns the address of the associated Pool for the *aToken.
UNDERLYING_ASSET_ADDRESS
`function UNDERLYING_ASSET_ADDRESS()
`function UNDERLYING_ASSET_ADDRESS()
Returns address of the underlying reserve asset.
RESERVE_TREASURY_ADDRESS
function RESERVE_TREASURY_ADDRESS()
function RESERVE_TREASURY_ADDRESS()
Returns address of the Bend Treasury, controlled by governance, receiving the fee on this aToken.
Bend Protocol Write Methods
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.
permit
Allows a user to permit another account (or contract) to use their funds using a signed message. This enables gas-less transactions and single approval/transfer transactions.
Parameter | Type | Description |
---|---|---|
owner | address | The spender for the funds |
spender | address | The spender for the funds |
value | uint256 | The amount the spender is permitted to use |
deadline | uint256 | The deadline timestamp that the permit is valid. Use type(uint).max for no deadline. |
v | uint8 | Signature parameter |
r | bytes32 | Signature parameter |
s | bytes32 | Signature parameter |
FAQs
How aToken earn interest? / How aToken balance increases?
LendingPool methods (deposit, withdraw, borrow, repay, liquidationCall) updates the state and cumulated liquidity index of the reserve once every block. AToken's balanceOf
method returns the balance computed based on block.timestamp
and liquidityIndex
of the underlying reserve and hence, returns the most up to date balance of account, which includes principal + interest.
Can I transfer aTokens?
There are a few important considerations to bear in mind:
When aTokens are transferred, it means you're moving the balance of the underlying asset. Only the account that possesses the aTokens has the ability to withdraw the deposited asset.
It's essential to note that an AToken transfer will be unsuccessful if the resulting Health Factor of the user falls below 1.
In terms of pending liquidity rewards: The rewards earned before the aToken transfer stay with the original user or address holding the aTokens. However, all future liquidity rewards will be earned by the new recipient.