IStableDebtToken
Also available on Github.
IStableDebtToken.sol
IScaledBalanceToken.sol
1
// SPDX-License-Identifier: agpl-3.0
2
pragma solidity 0.6.12;
3
4
/**
5
* @title IStableDebtToken
6
* @notice Defines the interface for the stable debt token
7
* @dev It does not inherit from IERC20 to save in code size
8
* @author Aave
9
**/
10
11
interface IStableDebtToken {
12
/**
13
* @dev Emitted when new stable debt is minted
14
* @param user The address of the user who triggered the minting
15
* @param onBehalfOf The recipient of stable debt tokens
16
* @param amount The amount minted
17
* @param currentBalance The current balance of the user
18
* @param balanceIncrease The increase in balance since the last action of the user
19
* @param newRate The rate of the debt after the minting
20
* @param avgStableRate The new average stable rate after the minting
21
* @param newTotalSupply The new total supply of the stable debt token after the action
22
**/
23
event Mint(
24
address indexed user,
25
address indexed onBehalfOf,
26
uint256 amount,
27
uint256 currentBalance,
28
uint256 balanceIncrease,
29
uint256 newRate,
30
uint256 avgStableRate,
31
uint256 newTotalSupply
32
);
33
34
/**
35
* @dev Emitted when new stable debt is burned
36
* @param user The address of the user
37
* @param amount The amount being burned
38
* @param currentBalance The current balance of the user
39
* @param balanceIncrease The the increase in balance since the last action of the user
40
* @param avgStableRate The new average stable rate after the burning
41
* @param newTotalSupply The new total supply of the stable debt token after the action
42
**/
43
event Burn(
44
address indexed user,
45
uint256 amount,
46
uint256 currentBalance,
47
uint256 balanceIncrease,
48
uint256 avgStableRate,
49
uint256 newTotalSupply
50
);
51
52
/**
53
* @dev delegates borrowing power to a user on the specific debt token
54
* @param delegatee the address receiving the delegated borrowing power
55
* @param amount the maximum amount being delegated. Delegation will still
56
* respect the liquidation constraints (even if delegated, a delegatee cannot
57
* force a delegator HF to go below 1)
58
**/
59
function approveDelegation(address delegatee, uint256 amount) external;
60
61
/**
62
* @dev returns the borrow allowance of the user
63
* @param fromUser The user to giving allowance
64
* @param toUser The user to give allowance to
65
* @return the current allowance of toUser
66
**/
67
function borrowAllowance(address fromUser, address toUser) external view returns (uint256);
68
69
/**
70
* @dev Mints debt token to the `onBehalfOf` address.
71
* - The resulting rate is the weighted average between the rate of the new debt
72
* and the rate of the previous debt
73
* @param user The address receiving the borrowed underlying, being the delegatee in case
74
* of credit delegate, or same as `onBehalfOf` otherwise
75
* @param onBehalfOf The address receiving the debt tokens
76
* @param amount The amount of debt tokens to mint
77
* @param rate The rate of the debt being minted
78
**/
79
function mint(
80
address user,
81
address onBehalfOf,
82
uint256 amount,
83
uint256 rate
84
) external returns (bool);
85
86
/**
87
* @dev Burns debt of `user`
88
* - The resulting rate is the weighted average between the rate of the new debt
89
* and the rate of the previous debt
90
* @param user The address of the user getting his debt burned
91
* @param amount The amount of debt tokens getting burned
92
**/
93
function burn(address user, uint256 amount) external;
94
95
/**
96
* @dev Returns the average rate of all the stable rate loans.
97
* @return The average stable rate
98
**/
99
function getAverageStableRate() external view returns (uint256);
100
101
/**
102
* @dev Returns the stable rate of the user debt
103
* @return The stable rate of the user
104
**/
105
function getUserStableRate(address user) external view returns (uint256);
106
107
/**
108
* @dev Returns the timestamp of the last update of the user
109
* @return The timestamp
110
**/
111
function getUserLastUpdated(address user) external view returns (uint40);
112
113
/**
114
* @dev Returns the principal, the total supply and the average stable rate
115
**/
116
function getSupplyData()
117
external
118
view
119
returns (
120
uint256,
121
uint256,
122
uint256,
123
uint40
124
);
125
126
/**
127
* @dev Returns the timestamp of the last update of the total supply
128
* @return The timestamp
129
**/
130
function getTotalSupplyLastUpdated() external view returns (uint40);
131
132
/**
133
* @dev Returns the total supply and the average stable rate
134
**/
135
function getTotalSupplyAndAvgRate() external view returns (uint256, uint256);
136
137
/**
138
* @dev Returns the principal debt balance of the user
139
* @return The debt balance of the user since the last burn/mint action
140
**/
141
function principalBalanceOf(address user) external view returns (uint256);
142
}
143
Copied!
1
// SPDX-License-Identifier: agpl-3.0
2
pragma solidity 0.6.12;
3
4
interface IScaledBalanceToken {
5
/**
6
* @dev Returns the scaled balance of the user. The scaled balance is the sum of all the
7
* updated stored balance divided by the reserve's liquidity index at the moment of the update
8
* @param user The user whose balance is calculated
9
* @return The scaled balance of the user
10
**/
11
function scaledBalanceOf(address user) external view returns (uint256);
12
13
/**
14
* @dev Returns the scaled balance of the user and the scaled total supply.
15
* @param user The address of the user
16
* @return The scaled balance of the user
17
* @return The scaled balance and the scaled total supply
18
**/
19
function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256);
20
21
/**
22
* @dev Returns the scaled total supply of the variable debt token. Represents sum(debt/index)
23
* @return The scaled total supply
24
**/
25
function scaledTotalSupply() external view returns (uint256);
26
}
27
Copied!
Last modified 10mo ago
Copy link