IVariableDebtToken
Also available on Github.
IVariableDebtToken.sol
IScaledBalanceToken.sol
1
// SPDX-License-Identifier: agpl-3.0
2
pragma solidity 0.6.12;
3
4
import {IScaledBalanceToken} from './IScaledBalanceToken.sol';
5
6
/**
7
* @title IVariableDebtToken
8
* @author Aave
9
* @notice Defines the basic interface for a variable debt token.
10
**/
11
interface IVariableDebtToken is IScaledBalanceToken {
12
/**
13
* @dev Emitted after the mint action
14
* @param from The address performing the mint
15
* @param onBehalfOf The address of the user on which behalf minting has been performed
16
* @param value The amount to be minted
17
* @param index The last index of the reserve
18
**/
19
event Mint(address indexed from, address indexed onBehalfOf, uint256 value, uint256 index);
20
21
22
/**
23
* @dev delegates borrowing power to a user on the specific debt token
24
* @param delegatee the address receiving the delegated borrowing power
25
* @param amount the maximum amount being delegated. Delegation will still
26
* respect the liquidation constraints (even if delegated, a delegatee cannot
27
* force a delegator HF to go below 1)
28
**/
29
function approveDelegation(address delegatee, uint256 amount) external;
30
31
/**
32
* @dev returns the borrow allowance of the user
33
* @param fromUser The user to giving allowance
34
* @param toUser The user to give allowance to
35
* @return the current allowance of toUser
36
**/
37
function borrowAllowance(address fromUser, address toUser) external view returns (uint256);
38
39
/**
40
* @dev Mints debt token to the `onBehalfOf` address
41
* @param user The address receiving the borrowed underlying, being the delegatee in case
42
* of credit delegate, or same as `onBehalfOf` otherwise
43
* @param onBehalfOf The address receiving the debt tokens
44
* @param amount The amount of debt being minted
45
* @param index The variable debt index of the reserve
46
* @return `true` if the the previous balance of the user is 0
47
**/
48
function mint(
49
address user,
50
address onBehalfOf,
51
uint256 amount,
52
uint256 index
53
) external returns (bool);
54
55
/**
56
* @dev Emitted when variable debt is burnt
57
* @param user The user which debt has been burned
58
* @param amount The amount of debt being burned
59
* @param index The index of the user
60
**/
61
event Burn(address indexed user, uint256 amount, uint256 index);
62
63
/**
64
* @dev Burns user variable debt
65
* @param user The user which debt is burnt
66
* @param index The variable debt index of the reserve
67
**/
68
function burn(
69
address user,
70
uint256 amount,
71
uint256 index
72
) external;
73
}
74
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