@dhedge/v2-sdk 1.10.9 → 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.
@@ -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;
@@ -4260,6 +4278,7 @@ var ManagerLogic = {
4260
4278
  Dapp["RAMSESCL"] = "ramsesCL";
4261
4279
  Dapp["PANCAKECL"] = "pancakeCL";
4262
4280
  Dapp["COMPOUNDV3"] = "compoundV3";
4281
+ Dapp["ODOS"] = "odos";
4263
4282
  })(exports.Dapp || (exports.Dapp = {}));
4264
4283
 
4265
4284
  (function (Transaction) {
@@ -4289,7 +4308,7 @@ var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _Ne
4289
4308
  require("dotenv").config();
4290
4309
 
4291
4310
  var factoryAddress = (_factoryAddress = {}, _factoryAddress[exports.Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress[exports.Network.OPTIMISM] = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", _factoryAddress[exports.Network.ARBITRUM] = "0xfffb5fb14606eb3a548c113026355020ddf27535", _factoryAddress[exports.Network.BASE] = "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F", _factoryAddress);
4292
- var routerAddress = (_routerAddress = {}, _routerAddress[exports.Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[exports.Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[exports.Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[exports.Dapp.ARRAKIS] = "0xc73fb100a995b33f9fa181d420f4c8d74506df66", _Network$POLYGON[exports.Dapp.TOROS] = "0x45b90480D6F643dE2f128db091A357C3c90399f2", _Network$POLYGON[exports.Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$POLYGON), _routerAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[exports.Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$OPTIMISM[exports.Dapp.TOROS] = "0x2Ed1bd7f66e47113672f3870308b5E867C5bb743", _Network$OPTIMISM[exports.Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[exports.Dapp.VELODROMEV2] = "0xa062ae8a9c5e11aaa026fc2670b0d65ccc8b2858", _Network$OPTIMISM[exports.Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM[exports.Dapp.ARRAKIS] = "0x9ce88a56d120300061593eF7AD074A1B710094d5", _Network$OPTIMISM[exports.Dapp.ZEROEX] = "0xdef1abe32c034e558cdd535791643c58a13acc10", _Network$OPTIMISM), _routerAddress[exports.Network.ARBITRUM] = (_Network$ARBITRUM = {}, _Network$ARBITRUM[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$ARBITRUM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$ARBITRUM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM[exports.Dapp.RAMSES] = "0xaaa87963efeb6f7e0a2711f397663105acb1805e", _Network$ARBITRUM[exports.Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$ARBITRUM[exports.Dapp.TOROS] = "0xA5679C4272A056Bb83f039961fae7D99C48529F5", _Network$ARBITRUM), _routerAddress[exports.Network.BASE] = (_Network$BASE = {}, _Network$BASE[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$BASE[exports.Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$BASE[exports.Dapp.AERODROME] = "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43", _Network$BASE[exports.Dapp.AAVEV3] = "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5", _Network$BASE[exports.Dapp.TOROS] = "0xf067575Eb60c7587C11e867907AA7284833704d1", _Network$BASE), _routerAddress);
4311
+ var routerAddress = (_routerAddress = {}, _routerAddress[exports.Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[exports.Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[exports.Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[exports.Dapp.ARRAKIS] = "0xc73fb100a995b33f9fa181d420f4c8d74506df66", _Network$POLYGON[exports.Dapp.TOROS] = "0x45b90480D6F643dE2f128db091A357C3c90399f2", _Network$POLYGON[exports.Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$POLYGON[exports.Dapp.ODOS] = "0x4e3288c9ca110bcc82bf38f09a7b425c095d92bf", _Network$POLYGON), _routerAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[exports.Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$OPTIMISM[exports.Dapp.TOROS] = "0x2Ed1bd7f66e47113672f3870308b5E867C5bb743", _Network$OPTIMISM[exports.Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[exports.Dapp.VELODROMEV2] = "0xa062ae8a9c5e11aaa026fc2670b0d65ccc8b2858", _Network$OPTIMISM[exports.Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM[exports.Dapp.ARRAKIS] = "0x9ce88a56d120300061593eF7AD074A1B710094d5", _Network$OPTIMISM[exports.Dapp.ZEROEX] = "0xdef1abe32c034e558cdd535791643c58a13acc10", _Network$OPTIMISM[exports.Dapp.ODOS] = "0xca423977156bb05b13a2ba3b76bc5419e2fe9680", _Network$OPTIMISM), _routerAddress[exports.Network.ARBITRUM] = (_Network$ARBITRUM = {}, _Network$ARBITRUM[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$ARBITRUM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$ARBITRUM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM[exports.Dapp.RAMSES] = "0xaaa87963efeb6f7e0a2711f397663105acb1805e", _Network$ARBITRUM[exports.Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$ARBITRUM[exports.Dapp.TOROS] = "0xA5679C4272A056Bb83f039961fae7D99C48529F5", _Network$ARBITRUM[exports.Dapp.ODOS] = "0xa669e7A0d4b3e4Fa48af2dE86BD4CD7126Be4e13", _Network$ARBITRUM), _routerAddress[exports.Network.BASE] = (_Network$BASE = {}, _Network$BASE[exports.Dapp.ONEINCH] = "0x111111125421ca6dc452d289314280a0f8842a65", _Network$BASE[exports.Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$BASE[exports.Dapp.AERODROME] = "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43", _Network$BASE[exports.Dapp.AAVEV3] = "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5", _Network$BASE[exports.Dapp.TOROS] = "0xf067575Eb60c7587C11e867907AA7284833704d1", _Network$BASE[exports.Dapp.ODOS] = "0x19cEeAd7105607Cd444F5ad10dd51356436095a1", _Network$BASE), _routerAddress);
4293
4312
  var dappFactoryAddress = (_dappFactoryAddress = {}, _dappFactoryAddress[exports.Network.POLYGON] = (_Network$POLYGON2 = {}, _Network$POLYGON2[exports.Dapp.SUSHISWAP] = "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", _Network$POLYGON2[exports.Dapp.QUICKSWAP] = "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32", _Network$POLYGON2), _dappFactoryAddress[exports.Network.OPTIMISM] = {}, _dappFactoryAddress[exports.Network.ARBITRUM] = {}, _dappFactoryAddress[exports.Network.BASE] = {}, _dappFactoryAddress);
4294
4313
  var stakingAddress = (_stakingAddress = {}, _stakingAddress[exports.Network.POLYGON] = (_Network$POLYGON3 = {}, _Network$POLYGON3[exports.Dapp.SUSHISWAP] = "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F", _Network$POLYGON3[exports.Dapp.BALANCER] = "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", _Network$POLYGON3[exports.Dapp.AAVE] = "0x357D51124f59836DeD84c8a1730D72B749d8BC23", _Network$POLYGON3[exports.Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$POLYGON3), _stakingAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM2 = {}, _Network$OPTIMISM2[exports.Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$OPTIMISM2[exports.Dapp.COMPOUNDV3] = "0x443ea0340cb75a160f31a440722dec7b5bc3c2e9", _Network$OPTIMISM2), _stakingAddress[exports.Network.ARBITRUM] = (_Network$ARBITRUM2 = {}, _Network$ARBITRUM2[exports.Dapp.COMPOUNDV3] = "0x88730d254a2f7e6ac8388c3198afd694ba9f7fae", _Network$ARBITRUM2[exports.Dapp.PANCAKECL] = "0x5e09ACf80C0296740eC5d6F643005a4ef8DaA694", _Network$ARBITRUM2), _stakingAddress[exports.Network.BASE] = (_Network$BASE2 = {}, _Network$BASE2[exports.Dapp.PANCAKECL] = "0xC6A2Db661D5a5690172d8eB0a7DEA2d3008665A3", _Network$BASE2), _stakingAddress);
4295
4314
  var aaveAddressProvider = (_aaveAddressProvider = {}, _aaveAddressProvider[exports.Network.POLYGON] = (_Network$POLYGON4 = {}, _Network$POLYGON4[exports.Dapp.AAVE] = "0xd05e3E715d945B59290df0ae8eF85c1BdB684744", _Network$POLYGON4[exports.Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$POLYGON4), _aaveAddressProvider[exports.Network.OPTIMISM] = (_Network$OPTIMISM3 = {}, _Network$OPTIMISM3[exports.Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$OPTIMISM3), _aaveAddressProvider[exports.Network.ARBITRUM] = (_Network$ARBITRUM3 = {}, _Network$ARBITRUM3[exports.Dapp.AAVEV3] = "0xa97684ead0e402dc232d5a977953df7ecbab3cdb", _Network$ARBITRUM3), _aaveAddressProvider[exports.Network.BASE] = (_Network$BASE3 = {}, _Network$BASE3[exports.Dapp.AAVEV3] = "0xe20fCBdBfFC4Dd138cE8b2E6FBb6CB49777ad64D", _Network$BASE3), _aaveAddressProvider);
@@ -4305,7 +4324,14 @@ var flatMoneyContractAddresses = (_flatMoneyContractAdd = {}, _flatMoneyContract
4305
4324
  DelayedOrder: "0x6D857e9D24a7566bB72a3FB0847A3E0e4E1c2879",
4306
4325
  FlatcoinVault: "0x95Fa1ddc9a78273f795e67AbE8f1Cd2Cd39831fF",
4307
4326
  StableModule: "0xb95fB324b8A2fAF8ec4f76e3dF46C718402736e2",
4308
- 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"
4309
4335
  }, _flatMoneyContractAdd);
4310
4336
 
4311
4337
  var abi$3 = [
@@ -10481,7 +10507,8 @@ var CONTRACT_ADDRESS = (_CONTRACT_ADDRESS = {}, _CONTRACT_ADDRESS[exports.Networ
10481
10507
  VELODROME_CL_USDC_WETH_GAUGE: "",
10482
10508
  VELO: "",
10483
10509
  COMPOUNDV3_WETH: "",
10484
- TOROS: ""
10510
+ TOROS: "",
10511
+ UNIT: ""
10485
10512
  }, _CONTRACT_ADDRESS[exports.Network.OPTIMISM] = {
10486
10513
  USDC: "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
10487
10514
  USDT: "",
@@ -10493,6 +10520,7 @@ var CONTRACT_ADDRESS = (_CONTRACT_ADDRESS = {}, _CONTRACT_ADDRESS[exports.Networ
10493
10520
  uniswapV3: {
10494
10521
  nonfungiblePositionManager: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
10495
10522
  },
10523
+ UNIT: "0x357CB23571EF7a3d6189b7FAcFC361eA71f7CAB5",
10496
10524
  WMATIC: "",
10497
10525
  //
10498
10526
  ARRAKIS_USDC_WETH_GAUGE: "",
@@ -10515,6 +10543,7 @@ var CONTRACT_ADDRESS = (_CONTRACT_ADDRESS = {}, _CONTRACT_ADDRESS[exports.Networ
10515
10543
  uniswapV3: {
10516
10544
  nonfungiblePositionManager: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
10517
10545
  },
10546
+ UNIT: "",
10518
10547
  //
10519
10548
  ARRAKIS_USDC_WETH_GAUGE: "",
10520
10549
  ARRAKIS_USDC_WETH_LP: "",
@@ -10530,6 +10559,7 @@ var CONTRACT_ADDRESS = (_CONTRACT_ADDRESS = {}, _CONTRACT_ADDRESS[exports.Networ
10530
10559
  WETH: "0x4200000000000000000000000000000000000006",
10531
10560
  WBTC: "",
10532
10561
  SWETH: "",
10562
+ UNIT: "0xb95fB324b8A2fAF8ec4f76e3dF46C718402736e2",
10533
10563
  uniswapV3: {
10534
10564
  nonfungiblePositionManager: ""
10535
10565
  },
@@ -16072,25 +16102,59 @@ var getPoolTxOrGasEstimate = /*#__PURE__*/function () {
16072
16102
  while (1) {
16073
16103
  switch (_context2.prev = _context2.next) {
16074
16104
  case 0:
16105
+ if (!pool.isDhedge) {
16106
+ _context2.next = 12;
16107
+ break;
16108
+ }
16109
+
16075
16110
  if (!estimateGas) {
16076
- _context2.next = 6;
16111
+ _context2.next = 7;
16077
16112
  break;
16078
16113
  }
16079
16114
 
16080
- _context2.next = 3;
16115
+ _context2.next = 4;
16081
16116
  return pool.poolLogic.estimateGas.execTransaction(args[0], args[1], args[2]);
16082
16117
 
16083
- case 3:
16118
+ case 4:
16084
16119
  return _context2.abrupt("return", _context2.sent);
16085
16120
 
16086
- case 6:
16087
- _context2.next = 8;
16121
+ case 7:
16122
+ _context2.next = 9;
16088
16123
  return pool.poolLogic.execTransaction(args[0], args[1], args[2]);
16089
16124
 
16090
- case 8:
16125
+ case 9:
16091
16126
  return _context2.abrupt("return", _context2.sent);
16092
16127
 
16093
- 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:
16094
16158
  case "end":
16095
16159
  return _context2.stop();
16096
16160
  }
@@ -21534,6 +21598,108 @@ var DelayedOrderAbi = [
21534
21598
  }
21535
21599
  ];
21536
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
+
21537
21703
  var StableModuleAbi = [
21538
21704
  {
21539
21705
  inputs: [
@@ -23408,7 +23574,7 @@ var getKeeperFeeContract = /*#__PURE__*/function () {
23408
23574
  }();
23409
23575
  var getKeeperFee = /*#__PURE__*/function () {
23410
23576
  var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, maxKeeperFeeInUsd) {
23411
- var keeperFeeContract, gasPrice, keeperfee, keeperFeeInUsd;
23577
+ var keeperFeeContract, feeHistory, gasPrice, keeperfee, keeperFeeInUsd;
23412
23578
  return runtime_1.wrap(function _callee2$(_context2) {
23413
23579
  while (1) {
23414
23580
  switch (_context2.prev = _context2.next) {
@@ -23419,49 +23585,50 @@ var getKeeperFee = /*#__PURE__*/function () {
23419
23585
  case 2:
23420
23586
  keeperFeeContract = _context2.sent;
23421
23587
  _context2.next = 5;
23422
- return pool.signer.provider.getGasPrice();
23588
+ return pool.signer.provider.send("eth_feeHistory", [1, "latest"]);
23423
23589
 
23424
23590
  case 5:
23425
- gasPrice = _context2.sent;
23591
+ feeHistory = _context2.sent;
23592
+ gasPrice = Number(feeHistory.baseFeePerGas[0]);
23426
23593
 
23427
23594
  if (!gasPrice) {
23428
- _context2.next = 12;
23595
+ _context2.next = 13;
23429
23596
  break;
23430
23597
  }
23431
23598
 
23432
- _context2.next = 9;
23433
- 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));
23434
23601
 
23435
- case 9:
23602
+ case 10:
23436
23603
  keeperfee = _context2.sent;
23437
- _context2.next = 15;
23604
+ _context2.next = 16;
23438
23605
  break;
23439
23606
 
23440
- case 12:
23441
- _context2.next = 14;
23607
+ case 13:
23608
+ _context2.next = 15;
23442
23609
  return keeperFeeContract["getKeeperFee()"]();
23443
23610
 
23444
- case 14:
23611
+ case 15:
23445
23612
  keeperfee = _context2.sent;
23446
23613
 
23447
- case 15:
23448
- _context2.next = 17;
23614
+ case 16:
23615
+ _context2.next = 18;
23449
23616
  return getKeeperFeeInUsd(pool, keeperfee);
23450
23617
 
23451
- case 17:
23618
+ case 18:
23452
23619
  keeperFeeInUsd = _context2.sent;
23453
23620
 
23454
23621
  if (!(Number.isFinite(maxKeeperFeeInUsd) && keeperFeeInUsd.gt(ethers.ethers.BigNumber.from(maxKeeperFeeInUsd).toString()))) {
23455
- _context2.next = 20;
23622
+ _context2.next = 21;
23456
23623
  break;
23457
23624
  }
23458
23625
 
23459
23626
  throw new Error("mintUnitViaFlatMoney: keeperFee too large");
23460
23627
 
23461
- case 20:
23628
+ case 21:
23462
23629
  return _context2.abrupt("return", keeperfee);
23463
23630
 
23464
- case 21:
23631
+ case 22:
23465
23632
  case "end":
23466
23633
  return _context2.stop();
23467
23634
  }
@@ -23475,7 +23642,7 @@ var getKeeperFee = /*#__PURE__*/function () {
23475
23642
  }();
23476
23643
  var getKeeperFeeInUsd = /*#__PURE__*/function () {
23477
23644
  var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(pool, keeperFee) {
23478
- var flatMoneyContracts, fundComposition, filteredFc, rateD1;
23645
+ var flatMoneyContracts, fundComposition, filteredFc, rateD1, assetDecimal;
23479
23646
  return runtime_1.wrap(function _callee3$(_context3) {
23480
23647
  while (1) {
23481
23648
  switch (_context3.prev = _context3.next) {
@@ -23496,7 +23663,7 @@ var getKeeperFeeInUsd = /*#__PURE__*/function () {
23496
23663
  case 5:
23497
23664
  fundComposition = _context3.sent;
23498
23665
  filteredFc = fundComposition.filter(function (fc) {
23499
- return fc.asset.toLocaleLowerCase() === flatMoneyContracts.RETH.toLocaleLowerCase();
23666
+ return fc.asset.toLocaleLowerCase() === flatMoneyContracts.COLLATERAL.toLocaleLowerCase();
23500
23667
  });
23501
23668
 
23502
23669
  if (filteredFc[0]) {
@@ -23508,9 +23675,14 @@ var getKeeperFeeInUsd = /*#__PURE__*/function () {
23508
23675
 
23509
23676
  case 9:
23510
23677
  rateD1 = new BigNumber(filteredFc[0].rate.toString()).div(1e18);
23511
- return _context3.abrupt("return", rateD1.times(keeperFee.toString()).div(1e18));
23678
+ _context3.next = 12;
23679
+ return pool.utils.getDecimals(flatMoneyContracts.COLLATERAL);
23512
23680
 
23513
- 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:
23514
23686
  case "end":
23515
23687
  return _context3.stop();
23516
23688
  }
@@ -23532,6 +23704,9 @@ function getAnnounceStableWithdrawTxData(withdrawAmount, minAmountOut, keeperFee
23532
23704
  function getCancelExistingOrderTxData(account) {
23533
23705
  return new ethers.ethers.utils.Interface(DelayedOrderAbi).encodeFunctionData("cancelExistingOrder", [account]);
23534
23706
  }
23707
+ function getCancelExistingOrderTxDataForV2(account) {
23708
+ return new ethers.ethers.utils.Interface(IOrderExecutionModuleAbi).encodeFunctionData("cancelExistingOrder", [account]);
23709
+ }
23535
23710
  function mintUnitViaFlatMoney(_x, _x2, _x3, _x4, _x5, _x6) {
23536
23711
  return _mintUnitViaFlatMoney.apply(this, arguments);
23537
23712
  }
@@ -23567,7 +23742,7 @@ function _mintUnitViaFlatMoney() {
23567
23742
 
23568
23743
  case 7:
23569
23744
  keeperfee = _context.sent;
23570
- // in RETH
23745
+ // in COLLATERAL
23571
23746
  adjustedDepositAmount = new BigNumber(depositAmount.toString()).minus(keeperfee.toString() // keeper fee deducted from amountIn
23572
23747
  );
23573
23748
  _context.next = 11;
@@ -23668,7 +23843,7 @@ function cancelOrderViaFlatMoney(_x13, _x14, _x15) {
23668
23843
 
23669
23844
  function _cancelOrderViaFlatMoney() {
23670
23845
  _cancelOrderViaFlatMoney = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(pool, options, estimateGas) {
23671
- var flatMoneyContracts, cancelOrderTxData, tx;
23846
+ var flatMoneyContracts, toAddress, cancelOrderTxData, tx;
23672
23847
  return runtime_1.wrap(function _callee3$(_context3) {
23673
23848
  while (1) {
23674
23849
  switch (_context3.prev = _context3.next) {
@@ -23691,19 +23866,46 @@ function _cancelOrderViaFlatMoney() {
23691
23866
  throw new Error("cancelOrderViaFlatMoney: network not supported");
23692
23867
 
23693
23868
  case 5:
23694
- _context3.next = 7;
23695
- return getCancelExistingOrderTxData(pool.address);
23869
+ // flat money v2
23870
+ // use OrderExecution module to cancel order
23871
+ toAddress = flatMoneyContracts.DelayedOrder;
23872
+ cancelOrderTxData = getCancelExistingOrderTxData(pool.address);
23696
23873
 
23697
- 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:
23698
23884
  cancelOrderTxData = _context3.sent;
23699
- _context3.next = 10;
23700
- return getPoolTxOrGasEstimate(pool, [flatMoneyContracts.DelayedOrder, cancelOrderTxData, options], estimateGas);
23701
23885
 
23702
- 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:
23703
23905
  tx = _context3.sent;
23704
23906
  return _context3.abrupt("return", tx);
23705
23907
 
23706
- case 12:
23908
+ case 20:
23707
23909
  case "end":
23708
23910
  return _context3.stop();
23709
23911
  }
@@ -24217,8 +24419,77 @@ function getPancakeHarvestClaimTxData(pool, tokenId) {
24217
24419
  return iMasterChef.encodeFunctionData(exports.Transaction.MULTI_CALL, [multicallParams]);
24218
24420
  }
24219
24421
 
24422
+ var odosBaseUrl = "https://api.odos.xyz/sor";
24423
+ function getOdosSwapTxData(_x, _x2, _x3, _x4, _x5) {
24424
+ return _getOdosSwapTxData.apply(this, arguments);
24425
+ }
24426
+
24427
+ function _getOdosSwapTxData() {
24428
+ _getOdosSwapTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, assetFrom, assetTo, amountIn, slippage) {
24429
+ var referralCode, quoteParams, quoteResult, assembleParams, assembleResult;
24430
+ return runtime_1.wrap(function _callee$(_context) {
24431
+ while (1) {
24432
+ switch (_context.prev = _context.next) {
24433
+ case 0:
24434
+ referralCode = 0; // Defaults to 0 for unregistered activity.
24435
+
24436
+ if (process.env.ODOS_REFERAL_CODE && Number(process.env.ODOS_REFERAL_CODE) > 0) {
24437
+ referralCode = Number(process.env.ODOS_REFERAL_CODE);
24438
+ }
24439
+
24440
+ quoteParams = {
24441
+ chainId: networkChainIdMap[pool.network],
24442
+ inputTokens: [{
24443
+ tokenAddress: assetFrom,
24444
+ amount: amountIn.toString()
24445
+ }],
24446
+ outputTokens: [{
24447
+ tokenAddress: assetTo,
24448
+ proportion: 1
24449
+ }],
24450
+ slippageLimitPercent: slippage,
24451
+ userAddr: pool.address,
24452
+ referralCode: referralCode
24453
+ };
24454
+ _context.prev = 3;
24455
+ _context.next = 6;
24456
+ return axios.post(odosBaseUrl + "/quote/v2", quoteParams);
24457
+
24458
+ case 6:
24459
+ quoteResult = _context.sent;
24460
+ assembleParams = {
24461
+ pathId: quoteResult.data.pathId,
24462
+ userAddr: pool.address
24463
+ };
24464
+ _context.next = 10;
24465
+ return axios.post(odosBaseUrl + "/assemble", assembleParams);
24466
+
24467
+ case 10:
24468
+ assembleResult = _context.sent;
24469
+ return _context.abrupt("return", assembleResult.data.transaction.data);
24470
+
24471
+ case 14:
24472
+ _context.prev = 14;
24473
+ _context.t0 = _context["catch"](3);
24474
+ console.error("Error in Odos API request:", _context.t0);
24475
+ throw new ApiError("Swap api request of Odos failed");
24476
+
24477
+ case 18:
24478
+ case "end":
24479
+ return _context.stop();
24480
+ }
24481
+ }
24482
+ }, _callee, null, [[3, 14]]);
24483
+ }));
24484
+ return _getOdosSwapTxData.apply(this, arguments);
24485
+ }
24486
+
24220
24487
  var Pool = /*#__PURE__*/function () {
24221
- 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
+
24222
24493
  this.network = network;
24223
24494
  this.poolLogic = poolLogic;
24224
24495
  this.address = poolLogic.address;
@@ -24226,6 +24497,7 @@ var Pool = /*#__PURE__*/function () {
24226
24497
  this.signer = signer;
24227
24498
  this.utils = utils;
24228
24499
  this.factory = factory;
24500
+ this.isDhedge = isDhedge;
24229
24501
  }
24230
24502
  /**
24231
24503
  * Return the assets with balances and deposit info of a pool
@@ -24749,7 +25021,7 @@ var Pool = /*#__PURE__*/function () {
24749
25021
  }
24750
25022
 
24751
25023
  _context10.t0 = dapp;
24752
- _context10.next = _context10.t0 === exports.Dapp.ZEROEX ? 6 : _context10.t0 === exports.Dapp.ONEINCH ? 10 : _context10.t0 === exports.Dapp.BALANCER ? 15 : _context10.t0 === exports.Dapp.SYNTHETIX ? 19 : _context10.t0 === exports.Dapp.TOROS ? 26 : 30;
25024
+ _context10.next = _context10.t0 === exports.Dapp.ZEROEX ? 6 : _context10.t0 === exports.Dapp.ONEINCH ? 10 : _context10.t0 === exports.Dapp.BALANCER ? 15 : _context10.t0 === exports.Dapp.SYNTHETIX ? 19 : _context10.t0 === exports.Dapp.TOROS ? 26 : _context10.t0 === exports.Dapp.ODOS ? 30 : 34;
24753
25025
  break;
24754
25026
 
24755
25027
  case 6:
@@ -24758,7 +25030,7 @@ var Pool = /*#__PURE__*/function () {
24758
25030
 
24759
25031
  case 8:
24760
25032
  swapTxData = _context10.sent;
24761
- return _context10.abrupt("break", 45);
25033
+ return _context10.abrupt("break", 49);
24762
25034
 
24763
25035
  case 10:
24764
25036
  _context10.next = 12;
@@ -24767,7 +25039,7 @@ var Pool = /*#__PURE__*/function () {
24767
25039
  case 12:
24768
25040
  _yield$getOneInchSwap = _context10.sent;
24769
25041
  swapTxData = _yield$getOneInchSwap.swapTxData;
24770
- return _context10.abrupt("break", 45);
25042
+ return _context10.abrupt("break", 49);
24771
25043
 
24772
25044
  case 15:
24773
25045
  _context10.next = 17;
@@ -24775,7 +25047,7 @@ var Pool = /*#__PURE__*/function () {
24775
25047
 
24776
25048
  case 17:
24777
25049
  swapTxData = _context10.sent;
24778
- return _context10.abrupt("break", 45);
25050
+ return _context10.abrupt("break", 49);
24779
25051
 
24780
25052
  case 19:
24781
25053
  iSynthetix = new ethers.ethers.utils.Interface(ISynthetix.abi);
@@ -24788,7 +25060,7 @@ var Pool = /*#__PURE__*/function () {
24788
25060
  case 23:
24789
25061
  daoAddress = _context10.sent;
24790
25062
  swapTxData = iSynthetix.encodeFunctionData(exports.Transaction.SWAP_SYNTHS, [assets[0], amountIn, assets[1], daoAddress, SYNTHETIX_TRACKING_CODE]);
24791
- return _context10.abrupt("break", 45);
25063
+ return _context10.abrupt("break", 49);
24792
25064
 
24793
25065
  case 26:
24794
25066
  _context10.next = 28;
@@ -24796,14 +25068,22 @@ var Pool = /*#__PURE__*/function () {
24796
25068
 
24797
25069
  case 28:
24798
25070
  swapTxData = _context10.sent;
24799
- return _context10.abrupt("break", 45);
25071
+ return _context10.abrupt("break", 49);
24800
25072
 
24801
25073
  case 30:
25074
+ _context10.next = 32;
25075
+ return getOdosSwapTxData(this, assetFrom, assetTo, amountIn, slippage);
25076
+
25077
+ case 32:
25078
+ swapTxData = _context10.sent;
25079
+ return _context10.abrupt("break", 49);
25080
+
25081
+ case 34:
24802
25082
  iUniswapV2Router = new ethers.ethers.utils.Interface(IUniswapV2Router.abi);
24803
- _context10.next = 33;
25083
+ _context10.next = 37;
24804
25084
  return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
24805
25085
 
24806
- case 33:
25086
+ case 37:
24807
25087
  minAmountOut = _context10.sent;
24808
25088
  _context10.t1 = iUniswapV2Router;
24809
25089
  _context10.t2 = exports.Transaction.SWAP;
@@ -24811,23 +25091,23 @@ var Pool = /*#__PURE__*/function () {
24811
25091
  _context10.t4 = minAmountOut;
24812
25092
  _context10.t5 = [assetFrom, assetTo];
24813
25093
  _context10.t6 = this.address;
24814
- _context10.next = 42;
25094
+ _context10.next = 46;
24815
25095
  return getDeadline(this);
24816
25096
 
24817
- case 42:
25097
+ case 46:
24818
25098
  _context10.t7 = _context10.sent;
24819
25099
  _context10.t8 = [_context10.t3, _context10.t4, _context10.t5, _context10.t6, _context10.t7];
24820
25100
  swapTxData = _context10.t1.encodeFunctionData.call(_context10.t1, _context10.t2, _context10.t8);
24821
25101
 
24822
- case 45:
24823
- _context10.next = 47;
25102
+ case 49:
25103
+ _context10.next = 51;
24824
25104
  return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], swapTxData, options], estimateGas);
24825
25105
 
24826
- case 47:
25106
+ case 51:
24827
25107
  tx = _context10.sent;
24828
25108
  return _context10.abrupt("return", tx);
24829
25109
 
24830
- case 49:
25110
+ case 53:
24831
25111
  case "end":
24832
25112
  return _context10.stop();
24833
25113
  }
@@ -31031,22 +31311,35 @@ var Dhedge = /*#__PURE__*/function () {
31031
31311
  _proto.loadPool =
31032
31312
  /*#__PURE__*/
31033
31313
  function () {
31034
- var _loadPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(address) {
31314
+ var _loadPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(address, isDhedge) {
31035
31315
  var poolLogic, managerLogicAddress, managerLogic;
31036
31316
  return runtime_1.wrap(function _callee2$(_context2) {
31037
31317
  while (1) {
31038
31318
  switch (_context2.prev = _context2.next) {
31039
31319
  case 0:
31320
+ if (isDhedge === void 0) {
31321
+ isDhedge = true;
31322
+ }
31323
+
31040
31324
  poolLogic = new ethers.Contract(address, PoolLogic.abi, this.signer);
31041
- _context2.next = 3;
31325
+ managerLogicAddress = address;
31326
+
31327
+ if (!isDhedge) {
31328
+ _context2.next = 7;
31329
+ break;
31330
+ }
31331
+
31332
+ _context2.next = 6;
31042
31333
  return poolLogic.poolManagerLogic();
31043
31334
 
31044
- case 3:
31335
+ case 6:
31045
31336
  managerLogicAddress = _context2.sent;
31337
+
31338
+ case 7:
31046
31339
  managerLogic = new ethers.Contract(managerLogicAddress, ManagerLogic.abi, this.signer);
31047
- 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));
31048
31341
 
31049
- case 6:
31342
+ case 9:
31050
31343
  case "end":
31051
31344
  return _context2.stop();
31052
31345
  }
@@ -31054,7 +31347,7 @@ var Dhedge = /*#__PURE__*/function () {
31054
31347
  }, _callee2, this);
31055
31348
  }));
31056
31349
 
31057
- function loadPool(_x7) {
31350
+ function loadPool(_x7, _x8) {
31058
31351
  return _loadPool.apply(this, arguments);
31059
31352
  }
31060
31353