@dhedge/v2-sdk 1.9.0 → 1.9.1

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.
@@ -52,6 +52,105 @@ function _asyncToGenerator(fn) {
52
52
  };
53
53
  }
54
54
 
55
+ function _inheritsLoose(subClass, superClass) {
56
+ subClass.prototype = Object.create(superClass.prototype);
57
+ subClass.prototype.constructor = subClass;
58
+
59
+ _setPrototypeOf(subClass, superClass);
60
+ }
61
+
62
+ function _getPrototypeOf(o) {
63
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
64
+ return o.__proto__ || Object.getPrototypeOf(o);
65
+ };
66
+ return _getPrototypeOf(o);
67
+ }
68
+
69
+ function _setPrototypeOf(o, p) {
70
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
71
+ o.__proto__ = p;
72
+ return o;
73
+ };
74
+
75
+ return _setPrototypeOf(o, p);
76
+ }
77
+
78
+ function _isNativeReflectConstruct() {
79
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
80
+ if (Reflect.construct.sham) return false;
81
+ if (typeof Proxy === "function") return true;
82
+
83
+ try {
84
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
85
+ return true;
86
+ } catch (e) {
87
+ return false;
88
+ }
89
+ }
90
+
91
+ function _construct(Parent, args, Class) {
92
+ if (_isNativeReflectConstruct()) {
93
+ _construct = Reflect.construct;
94
+ } else {
95
+ _construct = function _construct(Parent, args, Class) {
96
+ var a = [null];
97
+ a.push.apply(a, args);
98
+ var Constructor = Function.bind.apply(Parent, a);
99
+ var instance = new Constructor();
100
+ if (Class) _setPrototypeOf(instance, Class.prototype);
101
+ return instance;
102
+ };
103
+ }
104
+
105
+ return _construct.apply(null, arguments);
106
+ }
107
+
108
+ function _isNativeFunction(fn) {
109
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
110
+ }
111
+
112
+ function _wrapNativeSuper(Class) {
113
+ var _cache = typeof Map === "function" ? new Map() : undefined;
114
+
115
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
116
+ if (Class === null || !_isNativeFunction(Class)) return Class;
117
+
118
+ if (typeof Class !== "function") {
119
+ throw new TypeError("Super expression must either be null or a function");
120
+ }
121
+
122
+ if (typeof _cache !== "undefined") {
123
+ if (_cache.has(Class)) return _cache.get(Class);
124
+
125
+ _cache.set(Class, Wrapper);
126
+ }
127
+
128
+ function Wrapper() {
129
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
130
+ }
131
+
132
+ Wrapper.prototype = Object.create(Class.prototype, {
133
+ constructor: {
134
+ value: Wrapper,
135
+ enumerable: false,
136
+ writable: true,
137
+ configurable: true
138
+ }
139
+ });
140
+ return _setPrototypeOf(Wrapper, Class);
141
+ };
142
+
143
+ return _wrapNativeSuper(Class);
144
+ }
145
+
146
+ function _assertThisInitialized(self) {
147
+ if (self === void 0) {
148
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
149
+ }
150
+
151
+ return self;
152
+ }
153
+
55
154
  function createCommonjsModule(fn, module) {
56
155
  return module = { exports: {} }, fn(module, module.exports), module.exports;
57
156
  }
@@ -3822,7 +3921,9 @@ var ManagerLogic = {
3822
3921
  Dapp["ARRAKIS"] = "arrakis";
3823
3922
  Dapp["TOROS"] = "toros";
3824
3923
  Dapp["VELODROME"] = "velodrome";
3924
+ Dapp["VELODROMEV2"] = "velodromeV2";
3825
3925
  Dapp["LYRA"] = "lyra";
3926
+ Dapp["ZEROEX"] = "0x";
3826
3927
  })(exports.Dapp || (exports.Dapp = {}));
3827
3928
 
3828
3929
  (function (Transaction) {
@@ -3852,7 +3953,7 @@ var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _ro
3852
3953
  require("dotenv").config();
3853
3954
 
3854
3955
  var factoryAddress = (_factoryAddress = {}, _factoryAddress[exports.Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress[exports.Network.OPTIMISM] = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", _factoryAddress[exports.Network.ARBITRUM] = "0xfffb5fb14606eb3a548c113026355020ddf27535", _factoryAddress);
3855
- 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] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _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] = "0xB2F1498983bf9c9442c35F772e6C1AdE66a8DeDE", _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] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$OPTIMISM[exports.Dapp.TOROS] = "0x3988513793bCE39f0167064A9F7fC3617FaF35AB", _Network$OPTIMISM[exports.Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[exports.Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM[exports.Dapp.ARRAKIS] = "0x9ce88a56d120300061593eF7AD074A1B710094d5", _Network$OPTIMISM), _routerAddress[exports.Network.ARBITRUM] = (_Network$ARBITRUM = {}, _Network$ARBITRUM[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$ARBITRUM[exports.Dapp.UNISWAPV3] = "0xe592427a0aece92de3edee1f18e0157c05861564", _Network$ARBITRUM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM), _routerAddress);
3956
+ 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] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _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] = "0xB2F1498983bf9c9442c35F772e6C1AdE66a8DeDE", _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] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$OPTIMISM[exports.Dapp.TOROS] = "0x3988513793bCE39f0167064A9F7fC3617FaF35AB", _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] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$ARBITRUM[exports.Dapp.UNISWAPV3] = "0xe592427a0aece92de3edee1f18e0157c05861564", _Network$ARBITRUM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM), _routerAddress);
3856
3957
  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);
3857
3958
  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] = {}, _stakingAddress[exports.Network.ARBITRUM] = {}, _stakingAddress);
3858
3959
  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$OPTIMISM2 = {}, _Network$OPTIMISM2[exports.Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$OPTIMISM2), _aaveAddressProvider[exports.Network.ARBITRUM] = (_Network$ARBITRUM2 = {}, _Network$ARBITRUM2[exports.Dapp.AAVEV3] = "0xa97684ead0e402dc232d5a977953df7ecbab3cdb", _Network$ARBITRUM2), _aaveAddressProvider);
@@ -14540,10 +14641,213 @@ var abi$l = [
14540
14641
  type: "function"
14541
14642
  }
14542
14643
  ];
14543
- var IVelodromeGauge = {
14644
+ var IVelodromeGaugeV1 = {
14544
14645
  abi: abi$l
14545
14646
  };
14546
14647
 
14648
+ var abi$m = [
14649
+ {
14650
+ inputs: [
14651
+ {
14652
+ internalType: "address",
14653
+ name: "user",
14654
+ type: "address"
14655
+ }
14656
+ ],
14657
+ name: "balanceOf",
14658
+ outputs: [
14659
+ {
14660
+ internalType: "uint256",
14661
+ name: "",
14662
+ type: "uint256"
14663
+ }
14664
+ ],
14665
+ stateMutability: "view",
14666
+ type: "function"
14667
+ },
14668
+ {
14669
+ inputs: [
14670
+ {
14671
+ internalType: "uint256",
14672
+ name: "_amount",
14673
+ type: "uint256"
14674
+ },
14675
+ {
14676
+ internalType: "address",
14677
+ name: "_recipient",
14678
+ type: "address"
14679
+ }
14680
+ ],
14681
+ name: "deposit",
14682
+ outputs: [
14683
+ ],
14684
+ stateMutability: "nonpayable",
14685
+ type: "function"
14686
+ },
14687
+ {
14688
+ inputs: [
14689
+ {
14690
+ internalType: "uint256",
14691
+ name: "_amount",
14692
+ type: "uint256"
14693
+ }
14694
+ ],
14695
+ name: "deposit",
14696
+ outputs: [
14697
+ ],
14698
+ stateMutability: "nonpayable",
14699
+ type: "function"
14700
+ },
14701
+ {
14702
+ inputs: [
14703
+ {
14704
+ internalType: "address",
14705
+ name: "_account",
14706
+ type: "address"
14707
+ }
14708
+ ],
14709
+ name: "earned",
14710
+ outputs: [
14711
+ {
14712
+ internalType: "uint256",
14713
+ name: "_earned",
14714
+ type: "uint256"
14715
+ }
14716
+ ],
14717
+ stateMutability: "view",
14718
+ type: "function"
14719
+ },
14720
+ {
14721
+ inputs: [
14722
+ {
14723
+ internalType: "address",
14724
+ name: "_account",
14725
+ type: "address"
14726
+ }
14727
+ ],
14728
+ name: "getReward",
14729
+ outputs: [
14730
+ ],
14731
+ stateMutability: "nonpayable",
14732
+ type: "function"
14733
+ },
14734
+ {
14735
+ inputs: [
14736
+ ],
14737
+ name: "isPool",
14738
+ outputs: [
14739
+ {
14740
+ internalType: "bool",
14741
+ name: "_isPool",
14742
+ type: "bool"
14743
+ }
14744
+ ],
14745
+ stateMutability: "view",
14746
+ type: "function"
14747
+ },
14748
+ {
14749
+ inputs: [
14750
+ ],
14751
+ name: "lastTimeRewardApplicable",
14752
+ outputs: [
14753
+ {
14754
+ internalType: "uint256",
14755
+ name: "_time",
14756
+ type: "uint256"
14757
+ }
14758
+ ],
14759
+ stateMutability: "view",
14760
+ type: "function"
14761
+ },
14762
+ {
14763
+ inputs: [
14764
+ ],
14765
+ name: "left",
14766
+ outputs: [
14767
+ {
14768
+ internalType: "uint256",
14769
+ name: "_left",
14770
+ type: "uint256"
14771
+ }
14772
+ ],
14773
+ stateMutability: "view",
14774
+ type: "function"
14775
+ },
14776
+ {
14777
+ inputs: [
14778
+ {
14779
+ internalType: "uint256",
14780
+ name: "amount",
14781
+ type: "uint256"
14782
+ }
14783
+ ],
14784
+ name: "notifyRewardAmount",
14785
+ outputs: [
14786
+ ],
14787
+ stateMutability: "nonpayable",
14788
+ type: "function"
14789
+ },
14790
+ {
14791
+ inputs: [
14792
+ ],
14793
+ name: "rewardPerToken",
14794
+ outputs: [
14795
+ {
14796
+ internalType: "uint256",
14797
+ name: "_rewardPerToken",
14798
+ type: "uint256"
14799
+ }
14800
+ ],
14801
+ stateMutability: "view",
14802
+ type: "function"
14803
+ },
14804
+ {
14805
+ inputs: [
14806
+ ],
14807
+ name: "rewardToken",
14808
+ outputs: [
14809
+ {
14810
+ internalType: "address",
14811
+ name: "_token",
14812
+ type: "address"
14813
+ }
14814
+ ],
14815
+ stateMutability: "view",
14816
+ type: "function"
14817
+ },
14818
+ {
14819
+ inputs: [
14820
+ ],
14821
+ name: "stakingToken",
14822
+ outputs: [
14823
+ {
14824
+ internalType: "address",
14825
+ name: "_pool",
14826
+ type: "address"
14827
+ }
14828
+ ],
14829
+ stateMutability: "view",
14830
+ type: "function"
14831
+ },
14832
+ {
14833
+ inputs: [
14834
+ {
14835
+ internalType: "uint256",
14836
+ name: "_amount",
14837
+ type: "uint256"
14838
+ }
14839
+ ],
14840
+ name: "withdraw",
14841
+ outputs: [
14842
+ ],
14843
+ stateMutability: "nonpayable",
14844
+ type: "function"
14845
+ }
14846
+ ];
14847
+ var IVelodromeGaugeV2 = {
14848
+ abi: abi$m
14849
+ };
14850
+
14547
14851
  function call(_x, _x2, _x3, _x4) {
14548
14852
  return _call.apply(this, arguments);
14549
14853
  }
@@ -14579,36 +14883,47 @@ function _call() {
14579
14883
  return _call.apply(this, arguments);
14580
14884
  }
14581
14885
 
14582
- var iVelodromeGauge = /*#__PURE__*/new ethers.ethers.utils.Interface(IVelodromeGauge.abi);
14583
- function getVelodromeStakeTxData(amount) {
14584
- return iVelodromeGauge.encodeFunctionData(exports.Transaction.DEPOSIT, [amount, "0"]);
14886
+ var iVelodromeGaugeV1 = /*#__PURE__*/new ethers.ethers.utils.Interface(IVelodromeGaugeV1.abi);
14887
+ var iVelodromeGaugeV2 = /*#__PURE__*/new ethers.ethers.utils.Interface(IVelodromeGaugeV2.abi);
14888
+ function getVelodromeStakeTxData(amount, v2) {
14889
+ var depositParams = v2 ? ["deposit(uint256)", [amount]] : ["deposit", [amount, 0]];
14890
+ var iVelodromeGauge = v2 ? iVelodromeGaugeV2 : iVelodromeGaugeV1;
14891
+ return iVelodromeGauge.encodeFunctionData.apply(iVelodromeGauge, depositParams);
14585
14892
  }
14586
- function getVelodromeClaimTxData(_x, _x2) {
14893
+ function getVelodromeClaimTxData(_x, _x2, _x3) {
14587
14894
  return _getVelodromeClaimTxData.apply(this, arguments);
14588
14895
  }
14589
14896
 
14590
14897
  function _getVelodromeClaimTxData() {
14591
- _getVelodromeClaimTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, gauge) {
14898
+ _getVelodromeClaimTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, gauge, v2) {
14592
14899
  var rewardAssetCount, rewardAssets;
14593
14900
  return runtime_1.wrap(function _callee$(_context) {
14594
14901
  while (1) {
14595
14902
  switch (_context.prev = _context.next) {
14596
14903
  case 0:
14597
- _context.next = 2;
14598
- return call(pool.signer, IVelodromeGauge.abi, [gauge, "rewardsListLength", []]);
14904
+ if (!v2) {
14905
+ _context.next = 4;
14906
+ break;
14907
+ }
14599
14908
 
14600
- case 2:
14909
+ return _context.abrupt("return", iVelodromeGaugeV2.encodeFunctionData("getReward", [pool.address]));
14910
+
14911
+ case 4:
14912
+ _context.next = 6;
14913
+ return call(pool.signer, IVelodromeGaugeV1.abi, [gauge, "rewardsListLength", []]);
14914
+
14915
+ case 6:
14601
14916
  rewardAssetCount = _context.sent;
14602
- _context.next = 5;
14917
+ _context.next = 9;
14603
14918
  return Promise.all(Array.from(Array(rewardAssetCount.toNumber()).keys()).map(function (e) {
14604
- return call(pool.signer, IVelodromeGauge.abi, [gauge, "rewards", [e]]);
14919
+ return call(pool.signer, IVelodromeGaugeV1.abi, [gauge, "rewards", [e]]);
14605
14920
  }));
14606
14921
 
14607
- case 5:
14922
+ case 9:
14608
14923
  rewardAssets = _context.sent;
14609
- return _context.abrupt("return", iVelodromeGauge.encodeFunctionData("getReward", [pool.address, rewardAssets]));
14924
+ return _context.abrupt("return", iVelodromeGaugeV1.encodeFunctionData("getReward", [pool.address, rewardAssets]));
14610
14925
 
14611
- case 7:
14926
+ case 11:
14612
14927
  case "end":
14613
14928
  return _context.stop();
14614
14929
  }
@@ -14756,7 +15071,7 @@ function _getStrike() {
14756
15071
  return _getStrike.apply(this, arguments);
14757
15072
  }
14758
15073
 
14759
- var abi$m = [
15074
+ var abi$n = [
14760
15075
  {
14761
15076
  inputs: [
14762
15077
  {
@@ -16108,7 +16423,7 @@ var abi$m = [
16108
16423
  }
16109
16424
  ];
16110
16425
  var IOptionMarketWrapper = {
16111
- abi: abi$m
16426
+ abi: abi$n
16112
16427
  };
16113
16428
 
16114
16429
  function getLyraTradeOptionType(isCall, isLong, isCoveredCall) {
@@ -16125,7 +16440,7 @@ function isLong(optionType) {
16125
16440
  return optionType === 0 || optionType === 1;
16126
16441
  }
16127
16442
 
16128
- var abi$n = [
16443
+ var abi$o = [
16129
16444
  {
16130
16445
  inputs: [
16131
16446
  {
@@ -18459,7 +18774,7 @@ var abi$n = [
18459
18774
  }
18460
18775
  ];
18461
18776
  var IOptionToken = {
18462
- abi: abi$n
18777
+ abi: abi$o
18463
18778
  };
18464
18779
 
18465
18780
  function getOptionPositions(_x, _x2) {
@@ -18597,7 +18912,7 @@ function _getLyraOptionTxData() {
18597
18912
  return _getLyraOptionTxData.apply(this, arguments);
18598
18913
  }
18599
18914
 
18600
- var abi$o = [
18915
+ var abi$p = [
18601
18916
  {
18602
18917
  inputs: [
18603
18918
  {
@@ -19142,7 +19457,7 @@ var abi$o = [
19142
19457
  }
19143
19458
  ];
19144
19459
  var ISynthetixFuturesMarketV2 = {
19145
- abi: abi$o
19460
+ abi: abi$p
19146
19461
  };
19147
19462
 
19148
19463
  function getFuturesChangeMarginTxData(amount) {
@@ -19205,6 +19520,94 @@ function _getFuturesCancelOrderTxData() {
19205
19520
  return _getFuturesCancelOrderTxData.apply(this, arguments);
19206
19521
  }
19207
19522
 
19523
+ // see https://stackoverflow.com/a/41102306
19524
+ var CAN_SET_PROTOTYPE = ("setPrototypeOf" in Object);
19525
+ var ApiError = /*#__PURE__*/function (_Error) {
19526
+ _inheritsLoose(ApiError, _Error);
19527
+
19528
+ function ApiError(message) {
19529
+ var _this;
19530
+
19531
+ _this = _Error.call(this, message != null ? message : "Api request failed") || this;
19532
+ _this.name = _this.constructor.name;
19533
+ if (CAN_SET_PROTOTYPE) Object.setPrototypeOf(_assertThisInitialized(_this), (this instanceof ApiError ? this.constructor : void 0).prototype);
19534
+ return _this;
19535
+ }
19536
+
19537
+ return ApiError;
19538
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
19539
+
19540
+ // in 0x, e.g. 0.03 for 3% slippage allowed
19541
+ // 1inch slippage 0.5% represented by 0.5
19542
+ // 0x slippage 0.5% represented by 0.005
19543
+
19544
+ var getZeroExSlippage = function getZeroExSlippage(slippage) {
19545
+ return Number(slippage) / 100;
19546
+ };
19547
+
19548
+ var getZeroExTradeTxData = /*#__PURE__*/function () {
19549
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(network, assetFrom, assetTo, amountIn, slippage, takerAddress) {
19550
+ var slippagePercentage, params, response;
19551
+ return runtime_1.wrap(function _callee$(_context) {
19552
+ while (1) {
19553
+ switch (_context.prev = _context.next) {
19554
+ case 0:
19555
+ if (slippage === void 0) {
19556
+ slippage = 0.5;
19557
+ }
19558
+
19559
+ if (process.env.ZEROEX_API_KEY) {
19560
+ _context.next = 3;
19561
+ break;
19562
+ }
19563
+
19564
+ throw new Error("ZEROEX_API_KEY not configured in .env file");
19565
+
19566
+ case 3:
19567
+ _context.prev = 3;
19568
+ slippagePercentage = getZeroExSlippage(slippage);
19569
+ params = {
19570
+ buyToken: assetTo,
19571
+ sellToken: assetFrom,
19572
+ sellAmount: amountIn.toString(),
19573
+ // necessary to skip quote validation is that in which the takerAddress refers to a smart contract
19574
+ skipValidation: true,
19575
+ // Used to enable RFQ-T liquidity
19576
+ intentOnFilling: true,
19577
+ takerAddress: takerAddress,
19578
+ slippagePercentage: slippagePercentage // excludedSourcesParam
19579
+
19580
+ };
19581
+ _context.next = 8;
19582
+ return axios.get("https://" + network + ".api.0x.org/swap/v1/quote", {
19583
+ params: params,
19584
+ headers: {
19585
+ "0x-api-key": process.env.ZEROEX_API_KEY
19586
+ }
19587
+ });
19588
+
19589
+ case 8:
19590
+ response = _context.sent;
19591
+ return _context.abrupt("return", response.data.data);
19592
+
19593
+ case 12:
19594
+ _context.prev = 12;
19595
+ _context.t0 = _context["catch"](3);
19596
+ throw new ApiError("Swap api request of 0x failed");
19597
+
19598
+ case 15:
19599
+ case "end":
19600
+ return _context.stop();
19601
+ }
19602
+ }
19603
+ }, _callee, null, [[3, 12]]);
19604
+ }));
19605
+
19606
+ return function getZeroExTradeTxData(_x, _x2, _x3, _x4, _x5, _x6) {
19607
+ return _ref.apply(this, arguments);
19608
+ };
19609
+ }();
19610
+
19208
19611
  var Pool = /*#__PURE__*/function () {
19209
19612
  function Pool(network, signer, poolLogic, mangerLogic, utils, factory) {
19210
19613
  this.network = network;
@@ -19608,98 +20011,116 @@ var Pool = /*#__PURE__*/function () {
19608
20011
  }
19609
20012
 
19610
20013
  _context9.t0 = dapp;
19611
- _context9.next = _context9.t0 === exports.Dapp.ONEINCH ? 5 : _context9.t0 === exports.Dapp.BALANCER ? 17 : _context9.t0 === exports.Dapp.SYNTHETIX ? 21 : _context9.t0 === exports.Dapp.TOROS ? 28 : 32;
20014
+ _context9.next = _context9.t0 === exports.Dapp.ZEROEX ? 5 : _context9.t0 === exports.Dapp.ONEINCH ? 9 : _context9.t0 === exports.Dapp.BALANCER ? 27 : _context9.t0 === exports.Dapp.SYNTHETIX ? 31 : _context9.t0 === exports.Dapp.TOROS ? 38 : 42;
19612
20015
  break;
19613
20016
 
19614
20017
  case 5:
20018
+ _context9.next = 7;
20019
+ return getZeroExTradeTxData(this.network, assetFrom, assetTo, amountIn, slippage, this.address);
20020
+
20021
+ case 7:
20022
+ swapTxData = _context9.sent;
20023
+ return _context9.abrupt("break", 57);
20024
+
20025
+ case 9:
19615
20026
  chainId = networkChainIdMap[this.network];
19616
- _context9.next = 8;
20027
+ _context9.next = 12;
19617
20028
  return getOneInchProtocols(chainId);
19618
20029
 
19619
- case 8:
20030
+ case 12:
19620
20031
  protocols = _context9.sent;
19621
20032
 
19622
20033
  if (process.env.ONEINCH_API_URL) {
19623
- _context9.next = 11;
20034
+ _context9.next = 15;
19624
20035
  break;
19625
20036
  }
19626
20037
 
19627
20038
  throw new Error("ONEINCH_API_URL not configured in .env file");
19628
20039
 
19629
- case 11:
20040
+ case 15:
19630
20041
  apiUrl = process.env.ONEINCH_API_URL + "/" + chainId + "/swap?fromTokenAddress=" + assetFrom + "&toTokenAddress=" + assetTo + "&amount=" + amountIn.toString() + "&fromAddress=" + this.address + "&destReceiver=" + this.address + "&slippage=" + slippage.toString() + "&disableEstimate=true" + protocols;
19631
- _context9.next = 14;
20042
+ _context9.prev = 16;
20043
+ _context9.next = 19;
19632
20044
  return axios.get(apiUrl);
19633
20045
 
19634
- case 14:
20046
+ case 19:
19635
20047
  response = _context9.sent;
19636
20048
  swapTxData = response.data.tx.data;
19637
- return _context9.abrupt("break", 47);
20049
+ _context9.next = 26;
20050
+ break;
19638
20051
 
19639
- case 17:
19640
- _context9.next = 19;
20052
+ case 23:
20053
+ _context9.prev = 23;
20054
+ _context9.t1 = _context9["catch"](16);
20055
+ throw new ApiError("Swap api request of 1inch failed");
20056
+
20057
+ case 26:
20058
+ return _context9.abrupt("break", 57);
20059
+
20060
+ case 27:
20061
+ _context9.next = 29;
19641
20062
  return this.utils.getBalancerSwapTx(this, assetFrom, assetTo, amountIn, slippage);
19642
20063
 
19643
- case 19:
20064
+ case 29:
19644
20065
  swapTxData = _context9.sent;
19645
- return _context9.abrupt("break", 47);
20066
+ return _context9.abrupt("break", 57);
19646
20067
 
19647
- case 21:
20068
+ case 31:
19648
20069
  iSynthetix = new ethers.ethers.utils.Interface(ISynthetix.abi);
19649
20070
  assets = [assetFrom, assetTo].map(function (asset) {
19650
20071
  return ethers.ethers.utils.formatBytes32String(asset);
19651
20072
  });
19652
- _context9.next = 25;
20073
+ _context9.next = 35;
19653
20074
  return this.factory.owner();
19654
20075
 
19655
- case 25:
20076
+ case 35:
19656
20077
  daoAddress = _context9.sent;
19657
20078
  swapTxData = iSynthetix.encodeFunctionData(exports.Transaction.SWAP_SYNTHS, [assets[0], amountIn, assets[1], daoAddress, SYNTHETIX_TRACKING_CODE]);
19658
- return _context9.abrupt("break", 47);
20079
+ return _context9.abrupt("break", 57);
19659
20080
 
19660
- case 28:
19661
- _context9.next = 30;
20081
+ case 38:
20082
+ _context9.next = 40;
19662
20083
  return getEasySwapperTxData(this, assetFrom, assetTo, ethers.ethers.BigNumber.from(amountIn), slippage);
19663
20084
 
19664
- case 30:
20085
+ case 40:
19665
20086
  swapTxData = _context9.sent;
19666
- return _context9.abrupt("break", 47);
20087
+ return _context9.abrupt("break", 57);
19667
20088
 
19668
- case 32:
20089
+ case 42:
19669
20090
  iUniswapV2Router = new ethers.ethers.utils.Interface(IUniswapV2Router.abi);
19670
- _context9.next = 35;
20091
+ _context9.next = 45;
19671
20092
  return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
19672
20093
 
19673
- case 35:
20094
+ case 45:
19674
20095
  minAmountOut = _context9.sent;
19675
- _context9.t1 = iUniswapV2Router;
19676
- _context9.t2 = exports.Transaction.SWAP;
19677
- _context9.t3 = amountIn;
19678
- _context9.t4 = minAmountOut;
19679
- _context9.t5 = [assetFrom, assetTo];
19680
- _context9.t6 = this.address;
19681
- _context9.next = 44;
20096
+ _context9.t2 = iUniswapV2Router;
20097
+ _context9.t3 = exports.Transaction.SWAP;
20098
+ _context9.t4 = amountIn;
20099
+ _context9.t5 = minAmountOut;
20100
+ _context9.t6 = [assetFrom, assetTo];
20101
+ _context9.t7 = this.address;
20102
+ _context9.next = 54;
19682
20103
  return getDeadline(this);
19683
20104
 
19684
- case 44:
19685
- _context9.t7 = _context9.sent;
19686
- _context9.t8 = [_context9.t3, _context9.t4, _context9.t5, _context9.t6, _context9.t7];
19687
- swapTxData = _context9.t1.encodeFunctionData.call(_context9.t1, _context9.t2, _context9.t8);
20105
+ case 54:
20106
+ _context9.t8 = _context9.sent;
20107
+ _context9.t9 = [_context9.t4, _context9.t5, _context9.t6, _context9.t7, _context9.t8];
20108
+ swapTxData = _context9.t2.encodeFunctionData.call(_context9.t2, _context9.t3, _context9.t9);
19688
20109
 
19689
- case 47:
19690
- _context9.next = 49;
20110
+ case 57:
20111
+ _context9.next = 59;
19691
20112
  return this.poolLogic.execTransaction(routerAddress[this.network][dapp], swapTxData, options);
19692
20113
 
19693
- case 49:
20114
+ case 59:
19694
20115
  tx = _context9.sent;
19695
20116
  return _context9.abrupt("return", tx);
19696
20117
 
19697
- case 51:
20118
+ case 61:
19698
20119
  case "end":
19699
20120
  return _context9.stop();
19700
20121
  }
19701
20122
  }
19702
- }, _callee9, this);
20123
+ }, _callee9, this, [[16, 23]]);
19703
20124
  }));
19704
20125
 
19705
20126
  function trade(_x24, _x25, _x26, _x27, _x28, _x29) {
@@ -19903,30 +20324,34 @@ var Pool = /*#__PURE__*/function () {
19903
20324
  }
19904
20325
 
19905
20326
  _context13.t0 = dapp;
19906
- _context13.next = _context13.t0 === exports.Dapp.BALANCER ? 4 : _context13.t0 === exports.Dapp.VELODROME ? 7 : 9;
20327
+ _context13.next = _context13.t0 === exports.Dapp.BALANCER ? 4 : _context13.t0 === exports.Dapp.VELODROME ? 7 : _context13.t0 === exports.Dapp.VELODROMEV2 ? 9 : 11;
19907
20328
  break;
19908
20329
 
19909
20330
  case 4:
19910
20331
  rewardsGauge = new ethers.ethers.utils.Interface(IBalancerRewardsGauge.abi);
19911
20332
  stakeTxData = rewardsGauge.encodeFunctionData("deposit(uint256)", [amount]);
19912
- return _context13.abrupt("break", 10);
20333
+ return _context13.abrupt("break", 12);
19913
20334
 
19914
20335
  case 7:
19915
- stakeTxData = getVelodromeStakeTxData(amount);
19916
- return _context13.abrupt("break", 10);
20336
+ stakeTxData = getVelodromeStakeTxData(amount, false);
20337
+ return _context13.abrupt("break", 12);
19917
20338
 
19918
20339
  case 9:
20340
+ stakeTxData = getVelodromeStakeTxData(amount, true);
20341
+ return _context13.abrupt("break", 12);
20342
+
20343
+ case 11:
19919
20344
  throw new Error("dapp not supported");
19920
20345
 
19921
- case 10:
19922
- _context13.next = 12;
20346
+ case 12:
20347
+ _context13.next = 14;
19923
20348
  return this.poolLogic.execTransaction(gauge, stakeTxData, options);
19924
20349
 
19925
- case 12:
20350
+ case 14:
19926
20351
  tx = _context13.sent;
19927
20352
  return _context13.abrupt("return", tx);
19928
20353
 
19929
- case 14:
20354
+ case 16:
19930
20355
  case "end":
19931
20356
  return _context13.stop();
19932
20357
  }
@@ -19992,7 +20417,7 @@ var Pool = /*#__PURE__*/function () {
19992
20417
  return unStake;
19993
20418
  }()
19994
20419
  /**
19995
- * Unstake liquidity pool tokens from gauge contract
20420
+ * Unstake liquidity pool tokens from Velodrome or Balancer gauge
19996
20421
  * @param {string} gauge Gauge contract address
19997
20422
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
19998
20423
  * @param {any} options Transaction options
@@ -20854,38 +21279,43 @@ var Pool = /*#__PURE__*/function () {
20854
21279
  }
20855
21280
 
20856
21281
  _context30.t0 = dapp;
20857
- _context30.next = _context30.t0 === exports.Dapp.UNISWAPV3 ? 4 : _context30.t0 === exports.Dapp.ARRAKIS ? 8 : _context30.t0 === exports.Dapp.BALANCER ? 8 : _context30.t0 === exports.Dapp.VELODROME ? 12 : 15;
21282
+ _context30.next = _context30.t0 === exports.Dapp.UNISWAPV3 ? 4 : _context30.t0 === exports.Dapp.ARRAKIS ? 8 : _context30.t0 === exports.Dapp.BALANCER ? 8 : _context30.t0 === exports.Dapp.VELODROME ? 12 : _context30.t0 === exports.Dapp.VELODROMEV2 ? 15 : 18;
20858
21283
  break;
20859
21284
 
20860
21285
  case 4:
20861
21286
  contractAddress = nonfungiblePositionManagerAddress[this.network];
20862
21287
  iNonfungiblePositionManager = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
20863
21288
  txData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
20864
- return _context30.abrupt("break", 16);
21289
+ return _context30.abrupt("break", 19);
20865
21290
 
20866
21291
  case 8:
20867
21292
  contractAddress = tokenId;
20868
21293
  abi = new ethers.ethers.utils.Interface(ILiquidityGaugeV4.abi);
20869
21294
  txData = abi.encodeFunctionData("claim_rewards()", []);
20870
- return _context30.abrupt("break", 16);
21295
+ return _context30.abrupt("break", 19);
20871
21296
 
20872
21297
  case 12:
20873
21298
  contractAddress = tokenId;
20874
- txData = getVelodromeClaimTxData(this, tokenId);
20875
- return _context30.abrupt("break", 16);
21299
+ txData = getVelodromeClaimTxData(this, tokenId, false);
21300
+ return _context30.abrupt("break", 19);
20876
21301
 
20877
21302
  case 15:
21303
+ contractAddress = tokenId;
21304
+ txData = getVelodromeClaimTxData(this, tokenId, true);
21305
+ return _context30.abrupt("break", 19);
21306
+
21307
+ case 18:
20878
21308
  throw new Error("dapp not supported");
20879
21309
 
20880
- case 16:
20881
- _context30.next = 18;
21310
+ case 19:
21311
+ _context30.next = 21;
20882
21312
  return this.poolLogic.execTransaction(contractAddress, txData, options);
20883
21313
 
20884
- case 18:
21314
+ case 21:
20885
21315
  tx = _context30.sent;
20886
21316
  return _context30.abrupt("return", tx);
20887
21317
 
20888
- case 20:
21318
+ case 23:
20889
21319
  case "end":
20890
21320
  return _context30.stop();
20891
21321
  }
@@ -21062,6 +21492,113 @@ var Pool = /*#__PURE__*/function () {
21062
21492
 
21063
21493
  return removeLiquidityVelodrome;
21064
21494
  }()
21495
+ /**
21496
+ * Add liquidity to Velodrome V2 pool
21497
+ * @param {string} assetA First asset
21498
+ * @param {string} assetB Second asset
21499
+ * @param {BigNumber | string} amountA Amount first asset
21500
+ * @param {BigNumber | string} amountB Amount second asset
21501
+ * @param { boolean } isStable Is stable pool
21502
+ * @param {any} options Transaction options
21503
+ * @returns {Promise<any>} Transaction
21504
+ */
21505
+ ;
21506
+
21507
+ _proto.addLiquidityVelodromeV2 =
21508
+ /*#__PURE__*/
21509
+ function () {
21510
+ var _addLiquidityVelodromeV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee34(assetA, assetB, amountA, amountB, isStable, options) {
21511
+ var tx;
21512
+ return runtime_1.wrap(function _callee34$(_context34) {
21513
+ while (1) {
21514
+ switch (_context34.prev = _context34.next) {
21515
+ case 0:
21516
+ if (options === void 0) {
21517
+ options = null;
21518
+ }
21519
+
21520
+ _context34.t0 = this.poolLogic;
21521
+ _context34.t1 = routerAddress[this.network][exports.Dapp.VELODROMEV2];
21522
+ _context34.next = 5;
21523
+ return getVelodromeAddLiquidityTxData(this, assetA, assetB, amountA, amountB, isStable);
21524
+
21525
+ case 5:
21526
+ _context34.t2 = _context34.sent;
21527
+ _context34.t3 = options;
21528
+ _context34.next = 9;
21529
+ return _context34.t0.execTransaction.call(_context34.t0, _context34.t1, _context34.t2, _context34.t3);
21530
+
21531
+ case 9:
21532
+ tx = _context34.sent;
21533
+ return _context34.abrupt("return", tx);
21534
+
21535
+ case 11:
21536
+ case "end":
21537
+ return _context34.stop();
21538
+ }
21539
+ }
21540
+ }, _callee34, this);
21541
+ }));
21542
+
21543
+ function addLiquidityVelodromeV2(_x134, _x135, _x136, _x137, _x138, _x139) {
21544
+ return _addLiquidityVelodromeV.apply(this, arguments);
21545
+ }
21546
+
21547
+ return addLiquidityVelodromeV2;
21548
+ }()
21549
+ /**
21550
+ * Remove liquidity from Velodrome V2 pool
21551
+ * @param {string} assetA First asset
21552
+ * @param {string} assetB Second asset
21553
+ * @param {BigNumber | string} amount Amount of LP tokens
21554
+ * @param { boolean } isStable Is stable pool
21555
+ * @param {any} options Transaction options
21556
+ * @returns {Promise<any>} Transaction
21557
+ */
21558
+ ;
21559
+
21560
+ _proto.removeLiquidityVelodromeV2 =
21561
+ /*#__PURE__*/
21562
+ function () {
21563
+ var _removeLiquidityVelodromeV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee35(assetA, assetB, amount, isStable, options) {
21564
+ var tx;
21565
+ return runtime_1.wrap(function _callee35$(_context35) {
21566
+ while (1) {
21567
+ switch (_context35.prev = _context35.next) {
21568
+ case 0:
21569
+ if (options === void 0) {
21570
+ options = null;
21571
+ }
21572
+
21573
+ _context35.t0 = this.poolLogic;
21574
+ _context35.t1 = routerAddress[this.network][exports.Dapp.VELODROMEV2];
21575
+ _context35.next = 5;
21576
+ return getVelodromeRemoveLiquidityTxData(this, assetA, assetB, amount, isStable);
21577
+
21578
+ case 5:
21579
+ _context35.t2 = _context35.sent;
21580
+ _context35.t3 = options;
21581
+ _context35.next = 9;
21582
+ return _context35.t0.execTransaction.call(_context35.t0, _context35.t1, _context35.t2, _context35.t3);
21583
+
21584
+ case 9:
21585
+ tx = _context35.sent;
21586
+ return _context35.abrupt("return", tx);
21587
+
21588
+ case 11:
21589
+ case "end":
21590
+ return _context35.stop();
21591
+ }
21592
+ }
21593
+ }, _callee35, this);
21594
+ }));
21595
+
21596
+ function removeLiquidityVelodromeV2(_x140, _x141, _x142, _x143, _x144) {
21597
+ return _removeLiquidityVelodromeV.apply(this, arguments);
21598
+ }
21599
+
21600
+ return removeLiquidityVelodromeV2;
21601
+ }()
21065
21602
  /**
21066
21603
  * Trade options on lyra
21067
21604
  * @param {LyraOptionMarket} market Underlying market e.g. eth
@@ -21081,11 +21618,11 @@ var Pool = /*#__PURE__*/function () {
21081
21618
  _proto.tradeLyraOption =
21082
21619
  /*#__PURE__*/
21083
21620
  function () {
21084
- var _tradeLyraOption = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee34(market, expiry, strike, optionType, tradeType, optionAmount, assetIn, collateralChangeAmount, isCoveredCall, options) {
21621
+ var _tradeLyraOption = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee36(market, expiry, strike, optionType, tradeType, optionAmount, assetIn, collateralChangeAmount, isCoveredCall, options) {
21085
21622
  var swapxData, tx;
21086
- return runtime_1.wrap(function _callee34$(_context34) {
21623
+ return runtime_1.wrap(function _callee36$(_context36) {
21087
21624
  while (1) {
21088
- switch (_context34.prev = _context34.next) {
21625
+ switch (_context36.prev = _context36.next) {
21089
21626
  case 0:
21090
21627
  if (collateralChangeAmount === void 0) {
21091
21628
  collateralChangeAmount = "0";
@@ -21099,27 +21636,27 @@ var Pool = /*#__PURE__*/function () {
21099
21636
  options = null;
21100
21637
  }
21101
21638
 
21102
- _context34.next = 5;
21639
+ _context36.next = 5;
21103
21640
  return getLyraOptionTxData(this, market, optionType, expiry, strike, tradeType, optionAmount, assetIn, ethers.BigNumber.from(collateralChangeAmount), isCoveredCall);
21104
21641
 
21105
21642
  case 5:
21106
- swapxData = _context34.sent;
21107
- _context34.next = 8;
21643
+ swapxData = _context36.sent;
21644
+ _context36.next = 8;
21108
21645
  return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.LYRA], swapxData, options);
21109
21646
 
21110
21647
  case 8:
21111
- tx = _context34.sent;
21112
- return _context34.abrupt("return", tx);
21648
+ tx = _context36.sent;
21649
+ return _context36.abrupt("return", tx);
21113
21650
 
21114
21651
  case 10:
21115
21652
  case "end":
21116
- return _context34.stop();
21653
+ return _context36.stop();
21117
21654
  }
21118
21655
  }
21119
- }, _callee34, this);
21656
+ }, _callee36, this);
21120
21657
  }));
21121
21658
 
21122
- function tradeLyraOption(_x134, _x135, _x136, _x137, _x138, _x139, _x140, _x141, _x142, _x143) {
21659
+ function tradeLyraOption(_x145, _x146, _x147, _x148, _x149, _x150, _x151, _x152, _x153, _x154) {
21123
21660
  return _tradeLyraOption.apply(this, arguments);
21124
21661
  }
21125
21662
 
@@ -21134,26 +21671,26 @@ var Pool = /*#__PURE__*/function () {
21134
21671
  _proto.getLyraPositions =
21135
21672
  /*#__PURE__*/
21136
21673
  function () {
21137
- var _getLyraPositions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee35(market) {
21138
- return runtime_1.wrap(function _callee35$(_context35) {
21674
+ var _getLyraPositions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee37(market) {
21675
+ return runtime_1.wrap(function _callee37$(_context37) {
21139
21676
  while (1) {
21140
- switch (_context35.prev = _context35.next) {
21677
+ switch (_context37.prev = _context37.next) {
21141
21678
  case 0:
21142
- _context35.next = 2;
21679
+ _context37.next = 2;
21143
21680
  return getOptionPositions(this, market);
21144
21681
 
21145
21682
  case 2:
21146
- return _context35.abrupt("return", _context35.sent);
21683
+ return _context37.abrupt("return", _context37.sent);
21147
21684
 
21148
21685
  case 3:
21149
21686
  case "end":
21150
- return _context35.stop();
21687
+ return _context37.stop();
21151
21688
  }
21152
21689
  }
21153
- }, _callee35, this);
21690
+ }, _callee37, this);
21154
21691
  }));
21155
21692
 
21156
- function getLyraPositions(_x144) {
21693
+ function getLyraPositions(_x155) {
21157
21694
  return _getLyraPositions.apply(this, arguments);
21158
21695
  }
21159
21696
 
@@ -21171,32 +21708,32 @@ var Pool = /*#__PURE__*/function () {
21171
21708
  _proto.changeFuturesMargin =
21172
21709
  /*#__PURE__*/
21173
21710
  function () {
21174
- var _changeFuturesMargin = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee36(market, changeAmount, options) {
21711
+ var _changeFuturesMargin = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee38(market, changeAmount, options) {
21175
21712
  var tx;
21176
- return runtime_1.wrap(function _callee36$(_context36) {
21713
+ return runtime_1.wrap(function _callee38$(_context38) {
21177
21714
  while (1) {
21178
- switch (_context36.prev = _context36.next) {
21715
+ switch (_context38.prev = _context38.next) {
21179
21716
  case 0:
21180
21717
  if (options === void 0) {
21181
21718
  options = null;
21182
21719
  }
21183
21720
 
21184
- _context36.next = 3;
21721
+ _context38.next = 3;
21185
21722
  return this.poolLogic.execTransaction(market, getFuturesChangeMarginTxData(changeAmount), options);
21186
21723
 
21187
21724
  case 3:
21188
- tx = _context36.sent;
21189
- return _context36.abrupt("return", tx);
21725
+ tx = _context38.sent;
21726
+ return _context38.abrupt("return", tx);
21190
21727
 
21191
21728
  case 5:
21192
21729
  case "end":
21193
- return _context36.stop();
21730
+ return _context38.stop();
21194
21731
  }
21195
21732
  }
21196
- }, _callee36, this);
21733
+ }, _callee38, this);
21197
21734
  }));
21198
21735
 
21199
- function changeFuturesMargin(_x145, _x146, _x147) {
21736
+ function changeFuturesMargin(_x156, _x157, _x158) {
21200
21737
  return _changeFuturesMargin.apply(this, arguments);
21201
21738
  }
21202
21739
 
@@ -21214,37 +21751,37 @@ var Pool = /*#__PURE__*/function () {
21214
21751
  _proto.changeFuturesPosition =
21215
21752
  /*#__PURE__*/
21216
21753
  function () {
21217
- var _changeFuturesPosition = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee37(market, changeAmount, options) {
21754
+ var _changeFuturesPosition = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee39(market, changeAmount, options) {
21218
21755
  var txData, tx;
21219
- return runtime_1.wrap(function _callee37$(_context37) {
21756
+ return runtime_1.wrap(function _callee39$(_context39) {
21220
21757
  while (1) {
21221
- switch (_context37.prev = _context37.next) {
21758
+ switch (_context39.prev = _context39.next) {
21222
21759
  case 0:
21223
21760
  if (options === void 0) {
21224
21761
  options = null;
21225
21762
  }
21226
21763
 
21227
- _context37.next = 3;
21764
+ _context39.next = 3;
21228
21765
  return getFuturesChangePositionTxData(changeAmount, market, this);
21229
21766
 
21230
21767
  case 3:
21231
- txData = _context37.sent;
21232
- _context37.next = 6;
21768
+ txData = _context39.sent;
21769
+ _context39.next = 6;
21233
21770
  return this.poolLogic.execTransaction(market, txData, options);
21234
21771
 
21235
21772
  case 6:
21236
- tx = _context37.sent;
21237
- return _context37.abrupt("return", tx);
21773
+ tx = _context39.sent;
21774
+ return _context39.abrupt("return", tx);
21238
21775
 
21239
21776
  case 8:
21240
21777
  case "end":
21241
- return _context37.stop();
21778
+ return _context39.stop();
21242
21779
  }
21243
21780
  }
21244
- }, _callee37, this);
21781
+ }, _callee39, this);
21245
21782
  }));
21246
21783
 
21247
- function changeFuturesPosition(_x148, _x149, _x150) {
21784
+ function changeFuturesPosition(_x159, _x160, _x161) {
21248
21785
  return _changeFuturesPosition.apply(this, arguments);
21249
21786
  }
21250
21787
 
@@ -21261,37 +21798,37 @@ var Pool = /*#__PURE__*/function () {
21261
21798
  _proto.cancelFuturesOrder =
21262
21799
  /*#__PURE__*/
21263
21800
  function () {
21264
- var _cancelFuturesOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee38(market, options) {
21801
+ var _cancelFuturesOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee40(market, options) {
21265
21802
  var txData, tx;
21266
- return runtime_1.wrap(function _callee38$(_context38) {
21803
+ return runtime_1.wrap(function _callee40$(_context40) {
21267
21804
  while (1) {
21268
- switch (_context38.prev = _context38.next) {
21805
+ switch (_context40.prev = _context40.next) {
21269
21806
  case 0:
21270
21807
  if (options === void 0) {
21271
21808
  options = null;
21272
21809
  }
21273
21810
 
21274
- _context38.next = 3;
21811
+ _context40.next = 3;
21275
21812
  return getFuturesCancelOrderTxData(this);
21276
21813
 
21277
21814
  case 3:
21278
- txData = _context38.sent;
21279
- _context38.next = 6;
21815
+ txData = _context40.sent;
21816
+ _context40.next = 6;
21280
21817
  return this.poolLogic.execTransaction(market, txData, options);
21281
21818
 
21282
21819
  case 6:
21283
- tx = _context38.sent;
21284
- return _context38.abrupt("return", tx);
21820
+ tx = _context40.sent;
21821
+ return _context40.abrupt("return", tx);
21285
21822
 
21286
21823
  case 8:
21287
21824
  case "end":
21288
- return _context38.stop();
21825
+ return _context40.stop();
21289
21826
  }
21290
21827
  }
21291
- }, _callee38, this);
21828
+ }, _callee40, this);
21292
21829
  }));
21293
21830
 
21294
- function cancelFuturesOrder(_x151, _x152) {
21831
+ function cancelFuturesOrder(_x162, _x163) {
21295
21832
  return _cancelFuturesOrder.apply(this, arguments);
21296
21833
  }
21297
21834
 
@@ -21301,7 +21838,7 @@ var Pool = /*#__PURE__*/function () {
21301
21838
  return Pool;
21302
21839
  }();
21303
21840
 
21304
- var abi$p = [
21841
+ var abi$q = [
21305
21842
  {
21306
21843
  inputs: [
21307
21844
  {
@@ -21525,10 +22062,10 @@ var abi$p = [
21525
22062
  }
21526
22063
  ];
21527
22064
  var UniswapV2Factory = {
21528
- abi: abi$p
22065
+ abi: abi$q
21529
22066
  };
21530
22067
 
21531
- var abi$q = [
22068
+ var abi$r = [
21532
22069
  {
21533
22070
  anonymous: false,
21534
22071
  inputs: [
@@ -22272,7 +22809,7 @@ var evm = {
22272
22809
  }
22273
22810
  };
22274
22811
  var UniswapV2Pair = {
22275
- abi: abi$q,
22812
+ abi: abi$r,
22276
22813
  evm: evm,
22277
22814
  "interface": [
22278
22815
  {
@@ -23003,7 +23540,7 @@ var UniswapV2Pair = {
23003
23540
  ]
23004
23541
  };
23005
23542
 
23006
- var abi$r = [
23543
+ var abi$s = [
23007
23544
  {
23008
23545
  inputs: [
23009
23546
  {
@@ -24198,7 +24735,7 @@ var abi$r = [
24198
24735
  }
24199
24736
  ];
24200
24737
  var IBalancerV2Vault = {
24201
- abi: abi$r
24738
+ abi: abi$s
24202
24739
  };
24203
24740
 
24204
24741
  var Utils = /*#__PURE__*/function () {
@@ -24871,6 +25408,7 @@ Object.defineProperty(exports, 'ethers', {
24871
25408
  return ethers.ethers;
24872
25409
  }
24873
25410
  });
25411
+ exports.ApiError = ApiError;
24874
25412
  exports.Dhedge = Dhedge;
24875
25413
  exports.Pool = Pool;
24876
25414
  //# sourceMappingURL=v2-sdk.cjs.development.js.map