IStableDebtToken
Also available on Github.
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
/**
* @title IStableDebtToken
* @notice Defines the interface for the stable debt token
* @dev It does not inherit from IERC20 to save in code size
* @author Aave
**/
interface IStableDebtToken {
/**
* @dev Emitted when new stable debt is minted
* @param user The address of the user who triggered the minting
* @param onBehalfOf The recipient of stable debt tokens
* @param amount The amount minted
* @param currentBalance The current balance of the user
* @param balanceIncrease The increase in balance since the last action of the user
* @param newRate The rate of the debt after the minting
* @param avgStableRate The new average stable rate after the minting
* @param newTotalSupply The new total supply of the stable debt token after the action
**/
event Mint(
address indexed user,
address indexed onBehalfOf,
uint256 amount,
uint256 currentBalance,
uint256 balanceIncrease,
uint256 newRate,
uint256 avgStableRate,
uint256 newTotalSupply
);
/**
* @dev Emitted when new stable debt is burned
* @param user The address of the user
* @param amount The amount being burned
* @param currentBalance The current balance of the user
* @param balanceIncrease The the increase in balance since the last action of the user
* @param avgStableRate The new average stable rate after the burning
* @param newTotalSupply The new total supply of the stable debt token after the action
**/
event Burn(
address indexed user,
uint256 amount,
uint256 currentBalance,
uint256 balanceIncrease,
uint256 avgStableRate,
uint256 newTotalSupply
);
/**
* @dev delegates borrowing power to a user on the specific debt token
* @param delegatee the address receiving the delegated borrowing power
* @param amount the maximum amount being delegated. Delegation will still
* respect the liquidation constraints (even if delegated, a delegatee cannot
* force a delegator HF to go below 1)
**/
function approveDelegation(address delegatee, uint256 amount) external;
/**
* @dev returns the borrow allowance of the user
* @param fromUser The user to giving allowance
* @param toUser The user to give allowance to
* @return the current allowance of toUser
**/
function borrowAllowance(address fromUser, address toUser) external view returns (uint256);
/**
* @dev Mints debt token to the `onBehalfOf` address.
* - The resulting rate is the weighted average between the rate of the new debt
* and the rate of the previous debt
* @param user The address receiving the borrowed underlying, being the delegatee in case
* of credit delegate, or same as `onBehalfOf` otherwise
* @param onBehalfOf The address receiving the debt tokens
* @param amount The amount of debt tokens to mint
* @param rate The rate of the debt being minted
**/
function mint(
address user,
address onBehalfOf,
uint256 amount,
uint256 rate
) external returns (bool);
/**
* @dev Burns debt of `user`
* - The resulting rate is the weighted average between the rate of the new debt
* and the rate of the previous debt
* @param user The address of the user getting his debt burned
* @param amount The amount of debt tokens getting burned
**/
function burn(address user, uint256 amount) external;
/**
* @dev Returns the average rate of all the stable rate loans.
* @return The average stable rate
**/
function getAverageStableRate() external view returns (uint256);
/**
* @dev Returns the stable rate of the user debt
* @return The stable rate of the user
**/
function getUserStableRate(address user) external view returns (uint256);
/**
* @dev Returns the timestamp of the last update of the user
* @return The timestamp
**/
function getUserLastUpdated(address user) external view returns (uint40);
/**
* @dev Returns the principal, the total supply and the average stable rate
**/
function getSupplyData()
external
view
returns (
uint256,
uint256,
uint256,
uint40
);
/**
* @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
* @return The debt balance of the user since the last burn/mint action
**/
function principalBalanceOf(address user) external view returns (uint256);
}
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
interface IScaledBalanceToken {
/**
* @dev Returns the scaled balance of the user. The scaled balance is the sum of all the
* updated stored balance divided by the reserve's liquidity index at the moment of the update
* @param user The user whose balance is calculated
* @return The scaled balance of the user
**/
function scaledBalanceOf(address user) external view returns (uint256);
/**
* @dev Returns the scaled balance of the user and the scaled total supply.
* @param user The address of the user
* @return The scaled balance of the user
* @return The scaled balance and the scaled total supply
**/
function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256);
/**
* @dev Returns the scaled total supply of the variable debt token. Represents sum(debt/index)
* @return The scaled total supply
**/
function scaledTotalSupply() external view returns (uint256);
}
Last updated