mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
172 lines
5.8 KiB
Solidity
172 lines
5.8 KiB
Solidity
// SPDX-License-Identifier: agpl-3.0
|
|
pragma solidity ^0.6.8;
|
|
|
|
import {IERC20} from '../../interfaces/IERC20.sol';
|
|
|
|
interface IAToken is IERC20 {
|
|
/**
|
|
* @dev emitted after aTokens are burned
|
|
* @param from the address performing the redeem
|
|
* @param value the amount to be redeemed
|
|
* @param index the last index of the reserve
|
|
**/
|
|
event Burn(
|
|
address indexed from,
|
|
address indexed target,
|
|
uint256 value,
|
|
uint256 index
|
|
);
|
|
|
|
/**
|
|
* @dev emitted after the mint action
|
|
* @param from the address performing the mint
|
|
* @param value the amount to be minted
|
|
* @param index the last index of the reserve
|
|
**/
|
|
event Mint(address indexed from, uint256 value, uint256 index);
|
|
|
|
/**
|
|
* @dev emitted during the transfer action
|
|
* @param from the address from which the tokens are being transferred
|
|
* @param to the adress of the destination
|
|
* @param value the amount to be minted
|
|
* @param index the last index of the reserve
|
|
**/
|
|
event BalanceTransfer(
|
|
address indexed from,
|
|
address indexed to,
|
|
uint256 value,
|
|
uint256 index
|
|
);
|
|
|
|
/**
|
|
* @dev emitted when the accumulation of the interest
|
|
* by an user is redirected to another user
|
|
* @param from the address from which the interest is being redirected
|
|
* @param to the adress of the destination
|
|
* @param redirectedBalance the scaled balance being redirected
|
|
* @param index the last index of the reserve
|
|
**/
|
|
event InterestStreamRedirected(
|
|
address indexed from,
|
|
address indexed to,
|
|
uint256 redirectedBalance,
|
|
uint256 index
|
|
);
|
|
|
|
/**
|
|
* @dev emitted when the redirected balance of an user is being updated
|
|
* @param targetAddress the address of which the balance is being updated
|
|
* @param redirectedBalanceAdded the redirected balance being added
|
|
* @param redirectedBalanceRemoved the redirected balance being removed
|
|
* @param index the last index of the reserve
|
|
**/
|
|
event RedirectedBalanceUpdated(
|
|
address indexed targetAddress,
|
|
uint256 redirectedBalanceAdded,
|
|
uint256 redirectedBalanceRemoved,
|
|
uint256 index
|
|
);
|
|
|
|
event InterestRedirectionAllowanceChanged(address indexed from, address indexed to);
|
|
|
|
/**
|
|
* @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 scaledBalanceOf(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 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);
|
|
}
|