@@ -7,6 +7,8 @@ import {IBaseManager} from "v2-core/src/interfaces/IBaseManager.sol";
7
7
import {ISubAccounts} from "v2-core/src/interfaces/ISubAccounts.sol " ;
8
8
import {IAsset} from "v2-core/src/interfaces/IAsset.sol " ;
9
9
import {DutchAuction} from "v2-core/src/liquidation/DutchAuction.sol " ;
10
+ import {IPMRM_2} from "v2-core/src/interfaces/IPMRM_2.sol " ;
11
+ import {PMRM_2} from "v2-core/src/risk-managers/PMRM_2.sol " ;
10
12
11
13
/**
12
14
* @title LyraAuctionUtils
@@ -42,11 +44,17 @@ contract LyraAuctionUtils {
42
44
return (manager, mm, mtm, 0 );
43
45
}
44
46
45
- // Otherwise we assume it is a PMRM, so we need to work out the worst scenario by getting the portfolio and
46
- // calculating margin in the lib
47
- IPMRM.Portfolio memory portfolio = PMRM (manager).arrangePortfolio (subId);
48
- (mm, mtm, worstScenario) =
47
+ try PMRM (manager).arrangePortfolio (subId) returns (IPMRM.Portfolio memory portfolio ) {
48
+ (mm, mtm, worstScenario) =
49
49
PMRM (manager).lib ().getMarginAndMarkToMarket (portfolio, false , PMRM (manager).getScenarios ());
50
+ return (manager, mm, mtm, worstScenario);
51
+ } catch {
52
+ // Falling through to PMRM_2
53
+ }
54
+
55
+ IPMRM_2.Portfolio memory portfolio = PMRM_2 (manager).arrangePortfolio (subId);
56
+ (mm, mtm, worstScenario) =
57
+ PMRM_2 (manager).lib ().getMarginAndMarkToMarket (portfolio, false , PMRM_2 (manager).getScenarios ());
50
58
}
51
59
52
60
function startInsolventAuction (uint accountId , uint worstScenario ) external {
0 commit comments