mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
113 lines
4.1 KiB
Solidity
113 lines
4.1 KiB
Solidity
// SPDX-License-Identifier: agpl-3.0
|
|
pragma solidity ^0.6.8;
|
|
|
|
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
|
|
|
interface IAToken is IERC20 {
|
|
/**
|
|
* @dev redirects the interest generated to a target address.
|
|
* when the interest is redirected, the user balance is added to
|
|
* the recepient redirected balance.
|
|
* @param _to the address to which the interest will be redirected
|
|
**/
|
|
function redirectInterestStream(address _to) external;
|
|
|
|
/**
|
|
* @dev redirects the interest generated by _from to a target address.
|
|
* when the interest is redirected, the user balance is added to
|
|
* the recepient redirected balance. The caller needs to have allowance on
|
|
* the interest redirection to be able to execute the function.
|
|
* @param _from the address of the user whom interest is being redirected
|
|
* @param _to the address to which the interest will be redirected
|
|
**/
|
|
function redirectInterestStreamOf(address _from, address _to) external;
|
|
|
|
/**
|
|
* @dev gives allowance to an address to execute the interest redirection
|
|
* on behalf of the caller.
|
|
* @param _to the address to which the interest will be redirected. Pass address(0) to reset
|
|
* the allowance.
|
|
**/
|
|
function allowInterestRedirectionTo(address _to) external;
|
|
|
|
/**
|
|
* @dev burns the aTokens and sends the equivalent amount of underlying to the target.
|
|
* only lending pools can call this function
|
|
* @param _amount the amount being burned
|
|
**/
|
|
function burn(
|
|
address _user,
|
|
address _underlyingTarget,
|
|
uint256 _amount
|
|
) external;
|
|
|
|
/**
|
|
* @dev mints aTokens to _user
|
|
* only lending pools can call this function
|
|
* @param _user the address receiving the minted tokens
|
|
* @param _amount the amount of tokens to mint
|
|
*/
|
|
function mint(address _user, uint256 _amount) external;
|
|
|
|
/**
|
|
* @dev transfers tokens in the event of a borrow being liquidated, in case the liquidators reclaims the aToken
|
|
* only lending pools can call this function
|
|
* @param _from the address from which transfer the aTokens
|
|
* @param _to the destination address
|
|
* @param _value the amount to transfer
|
|
**/
|
|
function transferOnLiquidation(
|
|
address _from,
|
|
address _to,
|
|
uint256 _value
|
|
) external;
|
|
|
|
/**
|
|
* @dev returns the principal balance of the user. The principal balance is the last
|
|
* updated stored balance, which does not consider the perpetually accruing interest.
|
|
* @param _user the address of the user
|
|
* @return the principal balance of the user
|
|
**/
|
|
function principalBalanceOf(address _user) external view returns (uint256);
|
|
|
|
/**
|
|
* @dev Used to validate transfers before actually executing them.
|
|
* @param _user address of the user to check
|
|
* @param _amount the amount to check
|
|
* @return true if the _user can transfer _amount, false otherwise
|
|
**/
|
|
function isTransferAllowed(address _user, uint256 _amount) external view returns (bool);
|
|
|
|
/**
|
|
* @dev returns the last index of the user, used to calculate the balance of the user
|
|
* @param _user address of the user
|
|
* @return the last user index
|
|
**/
|
|
function getUserIndex(address _user) external view returns (uint256);
|
|
|
|
/**
|
|
* @dev returns the address to which the interest is redirected
|
|
* @param _user address of the user
|
|
* @return 0 if there is no redirection, an address otherwise
|
|
**/
|
|
function getInterestRedirectionAddress(address _user) external view returns (address);
|
|
|
|
/**
|
|
* @dev returns the redirected balance of the user. The redirected balance is the balance
|
|
* redirected by other accounts to the user, that is accrueing interest for him.
|
|
* @param _user address of the user
|
|
* @return the total redirected balance
|
|
**/
|
|
function getRedirectedBalance(address _user) external view returns (uint256);
|
|
|
|
/**
|
|
* @dev transfers the underlying asset to the target. Used by the lendingpool to transfer
|
|
* assets in borrow(), redeem() and flashLoan()
|
|
* @param _target the target of the transfer
|
|
* @param _amount the amount to transfer
|
|
* @return the amount transferred
|
|
**/
|
|
|
|
function transferUnderlyingTo(address _target, uint256 _amount) external returns (uint256);
|
|
}
|