IAToken

Git Source

Inherits: IERC20, IScaledBalanceToken, IInitializableAToken

Author: Aave

Defines the basic interface for an AToken.

Aave's IAToken inherit IERC20 from OZ, using pragma 0.8.10. This interface is copied to enable compilation using a different pragma.

Functions

mint

Mints amount aTokens to user

function mint(address caller, address onBehalfOf, uint256 amount, uint256 index) external returns (bool);

Parameters

NameTypeDescription
calleraddressThe address performing the mint
onBehalfOfaddressThe address of the user that will receive the minted aTokens
amountuint256The amount of tokens getting minted
indexuint256The next liquidity index of the reserve

Returns

NameTypeDescription
<none>booltrue if the the previous balance of the user was 0

burn

Burns aTokens from user and sends the equivalent amount of underlying to receiverOfUnderlying

In some instances, the mint event could be emitted from a burn transaction if the amount to burn is less than the interest that the user accrued

function burn(address from, address receiverOfUnderlying, uint256 amount, uint256 index) external;

Parameters

NameTypeDescription
fromaddressThe address from which the aTokens will be burned
receiverOfUnderlyingaddressThe address that will receive the underlying
amountuint256The amount being burned
indexuint256The next liquidity index of the reserve

mintToTreasury

Mints aTokens to the reserve treasury

function mintToTreasury(uint256 amount, uint256 index) external;

Parameters

NameTypeDescription
amountuint256The amount of tokens getting minted
indexuint256The next liquidity index of the reserve

transferOnLiquidation

Transfers aTokens in the event of a borrow being liquidated, in case the liquidators reclaims the aToken

function transferOnLiquidation(address from, address to, uint256 value) external;

Parameters

NameTypeDescription
fromaddressThe address getting liquidated, current owner of the aTokens
toaddressThe recipient
valueuint256The amount of tokens getting transferred

transferUnderlyingTo

Transfers the underlying asset to target.

Used by the Pool to transfer assets in borrow(), withdraw() and flashLoan()

function transferUnderlyingTo(address target, uint256 amount) external;

Parameters

NameTypeDescription
targetaddressThe recipient of the underlying
amountuint256The amount getting transferred

handleRepayment

Handles the underlying received by the aToken after the transfer has been completed.

The default implementation is empty as with standard ERC20 tokens, nothing needs to be done after the transfer is concluded. However in the future there may be aTokens that allow for example to stake the underlying to receive LM rewards. In that case, handleRepayment() would perform the staking of the underlying asset.

function handleRepayment(address user, address onBehalfOf, uint256 amount) external;

Parameters

NameTypeDescription
useraddressThe user executing the repayment
onBehalfOfaddressThe address of the user who will get his debt reduced/removed
amountuint256The amount getting repaid

permit

Allow passing a signed message to approve spending

implements the permit function as for https://github.com/ethereum/EIPs/blob/8a34d644aacf0f9f8f00815307fd7dd5da07655f/EIPS/eip-2612.md

function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
    external;

Parameters

NameTypeDescription
owneraddressThe owner of the funds
spenderaddressThe spender
valueuint256The amount
deadlineuint256The deadline timestamp, type(uint256).max for max deadline
vuint8Signature param
rbytes32Signature param
sbytes32Signature param

UNDERLYING_ASSET_ADDRESS

Returns the address of the underlying asset of this aToken (E.g. WETH for aWETH)

function UNDERLYING_ASSET_ADDRESS() external view returns (address);

Returns

NameTypeDescription
<none>addressThe address of the underlying asset

RESERVE_TREASURY_ADDRESS

Returns the address of the Aave treasury, receiving the fees on this aToken.

function RESERVE_TREASURY_ADDRESS() external view returns (address);

Returns

NameTypeDescription
<none>addressAddress of the Aave treasury

DOMAIN_SEPARATOR

Get the domain separator for the token

Return cached value if chainId matches cache, otherwise recomputes separator

function DOMAIN_SEPARATOR() external view returns (bytes32);

Returns

NameTypeDescription
<none>bytes32The domain separator of the token at current chain

nonces

Returns the nonce for owner.

function nonces(address owner) external view returns (uint256);

Parameters

NameTypeDescription
owneraddressThe address of the owner

Returns

NameTypeDescription
<none>uint256The nonce of the owner

rescueTokens

Rescue and transfer tokens locked in this contract

function rescueTokens(address token, address to, uint256 amount) external;

Parameters

NameTypeDescription
tokenaddressThe address of the token
toaddressThe address of the recipient
amountuint256The amount of token to transfer

Events

BalanceTransfer

Emitted during the transfer action

event BalanceTransfer(address indexed from, address indexed to, uint256 value, uint256 index);