2020-08-20 12:32:20 +00:00
|
|
|
// SPDX-License-Identifier: agpl-3.0
|
|
|
|
pragma solidity ^0.6.8;
|
2020-06-30 12:09:28 +00:00
|
|
|
|
2020-07-09 09:23:30 +00:00
|
|
|
/**
|
2020-07-13 08:54:08 +00:00
|
|
|
* @title interface IStableDebtToken
|
|
|
|
*
|
|
|
|
* @notice defines the interface for the stable debt token
|
|
|
|
*
|
|
|
|
* @dev it does not inherit from IERC20 to save in code size
|
|
|
|
*
|
|
|
|
* @author Aave
|
|
|
|
*
|
|
|
|
**/
|
2020-07-09 09:23:30 +00:00
|
|
|
|
2020-06-30 12:09:28 +00:00
|
|
|
interface IStableDebtToken {
|
2020-08-21 14:03:01 +00:00
|
|
|
/**
|
|
|
|
* @dev emitted when new stable debt is minted
|
2020-11-03 18:47:57 +00:00
|
|
|
* @param user the address of the user who triggered the minting
|
|
|
|
* @param onBehalfOf the address of the user
|
2020-08-21 14:03:01 +00:00
|
|
|
* @param amount the amount minted
|
|
|
|
* @param currentBalance the current balance of the user
|
2020-11-02 11:24:12 +00:00
|
|
|
* @param balanceIncrease the the increase in balance since the last action of the user
|
2020-08-21 14:03:01 +00:00
|
|
|
* @param newRate the rate of the debt after the minting
|
2020-10-27 09:36:02 +00:00
|
|
|
* @param avgStableRate the new average stable rate after the minting
|
2020-11-02 10:55:37 +00:00
|
|
|
* @param newTotalSupply the new total supply of the stable debt token after the action
|
2020-08-21 14:03:01 +00:00
|
|
|
**/
|
2020-10-09 08:00:55 +00:00
|
|
|
event Mint(
|
|
|
|
address indexed user,
|
2020-11-03 18:47:57 +00:00
|
|
|
address indexed onBehalfOf,
|
2020-08-21 14:03:01 +00:00
|
|
|
uint256 amount,
|
|
|
|
uint256 currentBalance,
|
2020-11-02 11:24:12 +00:00
|
|
|
uint256 balanceIncrease,
|
2020-10-27 09:36:02 +00:00
|
|
|
uint256 newRate,
|
2020-11-02 10:55:37 +00:00
|
|
|
uint256 avgStableRate,
|
|
|
|
uint256 newTotalSupply
|
2020-08-21 14:03:01 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev emitted when new stable debt is burned
|
|
|
|
* @param user the address of the user
|
|
|
|
* @param amount the amount minted
|
|
|
|
* @param currentBalance the current balance of the user
|
2020-11-02 11:24:12 +00:00
|
|
|
* @param balanceIncrease the the increase in balance since the last action of the user
|
2020-10-27 09:36:02 +00:00
|
|
|
* @param avgStableRate the new average stable rate after the minting
|
2020-11-02 10:55:37 +00:00
|
|
|
* @param newTotalSupply the new total supply of the stable debt token after the action
|
2020-08-21 14:03:01 +00:00
|
|
|
**/
|
2020-10-09 08:00:55 +00:00
|
|
|
event Burn(
|
|
|
|
address indexed user,
|
2020-08-21 14:03:01 +00:00
|
|
|
uint256 amount,
|
|
|
|
uint256 currentBalance,
|
2020-11-02 11:24:12 +00:00
|
|
|
uint256 balanceIncrease,
|
2020-11-02 10:55:37 +00:00
|
|
|
uint256 avgStableRate,
|
|
|
|
uint256 newTotalSupply
|
2020-08-21 14:03:01 +00:00
|
|
|
);
|
|
|
|
|
2020-07-09 09:23:30 +00:00
|
|
|
/**
|
2020-07-13 08:54:08 +00:00
|
|
|
* @dev mints debt token to the target user. The resulting rate is the weighted average
|
|
|
|
* between the rate of the new debt and the rate of the previous debt
|
2020-08-21 10:38:08 +00:00
|
|
|
* @param user the address of the user
|
|
|
|
* @param amount the amount of debt tokens to mint
|
|
|
|
* @param rate the rate of the debt being minted.
|
2020-07-13 08:54:08 +00:00
|
|
|
**/
|
2020-06-30 12:09:28 +00:00
|
|
|
function mint(
|
2020-08-21 10:38:08 +00:00
|
|
|
address user,
|
2020-11-03 18:47:57 +00:00
|
|
|
address onBehalfOf,
|
2020-08-21 10:38:08 +00:00
|
|
|
uint256 amount,
|
|
|
|
uint256 rate
|
2020-10-30 13:55:03 +00:00
|
|
|
) external returns (bool);
|
2020-06-30 12:09:28 +00:00
|
|
|
|
2020-07-09 09:23:30 +00:00
|
|
|
/**
|
2020-07-13 08:54:08 +00:00
|
|
|
* @dev burns debt of the target user.
|
2020-08-21 10:38:08 +00:00
|
|
|
* @param user the address of the user
|
|
|
|
* @param amount the amount of debt tokens to mint
|
2020-07-13 08:54:08 +00:00
|
|
|
**/
|
2020-08-21 10:38:08 +00:00
|
|
|
function burn(address user, uint256 amount) external;
|
2020-06-30 12:09:28 +00:00
|
|
|
|
2020-07-09 09:23:30 +00:00
|
|
|
/**
|
2020-07-13 08:54:08 +00:00
|
|
|
* @dev returns the average rate of all the stable rate loans.
|
|
|
|
* @return the average stable rate
|
|
|
|
**/
|
2020-08-20 12:32:20 +00:00
|
|
|
function getAverageStableRate() external view returns (uint256);
|
2020-06-30 12:09:28 +00:00
|
|
|
|
2020-07-09 09:23:30 +00:00
|
|
|
/**
|
2020-07-13 08:54:08 +00:00
|
|
|
* @dev returns the stable rate of the user debt
|
|
|
|
* @return the stable rate of the user
|
|
|
|
**/
|
2020-08-21 10:38:08 +00:00
|
|
|
function getUserStableRate(address user) external view returns (uint256);
|
2020-07-03 21:20:02 +00:00
|
|
|
|
2020-07-09 09:23:30 +00:00
|
|
|
/**
|
2020-07-13 08:54:08 +00:00
|
|
|
* @dev returns the timestamp of the last update of the user
|
|
|
|
* @return the timestamp
|
|
|
|
**/
|
2020-08-21 10:38:08 +00:00
|
|
|
function getUserLastUpdated(address user) external view returns (uint40);
|
2020-09-14 09:09:47 +00:00
|
|
|
|
|
|
|
/**
|
2020-09-16 18:00:13 +00:00
|
|
|
* @dev returns the principal, the total supply and the average stable rate
|
2020-09-14 09:09:47 +00:00
|
|
|
**/
|
2020-10-09 08:00:55 +00:00
|
|
|
function getSupplyData()
|
|
|
|
external
|
|
|
|
view
|
|
|
|
returns (
|
|
|
|
uint256,
|
|
|
|
uint256,
|
|
|
|
uint256,
|
|
|
|
uint40
|
|
|
|
);
|
2020-09-14 13:09:16 +00:00
|
|
|
|
2020-09-14 17:25:45 +00:00
|
|
|
/**
|
|
|
|
* @dev returns the timestamp of the last update of the total supply
|
|
|
|
* @return the timestamp
|
|
|
|
**/
|
|
|
|
function getTotalSupplyLastUpdated() external view returns (uint40);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev returns the total supply and the average stable rate
|
|
|
|
**/
|
|
|
|
function getTotalSupplyAndAvgRate() external view returns (uint256, uint256);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Returns the principal debt balance of the user
|
2020-09-14 13:09:16 +00:00
|
|
|
* @return The debt balance of the user since the last burn/mint action
|
|
|
|
**/
|
|
|
|
function principalBalanceOf(address user) external view returns (uint256);
|
2020-06-30 12:09:28 +00:00
|
|
|
}
|