forked from CreamFi/compound-protocol
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathComptrollerStorage.sol
153 lines (122 loc) · 5.59 KB
/
ComptrollerStorage.sol
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
pragma solidity ^0.5.16;
import "./CToken.sol";
import "./PriceOracle/PriceOracle.sol";
contract UnitrollerAdminStorage {
/**
* @notice Administrator for this contract
*/
address public admin;
/**
* @notice Pending administrator for this contract
*/
address public pendingAdmin;
/**
* @notice Active brains of Unitroller
*/
address public comptrollerImplementation;
/**
* @notice Pending brains of Unitroller
*/
address public pendingComptrollerImplementation;
}
contract ComptrollerV1Storage is UnitrollerAdminStorage {
/**
* @notice Oracle which gives the price of any given asset
*/
PriceOracle public oracle;
/**
* @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow
*/
uint256 public closeFactorMantissa;
/**
* @notice Multiplier representing the discount on collateral that a liquidator receives
*/
uint256 public liquidationIncentiveMantissa;
/**
* @notice Per-account mapping of "assets you are in"
*/
mapping(address => CToken[]) public accountAssets;
enum Version {
VANILLA,
COLLATERALCAP,
WRAPPEDNATIVE
}
struct Market {
/// @notice Whether or not this market is listed
bool isListed;
/**
* @notice Multiplier representing the most one can borrow against their collateral in this market.
* For instance, 0.9 to allow borrowing 90% of collateral value.
* Must be between 0 and 1, and stored as a mantissa.
*/
uint256 collateralFactorMantissa;
/// @notice Per-market mapping of "accounts in this asset"
mapping(address => bool) accountMembership;
/// @notice CToken version
Version version;
}
/**
* @notice Official mapping of cTokens -> Market metadata
* @dev Used e.g. to determine if a market is supported
*/
mapping(address => Market) public markets;
/**
* @notice The Pause Guardian can pause certain actions as a safety mechanism.
* Actions which allow users to remove their own assets cannot be paused.
* Liquidation / seizing / transfer can only be paused globally, not by market.
*/
address public pauseGuardian;
bool public _mintGuardianPaused;
bool public _borrowGuardianPaused;
bool public transferGuardianPaused;
bool public seizeGuardianPaused;
mapping(address => bool) public mintGuardianPaused;
mapping(address => bool) public borrowGuardianPaused;
struct CompMarketState {
/// @notice The market's last updated compBorrowIndex or compSupplyIndex
uint224 index;
/// @notice The block number the index was last updated at
uint32 block;
}
/// @notice A list of all markets
CToken[] public allMarkets;
/// @notice The portion of compRate that each market currently receives
/// @dev This storage is depreacted.
mapping(address => uint256) public compSpeeds;
/// @notice The COMP market supply state for each market
/// @dev This storage is depreacted.
mapping(address => CompMarketState) public compSupplyState;
/// @notice The COMP market borrow state for each market
/// @dev This storage is depreacted.
mapping(address => CompMarketState) public compBorrowState;
/// @notice The COMP borrow index for each market for each supplier as of the last time they accrued COMP
/// @dev This storage is depreacted.
mapping(address => mapping(address => uint256)) public compSupplierIndex;
/// @notice The COMP borrow index for each market for each borrower as of the last time they accrued COMP
/// @dev This storage is depreacted.
mapping(address => mapping(address => uint256)) public compBorrowerIndex;
/// @notice The COMP accrued but not yet transferred to each user
/// @dev This storage is depreacted.
mapping(address => uint256) public compAccrued;
/// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.
address public borrowCapGuardian;
/// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.
mapping(address => uint256) public borrowCaps;
/// @notice The supplyCapGuardian can set supplyCaps to any number for any market. Lowering the supply cap could disable supplying to the given market.
address public supplyCapGuardian;
/// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.
mapping(address => uint256) public supplyCaps;
/// @notice creditLimits allowed specific protocols to borrow and repay without collateral.
/// @dev This storage is depreacted.
mapping(address => uint256) internal _oldCreditLimits;
/// @notice flashloanGuardianPaused can pause flash loan as a safety mechanism.
mapping(address => bool) public flashloanGuardianPaused;
/// @notice liquidityMining the liquidity mining module that handles the LM rewards distribution.
address public liquidityMining;
/// @notice creditLimits allowed specific protocols to borrow and repay specific markets without collateral.
mapping(address => mapping(address => uint256)) internal _creditLimits;
/// @notice isMarketDelisted records the market which has been delisted by us.
mapping(address => bool) public isMarketDelisted;
/// @notice creditLimitManager is the role who is in charge of increasing the credit limit.
address public creditLimitManager;
}