@@ -15,17 +15,26 @@ import { FeeDistributor } from "../FeeDistributor.sol";
15
15
import { CTokenFirstExtension } from "../compound/CTokenFirstExtension.sol " ;
16
16
import { ComptrollerV3Storage } from "../compound/ComptrollerStorage.sol " ;
17
17
import { IonicComptroller } from "../compound/ComptrollerInterface.sol " ;
18
+ import { ILiquidator } from "../ILiquidator.sol " ;
18
19
19
20
import { IERC20Upgradeable } from "openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol " ;
20
21
import { TransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol " ;
21
22
import { PoolLens } from "../PoolLens.sol " ;
22
23
import { AddressesProvider } from "../ionic/AddressesProvider.sol " ;
23
24
import { IonicUniV3Liquidator } from "../IonicUniV3Liquidator.sol " ;
24
25
import { ERC20 } from "solmate/tokens/ERC20.sol " ;
26
+ import { IRedemptionStrategy } from "../liquidators/IRedemptionStrategy.sol " ;
27
+ import { IFundsConversionStrategy } from "../liquidators/IFundsConversionStrategy.sol " ;
25
28
26
29
contract PermissionedLiquidationsMarketTest is MarketsTest {
27
30
ICErc20 wethMarket;
28
31
ICErc20 usdtMarket;
32
+
33
+ ICErc20 wethNativeMarket;
34
+ ICErc20 usdcNativeMarket;
35
+ ICErc20 usdtNativeMarket;
36
+ ICErc20 modeNativeMarket;
37
+
29
38
IonicComptroller pool;
30
39
PoolLens lens;
31
40
address borrower;
@@ -37,6 +46,12 @@ contract PermissionedLiquidationsMarketTest is MarketsTest {
37
46
38
47
wethMarket = ICErc20 (0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2 );
39
48
usdtMarket = ICErc20 (0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3 );
49
+
50
+ wethNativeMarket = ICErc20 (0xDb8eE6D1114021A94A045956BBeeCF35d13a30F2 );
51
+ usdcNativeMarket = ICErc20 (0xc53edEafb6D502DAEC5A7015D67936CEa0cD0F52 );
52
+ usdtNativeMarket = ICErc20 (0x3120B4907851cc9D780eef9aF88ae4d5360175Fd );
53
+ modeNativeMarket = ICErc20 (0x4341620757Bee7EB4553912FaFC963e59C949147 );
54
+
40
55
pool = IonicComptroller (0xFB3323E24743Caf4ADD0fDCCFB268565c0685556 );
41
56
lens = PoolLens (0x70BB19a56BfAEc65aE861E6275A90163AbDF36a6 );
42
57
ffd = FeeDistributor (payable (ap.getAddress ("FeeDistributor " )));
@@ -164,6 +179,54 @@ contract PermissionedLiquidationsMarketTest is MarketsTest {
164
179
vm.stopPrank ();
165
180
}
166
181
182
+ function testPostUpgradeLiquidate () public debuggingOnly fork (MODE_MAINNET) {
183
+ address borrower = 0xE10B38bbe359656066b3c4648DfEa7018711c35f ;
184
+ PoolLens.PoolAsset[] memory assets = lens.getPoolAssetsByUser (pool, borrower);
185
+
186
+ for (uint i; i < assets.length ; i++ ) {
187
+ emit log_named_string ("Asset Named " , assets[i].underlyingName);
188
+ emit log_named_uint ("Supply Balance " , assets[i].supplyBalance);
189
+ emit log_named_uint ("Borrow Balance " , assets[i].borrowBalance);
190
+ emit log_named_uint ("Liquidity " , assets[i].liquidity);
191
+ emit log ("---------------------------------------------------- " );
192
+ }
193
+
194
+ emit log_named_uint ("HF " , lens.getHealthFactor (borrower, pool));
195
+
196
+ // vm.startPrank(0x344d9C4f488bb5519D390304457D64034618145C);
197
+
198
+ // ERC20(0xd988097fb8612cc24eeC14542bC03424c656005f).approve(address(uniV3liquidator), 4000);
199
+
200
+ // // ILiquidator.LiquidateToTokensWithFlashSwapVars memory vars = ILiquidator.LiquidateToTokensWithFlashSwapVars({
201
+ // // borrower: borrower,
202
+ // // repayAmount: 4000,
203
+ // // cErc20: ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038),
204
+ // // cTokenCollateral: wethMarket,
205
+ // // flashSwapContract: 0x468cC91dF6F669CaE6cdCE766995Bd7874052FBc,
206
+ // // minProfitAmount: 0,
207
+ // // redemptionStrategies: new IRedemptionStrategy[](0),
208
+ // // strategyData: new bytes[](0),
209
+ // // debtFundingStrategies: new IFundsConversionStrategy[](0),
210
+ // // debtFundingStrategiesData: new bytes[](0)
211
+ // // });
212
+ // // uniV3liquidator.safeLiquidateToTokensWithFlashLoan(vars);
213
+
214
+ // uniV3liquidator.safeLiquidate(borrower, 4000, ICErc20(0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038), wethMarket, 0);
215
+
216
+ // vm.stopPrank();
217
+
218
+ // emit log_named_uint("HF", lens.getHealthFactor(borrower, pool));
219
+ }
220
+
221
+ function testUpgradeNativeMarket () public debuggingOnly fork (MODE_MAINNET) {
222
+ _upgradeMarket (wethNativeMarket);
223
+ _upgradeMarket (usdcNativeMarket);
224
+ _upgradeMarket (usdtNativeMarket);
225
+ _upgradeMarket (modeNativeMarket);
226
+ _upgradeMarket (wethMarket);
227
+ _upgradeMarket (usdtMarket);
228
+ }
229
+
167
230
struct CErc20StorageStruct {
168
231
address ionicAdmin;
169
232
string name;
@@ -431,4 +494,28 @@ contract PermissionedLiquidationsMarketTest is MarketsTest {
431
494
"Mismatch in feeSeizeShareMantissa "
432
495
);
433
496
}
497
+
498
+ function testCurrentMarkets () public debuggingOnly forkAtBlock (MODE_MAINNET, 10785800 ) {
499
+ address [] memory ionAddresses = new address [](10 );
500
+
501
+ _upgradeMarket (wethMarket);
502
+
503
+ ionAddresses[0 ] = 0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2 ;
504
+ ionAddresses[1 ] = 0x2BE717340023C9e14C1Bb12cb3ecBcfd3c3fB038 ;
505
+ ionAddresses[2 ] = 0x94812F2eEa03A49869f95e1b5868C6f3206ee3D3 ;
506
+ ionAddresses[3 ] = 0xd70254C3baD29504789714A7c69d60Ec1127375C ;
507
+ ionAddresses[4 ] = 0x59e710215d45F584f44c0FEe83DA6d43D762D857 ;
508
+ ionAddresses[5 ] = 0x959FA710CCBb22c7Ce1e59Da82A247e686629310 ;
509
+ ionAddresses[6 ] = 0x49950319aBE7CE5c3A6C90698381b45989C99b46 ;
510
+ ionAddresses[7 ] = 0xA0D844742B4abbbc43d8931a6Edb00C56325aA18 ;
511
+ ionAddresses[8 ] = 0x9a9072302B775FfBd3Db79a7766E75Cf82bcaC0A ;
512
+ ionAddresses[9 ] = 0x19F245782b1258cf3e11Eda25784A378cC18c108 ;
513
+
514
+ address ap;
515
+ for (uint i = 0 ; i < ionAddresses.length ; i++ ) {
516
+ // ap = address(CTokenFirstExtension(ionAddresses[i]).ap());
517
+ ap = address (CTokenFirstExtension (address (wethMarket)).ap ());
518
+ emit log_named_address ("ap " , ap);
519
+ }
520
+ }
434
521
}
0 commit comments