2020-08-20 12:32:20 +00:00
|
|
|
// SPDX-License-Identifier: agpl-3.0
|
|
|
|
pragma solidity ^0.6.8;
|
|
|
|
|
2020-09-04 14:27:35 +00:00
|
|
|
import {IERC20} from '../../interfaces/IERC20.sol';
|
2020-08-20 12:32:20 +00:00
|
|
|
|
|
|
|
interface IAToken is IERC20 {
|
2020-08-21 14:03:01 +00:00
|
|
|
/**
|
|
|
|
* @dev emitted after aTokens are burned
|
|
|
|
* @param from the address performing the redeem
|
|
|
|
* @param value the amount to be redeemed
|
2020-09-07 15:55:47 +00:00
|
|
|
* @param index the last index of the reserve
|
2020-08-21 14:03:01 +00:00
|
|
|
**/
|
|
|
|
event Burn(
|
|
|
|
address indexed from,
|
|
|
|
address indexed target,
|
|
|
|
uint256 value,
|
2020-09-07 15:55:47 +00:00
|
|
|
uint256 index
|
2020-08-21 14:03:01 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev emitted after the mint action
|
|
|
|
* @param from the address performing the mint
|
|
|
|
* @param value the amount to be minted
|
2020-09-07 15:55:47 +00:00
|
|
|
* @param index the last index of the reserve
|
2020-08-21 14:03:01 +00:00
|
|
|
**/
|
2020-09-07 15:55:47 +00:00
|
|
|
event Mint(address indexed from, uint256 value, uint256 index);
|
2020-08-21 14:03:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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
|
2020-09-07 15:55:47 +00:00
|
|
|
* @param index the last index of the reserve
|
2020-08-21 14:03:01 +00:00
|
|
|
**/
|
|
|
|
event BalanceTransfer(
|
|
|
|
address indexed from,
|
|
|
|
address indexed to,
|
|
|
|
uint256 value,
|
2020-09-07 15:55:47 +00:00
|
|
|
uint256 index
|
2020-08-21 14:03:01 +00:00
|
|
|
);
|
|
|
|
|
2020-08-20 12:32:20 +00:00
|
|
|
/**
|
|
|
|
* @dev burns the aTokens and sends the equivalent amount of underlying to the target.
|
|
|
|
* only lending pools can call this function
|
2020-08-21 13:38:47 +00:00
|
|
|
* @param amount the amount being burned
|
2020-09-12 11:18:17 +00:00
|
|
|
* @param index the liquidity index
|
2020-08-20 12:32:20 +00:00
|
|
|
**/
|
|
|
|
function burn(
|
2020-08-21 13:38:47 +00:00
|
|
|
address user,
|
|
|
|
address underlyingTarget,
|
2020-09-12 11:18:17 +00:00
|
|
|
uint256 amount,
|
|
|
|
uint256 index
|
2020-08-20 12:32:20 +00:00
|
|
|
) external;
|
|
|
|
|
|
|
|
/**
|
2020-08-21 13:38:47 +00:00
|
|
|
* @dev mints aTokens to user
|
2020-08-20 12:32:20 +00:00
|
|
|
* only lending pools can call this function
|
2020-08-21 13:38:47 +00:00
|
|
|
* @param user the address receiving the minted tokens
|
|
|
|
* @param amount the amount of tokens to mint
|
2020-09-12 11:18:17 +00:00
|
|
|
* @param index the liquidity index
|
2020-08-20 12:32:20 +00:00
|
|
|
*/
|
2020-09-12 11:18:17 +00:00
|
|
|
function mint(address user, uint256 amount, uint256 index) external;
|
2020-08-20 12:32:20 +00:00
|
|
|
|
2020-09-10 10:51:52 +00:00
|
|
|
/**
|
2020-09-14 13:09:16 +00:00
|
|
|
* @dev mints aTokens to the reserve treasury
|
|
|
|
* @param amount the amount to mint
|
|
|
|
* @param index the liquidity index of the reserve
|
|
|
|
**/
|
|
|
|
function mintToTreasury(uint256 amount, uint256 index) external;
|
2020-09-10 10:51:52 +00:00
|
|
|
|
2020-08-20 12:32:20 +00:00
|
|
|
/**
|
|
|
|
* @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
|
2020-08-21 13:38:47 +00:00
|
|
|
* @param from the address from which transfer the aTokens
|
|
|
|
* @param to the destination address
|
|
|
|
* @param value the amount to transfer
|
2020-08-20 12:32:20 +00:00
|
|
|
**/
|
|
|
|
function transferOnLiquidation(
|
2020-08-21 13:38:47 +00:00
|
|
|
address from,
|
|
|
|
address to,
|
|
|
|
uint256 value
|
2020-08-20 12:32:20 +00:00
|
|
|
) 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.
|
2020-08-21 13:38:47 +00:00
|
|
|
* @param user the address of the user
|
2020-08-20 12:32:20 +00:00
|
|
|
* @return the principal balance of the user
|
|
|
|
**/
|
2020-09-07 15:55:47 +00:00
|
|
|
function scaledBalanceOf(address user) external view returns (uint256);
|
2020-08-20 12:32:20 +00:00
|
|
|
|
2020-09-15 13:53:20 +00:00
|
|
|
/**
|
|
|
|
* @dev returns the principal balance of the user and principal total supply.
|
|
|
|
* @param user the address of the user
|
|
|
|
* @return the principal balance of the user
|
|
|
|
* @return the principal total supply
|
|
|
|
**/
|
|
|
|
function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256);
|
|
|
|
|
2020-08-20 12:32:20 +00:00
|
|
|
/**
|
|
|
|
* @dev Used to validate transfers before actually executing them.
|
2020-08-21 13:38:47 +00:00
|
|
|
* @param user address of the user to check
|
|
|
|
* @param amount the amount to check
|
|
|
|
* @return true if the user can transfer amount, false otherwise
|
2020-08-20 12:32:20 +00:00
|
|
|
**/
|
2020-08-21 13:38:47 +00:00
|
|
|
function isTransferAllowed(address user, uint256 amount) external view returns (bool);
|
2020-08-20 12:32:20 +00:00
|
|
|
|
|
|
|
/**
|
2020-09-09 19:16:39 +00:00
|
|
|
* @dev transfer the amount of the underlying asset to the user
|
2020-08-21 13:38:47 +00:00
|
|
|
* @param user address of the user
|
|
|
|
* @param amount the amount to transfer
|
2020-09-14 09:13:53 +00:00
|
|
|
* @return the amount transferred
|
2020-08-20 12:32:20 +00:00
|
|
|
**/
|
2020-09-09 19:16:39 +00:00
|
|
|
function transferUnderlyingTo(address user, uint256 amount) external returns (uint256);
|
2020-09-14 13:09:16 +00:00
|
|
|
|
|
|
|
|
2020-08-20 12:32:20 +00:00
|
|
|
}
|