@dhedge/v2-sdk 1.10.10 → 1.10.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/config.d.ts CHANGED
@@ -14,8 +14,9 @@ export declare const MaxUint128 = "0xffffffffffffffffffffffffffffffff";
14
14
  export declare const UNISWAPV3_QUOTER_ADDRESS = "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6";
15
15
  export declare const SYNTHETIX_TRACKING_CODE = "0x4448454447450000000000000000000000000000000000000000000000000000";
16
16
  export declare const flatMoneyContractAddresses: Readonly<Partial<Record<Network, {
17
+ OrderExecution?: string;
17
18
  DelayedOrder: string;
18
19
  FlatcoinVault: string;
19
20
  StableModule: string;
20
- RETH: string;
21
+ COLLATERAL: string;
21
22
  }>>>;
@@ -25,7 +25,7 @@ export declare class Dhedge {
25
25
  * @param {string} address Pool address
26
26
  * @returns {Pool} Loaded Pool
27
27
  */
28
- loadPool(address: string): Promise<Pool>;
28
+ loadPool(address: string, isDhedge?: boolean): Promise<Pool>;
29
29
  /**
30
30
  * Check if pool address is valid
31
31
  * @param {string} address Pool address
@@ -9,7 +9,8 @@ export declare class Pool {
9
9
  readonly address: string;
10
10
  readonly utils: Utils;
11
11
  readonly network: Network;
12
- constructor(network: Network, signer: Wallet, poolLogic: Contract, mangerLogic: Contract, utils: Utils, factory: Contract);
12
+ readonly isDhedge: boolean;
13
+ constructor(network: Network, signer: Wallet, poolLogic: Contract, mangerLogic: Contract, utils: Utils, factory: Contract, isDhedge?: boolean);
13
14
  /**
14
15
  * Return the assets with balances and deposit info of a pool
15
16
  * @returns {Promise<FundComposition[]>} Composition of assets with balance, deposit info
@@ -2,6 +2,7 @@ import { Pool, ethers } from "../..";
2
2
  export declare function getAnnounceStableDepositTxData(depositAmount: ethers.BigNumber | string, minAmountOut: ethers.BigNumber | string, keeperFee: ethers.BigNumber | string): string;
3
3
  export declare function getAnnounceStableWithdrawTxData(withdrawAmount: ethers.BigNumber | string, minAmountOut: ethers.BigNumber | string, keeperFee: ethers.BigNumber | string): string;
4
4
  export declare function getCancelExistingOrderTxData(account: string): string;
5
+ export declare function getCancelExistingOrderTxDataForV2(account: string): string;
5
6
  export declare function mintUnitViaFlatMoney(pool: Pool, depositAmount: ethers.BigNumber | string, slippage: number, // 0.5 means 0.5%
6
7
  maxKeeperFeeInUsd: number | null, options?: any, estimateGas?: boolean): Promise<any>;
7
8
  export declare function redeemUnitViaFlatMoney(pool: Pool, withdrawAmount: ethers.BigNumber | string, slippage: number, // 0.5 means 0.5%
@@ -37,6 +37,7 @@ export declare const CONTRACT_ADDRESS: {
37
37
  VELO: string;
38
38
  COMPOUNDV3_WETH: string;
39
39
  TOROS: string;
40
+ UNIT: string;
40
41
  };
41
42
  optimism: {
42
43
  USDC: string;
@@ -49,6 +50,7 @@ export declare const CONTRACT_ADDRESS: {
49
50
  uniswapV3: {
50
51
  nonfungiblePositionManager: string;
51
52
  };
53
+ UNIT: string;
52
54
  WMATIC: string;
53
55
  ARRAKIS_USDC_WETH_GAUGE: string;
54
56
  ARRAKIS_USDC_WETH_LP: string;
@@ -70,6 +72,7 @@ export declare const CONTRACT_ADDRESS: {
70
72
  uniswapV3: {
71
73
  nonfungiblePositionManager: string;
72
74
  };
75
+ UNIT: string;
73
76
  ARRAKIS_USDC_WETH_GAUGE: string;
74
77
  ARRAKIS_USDC_WETH_LP: string;
75
78
  WMATIC: string;
@@ -85,6 +88,7 @@ export declare const CONTRACT_ADDRESS: {
85
88
  WETH: string;
86
89
  WBTC: string;
87
90
  SWETH: string;
91
+ UNIT: string;
88
92
  uniswapV3: {
89
93
  nonfungiblePositionManager: string;
90
94
  };
@@ -53,6 +53,24 @@ function _asyncToGenerator(fn) {
53
53
  };
54
54
  }
55
55
 
56
+ function _extends() {
57
+ _extends = Object.assign || function (target) {
58
+ for (var i = 1; i < arguments.length; i++) {
59
+ var source = arguments[i];
60
+
61
+ for (var key in source) {
62
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
63
+ target[key] = source[key];
64
+ }
65
+ }
66
+ }
67
+
68
+ return target;
69
+ };
70
+
71
+ return _extends.apply(this, arguments);
72
+ }
73
+
56
74
  function _inheritsLoose(subClass, superClass) {
57
75
  subClass.prototype = Object.create(superClass.prototype);
58
76
  subClass.prototype.constructor = subClass;
@@ -4306,7 +4324,14 @@ var flatMoneyContractAddresses = (_flatMoneyContractAdd = {}, _flatMoneyContract
4306
4324
  DelayedOrder: "0x6D857e9D24a7566bB72a3FB0847A3E0e4E1c2879",
4307
4325
  FlatcoinVault: "0x95Fa1ddc9a78273f795e67AbE8f1Cd2Cd39831fF",
4308
4326
  StableModule: "0xb95fB324b8A2fAF8ec4f76e3dF46C718402736e2",
4309
- RETH: "0xb6fe221fe9eef5aba221c348ba20a1bf5e73624c"
4327
+ COLLATERAL: "0xb6fe221fe9eef5aba221c348ba20a1bf5e73624c" // RETH
4328
+
4329
+ }, _flatMoneyContractAdd[exports.Network.OPTIMISM] = {
4330
+ OrderExecution: "0x7805CB7fb2C2e70FDdF92949065D9Ee1Fc2F72a8",
4331
+ DelayedOrder: "0xd917A0C9B21Bb71DF1209d2c211Ad83004F01554",
4332
+ FlatcoinVault: "0x86C7b9640302082B0dF78023F930d8612bFcaD3f",
4333
+ COLLATERAL: "0x68f180fcCe6836688e9084f035309E29Bf0A2095",
4334
+ StableModule: "0x357CB23571EF7a3d6189b7FAcFC361eA71f7CAB5"
4310
4335
  }, _flatMoneyContractAdd);
4311
4336
 
4312
4337
  var abi$3 = [
@@ -10482,7 +10507,8 @@ var CONTRACT_ADDRESS = (_CONTRACT_ADDRESS = {}, _CONTRACT_ADDRESS[exports.Networ
10482
10507
  VELODROME_CL_USDC_WETH_GAUGE: "",
10483
10508
  VELO: "",
10484
10509
  COMPOUNDV3_WETH: "",
10485
- TOROS: ""
10510
+ TOROS: "",
10511
+ UNIT: ""
10486
10512
  }, _CONTRACT_ADDRESS[exports.Network.OPTIMISM] = {
10487
10513
  USDC: "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
10488
10514
  USDT: "",
@@ -10494,6 +10520,7 @@ var CONTRACT_ADDRESS = (_CONTRACT_ADDRESS = {}, _CONTRACT_ADDRESS[exports.Networ
10494
10520
  uniswapV3: {
10495
10521
  nonfungiblePositionManager: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
10496
10522
  },
10523
+ UNIT: "0x357CB23571EF7a3d6189b7FAcFC361eA71f7CAB5",
10497
10524
  WMATIC: "",
10498
10525
  //
10499
10526
  ARRAKIS_USDC_WETH_GAUGE: "",
@@ -10516,6 +10543,7 @@ var CONTRACT_ADDRESS = (_CONTRACT_ADDRESS = {}, _CONTRACT_ADDRESS[exports.Networ
10516
10543
  uniswapV3: {
10517
10544
  nonfungiblePositionManager: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
10518
10545
  },
10546
+ UNIT: "",
10519
10547
  //
10520
10548
  ARRAKIS_USDC_WETH_GAUGE: "",
10521
10549
  ARRAKIS_USDC_WETH_LP: "",
@@ -10531,6 +10559,7 @@ var CONTRACT_ADDRESS = (_CONTRACT_ADDRESS = {}, _CONTRACT_ADDRESS[exports.Networ
10531
10559
  WETH: "0x4200000000000000000000000000000000000006",
10532
10560
  WBTC: "",
10533
10561
  SWETH: "",
10562
+ UNIT: "0xb95fB324b8A2fAF8ec4f76e3dF46C718402736e2",
10534
10563
  uniswapV3: {
10535
10564
  nonfungiblePositionManager: ""
10536
10565
  },
@@ -16073,25 +16102,59 @@ var getPoolTxOrGasEstimate = /*#__PURE__*/function () {
16073
16102
  while (1) {
16074
16103
  switch (_context2.prev = _context2.next) {
16075
16104
  case 0:
16105
+ if (!pool.isDhedge) {
16106
+ _context2.next = 12;
16107
+ break;
16108
+ }
16109
+
16076
16110
  if (!estimateGas) {
16077
- _context2.next = 6;
16111
+ _context2.next = 7;
16078
16112
  break;
16079
16113
  }
16080
16114
 
16081
- _context2.next = 3;
16115
+ _context2.next = 4;
16082
16116
  return pool.poolLogic.estimateGas.execTransaction(args[0], args[1], args[2]);
16083
16117
 
16084
- case 3:
16118
+ case 4:
16085
16119
  return _context2.abrupt("return", _context2.sent);
16086
16120
 
16087
- case 6:
16088
- _context2.next = 8;
16121
+ case 7:
16122
+ _context2.next = 9;
16089
16123
  return pool.poolLogic.execTransaction(args[0], args[1], args[2]);
16090
16124
 
16091
- case 8:
16125
+ case 9:
16092
16126
  return _context2.abrupt("return", _context2.sent);
16093
16127
 
16094
- case 9:
16128
+ case 10:
16129
+ _context2.next = 21;
16130
+ break;
16131
+
16132
+ case 12:
16133
+ if (!estimateGas) {
16134
+ _context2.next = 18;
16135
+ break;
16136
+ }
16137
+
16138
+ _context2.next = 15;
16139
+ return pool.signer.estimateGas({
16140
+ to: args[0],
16141
+ data: args[1]
16142
+ });
16143
+
16144
+ case 15:
16145
+ return _context2.abrupt("return", _context2.sent);
16146
+
16147
+ case 18:
16148
+ _context2.next = 20;
16149
+ return pool.signer.sendTransaction(_extends({
16150
+ to: args[0],
16151
+ data: args[1]
16152
+ }, args[2]));
16153
+
16154
+ case 20:
16155
+ return _context2.abrupt("return", _context2.sent);
16156
+
16157
+ case 21:
16095
16158
  case "end":
16096
16159
  return _context2.stop();
16097
16160
  }
@@ -21535,6 +21598,108 @@ var DelayedOrderAbi = [
21535
21598
  }
21536
21599
  ];
21537
21600
 
21601
+ var IOrderExecutionModuleAbi = [
21602
+ {
21603
+ type: "function",
21604
+ name: "cancelExistingOrder",
21605
+ inputs: [
21606
+ {
21607
+ name: "account",
21608
+ type: "address",
21609
+ internalType: "address"
21610
+ }
21611
+ ],
21612
+ outputs: [
21613
+ ],
21614
+ stateMutability: "nonpayable"
21615
+ },
21616
+ {
21617
+ type: "function",
21618
+ name: "cancelOrderByModule",
21619
+ inputs: [
21620
+ {
21621
+ name: "account",
21622
+ type: "address",
21623
+ internalType: "address"
21624
+ }
21625
+ ],
21626
+ outputs: [
21627
+ ],
21628
+ stateMutability: "nonpayable"
21629
+ },
21630
+ {
21631
+ type: "function",
21632
+ name: "executeLimitOrder",
21633
+ inputs: [
21634
+ {
21635
+ name: "tokenId",
21636
+ type: "uint256",
21637
+ internalType: "uint256"
21638
+ },
21639
+ {
21640
+ name: "priceUpdateData",
21641
+ type: "bytes[]",
21642
+ internalType: "bytes[]"
21643
+ }
21644
+ ],
21645
+ outputs: [
21646
+ ],
21647
+ stateMutability: "payable"
21648
+ },
21649
+ {
21650
+ type: "function",
21651
+ name: "executeOrder",
21652
+ inputs: [
21653
+ {
21654
+ name: "account",
21655
+ type: "address",
21656
+ internalType: "address"
21657
+ },
21658
+ {
21659
+ name: "priceUpdateData",
21660
+ type: "bytes[]",
21661
+ internalType: "bytes[]"
21662
+ }
21663
+ ],
21664
+ outputs: [
21665
+ ],
21666
+ stateMutability: "payable"
21667
+ },
21668
+ {
21669
+ type: "function",
21670
+ name: "hasOrderExpired",
21671
+ inputs: [
21672
+ {
21673
+ name: "account",
21674
+ type: "address",
21675
+ internalType: "address"
21676
+ }
21677
+ ],
21678
+ outputs: [
21679
+ {
21680
+ name: "expired",
21681
+ type: "bool",
21682
+ internalType: "bool"
21683
+ }
21684
+ ],
21685
+ stateMutability: "view"
21686
+ },
21687
+ {
21688
+ type: "function",
21689
+ name: "maxExecutabilityAge",
21690
+ inputs: [
21691
+ ],
21692
+ outputs: [
21693
+ {
21694
+ name: "maxExecutabilityAge",
21695
+ type: "uint64",
21696
+ internalType: "uint64"
21697
+ }
21698
+ ],
21699
+ stateMutability: "view"
21700
+ }
21701
+ ];
21702
+
21538
21703
  var StableModuleAbi = [
21539
21704
  {
21540
21705
  inputs: [
@@ -23409,7 +23574,7 @@ var getKeeperFeeContract = /*#__PURE__*/function () {
23409
23574
  }();
23410
23575
  var getKeeperFee = /*#__PURE__*/function () {
23411
23576
  var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, maxKeeperFeeInUsd) {
23412
- var keeperFeeContract, gasPrice, keeperfee, keeperFeeInUsd;
23577
+ var keeperFeeContract, feeHistory, gasPrice, keeperfee, keeperFeeInUsd;
23413
23578
  return runtime_1.wrap(function _callee2$(_context2) {
23414
23579
  while (1) {
23415
23580
  switch (_context2.prev = _context2.next) {
@@ -23420,49 +23585,50 @@ var getKeeperFee = /*#__PURE__*/function () {
23420
23585
  case 2:
23421
23586
  keeperFeeContract = _context2.sent;
23422
23587
  _context2.next = 5;
23423
- return pool.signer.provider.getGasPrice();
23588
+ return pool.signer.provider.send("eth_feeHistory", [1, "latest"]);
23424
23589
 
23425
23590
  case 5:
23426
- gasPrice = _context2.sent;
23591
+ feeHistory = _context2.sent;
23592
+ gasPrice = Number(feeHistory.baseFeePerGas[0]);
23427
23593
 
23428
23594
  if (!gasPrice) {
23429
- _context2.next = 12;
23595
+ _context2.next = 13;
23430
23596
  break;
23431
23597
  }
23432
23598
 
23433
- _context2.next = 9;
23434
- return keeperFeeContract["getKeeperFee(uint256)"](new BigNumber(gasPrice.toString()).times(1.2).toFixed(0));
23599
+ _context2.next = 10;
23600
+ return keeperFeeContract["getKeeperFee(uint256)"](new BigNumber(gasPrice.toString()).times(1.5).toFixed(0));
23435
23601
 
23436
- case 9:
23602
+ case 10:
23437
23603
  keeperfee = _context2.sent;
23438
- _context2.next = 15;
23604
+ _context2.next = 16;
23439
23605
  break;
23440
23606
 
23441
- case 12:
23442
- _context2.next = 14;
23607
+ case 13:
23608
+ _context2.next = 15;
23443
23609
  return keeperFeeContract["getKeeperFee()"]();
23444
23610
 
23445
- case 14:
23611
+ case 15:
23446
23612
  keeperfee = _context2.sent;
23447
23613
 
23448
- case 15:
23449
- _context2.next = 17;
23614
+ case 16:
23615
+ _context2.next = 18;
23450
23616
  return getKeeperFeeInUsd(pool, keeperfee);
23451
23617
 
23452
- case 17:
23618
+ case 18:
23453
23619
  keeperFeeInUsd = _context2.sent;
23454
23620
 
23455
23621
  if (!(Number.isFinite(maxKeeperFeeInUsd) && keeperFeeInUsd.gt(ethers.ethers.BigNumber.from(maxKeeperFeeInUsd).toString()))) {
23456
- _context2.next = 20;
23622
+ _context2.next = 21;
23457
23623
  break;
23458
23624
  }
23459
23625
 
23460
23626
  throw new Error("mintUnitViaFlatMoney: keeperFee too large");
23461
23627
 
23462
- case 20:
23628
+ case 21:
23463
23629
  return _context2.abrupt("return", keeperfee);
23464
23630
 
23465
- case 21:
23631
+ case 22:
23466
23632
  case "end":
23467
23633
  return _context2.stop();
23468
23634
  }
@@ -23476,7 +23642,7 @@ var getKeeperFee = /*#__PURE__*/function () {
23476
23642
  }();
23477
23643
  var getKeeperFeeInUsd = /*#__PURE__*/function () {
23478
23644
  var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(pool, keeperFee) {
23479
- var flatMoneyContracts, fundComposition, filteredFc, rateD1;
23645
+ var flatMoneyContracts, fundComposition, filteredFc, rateD1, assetDecimal;
23480
23646
  return runtime_1.wrap(function _callee3$(_context3) {
23481
23647
  while (1) {
23482
23648
  switch (_context3.prev = _context3.next) {
@@ -23497,7 +23663,7 @@ var getKeeperFeeInUsd = /*#__PURE__*/function () {
23497
23663
  case 5:
23498
23664
  fundComposition = _context3.sent;
23499
23665
  filteredFc = fundComposition.filter(function (fc) {
23500
- return fc.asset.toLocaleLowerCase() === flatMoneyContracts.RETH.toLocaleLowerCase();
23666
+ return fc.asset.toLocaleLowerCase() === flatMoneyContracts.COLLATERAL.toLocaleLowerCase();
23501
23667
  });
23502
23668
 
23503
23669
  if (filteredFc[0]) {
@@ -23509,9 +23675,14 @@ var getKeeperFeeInUsd = /*#__PURE__*/function () {
23509
23675
 
23510
23676
  case 9:
23511
23677
  rateD1 = new BigNumber(filteredFc[0].rate.toString()).div(1e18);
23512
- return _context3.abrupt("return", rateD1.times(keeperFee.toString()).div(1e18));
23678
+ _context3.next = 12;
23679
+ return pool.utils.getDecimals(flatMoneyContracts.COLLATERAL);
23513
23680
 
23514
- case 11:
23681
+ case 12:
23682
+ assetDecimal = _context3.sent;
23683
+ return _context3.abrupt("return", rateD1.times(keeperFee.toString()).div(Math.pow(10, assetDecimal)));
23684
+
23685
+ case 14:
23515
23686
  case "end":
23516
23687
  return _context3.stop();
23517
23688
  }
@@ -23533,6 +23704,9 @@ function getAnnounceStableWithdrawTxData(withdrawAmount, minAmountOut, keeperFee
23533
23704
  function getCancelExistingOrderTxData(account) {
23534
23705
  return new ethers.ethers.utils.Interface(DelayedOrderAbi).encodeFunctionData("cancelExistingOrder", [account]);
23535
23706
  }
23707
+ function getCancelExistingOrderTxDataForV2(account) {
23708
+ return new ethers.ethers.utils.Interface(IOrderExecutionModuleAbi).encodeFunctionData("cancelExistingOrder", [account]);
23709
+ }
23536
23710
  function mintUnitViaFlatMoney(_x, _x2, _x3, _x4, _x5, _x6) {
23537
23711
  return _mintUnitViaFlatMoney.apply(this, arguments);
23538
23712
  }
@@ -23568,7 +23742,7 @@ function _mintUnitViaFlatMoney() {
23568
23742
 
23569
23743
  case 7:
23570
23744
  keeperfee = _context.sent;
23571
- // in RETH
23745
+ // in COLLATERAL
23572
23746
  adjustedDepositAmount = new BigNumber(depositAmount.toString()).minus(keeperfee.toString() // keeper fee deducted from amountIn
23573
23747
  );
23574
23748
  _context.next = 11;
@@ -23669,7 +23843,7 @@ function cancelOrderViaFlatMoney(_x13, _x14, _x15) {
23669
23843
 
23670
23844
  function _cancelOrderViaFlatMoney() {
23671
23845
  _cancelOrderViaFlatMoney = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(pool, options, estimateGas) {
23672
- var flatMoneyContracts, cancelOrderTxData, tx;
23846
+ var flatMoneyContracts, toAddress, cancelOrderTxData, tx;
23673
23847
  return runtime_1.wrap(function _callee3$(_context3) {
23674
23848
  while (1) {
23675
23849
  switch (_context3.prev = _context3.next) {
@@ -23692,19 +23866,46 @@ function _cancelOrderViaFlatMoney() {
23692
23866
  throw new Error("cancelOrderViaFlatMoney: network not supported");
23693
23867
 
23694
23868
  case 5:
23695
- _context3.next = 7;
23696
- return getCancelExistingOrderTxData(pool.address);
23869
+ // flat money v2
23870
+ // use OrderExecution module to cancel order
23871
+ toAddress = flatMoneyContracts.DelayedOrder;
23872
+ cancelOrderTxData = getCancelExistingOrderTxData(pool.address);
23697
23873
 
23698
- case 7:
23874
+ if (!flatMoneyContracts.OrderExecution) {
23875
+ _context3.next = 12;
23876
+ break;
23877
+ }
23878
+
23879
+ toAddress = flatMoneyContracts.OrderExecution;
23880
+ _context3.next = 11;
23881
+ return getCancelExistingOrderTxDataForV2(pool.address);
23882
+
23883
+ case 11:
23699
23884
  cancelOrderTxData = _context3.sent;
23700
- _context3.next = 10;
23701
- return getPoolTxOrGasEstimate(pool, [flatMoneyContracts.DelayedOrder, cancelOrderTxData, options], estimateGas);
23702
23885
 
23703
- case 10:
23886
+ case 12:
23887
+ if (!estimateGas) {
23888
+ _context3.next = 16;
23889
+ break;
23890
+ }
23891
+
23892
+ return _context3.abrupt("return", pool.signer.estimateGas({
23893
+ to: toAddress,
23894
+ data: cancelOrderTxData
23895
+ }));
23896
+
23897
+ case 16:
23898
+ _context3.next = 18;
23899
+ return pool.signer.sendTransaction(_extends({
23900
+ to: toAddress,
23901
+ data: cancelOrderTxData
23902
+ }, options));
23903
+
23904
+ case 18:
23704
23905
  tx = _context3.sent;
23705
23906
  return _context3.abrupt("return", tx);
23706
23907
 
23707
- case 12:
23908
+ case 20:
23708
23909
  case "end":
23709
23910
  return _context3.stop();
23710
23911
  }
@@ -24284,7 +24485,11 @@ function _getOdosSwapTxData() {
24284
24485
  }
24285
24486
 
24286
24487
  var Pool = /*#__PURE__*/function () {
24287
- function Pool(network, signer, poolLogic, mangerLogic, utils, factory) {
24488
+ function Pool(network, signer, poolLogic, mangerLogic, utils, factory, isDhedge) {
24489
+ if (isDhedge === void 0) {
24490
+ isDhedge = true;
24491
+ }
24492
+
24288
24493
  this.network = network;
24289
24494
  this.poolLogic = poolLogic;
24290
24495
  this.address = poolLogic.address;
@@ -24292,6 +24497,7 @@ var Pool = /*#__PURE__*/function () {
24292
24497
  this.signer = signer;
24293
24498
  this.utils = utils;
24294
24499
  this.factory = factory;
24500
+ this.isDhedge = isDhedge;
24295
24501
  }
24296
24502
  /**
24297
24503
  * Return the assets with balances and deposit info of a pool
@@ -31105,22 +31311,35 @@ var Dhedge = /*#__PURE__*/function () {
31105
31311
  _proto.loadPool =
31106
31312
  /*#__PURE__*/
31107
31313
  function () {
31108
- var _loadPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(address) {
31314
+ var _loadPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(address, isDhedge) {
31109
31315
  var poolLogic, managerLogicAddress, managerLogic;
31110
31316
  return runtime_1.wrap(function _callee2$(_context2) {
31111
31317
  while (1) {
31112
31318
  switch (_context2.prev = _context2.next) {
31113
31319
  case 0:
31320
+ if (isDhedge === void 0) {
31321
+ isDhedge = true;
31322
+ }
31323
+
31114
31324
  poolLogic = new ethers.Contract(address, PoolLogic.abi, this.signer);
31115
- _context2.next = 3;
31325
+ managerLogicAddress = address;
31326
+
31327
+ if (!isDhedge) {
31328
+ _context2.next = 7;
31329
+ break;
31330
+ }
31331
+
31332
+ _context2.next = 6;
31116
31333
  return poolLogic.poolManagerLogic();
31117
31334
 
31118
- case 3:
31335
+ case 6:
31119
31336
  managerLogicAddress = _context2.sent;
31337
+
31338
+ case 7:
31120
31339
  managerLogic = new ethers.Contract(managerLogicAddress, ManagerLogic.abi, this.signer);
31121
- return _context2.abrupt("return", new Pool(this.network, this.signer, poolLogic, managerLogic, this.utils, this.factory));
31340
+ return _context2.abrupt("return", new Pool(this.network, this.signer, poolLogic, managerLogic, this.utils, this.factory, isDhedge));
31122
31341
 
31123
- case 6:
31342
+ case 9:
31124
31343
  case "end":
31125
31344
  return _context2.stop();
31126
31345
  }
@@ -31128,7 +31347,7 @@ var Dhedge = /*#__PURE__*/function () {
31128
31347
  }, _callee2, this);
31129
31348
  }));
31130
31349
 
31131
- function loadPool(_x7) {
31350
+ function loadPool(_x7, _x8) {
31132
31351
  return _loadPool.apply(this, arguments);
31133
31352
  }
31134
31353