@dhedge/v2-sdk 1.8.3 → 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
  }
@@ -3807,6 +3906,7 @@ var ManagerLogic = {
3807
3906
  (function (Network) {
3808
3907
  Network["POLYGON"] = "polygon";
3809
3908
  Network["OPTIMISM"] = "optimism";
3909
+ Network["ARBITRUM"] = "arbitrum";
3810
3910
  })(exports.Network || (exports.Network = {}));
3811
3911
 
3812
3912
  (function (Dapp) {
@@ -3821,7 +3921,9 @@ var ManagerLogic = {
3821
3921
  Dapp["ARRAKIS"] = "arrakis";
3822
3922
  Dapp["TOROS"] = "toros";
3823
3923
  Dapp["VELODROME"] = "velodrome";
3924
+ Dapp["VELODROMEV2"] = "velodromeV2";
3824
3925
  Dapp["LYRA"] = "lyra";
3926
+ Dapp["ZEROEX"] = "0x";
3825
3927
  })(exports.Dapp || (exports.Dapp = {}));
3826
3928
 
3827
3929
  (function (Transaction) {
@@ -3846,19 +3948,19 @@ var ManagerLogic = {
3846
3948
  Transaction["REMOVE_LIQUIDITY_UNSTAKE"] = "removeLiquidityAndUnstake";
3847
3949
  })(exports.Transaction || (exports.Transaction = {}));
3848
3950
 
3849
- var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _stakingAddress, _Network$POLYGON4, _Network$OPTIMISM2, _aaveAddressProvider, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress, _lyraNetworkMap;
3951
+ var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _stakingAddress, _Network$POLYGON4, _Network$OPTIMISM2, _Network$ARBITRUM2, _aaveAddressProvider, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress, _lyraNetworkMap;
3850
3952
 
3851
3953
  require("dotenv").config();
3852
3954
 
3853
- var factoryAddress = (_factoryAddress = {}, _factoryAddress[exports.Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress[exports.Network.OPTIMISM] = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", _factoryAddress);
3854
- 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);
3855
- 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);
3856
- 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);
3857
- 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);
3858
- var nonfungiblePositionManagerAddress = (_nonfungiblePositionM = {}, _nonfungiblePositionM[exports.Network.POLYGON] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM[exports.Network.OPTIMISM] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM);
3859
- var networkChainIdMap = (_networkChainIdMap = {}, _networkChainIdMap[exports.Network.POLYGON] = 137, _networkChainIdMap[exports.Network.OPTIMISM] = 10, _networkChainIdMap);
3860
- var balancerSubgraph = (_balancerSubgraph = {}, _balancerSubgraph[exports.Network.POLYGON] = "https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2", _balancerSubgraph[exports.Network.OPTIMISM] = "", _balancerSubgraph);
3861
- var multiCallAddress = (_multiCallAddress = {}, _multiCallAddress[exports.Network.POLYGON] = "0x275617327c958bD06b5D6b871E7f491D76113dd8", _multiCallAddress[exports.Network.OPTIMISM] = "", _multiCallAddress);
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);
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);
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);
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);
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);
3960
+ var nonfungiblePositionManagerAddress = (_nonfungiblePositionM = {}, _nonfungiblePositionM[exports.Network.POLYGON] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM[exports.Network.OPTIMISM] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM[exports.Network.ARBITRUM] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM);
3961
+ var networkChainIdMap = (_networkChainIdMap = {}, _networkChainIdMap[exports.Network.POLYGON] = 137, _networkChainIdMap[exports.Network.OPTIMISM] = 10, _networkChainIdMap[exports.Network.ARBITRUM] = 42161, _networkChainIdMap);
3962
+ var balancerSubgraph = (_balancerSubgraph = {}, _balancerSubgraph[exports.Network.POLYGON] = "https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2", _balancerSubgraph[exports.Network.OPTIMISM] = "", _balancerSubgraph[exports.Network.ARBITRUM] = "", _balancerSubgraph);
3963
+ var multiCallAddress = (_multiCallAddress = {}, _multiCallAddress[exports.Network.POLYGON] = "0x275617327c958bD06b5D6b871E7f491D76113dd8", _multiCallAddress[exports.Network.OPTIMISM] = "", _multiCallAddress[exports.Network.ARBITRUM] = "", _multiCallAddress);
3862
3964
  var lyraNetworkMap = (_lyraNetworkMap = {}, _lyraNetworkMap[exports.Network.OPTIMISM] = Lyra.Deployment.Mainnet, _lyraNetworkMap);
3863
3965
  var MaxUint128 = "0xffffffffffffffffffffffffffffffff";
3864
3966
  var UNISWAPV3_QUOTER_ADDRESS = "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6";
@@ -14539,10 +14641,213 @@ var abi$l = [
14539
14641
  type: "function"
14540
14642
  }
14541
14643
  ];
14542
- var IVelodromeGauge = {
14644
+ var IVelodromeGaugeV1 = {
14543
14645
  abi: abi$l
14544
14646
  };
14545
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
+
14546
14851
  function call(_x, _x2, _x3, _x4) {
14547
14852
  return _call.apply(this, arguments);
14548
14853
  }
@@ -14578,36 +14883,47 @@ function _call() {
14578
14883
  return _call.apply(this, arguments);
14579
14884
  }
14580
14885
 
14581
- var iVelodromeGauge = /*#__PURE__*/new ethers.ethers.utils.Interface(IVelodromeGauge.abi);
14582
- function getVelodromeStakeTxData(amount) {
14583
- 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);
14584
14892
  }
14585
- function getVelodromeClaimTxData(_x, _x2) {
14893
+ function getVelodromeClaimTxData(_x, _x2, _x3) {
14586
14894
  return _getVelodromeClaimTxData.apply(this, arguments);
14587
14895
  }
14588
14896
 
14589
14897
  function _getVelodromeClaimTxData() {
14590
- _getVelodromeClaimTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, gauge) {
14898
+ _getVelodromeClaimTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(pool, gauge, v2) {
14591
14899
  var rewardAssetCount, rewardAssets;
14592
14900
  return runtime_1.wrap(function _callee$(_context) {
14593
14901
  while (1) {
14594
14902
  switch (_context.prev = _context.next) {
14595
14903
  case 0:
14596
- _context.next = 2;
14597
- return call(pool.signer, IVelodromeGauge.abi, [gauge, "rewardsListLength", []]);
14904
+ if (!v2) {
14905
+ _context.next = 4;
14906
+ break;
14907
+ }
14598
14908
 
14599
- 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:
14600
14916
  rewardAssetCount = _context.sent;
14601
- _context.next = 5;
14917
+ _context.next = 9;
14602
14918
  return Promise.all(Array.from(Array(rewardAssetCount.toNumber()).keys()).map(function (e) {
14603
- return call(pool.signer, IVelodromeGauge.abi, [gauge, "rewards", [e]]);
14919
+ return call(pool.signer, IVelodromeGaugeV1.abi, [gauge, "rewards", [e]]);
14604
14920
  }));
14605
14921
 
14606
- case 5:
14922
+ case 9:
14607
14923
  rewardAssets = _context.sent;
14608
- return _context.abrupt("return", iVelodromeGauge.encodeFunctionData("getReward", [pool.address, rewardAssets]));
14924
+ return _context.abrupt("return", iVelodromeGaugeV1.encodeFunctionData("getReward", [pool.address, rewardAssets]));
14609
14925
 
14610
- case 7:
14926
+ case 11:
14611
14927
  case "end":
14612
14928
  return _context.stop();
14613
14929
  }
@@ -14755,7 +15071,7 @@ function _getStrike() {
14755
15071
  return _getStrike.apply(this, arguments);
14756
15072
  }
14757
15073
 
14758
- var abi$m = [
15074
+ var abi$n = [
14759
15075
  {
14760
15076
  inputs: [
14761
15077
  {
@@ -16107,7 +16423,7 @@ var abi$m = [
16107
16423
  }
16108
16424
  ];
16109
16425
  var IOptionMarketWrapper = {
16110
- abi: abi$m
16426
+ abi: abi$n
16111
16427
  };
16112
16428
 
16113
16429
  function getLyraTradeOptionType(isCall, isLong, isCoveredCall) {
@@ -16124,7 +16440,7 @@ function isLong(optionType) {
16124
16440
  return optionType === 0 || optionType === 1;
16125
16441
  }
16126
16442
 
16127
- var abi$n = [
16443
+ var abi$o = [
16128
16444
  {
16129
16445
  inputs: [
16130
16446
  {
@@ -18458,7 +18774,7 @@ var abi$n = [
18458
18774
  }
18459
18775
  ];
18460
18776
  var IOptionToken = {
18461
- abi: abi$n
18777
+ abi: abi$o
18462
18778
  };
18463
18779
 
18464
18780
  function getOptionPositions(_x, _x2) {
@@ -18596,7 +18912,7 @@ function _getLyraOptionTxData() {
18596
18912
  return _getLyraOptionTxData.apply(this, arguments);
18597
18913
  }
18598
18914
 
18599
- var abi$o = [
18915
+ var abi$p = [
18600
18916
  {
18601
18917
  inputs: [
18602
18918
  {
@@ -19141,7 +19457,7 @@ var abi$o = [
19141
19457
  }
19142
19458
  ];
19143
19459
  var ISynthetixFuturesMarketV2 = {
19144
- abi: abi$o
19460
+ abi: abi$p
19145
19461
  };
19146
19462
 
19147
19463
  function getFuturesChangeMarginTxData(amount) {
@@ -19182,6 +19498,116 @@ function _getFuturesChangePositionTxData() {
19182
19498
  return _getFuturesChangePositionTxData.apply(this, arguments);
19183
19499
  }
19184
19500
 
19501
+ function getFuturesCancelOrderTxData(_x4) {
19502
+ return _getFuturesCancelOrderTxData.apply(this, arguments);
19503
+ }
19504
+
19505
+ function _getFuturesCancelOrderTxData() {
19506
+ _getFuturesCancelOrderTxData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool) {
19507
+ return runtime_1.wrap(function _callee2$(_context2) {
19508
+ while (1) {
19509
+ switch (_context2.prev = _context2.next) {
19510
+ case 0:
19511
+ return _context2.abrupt("return", new ethers.ethers.utils.Interface(ISynthetixFuturesMarketV2.abi).encodeFunctionData("cancelOffchainDelayedOrder", [pool.address]));
19512
+
19513
+ case 1:
19514
+ case "end":
19515
+ return _context2.stop();
19516
+ }
19517
+ }
19518
+ }, _callee2);
19519
+ }));
19520
+ return _getFuturesCancelOrderTxData.apply(this, arguments);
19521
+ }
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
+
19185
19611
  var Pool = /*#__PURE__*/function () {
19186
19612
  function Pool(network, signer, poolLogic, mangerLogic, utils, factory) {
19187
19613
  this.network = network;
@@ -19585,89 +20011,116 @@ var Pool = /*#__PURE__*/function () {
19585
20011
  }
19586
20012
 
19587
20013
  _context9.t0 = dapp;
19588
- _context9.next = _context9.t0 === exports.Dapp.ONEINCH ? 5 : _context9.t0 === exports.Dapp.BALANCER ? 15 : _context9.t0 === exports.Dapp.SYNTHETIX ? 19 : _context9.t0 === exports.Dapp.TOROS ? 26 : 30;
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;
19589
20015
  break;
19590
20016
 
19591
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:
19592
20026
  chainId = networkChainIdMap[this.network];
19593
- _context9.next = 8;
20027
+ _context9.next = 12;
19594
20028
  return getOneInchProtocols(chainId);
19595
20029
 
19596
- case 8:
20030
+ case 12:
19597
20031
  protocols = _context9.sent;
19598
- apiUrl = "https://api.1inch.exchange/v5.0/" + chainId + "/swap?fromTokenAddress=" + assetFrom + "&toTokenAddress=" + assetTo + "&amount=" + amountIn.toString() + "&fromAddress=" + this.address + "&destReceiver=" + this.address + "&slippage=" + slippage.toString() + "&disableEstimate=true" + protocols;
19599
- _context9.next = 12;
20032
+
20033
+ if (process.env.ONEINCH_API_URL) {
20034
+ _context9.next = 15;
20035
+ break;
20036
+ }
20037
+
20038
+ throw new Error("ONEINCH_API_URL not configured in .env file");
20039
+
20040
+ case 15:
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;
20042
+ _context9.prev = 16;
20043
+ _context9.next = 19;
19600
20044
  return axios.get(apiUrl);
19601
20045
 
19602
- case 12:
20046
+ case 19:
19603
20047
  response = _context9.sent;
19604
20048
  swapTxData = response.data.tx.data;
19605
- return _context9.abrupt("break", 45);
20049
+ _context9.next = 26;
20050
+ break;
19606
20051
 
19607
- case 15:
19608
- _context9.next = 17;
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;
19609
20062
  return this.utils.getBalancerSwapTx(this, assetFrom, assetTo, amountIn, slippage);
19610
20063
 
19611
- case 17:
20064
+ case 29:
19612
20065
  swapTxData = _context9.sent;
19613
- return _context9.abrupt("break", 45);
20066
+ return _context9.abrupt("break", 57);
19614
20067
 
19615
- case 19:
20068
+ case 31:
19616
20069
  iSynthetix = new ethers.ethers.utils.Interface(ISynthetix.abi);
19617
20070
  assets = [assetFrom, assetTo].map(function (asset) {
19618
20071
  return ethers.ethers.utils.formatBytes32String(asset);
19619
20072
  });
19620
- _context9.next = 23;
20073
+ _context9.next = 35;
19621
20074
  return this.factory.owner();
19622
20075
 
19623
- case 23:
20076
+ case 35:
19624
20077
  daoAddress = _context9.sent;
19625
20078
  swapTxData = iSynthetix.encodeFunctionData(exports.Transaction.SWAP_SYNTHS, [assets[0], amountIn, assets[1], daoAddress, SYNTHETIX_TRACKING_CODE]);
19626
- return _context9.abrupt("break", 45);
20079
+ return _context9.abrupt("break", 57);
19627
20080
 
19628
- case 26:
19629
- _context9.next = 28;
20081
+ case 38:
20082
+ _context9.next = 40;
19630
20083
  return getEasySwapperTxData(this, assetFrom, assetTo, ethers.ethers.BigNumber.from(amountIn), slippage);
19631
20084
 
19632
- case 28:
20085
+ case 40:
19633
20086
  swapTxData = _context9.sent;
19634
- return _context9.abrupt("break", 45);
20087
+ return _context9.abrupt("break", 57);
19635
20088
 
19636
- case 30:
20089
+ case 42:
19637
20090
  iUniswapV2Router = new ethers.ethers.utils.Interface(IUniswapV2Router.abi);
19638
- _context9.next = 33;
20091
+ _context9.next = 45;
19639
20092
  return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
19640
20093
 
19641
- case 33:
20094
+ case 45:
19642
20095
  minAmountOut = _context9.sent;
19643
- _context9.t1 = iUniswapV2Router;
19644
- _context9.t2 = exports.Transaction.SWAP;
19645
- _context9.t3 = amountIn;
19646
- _context9.t4 = minAmountOut;
19647
- _context9.t5 = [assetFrom, assetTo];
19648
- _context9.t6 = this.address;
19649
- _context9.next = 42;
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;
19650
20103
  return getDeadline(this);
19651
20104
 
19652
- case 42:
19653
- _context9.t7 = _context9.sent;
19654
- _context9.t8 = [_context9.t3, _context9.t4, _context9.t5, _context9.t6, _context9.t7];
19655
- 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);
19656
20109
 
19657
- case 45:
19658
- _context9.next = 47;
20110
+ case 57:
20111
+ _context9.next = 59;
19659
20112
  return this.poolLogic.execTransaction(routerAddress[this.network][dapp], swapTxData, options);
19660
20113
 
19661
- case 47:
20114
+ case 59:
19662
20115
  tx = _context9.sent;
19663
20116
  return _context9.abrupt("return", tx);
19664
20117
 
19665
- case 49:
20118
+ case 61:
19666
20119
  case "end":
19667
20120
  return _context9.stop();
19668
20121
  }
19669
20122
  }
19670
- }, _callee9, this);
20123
+ }, _callee9, this, [[16, 23]]);
19671
20124
  }));
19672
20125
 
19673
20126
  function trade(_x24, _x25, _x26, _x27, _x28, _x29) {
@@ -19871,30 +20324,34 @@ var Pool = /*#__PURE__*/function () {
19871
20324
  }
19872
20325
 
19873
20326
  _context13.t0 = dapp;
19874
- _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;
19875
20328
  break;
19876
20329
 
19877
20330
  case 4:
19878
20331
  rewardsGauge = new ethers.ethers.utils.Interface(IBalancerRewardsGauge.abi);
19879
20332
  stakeTxData = rewardsGauge.encodeFunctionData("deposit(uint256)", [amount]);
19880
- return _context13.abrupt("break", 10);
20333
+ return _context13.abrupt("break", 12);
19881
20334
 
19882
20335
  case 7:
19883
- stakeTxData = getVelodromeStakeTxData(amount);
19884
- return _context13.abrupt("break", 10);
20336
+ stakeTxData = getVelodromeStakeTxData(amount, false);
20337
+ return _context13.abrupt("break", 12);
19885
20338
 
19886
20339
  case 9:
20340
+ stakeTxData = getVelodromeStakeTxData(amount, true);
20341
+ return _context13.abrupt("break", 12);
20342
+
20343
+ case 11:
19887
20344
  throw new Error("dapp not supported");
19888
20345
 
19889
- case 10:
19890
- _context13.next = 12;
20346
+ case 12:
20347
+ _context13.next = 14;
19891
20348
  return this.poolLogic.execTransaction(gauge, stakeTxData, options);
19892
20349
 
19893
- case 12:
20350
+ case 14:
19894
20351
  tx = _context13.sent;
19895
20352
  return _context13.abrupt("return", tx);
19896
20353
 
19897
- case 14:
20354
+ case 16:
19898
20355
  case "end":
19899
20356
  return _context13.stop();
19900
20357
  }
@@ -19960,7 +20417,7 @@ var Pool = /*#__PURE__*/function () {
19960
20417
  return unStake;
19961
20418
  }()
19962
20419
  /**
19963
- * Unstake liquidity pool tokens from gauge contract
20420
+ * Unstake liquidity pool tokens from Velodrome or Balancer gauge
19964
20421
  * @param {string} gauge Gauge contract address
19965
20422
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
19966
20423
  * @param {any} options Transaction options
@@ -20822,38 +21279,43 @@ var Pool = /*#__PURE__*/function () {
20822
21279
  }
20823
21280
 
20824
21281
  _context30.t0 = dapp;
20825
- _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;
20826
21283
  break;
20827
21284
 
20828
21285
  case 4:
20829
21286
  contractAddress = nonfungiblePositionManagerAddress[this.network];
20830
21287
  iNonfungiblePositionManager = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
20831
21288
  txData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
20832
- return _context30.abrupt("break", 16);
21289
+ return _context30.abrupt("break", 19);
20833
21290
 
20834
21291
  case 8:
20835
21292
  contractAddress = tokenId;
20836
21293
  abi = new ethers.ethers.utils.Interface(ILiquidityGaugeV4.abi);
20837
21294
  txData = abi.encodeFunctionData("claim_rewards()", []);
20838
- return _context30.abrupt("break", 16);
21295
+ return _context30.abrupt("break", 19);
20839
21296
 
20840
21297
  case 12:
20841
21298
  contractAddress = tokenId;
20842
- txData = getVelodromeClaimTxData(this, tokenId);
20843
- return _context30.abrupt("break", 16);
21299
+ txData = getVelodromeClaimTxData(this, tokenId, false);
21300
+ return _context30.abrupt("break", 19);
20844
21301
 
20845
21302
  case 15:
21303
+ contractAddress = tokenId;
21304
+ txData = getVelodromeClaimTxData(this, tokenId, true);
21305
+ return _context30.abrupt("break", 19);
21306
+
21307
+ case 18:
20846
21308
  throw new Error("dapp not supported");
20847
21309
 
20848
- case 16:
20849
- _context30.next = 18;
21310
+ case 19:
21311
+ _context30.next = 21;
20850
21312
  return this.poolLogic.execTransaction(contractAddress, txData, options);
20851
21313
 
20852
- case 18:
21314
+ case 21:
20853
21315
  tx = _context30.sent;
20854
21316
  return _context30.abrupt("return", tx);
20855
21317
 
20856
- case 20:
21318
+ case 23:
20857
21319
  case "end":
20858
21320
  return _context30.stop();
20859
21321
  }
@@ -21030,6 +21492,113 @@ var Pool = /*#__PURE__*/function () {
21030
21492
 
21031
21493
  return removeLiquidityVelodrome;
21032
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
+ }()
21033
21602
  /**
21034
21603
  * Trade options on lyra
21035
21604
  * @param {LyraOptionMarket} market Underlying market e.g. eth
@@ -21049,11 +21618,11 @@ var Pool = /*#__PURE__*/function () {
21049
21618
  _proto.tradeLyraOption =
21050
21619
  /*#__PURE__*/
21051
21620
  function () {
21052
- 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) {
21053
21622
  var swapxData, tx;
21054
- return runtime_1.wrap(function _callee34$(_context34) {
21623
+ return runtime_1.wrap(function _callee36$(_context36) {
21055
21624
  while (1) {
21056
- switch (_context34.prev = _context34.next) {
21625
+ switch (_context36.prev = _context36.next) {
21057
21626
  case 0:
21058
21627
  if (collateralChangeAmount === void 0) {
21059
21628
  collateralChangeAmount = "0";
@@ -21067,27 +21636,27 @@ var Pool = /*#__PURE__*/function () {
21067
21636
  options = null;
21068
21637
  }
21069
21638
 
21070
- _context34.next = 5;
21639
+ _context36.next = 5;
21071
21640
  return getLyraOptionTxData(this, market, optionType, expiry, strike, tradeType, optionAmount, assetIn, ethers.BigNumber.from(collateralChangeAmount), isCoveredCall);
21072
21641
 
21073
21642
  case 5:
21074
- swapxData = _context34.sent;
21075
- _context34.next = 8;
21643
+ swapxData = _context36.sent;
21644
+ _context36.next = 8;
21076
21645
  return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.LYRA], swapxData, options);
21077
21646
 
21078
21647
  case 8:
21079
- tx = _context34.sent;
21080
- return _context34.abrupt("return", tx);
21648
+ tx = _context36.sent;
21649
+ return _context36.abrupt("return", tx);
21081
21650
 
21082
21651
  case 10:
21083
21652
  case "end":
21084
- return _context34.stop();
21653
+ return _context36.stop();
21085
21654
  }
21086
21655
  }
21087
- }, _callee34, this);
21656
+ }, _callee36, this);
21088
21657
  }));
21089
21658
 
21090
- 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) {
21091
21660
  return _tradeLyraOption.apply(this, arguments);
21092
21661
  }
21093
21662
 
@@ -21102,26 +21671,26 @@ var Pool = /*#__PURE__*/function () {
21102
21671
  _proto.getLyraPositions =
21103
21672
  /*#__PURE__*/
21104
21673
  function () {
21105
- var _getLyraPositions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee35(market) {
21106
- 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) {
21107
21676
  while (1) {
21108
- switch (_context35.prev = _context35.next) {
21677
+ switch (_context37.prev = _context37.next) {
21109
21678
  case 0:
21110
- _context35.next = 2;
21679
+ _context37.next = 2;
21111
21680
  return getOptionPositions(this, market);
21112
21681
 
21113
21682
  case 2:
21114
- return _context35.abrupt("return", _context35.sent);
21683
+ return _context37.abrupt("return", _context37.sent);
21115
21684
 
21116
21685
  case 3:
21117
21686
  case "end":
21118
- return _context35.stop();
21687
+ return _context37.stop();
21119
21688
  }
21120
21689
  }
21121
- }, _callee35, this);
21690
+ }, _callee37, this);
21122
21691
  }));
21123
21692
 
21124
- function getLyraPositions(_x144) {
21693
+ function getLyraPositions(_x155) {
21125
21694
  return _getLyraPositions.apply(this, arguments);
21126
21695
  }
21127
21696
 
@@ -21139,32 +21708,32 @@ var Pool = /*#__PURE__*/function () {
21139
21708
  _proto.changeFuturesMargin =
21140
21709
  /*#__PURE__*/
21141
21710
  function () {
21142
- 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) {
21143
21712
  var tx;
21144
- return runtime_1.wrap(function _callee36$(_context36) {
21713
+ return runtime_1.wrap(function _callee38$(_context38) {
21145
21714
  while (1) {
21146
- switch (_context36.prev = _context36.next) {
21715
+ switch (_context38.prev = _context38.next) {
21147
21716
  case 0:
21148
21717
  if (options === void 0) {
21149
21718
  options = null;
21150
21719
  }
21151
21720
 
21152
- _context36.next = 3;
21721
+ _context38.next = 3;
21153
21722
  return this.poolLogic.execTransaction(market, getFuturesChangeMarginTxData(changeAmount), options);
21154
21723
 
21155
21724
  case 3:
21156
- tx = _context36.sent;
21157
- return _context36.abrupt("return", tx);
21725
+ tx = _context38.sent;
21726
+ return _context38.abrupt("return", tx);
21158
21727
 
21159
21728
  case 5:
21160
21729
  case "end":
21161
- return _context36.stop();
21730
+ return _context38.stop();
21162
21731
  }
21163
21732
  }
21164
- }, _callee36, this);
21733
+ }, _callee38, this);
21165
21734
  }));
21166
21735
 
21167
- function changeFuturesMargin(_x145, _x146, _x147) {
21736
+ function changeFuturesMargin(_x156, _x157, _x158) {
21168
21737
  return _changeFuturesMargin.apply(this, arguments);
21169
21738
  }
21170
21739
 
@@ -21182,47 +21751,94 @@ var Pool = /*#__PURE__*/function () {
21182
21751
  _proto.changeFuturesPosition =
21183
21752
  /*#__PURE__*/
21184
21753
  function () {
21185
- 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) {
21186
21755
  var txData, tx;
21187
- return runtime_1.wrap(function _callee37$(_context37) {
21756
+ return runtime_1.wrap(function _callee39$(_context39) {
21188
21757
  while (1) {
21189
- switch (_context37.prev = _context37.next) {
21758
+ switch (_context39.prev = _context39.next) {
21190
21759
  case 0:
21191
21760
  if (options === void 0) {
21192
21761
  options = null;
21193
21762
  }
21194
21763
 
21195
- _context37.next = 3;
21764
+ _context39.next = 3;
21196
21765
  return getFuturesChangePositionTxData(changeAmount, market, this);
21197
21766
 
21198
21767
  case 3:
21199
- txData = _context37.sent;
21200
- _context37.next = 6;
21768
+ txData = _context39.sent;
21769
+ _context39.next = 6;
21201
21770
  return this.poolLogic.execTransaction(market, txData, options);
21202
21771
 
21203
21772
  case 6:
21204
- tx = _context37.sent;
21205
- return _context37.abrupt("return", tx);
21773
+ tx = _context39.sent;
21774
+ return _context39.abrupt("return", tx);
21206
21775
 
21207
21776
  case 8:
21208
21777
  case "end":
21209
- return _context37.stop();
21778
+ return _context39.stop();
21210
21779
  }
21211
21780
  }
21212
- }, _callee37, this);
21781
+ }, _callee39, this);
21213
21782
  }));
21214
21783
 
21215
- function changeFuturesPosition(_x148, _x149, _x150) {
21784
+ function changeFuturesPosition(_x159, _x160, _x161) {
21216
21785
  return _changeFuturesPosition.apply(this, arguments);
21217
21786
  }
21218
21787
 
21219
21788
  return changeFuturesPosition;
21789
+ }()
21790
+ /** Cancels an open oder on Synthetix futures market
21791
+ *
21792
+ * @param {string} market Address of futures market
21793
+ * @param {any} options Transaction options
21794
+ * @returns {Promise<any>} Transaction
21795
+ */
21796
+ ;
21797
+
21798
+ _proto.cancelFuturesOrder =
21799
+ /*#__PURE__*/
21800
+ function () {
21801
+ var _cancelFuturesOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee40(market, options) {
21802
+ var txData, tx;
21803
+ return runtime_1.wrap(function _callee40$(_context40) {
21804
+ while (1) {
21805
+ switch (_context40.prev = _context40.next) {
21806
+ case 0:
21807
+ if (options === void 0) {
21808
+ options = null;
21809
+ }
21810
+
21811
+ _context40.next = 3;
21812
+ return getFuturesCancelOrderTxData(this);
21813
+
21814
+ case 3:
21815
+ txData = _context40.sent;
21816
+ _context40.next = 6;
21817
+ return this.poolLogic.execTransaction(market, txData, options);
21818
+
21819
+ case 6:
21820
+ tx = _context40.sent;
21821
+ return _context40.abrupt("return", tx);
21822
+
21823
+ case 8:
21824
+ case "end":
21825
+ return _context40.stop();
21826
+ }
21827
+ }
21828
+ }, _callee40, this);
21829
+ }));
21830
+
21831
+ function cancelFuturesOrder(_x162, _x163) {
21832
+ return _cancelFuturesOrder.apply(this, arguments);
21833
+ }
21834
+
21835
+ return cancelFuturesOrder;
21220
21836
  }();
21221
21837
 
21222
21838
  return Pool;
21223
21839
  }();
21224
21840
 
21225
- var abi$p = [
21841
+ var abi$q = [
21226
21842
  {
21227
21843
  inputs: [
21228
21844
  {
@@ -21446,10 +22062,10 @@ var abi$p = [
21446
22062
  }
21447
22063
  ];
21448
22064
  var UniswapV2Factory = {
21449
- abi: abi$p
22065
+ abi: abi$q
21450
22066
  };
21451
22067
 
21452
- var abi$q = [
22068
+ var abi$r = [
21453
22069
  {
21454
22070
  anonymous: false,
21455
22071
  inputs: [
@@ -22193,7 +22809,7 @@ var evm = {
22193
22809
  }
22194
22810
  };
22195
22811
  var UniswapV2Pair = {
22196
- abi: abi$q,
22812
+ abi: abi$r,
22197
22813
  evm: evm,
22198
22814
  "interface": [
22199
22815
  {
@@ -22924,7 +23540,7 @@ var UniswapV2Pair = {
22924
23540
  ]
22925
23541
  };
22926
23542
 
22927
- var abi$r = [
23543
+ var abi$s = [
22928
23544
  {
22929
23545
  inputs: [
22930
23546
  {
@@ -24119,7 +24735,7 @@ var abi$r = [
24119
24735
  }
24120
24736
  ];
24121
24737
  var IBalancerV2Vault = {
24122
- abi: abi$r
24738
+ abi: abi$s
24123
24739
  };
24124
24740
 
24125
24741
  var Utils = /*#__PURE__*/function () {
@@ -24792,6 +25408,7 @@ Object.defineProperty(exports, 'ethers', {
24792
25408
  return ethers.ethers;
24793
25409
  }
24794
25410
  });
25411
+ exports.ApiError = ApiError;
24795
25412
  exports.Dhedge = Dhedge;
24796
25413
  exports.Pool = Pool;
24797
25414
  //# sourceMappingURL=v2-sdk.cjs.development.js.map