@@ -8,12 +8,22 @@ import "../modules/EToken.sol";
8
8
import "../modules/Markets.sol " ;
9
9
import "../BaseIRMLinearKink.sol " ;
10
10
import "../vendor/RPow.sol " ;
11
+ import "../IRiskManager.sol " ;
11
12
12
13
interface IExec {
13
14
function getPriceFull (address underlying ) external view returns (uint twap , uint twapPeriod , uint currPrice );
14
15
function getPrice (address underlying ) external view returns (uint twap , uint twapPeriod );
15
16
function detailedLiquidity (address account ) external view returns (IRiskManager.AssetLiquidity[] memory assets );
16
17
function liquidity (address account ) external view returns (IRiskManager.LiquidityStatus memory status );
18
+ function getRiskManagerSettings () external view returns (IRiskManager.RiskManagerSettings memory settings );
19
+ }
20
+
21
+ interface IInstaller {
22
+ function getUpgradeAdmin () external view returns (address );
23
+ }
24
+
25
+ interface IGovernance {
26
+ function getGovernorAdmin () external view returns (address );
17
27
}
18
28
19
29
contract EulerGeneralView is Constants {
@@ -84,10 +94,54 @@ contract EulerGeneralView is Constants {
84
94
address [] enteredMarkets;
85
95
}
86
96
97
+ struct ResponseModule {
98
+ uint moduleId;
99
+ address proxyAddress;
100
+ bytes32 gitCommit;
101
+ }
102
+
103
+ struct ResponseConfig {
104
+ uint defaultReserveFee;
105
+ uint defaultTWAPWindowSeconds;
106
+ uint defaultBorrowFactor;
107
+ address upgradeAdmin;
108
+ address governorAdmin;
109
+ IRiskManager.RiskManagerSettings riskManagerSettings;
110
+
111
+ ResponseModule[] modules;
112
+ }
87
113
88
114
89
115
// Implementation
90
116
117
+ function doQueryEulerConfig (address eulerContract ) external view returns (ResponseConfig memory r ) {
118
+ uint [7 ] memory moduleIds = [
119
+ MODULEID__INSTALLER,
120
+ MODULEID__MARKETS,
121
+ MODULEID__LIQUIDATION,
122
+ MODULEID__GOVERNANCE,
123
+ MODULEID__EXEC,
124
+ MODULEID__SWAP,
125
+ MODULEID__SWAPHUB
126
+ ];
127
+
128
+ r.defaultReserveFee = DEFAULT_RESERVE_FEE;
129
+ r.defaultTWAPWindowSeconds = DEFAULT_TWAP_WINDOW_SECONDS;
130
+ r.defaultBorrowFactor = DEFAULT_BORROW_FACTOR;
131
+ r.modules = new ResponseModule [](moduleIds.length );
132
+
133
+ Euler eulerProxy = Euler (eulerContract);
134
+ for (uint i = 0 ; i < moduleIds.length ; ++ i) {
135
+ address currentProxy = eulerProxy.moduleIdToProxy (moduleIds[i]);
136
+ bytes32 currentGitCommit = BaseModule (currentProxy).moduleGitCommit ();
137
+ r.modules[i] = ResponseModule (moduleIds[i], currentProxy, currentGitCommit);
138
+ }
139
+
140
+ r.upgradeAdmin = IInstaller (r.modules[0 ].proxyAddress).getUpgradeAdmin ();
141
+ r.governorAdmin = IGovernance (r.modules[3 ].proxyAddress).getGovernorAdmin ();
142
+ r.riskManagerSettings = IExec (r.modules[4 ].proxyAddress).getRiskManagerSettings ();
143
+ }
144
+
91
145
function doQueryBatch (Query[] memory qs ) external view returns (Response[] memory r ) {
92
146
r = new Response [](qs.length );
93
147
0 commit comments