forked from aave-dao/aave-v3-origin
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathInvariantsSpec.t.sol
More file actions
74 lines (53 loc) · 3.93 KB
/
Copy pathInvariantsSpec.t.sol
File metadata and controls
74 lines (53 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
/// @title InvariantsSpec
/// @notice Invariants specification for the protocol
/// @dev Contains pseudo code and description for the invariant properties in the protocol
abstract contract InvariantsSpec {
/*/////////////////////////////////////////////////////////////////////////////////////////////
// PROPERTY TYPES //
///////////////////////////////////////////////////////////////////////////////////////////////
/// - INVARIANTS (INV):
/// - Properties that should always hold true in the system.
/// - Implemented in the /invariants folder.
/////////////////////////////////////////////////////////////////////////////////////////////*/
///////////////////////////////////////////////////////////////////////////////////////////////
// BASE //
///////////////////////////////////////////////////////////////////////////////////////////////
string constant BASE_INVARIANT_A =
'BASE_INVARIANT_A: debtToken totalSupply should be equal to the sum of all user balances (user debt)';
string constant BASE_INVARIANT_B =
'BASE_INVARIANT_B: aToken totalSupply should be equal to the sum of all user balances)';
string constant BASE_INVARIANT_C =
'BASE_INVARIANT_C: The total amount of underlying in the protocol should be greater or equal than the aToken totalSuuply - debtToken totalSupply';
string constant BASE_INVARIANT_D =
'BASE_INVARIANT_D: The total amount of underlying in the protocol should greater or equal to the reserve virtualUnderlyingBalance';
string constant BASE_INVARIANT_E =
'BASE_INVARIANT_E: If reserve is frozen pending ltv cannot be 0';
string constant BASE_INVARIANT_F =
'BASE_INVARIANT_F: virtualBalance + currentDebt = (scaledATokenTotalSupply + accrueToTreasury) * liquidityIndexRightNow';
///////////////////////////////////////////////////////////////////////////////////////////////
// BORROWING //
///////////////////////////////////////////////////////////////////////////////////////////////
string constant BORROWING_INVARIANT_A =
'BORROWING_INVARIANT_A: sum of all user debt == 0 <=> totalBorrowed == 0';
string constant BORROWING_INVARIANT_B =
'BORROWING_INVARIANT_B: if a user does not have debt, configuration.isBorrowing -> false'; // Discarded
string constant BORROWING_INVARIANT_B2 =
'BORROWING_INVARIANT_B: if a user has any debt, configuration.isBorrowing -> true';
string constant BORROWING_INVARIANT_C =
'BORROWING_INVARIANT_C: if a user does not have collateral supplied, configuration.isCollateral -> false';
string constant BORROWING_INVARIANT_C2 =
'BORROWING_INVARIANT_C: if a user does has any collateral, configuration.isCollateral -> true'; // Discarded
string constant BORROWING_INVARIANT_D =
'BORROWING_INVARIANT_D: The grace period must not exceed the defined maximum limit of 4 hours';
///////////////////////////////////////////////////////////////////////////////////////////////
// ORACLE //
///////////////////////////////////////////////////////////////////////////////////////////////
string constant ORACLE_INVARIANT_A = 'ORACLE_INVARIANT_A: getAssetPrice must never revert';
string constant ORACLE_INVARIANT_B =
'ORACLE_INVARIANT_B: The price feed should never return different prices when called multiple times in a single tx';
///////////////////////////////////////////////////////////////////////////////////////////////
// DEFICIT MANAGEMENT //
///////////////////////////////////////////////////////////////////////////////////////////////
}