@dhedge/v2-sdk 1.9.5 → 1.9.6

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.
@@ -2375,7 +2375,7 @@ var abi$1 = [
2375
2375
  },
2376
2376
  {
2377
2377
  internalType: "bool",
2378
- name: "withdrawProcessed",
2378
+ name: "externalWithdrawProcessed",
2379
2379
  type: "bool"
2380
2380
  }
2381
2381
  ],
@@ -2449,7 +2449,7 @@ var abi$1 = [
2449
2449
  outputs: [
2450
2450
  {
2451
2451
  internalType: "uint256",
2452
- name: "",
2452
+ name: "fee",
2453
2453
  type: "uint256"
2454
2454
  }
2455
2455
  ],
@@ -2475,6 +2475,69 @@ var abi$1 = [
2475
2475
  stateMutability: "view",
2476
2476
  type: "function"
2477
2477
  },
2478
+ {
2479
+ inputs: [
2480
+ {
2481
+ internalType: "uint256",
2482
+ name: "fundValue",
2483
+ type: "uint256"
2484
+ }
2485
+ ],
2486
+ name: "calculateAvailableManagerFee",
2487
+ outputs: [
2488
+ {
2489
+ internalType: "uint256",
2490
+ name: "fee",
2491
+ type: "uint256"
2492
+ }
2493
+ ],
2494
+ stateMutability: "view",
2495
+ type: "function"
2496
+ },
2497
+ {
2498
+ inputs: [
2499
+ {
2500
+ internalType: "uint256",
2501
+ name: "currentBalance",
2502
+ type: "uint256"
2503
+ },
2504
+ {
2505
+ internalType: "uint256",
2506
+ name: "liquidityMinted",
2507
+ type: "uint256"
2508
+ },
2509
+ {
2510
+ internalType: "uint256",
2511
+ name: "newCooldown",
2512
+ type: "uint256"
2513
+ },
2514
+ {
2515
+ internalType: "uint256",
2516
+ name: "lastCooldown",
2517
+ type: "uint256"
2518
+ },
2519
+ {
2520
+ internalType: "uint256",
2521
+ name: "lastDepositTime",
2522
+ type: "uint256"
2523
+ },
2524
+ {
2525
+ internalType: "uint256",
2526
+ name: "blockTimestamp",
2527
+ type: "uint256"
2528
+ }
2529
+ ],
2530
+ name: "calculateCooldown",
2531
+ outputs: [
2532
+ {
2533
+ internalType: "uint256",
2534
+ name: "cooldown",
2535
+ type: "uint256"
2536
+ }
2537
+ ],
2538
+ stateMutability: "pure",
2539
+ type: "function"
2540
+ },
2478
2541
  {
2479
2542
  inputs: [
2480
2543
  ],
@@ -2558,7 +2621,70 @@ var abi$1 = [
2558
2621
  outputs: [
2559
2622
  {
2560
2623
  internalType: "uint256",
2561
- name: "",
2624
+ name: "liquidityMinted",
2625
+ type: "uint256"
2626
+ }
2627
+ ],
2628
+ stateMutability: "nonpayable",
2629
+ type: "function"
2630
+ },
2631
+ {
2632
+ inputs: [
2633
+ {
2634
+ internalType: "address",
2635
+ name: "_recipient",
2636
+ type: "address"
2637
+ },
2638
+ {
2639
+ internalType: "address",
2640
+ name: "_asset",
2641
+ type: "address"
2642
+ },
2643
+ {
2644
+ internalType: "uint256",
2645
+ name: "_amount",
2646
+ type: "uint256"
2647
+ }
2648
+ ],
2649
+ name: "depositFor",
2650
+ outputs: [
2651
+ {
2652
+ internalType: "uint256",
2653
+ name: "liquidityMinted",
2654
+ type: "uint256"
2655
+ }
2656
+ ],
2657
+ stateMutability: "nonpayable",
2658
+ type: "function"
2659
+ },
2660
+ {
2661
+ inputs: [
2662
+ {
2663
+ internalType: "address",
2664
+ name: "_recipient",
2665
+ type: "address"
2666
+ },
2667
+ {
2668
+ internalType: "address",
2669
+ name: "_asset",
2670
+ type: "address"
2671
+ },
2672
+ {
2673
+ internalType: "uint256",
2674
+ name: "_amount",
2675
+ type: "uint256"
2676
+ },
2677
+ {
2678
+ internalType: "uint256",
2679
+ name: "_cooldown",
2680
+ type: "uint256"
2681
+ }
2682
+ ],
2683
+ name: "depositForWithCustomCooldown",
2684
+ outputs: [
2685
+ {
2686
+ internalType: "uint256",
2687
+ name: "liquidityMinted",
2562
2688
  type: "uint256"
2563
2689
  }
2564
2690
  ],
@@ -2589,6 +2715,37 @@ var abi$1 = [
2589
2715
  stateMutability: "nonpayable",
2590
2716
  type: "function"
2591
2717
  },
2718
+ {
2719
+ inputs: [
2720
+ {
2721
+ components: [
2722
+ {
2723
+ internalType: "address",
2724
+ name: "to",
2725
+ type: "address"
2726
+ },
2727
+ {
2728
+ internalType: "bytes",
2729
+ name: "data",
2730
+ type: "bytes"
2731
+ }
2732
+ ],
2733
+ internalType: "struct PoolLogic.TxToExecute[]",
2734
+ name: "txs",
2735
+ type: "tuple[]"
2736
+ }
2737
+ ],
2738
+ name: "execTransactions",
2739
+ outputs: [
2740
+ {
2741
+ internalType: "bool",
2742
+ name: "success",
2743
+ type: "bool"
2744
+ }
2745
+ ],
2746
+ stateMutability: "nonpayable",
2747
+ type: "function"
2748
+ },
2592
2749
  {
2593
2750
  inputs: [
2594
2751
  {
@@ -2621,7 +2778,7 @@ var abi$1 = [
2621
2778
  outputs: [
2622
2779
  {
2623
2780
  internalType: "bool",
2624
- name: "",
2781
+ name: "success",
2625
2782
  type: "bool"
2626
2783
  }
2627
2784
  ],
@@ -2642,20 +2799,6 @@ var abi$1 = [
2642
2799
  stateMutability: "view",
2643
2800
  type: "function"
2644
2801
  },
2645
- {
2646
- inputs: [
2647
- ],
2648
- name: "getExitCooldown",
2649
- outputs: [
2650
- {
2651
- internalType: "uint256",
2652
- name: "",
2653
- type: "uint256"
2654
- }
2655
- ],
2656
- stateMutability: "view",
2657
- type: "function"
2658
- },
2659
2802
  {
2660
2803
  inputs: [
2661
2804
  {
@@ -2668,7 +2811,7 @@ var abi$1 = [
2668
2811
  outputs: [
2669
2812
  {
2670
2813
  internalType: "uint256",
2671
- name: "",
2814
+ name: "remaining",
2672
2815
  type: "uint256"
2673
2816
  }
2674
2817
  ],
@@ -2681,49 +2824,76 @@ var abi$1 = [
2681
2824
  name: "getFundSummary",
2682
2825
  outputs: [
2683
2826
  {
2684
- internalType: "string",
2685
- name: "",
2686
- type: "string"
2687
- },
2688
- {
2689
- internalType: "uint256",
2690
- name: "",
2691
- type: "uint256"
2692
- },
2693
- {
2694
- internalType: "uint256",
2695
- name: "",
2696
- type: "uint256"
2697
- },
2698
- {
2699
- internalType: "address",
2700
- name: "",
2701
- type: "address"
2702
- },
2703
- {
2704
- internalType: "string",
2705
- name: "",
2706
- type: "string"
2707
- },
2708
- {
2709
- internalType: "uint256",
2710
- name: "",
2711
- type: "uint256"
2712
- },
2713
- {
2714
- internalType: "bool",
2715
- name: "",
2716
- type: "bool"
2717
- },
2718
- {
2719
- internalType: "uint256",
2720
- name: "",
2721
- type: "uint256"
2722
- },
2723
- {
2724
- internalType: "uint256",
2827
+ components: [
2828
+ {
2829
+ internalType: "string",
2830
+ name: "name",
2831
+ type: "string"
2832
+ },
2833
+ {
2834
+ internalType: "uint256",
2835
+ name: "totalSupply",
2836
+ type: "uint256"
2837
+ },
2838
+ {
2839
+ internalType: "uint256",
2840
+ name: "totalFundValue",
2841
+ type: "uint256"
2842
+ },
2843
+ {
2844
+ internalType: "address",
2845
+ name: "manager",
2846
+ type: "address"
2847
+ },
2848
+ {
2849
+ internalType: "string",
2850
+ name: "managerName",
2851
+ type: "string"
2852
+ },
2853
+ {
2854
+ internalType: "uint256",
2855
+ name: "creationTime",
2856
+ type: "uint256"
2857
+ },
2858
+ {
2859
+ internalType: "bool",
2860
+ name: "privatePool",
2861
+ type: "bool"
2862
+ },
2863
+ {
2864
+ internalType: "uint256",
2865
+ name: "performanceFeeNumerator",
2866
+ type: "uint256"
2867
+ },
2868
+ {
2869
+ internalType: "uint256",
2870
+ name: "managerFeeNumerator",
2871
+ type: "uint256"
2872
+ },
2873
+ {
2874
+ internalType: "uint256",
2875
+ name: "managerFeeDenominator",
2876
+ type: "uint256"
2877
+ },
2878
+ {
2879
+ internalType: "uint256",
2880
+ name: "exitFeeNumerator",
2881
+ type: "uint256"
2882
+ },
2883
+ {
2884
+ internalType: "uint256",
2885
+ name: "exitFeeDenominator",
2886
+ type: "uint256"
2887
+ },
2888
+ {
2889
+ internalType: "uint256",
2890
+ name: "entryFeeNumerator",
2891
+ type: "uint256"
2892
+ }
2893
+ ],
2894
+ internalType: "struct PoolLogic.FundSummary",
2725
2895
  name: "",
2726
- type: "uint256"
2896
+ type: "tuple"
2727
2897
  }
2728
2898
  ],
2729
2899
  stateMutability: "view",
@@ -2820,6 +2990,58 @@ var abi$1 = [
2820
2990
  stateMutability: "view",
2821
2991
  type: "function"
2822
2992
  },
2993
+ {
2994
+ inputs: [
2995
+ {
2996
+ internalType: "address",
2997
+ name: "",
2998
+ type: "address"
2999
+ }
3000
+ ],
3001
+ name: "lastExitCooldown",
3002
+ outputs: [
3003
+ {
3004
+ internalType: "uint256",
3005
+ name: "",
3006
+ type: "uint256"
3007
+ }
3008
+ ],
3009
+ stateMutability: "view",
3010
+ type: "function"
3011
+ },
3012
+ {
3013
+ inputs: [
3014
+ ],
3015
+ name: "lastFeeMintTime",
3016
+ outputs: [
3017
+ {
3018
+ internalType: "uint256",
3019
+ name: "",
3020
+ type: "uint256"
3021
+ }
3022
+ ],
3023
+ stateMutability: "view",
3024
+ type: "function"
3025
+ },
3026
+ {
3027
+ inputs: [
3028
+ {
3029
+ internalType: "address",
3030
+ name: "",
3031
+ type: "address"
3032
+ }
3033
+ ],
3034
+ name: "lastWhitelistTransfer",
3035
+ outputs: [
3036
+ {
3037
+ internalType: "uint256",
3038
+ name: "",
3039
+ type: "uint256"
3040
+ }
3041
+ ],
3042
+ stateMutability: "view",
3043
+ type: "function"
3044
+ },
2823
3045
  {
2824
3046
  inputs: [
2825
3047
  ],
@@ -2827,7 +3049,7 @@ var abi$1 = [
2827
3049
  outputs: [
2828
3050
  {
2829
3051
  internalType: "string",
2830
- name: "",
3052
+ name: "_managerName",
2831
3053
  type: "string"
2832
3054
  }
2833
3055
  ],
@@ -2857,6 +3079,40 @@ var abi$1 = [
2857
3079
  stateMutability: "view",
2858
3080
  type: "function"
2859
3081
  },
3082
+ {
3083
+ inputs: [
3084
+ {
3085
+ internalType: "address",
3086
+ name: "operator",
3087
+ type: "address"
3088
+ },
3089
+ {
3090
+ internalType: "address",
3091
+ name: "from",
3092
+ type: "address"
3093
+ },
3094
+ {
3095
+ internalType: "uint256",
3096
+ name: "tokenId",
3097
+ type: "uint256"
3098
+ },
3099
+ {
3100
+ internalType: "bytes",
3101
+ name: "data",
3102
+ type: "bytes"
3103
+ }
3104
+ ],
3105
+ name: "onERC721Received",
3106
+ outputs: [
3107
+ {
3108
+ internalType: "bytes4",
3109
+ name: "magicSelector",
3110
+ type: "bytes4"
3111
+ }
3112
+ ],
3113
+ stateMutability: "nonpayable",
3114
+ type: "function"
3115
+ },
2860
3116
  {
2861
3117
  inputs: [
2862
3118
  ],
@@ -2939,7 +3195,7 @@ var abi$1 = [
2939
3195
  outputs: [
2940
3196
  {
2941
3197
  internalType: "uint256",
2942
- name: "",
3198
+ name: "price",
2943
3199
  type: "uint256"
2944
3200
  }
2945
3201
  ],
@@ -2960,6 +3216,20 @@ var abi$1 = [
2960
3216
  stateMutability: "view",
2961
3217
  type: "function"
2962
3218
  },
3219
+ {
3220
+ inputs: [
3221
+ ],
3222
+ name: "tokenPriceWithoutManagerFee",
3223
+ outputs: [
3224
+ {
3225
+ internalType: "uint256",
3226
+ name: "price",
3227
+ type: "uint256"
3228
+ }
3229
+ ],
3230
+ stateMutability: "view",
3231
+ type: "function"
3232
+ },
2963
3233
  {
2964
3234
  inputs: [
2965
3235
  ],
@@ -3040,6 +3310,25 @@ var abi$1 = [
3040
3310
  ],
3041
3311
  stateMutability: "nonpayable",
3042
3312
  type: "function"
3313
+ },
3314
+ {
3315
+ inputs: [
3316
+ {
3317
+ internalType: "address",
3318
+ name: "_recipient",
3319
+ type: "address"
3320
+ },
3321
+ {
3322
+ internalType: "uint256",
3323
+ name: "_fundTokenAmount",
3324
+ type: "uint256"
3325
+ }
3326
+ ],
3327
+ name: "withdrawTo",
3328
+ outputs: [
3329
+ ],
3330
+ stateMutability: "nonpayable",
3331
+ type: "function"
3043
3332
  }
3044
3333
  ];
3045
3334
  var PoolLogic = {
@@ -14815,35 +15104,71 @@ function call(_x, _x2, _x3, _x4) {
14815
15104
  }
14816
15105
 
14817
15106
  function _call() {
14818
- _call = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(provider, abi, call, options) {
15107
+ _call = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(provider, abi, call, options) {
14819
15108
  var contract, params;
14820
- return runtime_1.wrap(function _callee2$(_context2) {
15109
+ return runtime_1.wrap(function _callee3$(_context3) {
14821
15110
  while (1) {
14822
- switch (_context2.prev = _context2.next) {
15111
+ switch (_context3.prev = _context3.next) {
14823
15112
  case 0:
14824
15113
  contract = new ethers.Contract(call[0], abi, provider);
14825
- _context2.prev = 1;
15114
+ _context3.prev = 1;
14826
15115
  params = call[2] || [];
14827
- _context2.next = 5;
15116
+ _context3.next = 5;
14828
15117
  return contract[call[1]].apply(contract, params.concat([options || {}]));
14829
15118
 
14830
15119
  case 5:
14831
- return _context2.abrupt("return", _context2.sent);
15120
+ return _context3.abrupt("return", _context3.sent);
14832
15121
 
14833
15122
  case 8:
14834
- _context2.prev = 8;
14835
- _context2.t0 = _context2["catch"](1);
14836
- return _context2.abrupt("return", Promise.reject(_context2.t0));
15123
+ _context3.prev = 8;
15124
+ _context3.t0 = _context3["catch"](1);
15125
+ return _context3.abrupt("return", Promise.reject(_context3.t0));
14837
15126
 
14838
15127
  case 11:
14839
15128
  case "end":
14840
- return _context2.stop();
15129
+ return _context3.stop();
14841
15130
  }
14842
15131
  }
14843
- }, _callee2, null, [[1, 8]]);
15132
+ }, _callee3, null, [[1, 8]]);
14844
15133
  }));
14845
15134
  return _call.apply(this, arguments);
14846
15135
  }
15136
+ var getPoolTxOrGasEstimate = /*#__PURE__*/function () {
15137
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, args, estimateGas) {
15138
+ return runtime_1.wrap(function _callee2$(_context2) {
15139
+ while (1) {
15140
+ switch (_context2.prev = _context2.next) {
15141
+ case 0:
15142
+ if (!estimateGas) {
15143
+ _context2.next = 6;
15144
+ break;
15145
+ }
15146
+
15147
+ _context2.next = 3;
15148
+ return pool.poolLogic.estimateGas.execTransaction(args[0], args[1], args[2]);
15149
+
15150
+ case 3:
15151
+ return _context2.abrupt("return", _context2.sent);
15152
+
15153
+ case 6:
15154
+ _context2.next = 8;
15155
+ return pool.poolLogic.execTransaction(args[0], args[1], args[2]);
15156
+
15157
+ case 8:
15158
+ return _context2.abrupt("return", _context2.sent);
15159
+
15160
+ case 9:
15161
+ case "end":
15162
+ return _context2.stop();
15163
+ }
15164
+ }
15165
+ }, _callee2);
15166
+ }));
15167
+
15168
+ return function getPoolTxOrGasEstimate(_x12, _x13, _x14) {
15169
+ return _ref.apply(this, arguments);
15170
+ };
15171
+ }();
14847
15172
 
14848
15173
  var iVelodromeGaugeV1 = /*#__PURE__*/new ethers.utils.Interface(IVelodromeGaugeV1.abi);
14849
15174
  var iVelodromeGaugeV2 = /*#__PURE__*/new ethers.utils.Interface(IVelodromeGaugeV2.abi);
@@ -19925,8 +20250,9 @@ var Pool = /*#__PURE__*/function () {
19925
20250
  * Approve the asset for trading and providing liquidity
19926
20251
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
19927
20252
  * @param {string} asset Address of asset
19928
- * @param @param {BigNumber | string} Amount to be approved
20253
+ * @param {BigNumber | string} Amount to be approved
19929
20254
  * @param {any} options Transaction options
20255
+ * @param {boolean} estimateGas Simulate/estimate gas
19930
20256
  * @returns {Promise<any>} Transaction
19931
20257
  */
19932
20258
  ;
@@ -19934,7 +20260,7 @@ var Pool = /*#__PURE__*/function () {
19934
20260
  _proto.approve =
19935
20261
  /*#__PURE__*/
19936
20262
  function () {
19937
- var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(dapp, asset, amount, options) {
20263
+ var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(dapp, asset, amount, options, estimateGas) {
19938
20264
  var iERC20, approveTxData, tx;
19939
20265
  return runtime_1.wrap(function _callee5$(_context5) {
19940
20266
  while (1) {
@@ -19944,16 +20270,20 @@ var Pool = /*#__PURE__*/function () {
19944
20270
  options = null;
19945
20271
  }
19946
20272
 
20273
+ if (estimateGas === void 0) {
20274
+ estimateGas = false;
20275
+ }
20276
+
19947
20277
  iERC20 = new ethers.utils.Interface(IERC20.abi);
19948
20278
  approveTxData = iERC20.encodeFunctionData("approve", [routerAddress[this.network][dapp], amount]);
19949
- _context5.next = 5;
19950
- return this.poolLogic.execTransaction(asset, approveTxData, options);
20279
+ _context5.next = 6;
20280
+ return getPoolTxOrGasEstimate(this, [asset, approveTxData, options], estimateGas);
19951
20281
 
19952
- case 5:
20282
+ case 6:
19953
20283
  tx = _context5.sent;
19954
20284
  return _context5.abrupt("return", tx);
19955
20285
 
19956
- case 7:
20286
+ case 8:
19957
20287
  case "end":
19958
20288
  return _context5.stop();
19959
20289
  }
@@ -19961,7 +20291,7 @@ var Pool = /*#__PURE__*/function () {
19961
20291
  }, _callee5, this);
19962
20292
  }));
19963
20293
 
19964
- function approve(_x9, _x10, _x11, _x12) {
20294
+ function approve(_x9, _x10, _x11, _x12, _x13) {
19965
20295
  return _approve.apply(this, arguments);
19966
20296
  }
19967
20297
 
@@ -19973,6 +20303,7 @@ var Pool = /*#__PURE__*/function () {
19973
20303
  * @param {string} asset Address of liquidity pool token
19974
20304
  * @param {BigNumber | string} amount Aamount to be approved
19975
20305
  * @param {any} options Transaction options
20306
+ * @param {boolean} estimateGas Simulate/estimate gas
19976
20307
  * @returns {Promise<any>} Transaction
19977
20308
  */
19978
20309
  ;
@@ -19980,7 +20311,7 @@ var Pool = /*#__PURE__*/function () {
19980
20311
  _proto.approveStaking =
19981
20312
  /*#__PURE__*/
19982
20313
  function () {
19983
- var _approveStaking = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(dapp, asset, amount, options) {
20314
+ var _approveStaking = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(dapp, asset, amount, options, estimateGas) {
19984
20315
  var iERC20, approveTxData, tx;
19985
20316
  return runtime_1.wrap(function _callee6$(_context6) {
19986
20317
  while (1) {
@@ -19990,16 +20321,20 @@ var Pool = /*#__PURE__*/function () {
19990
20321
  options = null;
19991
20322
  }
19992
20323
 
20324
+ if (estimateGas === void 0) {
20325
+ estimateGas = false;
20326
+ }
20327
+
19993
20328
  iERC20 = new ethers.utils.Interface(IERC20.abi);
19994
20329
  approveTxData = iERC20.encodeFunctionData("approve", [stakingAddress[this.network][dapp], amount]);
19995
- _context6.next = 5;
19996
- return this.poolLogic.execTransaction(asset, approveTxData, options);
20330
+ _context6.next = 6;
20331
+ return getPoolTxOrGasEstimate(this, [asset, approveTxData, options], estimateGas);
19997
20332
 
19998
- case 5:
20333
+ case 6:
19999
20334
  tx = _context6.sent;
20000
20335
  return _context6.abrupt("return", tx);
20001
20336
 
20002
- case 7:
20337
+ case 8:
20003
20338
  case "end":
20004
20339
  return _context6.stop();
20005
20340
  }
@@ -20007,7 +20342,7 @@ var Pool = /*#__PURE__*/function () {
20007
20342
  }, _callee6, this);
20008
20343
  }));
20009
20344
 
20010
- function approveStaking(_x13, _x14, _x15, _x16) {
20345
+ function approveStaking(_x14, _x15, _x16, _x17, _x18) {
20011
20346
  return _approveStaking.apply(this, arguments);
20012
20347
  }
20013
20348
 
@@ -20019,6 +20354,7 @@ var Pool = /*#__PURE__*/function () {
20019
20354
  * @param {string} asset Address of liquidity pool token
20020
20355
  * @param {BigNumber | string} amount Aamount to be approved
20021
20356
  * @param {any} options Transaction options
20357
+ * @param {boolean} estimateGas Simulate/estimate gas
20022
20358
  * @returns {Promise<any>} Transaction
20023
20359
  */
20024
20360
  ;
@@ -20026,7 +20362,7 @@ var Pool = /*#__PURE__*/function () {
20026
20362
  _proto.approveUniswapV3Liquidity =
20027
20363
  /*#__PURE__*/
20028
20364
  function () {
20029
- var _approveUniswapV3Liquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(asset, amount, options) {
20365
+ var _approveUniswapV3Liquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(asset, amount, options, estimateGas) {
20030
20366
  var iERC20, approveTxData, tx;
20031
20367
  return runtime_1.wrap(function _callee7$(_context7) {
20032
20368
  while (1) {
@@ -20036,16 +20372,20 @@ var Pool = /*#__PURE__*/function () {
20036
20372
  options = null;
20037
20373
  }
20038
20374
 
20375
+ if (estimateGas === void 0) {
20376
+ estimateGas = false;
20377
+ }
20378
+
20039
20379
  iERC20 = new ethers.utils.Interface(IERC20.abi);
20040
20380
  approveTxData = iERC20.encodeFunctionData("approve", [nonfungiblePositionManagerAddress[this.network], amount]);
20041
- _context7.next = 5;
20042
- return this.poolLogic.execTransaction(asset, approveTxData, options);
20381
+ _context7.next = 6;
20382
+ return getPoolTxOrGasEstimate(this, [asset, approveTxData, options], estimateGas);
20043
20383
 
20044
- case 5:
20384
+ case 6:
20045
20385
  tx = _context7.sent;
20046
20386
  return _context7.abrupt("return", tx);
20047
20387
 
20048
- case 7:
20388
+ case 8:
20049
20389
  case "end":
20050
20390
  return _context7.stop();
20051
20391
  }
@@ -20053,7 +20393,7 @@ var Pool = /*#__PURE__*/function () {
20053
20393
  }, _callee7, this);
20054
20394
  }));
20055
20395
 
20056
- function approveUniswapV3Liquidity(_x17, _x18, _x19) {
20396
+ function approveUniswapV3Liquidity(_x19, _x20, _x21, _x22) {
20057
20397
  return _approveUniswapV3Liquidity.apply(this, arguments);
20058
20398
  }
20059
20399
 
@@ -20065,6 +20405,7 @@ var Pool = /*#__PURE__*/function () {
20065
20405
  * @param {string} asset Address of asset
20066
20406
  * @param {BigNumber | string} amount to be approved
20067
20407
  * @param {any} options Transaction options
20408
+ * @param {boolean} estimateGas Simulate/estimate gas
20068
20409
  * @returns {Promise<any>} Transaction
20069
20410
  */
20070
20411
  ;
@@ -20072,7 +20413,7 @@ var Pool = /*#__PURE__*/function () {
20072
20413
  _proto.approveSpender =
20073
20414
  /*#__PURE__*/
20074
20415
  function () {
20075
- var _approveSpender = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(spender, asset, amount, options) {
20416
+ var _approveSpender = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(spender, asset, amount, options, estimateGas) {
20076
20417
  var iERC20, approveTxData, tx;
20077
20418
  return runtime_1.wrap(function _callee8$(_context8) {
20078
20419
  while (1) {
@@ -20082,16 +20423,20 @@ var Pool = /*#__PURE__*/function () {
20082
20423
  options = null;
20083
20424
  }
20084
20425
 
20426
+ if (estimateGas === void 0) {
20427
+ estimateGas = false;
20428
+ }
20429
+
20085
20430
  iERC20 = new ethers.utils.Interface(IERC20.abi);
20086
20431
  approveTxData = iERC20.encodeFunctionData("approve", [spender, amount]);
20087
- _context8.next = 5;
20088
- return this.poolLogic.execTransaction(asset, approveTxData, options);
20432
+ _context8.next = 6;
20433
+ return getPoolTxOrGasEstimate(this, [asset, approveTxData, options], estimateGas);
20089
20434
 
20090
- case 5:
20435
+ case 6:
20091
20436
  tx = _context8.sent;
20092
20437
  return _context8.abrupt("return", tx);
20093
20438
 
20094
- case 7:
20439
+ case 8:
20095
20440
  case "end":
20096
20441
  return _context8.stop();
20097
20442
  }
@@ -20099,7 +20444,7 @@ var Pool = /*#__PURE__*/function () {
20099
20444
  }, _callee8, this);
20100
20445
  }));
20101
20446
 
20102
- function approveSpender(_x20, _x21, _x22, _x23) {
20447
+ function approveSpender(_x23, _x24, _x25, _x26, _x27) {
20103
20448
  return _approveSpender.apply(this, arguments);
20104
20449
  }
20105
20450
 
@@ -20113,6 +20458,7 @@ var Pool = /*#__PURE__*/function () {
20113
20458
  * @param {BigNumber | string} amountIn Amount
20114
20459
  * @param {number} slippage Slippage tolerance in %
20115
20460
  * @param {any} options Transaction options
20461
+ * @param {boolean} estimateGas Simulate/estimate gas
20116
20462
  * @returns {Promise<any>} Transaction
20117
20463
  */
20118
20464
  ;
@@ -20120,7 +20466,7 @@ var Pool = /*#__PURE__*/function () {
20120
20466
  _proto.trade =
20121
20467
  /*#__PURE__*/
20122
20468
  function () {
20123
- var _trade = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(dapp, assetFrom, assetTo, amountIn, slippage, options) {
20469
+ var _trade = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(dapp, assetFrom, assetTo, amountIn, slippage, options, estimateGas) {
20124
20470
  var swapTxData, iSynthetix, assets, daoAddress, iUniswapV2Router, minAmountOut, tx;
20125
20471
  return runtime_1.wrap(function _callee9$(_context9) {
20126
20472
  while (1) {
@@ -20134,61 +20480,65 @@ var Pool = /*#__PURE__*/function () {
20134
20480
  options = null;
20135
20481
  }
20136
20482
 
20483
+ if (estimateGas === void 0) {
20484
+ estimateGas = false;
20485
+ }
20486
+
20137
20487
  _context9.t0 = dapp;
20138
- _context9.next = _context9.t0 === Dapp.ZEROEX ? 5 : _context9.t0 === Dapp.ONEINCH ? 9 : _context9.t0 === Dapp.BALANCER ? 13 : _context9.t0 === Dapp.SYNTHETIX ? 17 : _context9.t0 === Dapp.TOROS ? 24 : 28;
20488
+ _context9.next = _context9.t0 === Dapp.ZEROEX ? 6 : _context9.t0 === Dapp.ONEINCH ? 10 : _context9.t0 === Dapp.BALANCER ? 14 : _context9.t0 === Dapp.SYNTHETIX ? 18 : _context9.t0 === Dapp.TOROS ? 25 : 29;
20139
20489
  break;
20140
20490
 
20141
- case 5:
20142
- _context9.next = 7;
20491
+ case 6:
20492
+ _context9.next = 8;
20143
20493
  return getZeroExTradeTxData(this.network, assetFrom, assetTo, amountIn, slippage, this.address);
20144
20494
 
20145
- case 7:
20495
+ case 8:
20146
20496
  swapTxData = _context9.sent;
20147
- return _context9.abrupt("break", 43);
20497
+ return _context9.abrupt("break", 44);
20148
20498
 
20149
- case 9:
20150
- _context9.next = 11;
20499
+ case 10:
20500
+ _context9.next = 12;
20151
20501
  return getOneInchSwapTxData(this, assetFrom, assetTo, amountIn, slippage);
20152
20502
 
20153
- case 11:
20503
+ case 12:
20154
20504
  swapTxData = _context9.sent;
20155
- return _context9.abrupt("break", 43);
20505
+ return _context9.abrupt("break", 44);
20156
20506
 
20157
- case 13:
20158
- _context9.next = 15;
20507
+ case 14:
20508
+ _context9.next = 16;
20159
20509
  return this.utils.getBalancerSwapTx(this, assetFrom, assetTo, amountIn, slippage);
20160
20510
 
20161
- case 15:
20511
+ case 16:
20162
20512
  swapTxData = _context9.sent;
20163
- return _context9.abrupt("break", 43);
20513
+ return _context9.abrupt("break", 44);
20164
20514
 
20165
- case 17:
20515
+ case 18:
20166
20516
  iSynthetix = new ethers.utils.Interface(ISynthetix.abi);
20167
20517
  assets = [assetFrom, assetTo].map(function (asset) {
20168
20518
  return ethers.utils.formatBytes32String(asset);
20169
20519
  });
20170
- _context9.next = 21;
20520
+ _context9.next = 22;
20171
20521
  return this.factory.owner();
20172
20522
 
20173
- case 21:
20523
+ case 22:
20174
20524
  daoAddress = _context9.sent;
20175
20525
  swapTxData = iSynthetix.encodeFunctionData(Transaction.SWAP_SYNTHS, [assets[0], amountIn, assets[1], daoAddress, SYNTHETIX_TRACKING_CODE]);
20176
- return _context9.abrupt("break", 43);
20526
+ return _context9.abrupt("break", 44);
20177
20527
 
20178
- case 24:
20179
- _context9.next = 26;
20528
+ case 25:
20529
+ _context9.next = 27;
20180
20530
  return getEasySwapperTxData(this, assetFrom, assetTo, ethers.BigNumber.from(amountIn), slippage);
20181
20531
 
20182
- case 26:
20532
+ case 27:
20183
20533
  swapTxData = _context9.sent;
20184
- return _context9.abrupt("break", 43);
20534
+ return _context9.abrupt("break", 44);
20185
20535
 
20186
- case 28:
20536
+ case 29:
20187
20537
  iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
20188
- _context9.next = 31;
20538
+ _context9.next = 32;
20189
20539
  return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
20190
20540
 
20191
- case 31:
20541
+ case 32:
20192
20542
  minAmountOut = _context9.sent;
20193
20543
  _context9.t1 = iUniswapV2Router;
20194
20544
  _context9.t2 = Transaction.SWAP;
@@ -20196,23 +20546,23 @@ var Pool = /*#__PURE__*/function () {
20196
20546
  _context9.t4 = minAmountOut;
20197
20547
  _context9.t5 = [assetFrom, assetTo];
20198
20548
  _context9.t6 = this.address;
20199
- _context9.next = 40;
20549
+ _context9.next = 41;
20200
20550
  return getDeadline(this);
20201
20551
 
20202
- case 40:
20552
+ case 41:
20203
20553
  _context9.t7 = _context9.sent;
20204
20554
  _context9.t8 = [_context9.t3, _context9.t4, _context9.t5, _context9.t6, _context9.t7];
20205
20555
  swapTxData = _context9.t1.encodeFunctionData.call(_context9.t1, _context9.t2, _context9.t8);
20206
20556
 
20207
- case 43:
20208
- _context9.next = 45;
20209
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], swapTxData, options);
20557
+ case 44:
20558
+ _context9.next = 46;
20559
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], swapTxData, options], estimateGas);
20210
20560
 
20211
- case 45:
20561
+ case 46:
20212
20562
  tx = _context9.sent;
20213
20563
  return _context9.abrupt("return", tx);
20214
20564
 
20215
- case 47:
20565
+ case 48:
20216
20566
  case "end":
20217
20567
  return _context9.stop();
20218
20568
  }
@@ -20220,7 +20570,7 @@ var Pool = /*#__PURE__*/function () {
20220
20570
  }, _callee9, this);
20221
20571
  }));
20222
20572
 
20223
- function trade(_x24, _x25, _x26, _x27, _x28, _x29) {
20573
+ function trade(_x28, _x29, _x30, _x31, _x32, _x33, _x34) {
20224
20574
  return _trade.apply(this, arguments);
20225
20575
  }
20226
20576
 
@@ -20234,6 +20584,7 @@ var Pool = /*#__PURE__*/function () {
20234
20584
  * @param {BigNumber | string} amountA Amount first asset
20235
20585
  * @param {BigNumber | string} amountB Amount second asset
20236
20586
  * @param {any} options Transaction options
20587
+ * @param {boolean} estimateGas Simulate/estimate gas
20237
20588
  * @returns {Promise<any>} Transaction
20238
20589
  */
20239
20590
  ;
@@ -20241,7 +20592,7 @@ var Pool = /*#__PURE__*/function () {
20241
20592
  _proto.addLiquidity =
20242
20593
  /*#__PURE__*/
20243
20594
  function () {
20244
- var _addLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(dapp, assetA, assetB, amountA, amountB, options) {
20595
+ var _addLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(dapp, assetA, assetB, amountA, amountB, options, estimateGas) {
20245
20596
  var iUniswapV2Router, addLiquidityTxData, tx;
20246
20597
  return runtime_1.wrap(function _callee10$(_context10) {
20247
20598
  while (1) {
@@ -20251,6 +20602,10 @@ var Pool = /*#__PURE__*/function () {
20251
20602
  options = null;
20252
20603
  }
20253
20604
 
20605
+ if (estimateGas === void 0) {
20606
+ estimateGas = false;
20607
+ }
20608
+
20254
20609
  iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
20255
20610
  _context10.t0 = iUniswapV2Router;
20256
20611
  _context10.t1 = Transaction.ADD_LIQUIDITY;
@@ -20259,21 +20614,21 @@ var Pool = /*#__PURE__*/function () {
20259
20614
  _context10.t4 = amountA;
20260
20615
  _context10.t5 = amountB;
20261
20616
  _context10.t6 = this.address;
20262
- _context10.next = 11;
20617
+ _context10.next = 12;
20263
20618
  return getDeadline(this);
20264
20619
 
20265
- case 11:
20620
+ case 12:
20266
20621
  _context10.t7 = _context10.sent;
20267
20622
  _context10.t8 = [_context10.t2, _context10.t3, _context10.t4, _context10.t5, 0, 0, _context10.t6, _context10.t7];
20268
20623
  addLiquidityTxData = _context10.t0.encodeFunctionData.call(_context10.t0, _context10.t1, _context10.t8);
20269
- _context10.next = 16;
20270
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], addLiquidityTxData, options);
20624
+ _context10.next = 17;
20625
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], addLiquidityTxData, options], estimateGas);
20271
20626
 
20272
- case 16:
20627
+ case 17:
20273
20628
  tx = _context10.sent;
20274
20629
  return _context10.abrupt("return", tx);
20275
20630
 
20276
- case 18:
20631
+ case 19:
20277
20632
  case "end":
20278
20633
  return _context10.stop();
20279
20634
  }
@@ -20281,7 +20636,7 @@ var Pool = /*#__PURE__*/function () {
20281
20636
  }, _callee10, this);
20282
20637
  }));
20283
20638
 
20284
- function addLiquidity(_x30, _x31, _x32, _x33, _x34, _x35) {
20639
+ function addLiquidity(_x35, _x36, _x37, _x38, _x39, _x40, _x41) {
20285
20640
  return _addLiquidity.apply(this, arguments);
20286
20641
  }
20287
20642
 
@@ -20294,6 +20649,7 @@ var Pool = /*#__PURE__*/function () {
20294
20649
  * @param {string} assetB Second asset
20295
20650
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20296
20651
  * @param {any} options Transaction options
20652
+ * @param {boolean} estimateGas Simulate/estimate gas
20297
20653
  * @returns {Promise<any>} Transaction
20298
20654
  */
20299
20655
  ;
@@ -20301,7 +20657,7 @@ var Pool = /*#__PURE__*/function () {
20301
20657
  _proto.removeLiquidity =
20302
20658
  /*#__PURE__*/
20303
20659
  function () {
20304
- var _removeLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(dapp, assetA, assetB, amount, options) {
20660
+ var _removeLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(dapp, assetA, assetB, amount, options, estimateGas) {
20305
20661
  var iUniswapV2Router, removeLiquidityTxData, tx;
20306
20662
  return runtime_1.wrap(function _callee11$(_context11) {
20307
20663
  while (1) {
@@ -20311,6 +20667,10 @@ var Pool = /*#__PURE__*/function () {
20311
20667
  options = null;
20312
20668
  }
20313
20669
 
20670
+ if (estimateGas === void 0) {
20671
+ estimateGas = false;
20672
+ }
20673
+
20314
20674
  iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
20315
20675
  _context11.t0 = iUniswapV2Router;
20316
20676
  _context11.t1 = Transaction.REMOVE_LIQUIDITY;
@@ -20318,21 +20678,21 @@ var Pool = /*#__PURE__*/function () {
20318
20678
  _context11.t3 = assetB;
20319
20679
  _context11.t4 = amount;
20320
20680
  _context11.t5 = this.address;
20321
- _context11.next = 10;
20681
+ _context11.next = 11;
20322
20682
  return getDeadline(this);
20323
20683
 
20324
- case 10:
20684
+ case 11:
20325
20685
  _context11.t6 = _context11.sent;
20326
20686
  _context11.t7 = [_context11.t2, _context11.t3, _context11.t4, 0, 0, _context11.t5, _context11.t6];
20327
20687
  removeLiquidityTxData = _context11.t0.encodeFunctionData.call(_context11.t0, _context11.t1, _context11.t7);
20328
- _context11.next = 15;
20329
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], removeLiquidityTxData, options);
20688
+ _context11.next = 16;
20689
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], removeLiquidityTxData, options], estimateGas);
20330
20690
 
20331
- case 15:
20691
+ case 16:
20332
20692
  tx = _context11.sent;
20333
20693
  return _context11.abrupt("return", tx);
20334
20694
 
20335
- case 17:
20695
+ case 18:
20336
20696
  case "end":
20337
20697
  return _context11.stop();
20338
20698
  }
@@ -20340,7 +20700,7 @@ var Pool = /*#__PURE__*/function () {
20340
20700
  }, _callee11, this);
20341
20701
  }));
20342
20702
 
20343
- function removeLiquidity(_x36, _x37, _x38, _x39, _x40) {
20703
+ function removeLiquidity(_x42, _x43, _x44, _x45, _x46, _x47) {
20344
20704
  return _removeLiquidity.apply(this, arguments);
20345
20705
  }
20346
20706
 
@@ -20352,6 +20712,7 @@ var Pool = /*#__PURE__*/function () {
20352
20712
  * @param {string} asset Liquidity pool token
20353
20713
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20354
20714
  * @param {any} options Transaction options
20715
+ * @param {boolean} estimateGas Simulate/estimate gas
20355
20716
  * @returns {Promise<any>} Transaction
20356
20717
  */
20357
20718
  ;
@@ -20359,7 +20720,7 @@ var Pool = /*#__PURE__*/function () {
20359
20720
  _proto.stake =
20360
20721
  /*#__PURE__*/
20361
20722
  function () {
20362
- var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(dapp, asset, amount, options) {
20723
+ var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(dapp, asset, amount, options, estimateGas) {
20363
20724
  var iMiniChefV2, poolId, stakeTxData, tx;
20364
20725
  return runtime_1.wrap(function _callee12$(_context12) {
20365
20726
  while (1) {
@@ -20369,21 +20730,25 @@ var Pool = /*#__PURE__*/function () {
20369
20730
  options = null;
20370
20731
  }
20371
20732
 
20733
+ if (estimateGas === void 0) {
20734
+ estimateGas = false;
20735
+ }
20736
+
20372
20737
  iMiniChefV2 = new ethers.utils.Interface(IMiniChefV2.abi);
20373
- _context12.next = 4;
20738
+ _context12.next = 5;
20374
20739
  return this.utils.getLpPoolId(dapp, asset);
20375
20740
 
20376
- case 4:
20741
+ case 5:
20377
20742
  poolId = _context12.sent;
20378
20743
  stakeTxData = iMiniChefV2.encodeFunctionData(Transaction.DEPOSIT, [poolId, amount, this.address]);
20379
- _context12.next = 8;
20380
- return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], stakeTxData, options);
20744
+ _context12.next = 9;
20745
+ return getPoolTxOrGasEstimate(this, [stakingAddress[this.network][dapp], stakeTxData, options], estimateGas);
20381
20746
 
20382
- case 8:
20747
+ case 9:
20383
20748
  tx = _context12.sent;
20384
20749
  return _context12.abrupt("return", tx);
20385
20750
 
20386
- case 10:
20751
+ case 11:
20387
20752
  case "end":
20388
20753
  return _context12.stop();
20389
20754
  }
@@ -20391,7 +20756,7 @@ var Pool = /*#__PURE__*/function () {
20391
20756
  }, _callee12, this);
20392
20757
  }));
20393
20758
 
20394
- function stake(_x41, _x42, _x43, _x44) {
20759
+ function stake(_x48, _x49, _x50, _x51, _x52) {
20395
20760
  return _stake.apply(this, arguments);
20396
20761
  }
20397
20762
 
@@ -20403,6 +20768,7 @@ var Pool = /*#__PURE__*/function () {
20403
20768
  * @param {string} gauge Gauge contract address
20404
20769
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20405
20770
  * @param {any} options Transaction options
20771
+ * @param {boolean} estimateGas Simulate/estimate gas
20406
20772
  * @returns {Promise<any>} Transaction
20407
20773
  */
20408
20774
  ;
@@ -20410,7 +20776,7 @@ var Pool = /*#__PURE__*/function () {
20410
20776
  _proto.stakeInGauge =
20411
20777
  /*#__PURE__*/
20412
20778
  function () {
20413
- var _stakeInGauge = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(dapp, gauge, amount, options) {
20779
+ var _stakeInGauge = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(dapp, gauge, amount, options, estimateGas) {
20414
20780
  var stakeTxData, rewardsGauge, tx;
20415
20781
  return runtime_1.wrap(function _callee13$(_context13) {
20416
20782
  while (1) {
@@ -20420,35 +20786,39 @@ var Pool = /*#__PURE__*/function () {
20420
20786
  options = null;
20421
20787
  }
20422
20788
 
20789
+ if (estimateGas === void 0) {
20790
+ estimateGas = false;
20791
+ }
20792
+
20423
20793
  _context13.t0 = dapp;
20424
- _context13.next = _context13.t0 === Dapp.BALANCER ? 4 : _context13.t0 === Dapp.VELODROME ? 7 : _context13.t0 === Dapp.RAMSES ? 7 : _context13.t0 === Dapp.VELODROMEV2 ? 9 : 11;
20794
+ _context13.next = _context13.t0 === Dapp.BALANCER ? 5 : _context13.t0 === Dapp.VELODROME ? 8 : _context13.t0 === Dapp.RAMSES ? 8 : _context13.t0 === Dapp.VELODROMEV2 ? 10 : 12;
20425
20795
  break;
20426
20796
 
20427
- case 4:
20797
+ case 5:
20428
20798
  rewardsGauge = new ethers.utils.Interface(IBalancerRewardsGauge.abi);
20429
20799
  stakeTxData = rewardsGauge.encodeFunctionData("deposit(uint256)", [amount]);
20430
- return _context13.abrupt("break", 12);
20800
+ return _context13.abrupt("break", 13);
20431
20801
 
20432
- case 7:
20802
+ case 8:
20433
20803
  stakeTxData = getVelodromeStakeTxData(amount, false);
20434
- return _context13.abrupt("break", 12);
20804
+ return _context13.abrupt("break", 13);
20435
20805
 
20436
- case 9:
20806
+ case 10:
20437
20807
  stakeTxData = getVelodromeStakeTxData(amount, true);
20438
- return _context13.abrupt("break", 12);
20808
+ return _context13.abrupt("break", 13);
20439
20809
 
20440
- case 11:
20810
+ case 12:
20441
20811
  throw new Error("dapp not supported");
20442
20812
 
20443
- case 12:
20444
- _context13.next = 14;
20445
- return this.poolLogic.execTransaction(gauge, stakeTxData, options);
20813
+ case 13:
20814
+ _context13.next = 15;
20815
+ return getPoolTxOrGasEstimate(this, [gauge, stakeTxData, options], estimateGas);
20446
20816
 
20447
- case 14:
20817
+ case 15:
20448
20818
  tx = _context13.sent;
20449
20819
  return _context13.abrupt("return", tx);
20450
20820
 
20451
- case 16:
20821
+ case 17:
20452
20822
  case "end":
20453
20823
  return _context13.stop();
20454
20824
  }
@@ -20456,7 +20826,7 @@ var Pool = /*#__PURE__*/function () {
20456
20826
  }, _callee13, this);
20457
20827
  }));
20458
20828
 
20459
- function stakeInGauge(_x45, _x46, _x47, _x48) {
20829
+ function stakeInGauge(_x53, _x54, _x55, _x56, _x57) {
20460
20830
  return _stakeInGauge.apply(this, arguments);
20461
20831
  }
20462
20832
 
@@ -20468,6 +20838,7 @@ var Pool = /*#__PURE__*/function () {
20468
20838
  * @param {string} asset Liquidity pool token
20469
20839
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20470
20840
  * @param {any} options Transaction options
20841
+ * @param {boolean} estimateGas Simulate/estimate gas
20471
20842
  * @returns {Promise<any>} Transaction
20472
20843
  */
20473
20844
  ;
@@ -20475,7 +20846,7 @@ var Pool = /*#__PURE__*/function () {
20475
20846
  _proto.unStake =
20476
20847
  /*#__PURE__*/
20477
20848
  function () {
20478
- var _unStake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(dapp, asset, amount, options) {
20849
+ var _unStake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(dapp, asset, amount, options, estimateGas) {
20479
20850
  var iMiniChefV2, poolId, unStakeTxData, tx;
20480
20851
  return runtime_1.wrap(function _callee14$(_context14) {
20481
20852
  while (1) {
@@ -20485,21 +20856,25 @@ var Pool = /*#__PURE__*/function () {
20485
20856
  options = null;
20486
20857
  }
20487
20858
 
20859
+ if (estimateGas === void 0) {
20860
+ estimateGas = false;
20861
+ }
20862
+
20488
20863
  iMiniChefV2 = new ethers.utils.Interface(IMiniChefV2.abi);
20489
- _context14.next = 4;
20864
+ _context14.next = 5;
20490
20865
  return this.utils.getLpPoolId(dapp, asset);
20491
20866
 
20492
- case 4:
20867
+ case 5:
20493
20868
  poolId = _context14.sent;
20494
20869
  unStakeTxData = iMiniChefV2.encodeFunctionData(Transaction.WITHDRAW, [poolId, amount, this.address]);
20495
- _context14.next = 8;
20496
- return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], unStakeTxData, options);
20870
+ _context14.next = 9;
20871
+ return getPoolTxOrGasEstimate(this, [stakingAddress[this.network][dapp], unStakeTxData, options], estimateGas);
20497
20872
 
20498
- case 8:
20873
+ case 9:
20499
20874
  tx = _context14.sent;
20500
20875
  return _context14.abrupt("return", tx);
20501
20876
 
20502
- case 10:
20877
+ case 11:
20503
20878
  case "end":
20504
20879
  return _context14.stop();
20505
20880
  }
@@ -20507,7 +20882,7 @@ var Pool = /*#__PURE__*/function () {
20507
20882
  }, _callee14, this);
20508
20883
  }));
20509
20884
 
20510
- function unStake(_x49, _x50, _x51, _x52) {
20885
+ function unStake(_x58, _x59, _x60, _x61, _x62) {
20511
20886
  return _unStake.apply(this, arguments);
20512
20887
  }
20513
20888
 
@@ -20518,6 +20893,7 @@ var Pool = /*#__PURE__*/function () {
20518
20893
  * @param {string} gauge Gauge contract address
20519
20894
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20520
20895
  * @param {any} options Transaction options
20896
+ * @param {boolean} estimateGas Simulate/estimate gas
20521
20897
  * @returns {Promise<any>} Transaction
20522
20898
  */
20523
20899
  ;
@@ -20525,7 +20901,7 @@ var Pool = /*#__PURE__*/function () {
20525
20901
  _proto.unstakeFromGauge =
20526
20902
  /*#__PURE__*/
20527
20903
  function () {
20528
- var _unstakeFromGauge = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(gauge, amount, options) {
20904
+ var _unstakeFromGauge = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(gauge, amount, options, estimateGas) {
20529
20905
  var rewardsGauge, unstakeTxData, tx;
20530
20906
  return runtime_1.wrap(function _callee15$(_context15) {
20531
20907
  while (1) {
@@ -20535,16 +20911,20 @@ var Pool = /*#__PURE__*/function () {
20535
20911
  options = null;
20536
20912
  }
20537
20913
 
20914
+ if (estimateGas === void 0) {
20915
+ estimateGas = false;
20916
+ }
20917
+
20538
20918
  rewardsGauge = new ethers.utils.Interface(IBalancerRewardsGauge.abi);
20539
20919
  unstakeTxData = rewardsGauge.encodeFunctionData("withdraw(uint256)", [amount]);
20540
- _context15.next = 5;
20541
- return this.poolLogic.execTransaction(gauge, unstakeTxData, options);
20920
+ _context15.next = 6;
20921
+ return getPoolTxOrGasEstimate(this, [gauge, unstakeTxData, options], estimateGas);
20542
20922
 
20543
- case 5:
20923
+ case 6:
20544
20924
  tx = _context15.sent;
20545
20925
  return _context15.abrupt("return", tx);
20546
20926
 
20547
- case 7:
20927
+ case 8:
20548
20928
  case "end":
20549
20929
  return _context15.stop();
20550
20930
  }
@@ -20552,7 +20932,7 @@ var Pool = /*#__PURE__*/function () {
20552
20932
  }, _callee15, this);
20553
20933
  }));
20554
20934
 
20555
- function unstakeFromGauge(_x53, _x54, _x55) {
20935
+ function unstakeFromGauge(_x63, _x64, _x65, _x66) {
20556
20936
  return _unstakeFromGauge.apply(this, arguments);
20557
20937
  }
20558
20938
 
@@ -20565,6 +20945,7 @@ var Pool = /*#__PURE__*/function () {
20565
20945
  * @param {BigNumber | string} amount Amount of asset to lend
20566
20946
  * @param {number} referralCode Code from Aave referral program
20567
20947
  * @param {any} options Transaction options
20948
+ * @param {boolean} estimateGas Simulate/estimate gas
20568
20949
  * @returns {Promise<any>} Transaction
20569
20950
  */
20570
20951
  ;
@@ -20572,7 +20953,7 @@ var Pool = /*#__PURE__*/function () {
20572
20953
  _proto.lend =
20573
20954
  /*#__PURE__*/
20574
20955
  function () {
20575
- var _lend = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16(dapp, asset, amount, referralCode, options) {
20956
+ var _lend = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16(dapp, asset, amount, referralCode, options, estimateGas) {
20576
20957
  var iLendingPool, depositTxData, tx;
20577
20958
  return runtime_1.wrap(function _callee16$(_context16) {
20578
20959
  while (1) {
@@ -20586,16 +20967,20 @@ var Pool = /*#__PURE__*/function () {
20586
20967
  options = null;
20587
20968
  }
20588
20969
 
20970
+ if (estimateGas === void 0) {
20971
+ estimateGas = false;
20972
+ }
20973
+
20589
20974
  iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
20590
20975
  depositTxData = iLendingPool.encodeFunctionData(Transaction.DEPOSIT, [asset, amount, this.address, referralCode]);
20591
- _context16.next = 6;
20592
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], depositTxData, options);
20976
+ _context16.next = 7;
20977
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], depositTxData, options], estimateGas);
20593
20978
 
20594
- case 6:
20979
+ case 7:
20595
20980
  tx = _context16.sent;
20596
20981
  return _context16.abrupt("return", tx);
20597
20982
 
20598
- case 8:
20983
+ case 9:
20599
20984
  case "end":
20600
20985
  return _context16.stop();
20601
20986
  }
@@ -20603,7 +20988,7 @@ var Pool = /*#__PURE__*/function () {
20603
20988
  }, _callee16, this);
20604
20989
  }));
20605
20990
 
20606
- function lend(_x56, _x57, _x58, _x59, _x60) {
20991
+ function lend(_x67, _x68, _x69, _x70, _x71, _x72) {
20607
20992
  return _lend.apply(this, arguments);
20608
20993
  }
20609
20994
 
@@ -20615,6 +21000,7 @@ var Pool = /*#__PURE__*/function () {
20615
21000
  * @param {string} asset Asset
20616
21001
  * @param {BigNumber | string} amount Amount of asset to lend
20617
21002
  * @param {any} options Transaction options
21003
+ * @param {boolean} estimateGas Simulate/estimate gas
20618
21004
  * @returns {Promise<any>} Transaction
20619
21005
  */
20620
21006
  ;
@@ -20622,7 +21008,7 @@ var Pool = /*#__PURE__*/function () {
20622
21008
  _proto.withdrawDeposit =
20623
21009
  /*#__PURE__*/
20624
21010
  function () {
20625
- var _withdrawDeposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17(dapp, asset, amount, options) {
21011
+ var _withdrawDeposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17(dapp, asset, amount, options, estimateGas) {
20626
21012
  var iLendingPool, withdrawTxData, tx;
20627
21013
  return runtime_1.wrap(function _callee17$(_context17) {
20628
21014
  while (1) {
@@ -20632,16 +21018,20 @@ var Pool = /*#__PURE__*/function () {
20632
21018
  options = null;
20633
21019
  }
20634
21020
 
21021
+ if (estimateGas === void 0) {
21022
+ estimateGas = false;
21023
+ }
21024
+
20635
21025
  iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
20636
21026
  withdrawTxData = iLendingPool.encodeFunctionData(Transaction.WITHDRAW, [asset, amount, this.address]);
20637
- _context17.next = 5;
20638
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], withdrawTxData, options);
21027
+ _context17.next = 6;
21028
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], withdrawTxData, options], estimateGas);
20639
21029
 
20640
- case 5:
21030
+ case 6:
20641
21031
  tx = _context17.sent;
20642
21032
  return _context17.abrupt("return", tx);
20643
21033
 
20644
- case 7:
21034
+ case 8:
20645
21035
  case "end":
20646
21036
  return _context17.stop();
20647
21037
  }
@@ -20649,7 +21039,7 @@ var Pool = /*#__PURE__*/function () {
20649
21039
  }, _callee17, this);
20650
21040
  }));
20651
21041
 
20652
- function withdrawDeposit(_x61, _x62, _x63, _x64) {
21042
+ function withdrawDeposit(_x73, _x74, _x75, _x76, _x77) {
20653
21043
  return _withdrawDeposit.apply(this, arguments);
20654
21044
  }
20655
21045
 
@@ -20662,6 +21052,7 @@ var Pool = /*#__PURE__*/function () {
20662
21052
  * @param {BigNumber | string} amount Amount of asset to lend
20663
21053
  * @param {number} referralCode Code from Aave referral program
20664
21054
  * @param {any} options Transaction options
21055
+ * @param {boolean} estimateGas Simulate/estimate gas
20665
21056
  * @returns {Promise<any>} Transaction
20666
21057
  */
20667
21058
  ;
@@ -20669,7 +21060,7 @@ var Pool = /*#__PURE__*/function () {
20669
21060
  _proto.borrow =
20670
21061
  /*#__PURE__*/
20671
21062
  function () {
20672
- var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee18(dapp, asset, amount, referralCode, options) {
21063
+ var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee18(dapp, asset, amount, referralCode, options, estimateGas) {
20673
21064
  var iLendingPool, borrowTxData, tx;
20674
21065
  return runtime_1.wrap(function _callee18$(_context18) {
20675
21066
  while (1) {
@@ -20683,16 +21074,20 @@ var Pool = /*#__PURE__*/function () {
20683
21074
  options = null;
20684
21075
  }
20685
21076
 
21077
+ if (estimateGas === void 0) {
21078
+ estimateGas = false;
21079
+ }
21080
+
20686
21081
  iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
20687
21082
  borrowTxData = iLendingPool.encodeFunctionData(Transaction.BORROW, [asset, amount, 2, referralCode, this.address]);
20688
- _context18.next = 6;
20689
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], borrowTxData, options);
21083
+ _context18.next = 7;
21084
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], borrowTxData, options], estimateGas);
20690
21085
 
20691
- case 6:
21086
+ case 7:
20692
21087
  tx = _context18.sent;
20693
21088
  return _context18.abrupt("return", tx);
20694
21089
 
20695
- case 8:
21090
+ case 9:
20696
21091
  case "end":
20697
21092
  return _context18.stop();
20698
21093
  }
@@ -20700,7 +21095,7 @@ var Pool = /*#__PURE__*/function () {
20700
21095
  }, _callee18, this);
20701
21096
  }));
20702
21097
 
20703
- function borrow(_x65, _x66, _x67, _x68, _x69) {
21098
+ function borrow(_x78, _x79, _x80, _x81, _x82, _x83) {
20704
21099
  return _borrow.apply(this, arguments);
20705
21100
  }
20706
21101
 
@@ -20712,6 +21107,7 @@ var Pool = /*#__PURE__*/function () {
20712
21107
  * @param {string} asset Asset
20713
21108
  * @param {BigNumber | string} amount Amount of asset to lend
20714
21109
  * @param {any} options Transaction options
21110
+ * @param {boolean} estimateGas Simulate/estimate gas
20715
21111
  * @returns {Promise<any>} Transaction
20716
21112
  */
20717
21113
  ;
@@ -20719,7 +21115,7 @@ var Pool = /*#__PURE__*/function () {
20719
21115
  _proto.repay =
20720
21116
  /*#__PURE__*/
20721
21117
  function () {
20722
- var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19(dapp, asset, amount, options) {
21118
+ var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19(dapp, asset, amount, options, estimateGas) {
20723
21119
  var iLendingPool, repayTxData, tx;
20724
21120
  return runtime_1.wrap(function _callee19$(_context19) {
20725
21121
  while (1) {
@@ -20729,16 +21125,20 @@ var Pool = /*#__PURE__*/function () {
20729
21125
  options = null;
20730
21126
  }
20731
21127
 
21128
+ if (estimateGas === void 0) {
21129
+ estimateGas = false;
21130
+ }
21131
+
20732
21132
  iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
20733
21133
  repayTxData = iLendingPool.encodeFunctionData(Transaction.REPAY, [asset, amount, 2, this.address]);
20734
- _context19.next = 5;
20735
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], repayTxData, options);
21134
+ _context19.next = 6;
21135
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], repayTxData, options], estimateGas);
20736
21136
 
20737
- case 5:
21137
+ case 6:
20738
21138
  tx = _context19.sent;
20739
21139
  return _context19.abrupt("return", tx);
20740
21140
 
20741
- case 7:
21141
+ case 8:
20742
21142
  case "end":
20743
21143
  return _context19.stop();
20744
21144
  }
@@ -20746,7 +21146,7 @@ var Pool = /*#__PURE__*/function () {
20746
21146
  }, _callee19, this);
20747
21147
  }));
20748
21148
 
20749
- function repay(_x70, _x71, _x72, _x73) {
21149
+ function repay(_x84, _x85, _x86, _x87, _x88) {
20750
21150
  return _repay.apply(this, arguments);
20751
21151
  }
20752
21152
 
@@ -20756,7 +21156,8 @@ var Pool = /*#__PURE__*/function () {
20756
21156
  * Claim rewards of staked liquidity pool tokens
20757
21157
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
20758
21158
  * @param {string} asset Liquidity pool token
20759
- * @param {any} options Transaction options
21159
+ * @param {any} options Transaction option
21160
+ * @param {boolean} estimateGas Simulate/estimate gas
20760
21161
  * @returns {Promise<any>} Transaction
20761
21162
  */
20762
21163
  ;
@@ -20764,7 +21165,7 @@ var Pool = /*#__PURE__*/function () {
20764
21165
  _proto.harvestRewards =
20765
21166
  /*#__PURE__*/
20766
21167
  function () {
20767
- var _harvestRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee20(dapp, asset, options) {
21168
+ var _harvestRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee20(dapp, asset, options, estimateGas) {
20768
21169
  var iMiniChefV2, poolId, harvestTxData, tx;
20769
21170
  return runtime_1.wrap(function _callee20$(_context20) {
20770
21171
  while (1) {
@@ -20774,21 +21175,25 @@ var Pool = /*#__PURE__*/function () {
20774
21175
  options = null;
20775
21176
  }
20776
21177
 
21178
+ if (estimateGas === void 0) {
21179
+ estimateGas = false;
21180
+ }
21181
+
20777
21182
  iMiniChefV2 = new ethers.utils.Interface(IMiniChefV2.abi);
20778
- _context20.next = 4;
21183
+ _context20.next = 5;
20779
21184
  return this.utils.getLpPoolId(dapp, asset);
20780
21185
 
20781
- case 4:
21186
+ case 5:
20782
21187
  poolId = _context20.sent;
20783
21188
  harvestTxData = iMiniChefV2.encodeFunctionData(Transaction.HARVEST, [poolId, this.address]);
20784
- _context20.next = 8;
20785
- return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], harvestTxData, options);
21189
+ _context20.next = 9;
21190
+ return getPoolTxOrGasEstimate(this, [stakingAddress[this.network][dapp], harvestTxData, options], estimateGas);
20786
21191
 
20787
- case 8:
21192
+ case 9:
20788
21193
  tx = _context20.sent;
20789
21194
  return _context20.abrupt("return", tx);
20790
21195
 
20791
- case 10:
21196
+ case 11:
20792
21197
  case "end":
20793
21198
  return _context20.stop();
20794
21199
  }
@@ -20796,7 +21201,7 @@ var Pool = /*#__PURE__*/function () {
20796
21201
  }, _callee20, this);
20797
21202
  }));
20798
21203
 
20799
- function harvestRewards(_x74, _x75, _x76) {
21204
+ function harvestRewards(_x89, _x90, _x91, _x92) {
20800
21205
  return _harvestRewards.apply(this, arguments);
20801
21206
  }
20802
21207
 
@@ -20855,7 +21260,7 @@ var Pool = /*#__PURE__*/function () {
20855
21260
  }, _callee21, this);
20856
21261
  }));
20857
21262
 
20858
- function changeAssets(_x77, _x78) {
21263
+ function changeAssets(_x93, _x94) {
20859
21264
  return _changeAssets.apply(this, arguments);
20860
21265
  }
20861
21266
 
@@ -20897,7 +21302,7 @@ var Pool = /*#__PURE__*/function () {
20897
21302
  }, _callee22, this);
20898
21303
  }));
20899
21304
 
20900
- function setTrader(_x79, _x80) {
21305
+ function setTrader(_x95, _x96) {
20901
21306
  return _setTrader.apply(this, arguments);
20902
21307
  }
20903
21308
 
@@ -20909,6 +21314,7 @@ var Pool = /*#__PURE__*/function () {
20909
21314
  * @param {string[] | } assetsIn Array of balancer pool assets
20910
21315
  * @param {BigNumber[] | string[]} amountsIn Array of maximum amounts to provide to pool
20911
21316
  * @param {any} options Transaction options
21317
+ * @param {boolean} estimateGas Simulate/estimate gas
20912
21318
  * @returns {Promise<any>} Transaction
20913
21319
  */
20914
21320
  ;
@@ -20916,7 +21322,7 @@ var Pool = /*#__PURE__*/function () {
20916
21322
  _proto.joinBalancerPool =
20917
21323
  /*#__PURE__*/
20918
21324
  function () {
20919
- var _joinBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee23(poolId, assets, amountsIn, options) {
21325
+ var _joinBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee23(poolId, assets, amountsIn, options, estimateGas) {
20920
21326
  var joinPoolTxData, tx;
20921
21327
  return runtime_1.wrap(function _callee23$(_context23) {
20922
21328
  while (1) {
@@ -20926,15 +21332,19 @@ var Pool = /*#__PURE__*/function () {
20926
21332
  options = null;
20927
21333
  }
20928
21334
 
21335
+ if (estimateGas === void 0) {
21336
+ estimateGas = false;
21337
+ }
21338
+
20929
21339
  joinPoolTxData = this.utils.getBalancerJoinPoolTx(this, poolId, assets, amountsIn);
20930
- _context23.next = 4;
20931
- return this.poolLogic.execTransaction(routerAddress[this.network][Dapp.BALANCER], joinPoolTxData, options);
21340
+ _context23.next = 5;
21341
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][Dapp.BALANCER], joinPoolTxData, options], estimateGas);
20932
21342
 
20933
- case 4:
21343
+ case 5:
20934
21344
  tx = _context23.sent;
20935
21345
  return _context23.abrupt("return", tx);
20936
21346
 
20937
- case 6:
21347
+ case 7:
20938
21348
  case "end":
20939
21349
  return _context23.stop();
20940
21350
  }
@@ -20942,7 +21352,7 @@ var Pool = /*#__PURE__*/function () {
20942
21352
  }, _callee23, this);
20943
21353
  }));
20944
21354
 
20945
- function joinBalancerPool(_x81, _x82, _x83, _x84) {
21355
+ function joinBalancerPool(_x97, _x98, _x99, _x100, _x101) {
20946
21356
  return _joinBalancerPool.apply(this, arguments);
20947
21357
  }
20948
21358
 
@@ -20955,6 +21365,7 @@ var Pool = /*#__PURE__*/function () {
20955
21365
  * @param {BigNumber | string } amount Amount of pool tokens to withdraw
20956
21366
  * @param { null | number } singleExitAssetIndex Index of asset to withdraw to
20957
21367
  * @param {any} options Transaction options
21368
+ * @param {boolean} estimateGas Simulate/estimate gas
20958
21369
  * @returns {Promise<any>} Transaction
20959
21370
  */
20960
21371
  ;
@@ -20962,7 +21373,7 @@ var Pool = /*#__PURE__*/function () {
20962
21373
  _proto.exitBalancerPool =
20963
21374
  /*#__PURE__*/
20964
21375
  function () {
20965
- var _exitBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee24(poolId, assets, amount, singleExitAssetIndex, options) {
21376
+ var _exitBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee24(poolId, assets, amount, singleExitAssetIndex, options, estimateGas) {
20966
21377
  var exitPoolTxData, tx;
20967
21378
  return runtime_1.wrap(function _callee24$(_context24) {
20968
21379
  while (1) {
@@ -20976,15 +21387,19 @@ var Pool = /*#__PURE__*/function () {
20976
21387
  options = null;
20977
21388
  }
20978
21389
 
21390
+ if (estimateGas === void 0) {
21391
+ estimateGas = false;
21392
+ }
21393
+
20979
21394
  exitPoolTxData = this.utils.getBalancerExitPoolTx(this, poolId, assets, singleExitAssetIndex, amount);
20980
- _context24.next = 5;
20981
- return this.poolLogic.execTransaction(routerAddress[this.network][Dapp.BALANCER], exitPoolTxData, options);
21395
+ _context24.next = 6;
21396
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][Dapp.BALANCER], exitPoolTxData, options], estimateGas);
20982
21397
 
20983
- case 5:
21398
+ case 6:
20984
21399
  tx = _context24.sent;
20985
21400
  return _context24.abrupt("return", tx);
20986
21401
 
20987
- case 7:
21402
+ case 8:
20988
21403
  case "end":
20989
21404
  return _context24.stop();
20990
21405
  }
@@ -20992,7 +21407,7 @@ var Pool = /*#__PURE__*/function () {
20992
21407
  }, _callee24, this);
20993
21408
  }));
20994
21409
 
20995
- function exitBalancerPool(_x85, _x86, _x87, _x88, _x89) {
21410
+ function exitBalancerPool(_x102, _x103, _x104, _x105, _x106, _x107) {
20996
21411
  return _exitBalancerPool.apply(this, arguments);
20997
21412
  }
20998
21413
 
@@ -21002,6 +21417,7 @@ var Pool = /*#__PURE__*/function () {
21002
21417
  * Claim rewards from Aave platform
21003
21418
  * @param {string[]} assets Aave tokens (deposit/debt) hold by pool
21004
21419
  * @param {any} options Transaction options
21420
+ * @param {boolean} estimateGas Simulate/estimate gas
21005
21421
  * @returns {Promise<any>} Transaction
21006
21422
  */
21007
21423
  ;
@@ -21009,7 +21425,7 @@ var Pool = /*#__PURE__*/function () {
21009
21425
  _proto.harvestAaveRewards =
21010
21426
  /*#__PURE__*/
21011
21427
  function () {
21012
- var _harvestAaveRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee25(assets, options) {
21428
+ var _harvestAaveRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee25(assets, options, estimateGas) {
21013
21429
  var aaveIncentivesAddress, iAaveIncentivesController, aaveIncentivesController, amount, claimTxData, tx;
21014
21430
  return runtime_1.wrap(function _callee25$(_context25) {
21015
21431
  while (1) {
@@ -21019,23 +21435,27 @@ var Pool = /*#__PURE__*/function () {
21019
21435
  options = null;
21020
21436
  }
21021
21437
 
21438
+ if (estimateGas === void 0) {
21439
+ estimateGas = false;
21440
+ }
21441
+
21022
21442
  aaveIncentivesAddress = stakingAddress[this.network][Dapp.AAVE];
21023
21443
  iAaveIncentivesController = new ethers.utils.Interface(IAaveIncentivesController.abi);
21024
21444
  aaveIncentivesController = new ethers.Contract(aaveIncentivesAddress, iAaveIncentivesController, this.signer);
21025
- _context25.next = 6;
21445
+ _context25.next = 7;
21026
21446
  return aaveIncentivesController.getUserUnclaimedRewards(this.address);
21027
21447
 
21028
- case 6:
21448
+ case 7:
21029
21449
  amount = _context25.sent;
21030
21450
  claimTxData = iAaveIncentivesController.encodeFunctionData(Transaction.CLAIM_REWARDS, [assets, amount, this.address]);
21031
- _context25.next = 10;
21032
- return this.poolLogic.execTransaction(aaveIncentivesAddress, claimTxData, options);
21451
+ _context25.next = 11;
21452
+ return getPoolTxOrGasEstimate(this, [aaveIncentivesAddress, claimTxData, options], estimateGas);
21033
21453
 
21034
- case 10:
21454
+ case 11:
21035
21455
  tx = _context25.sent;
21036
21456
  return _context25.abrupt("return", tx);
21037
21457
 
21038
- case 12:
21458
+ case 13:
21039
21459
  case "end":
21040
21460
  return _context25.stop();
21041
21461
  }
@@ -21043,7 +21463,7 @@ var Pool = /*#__PURE__*/function () {
21043
21463
  }, _callee25, this);
21044
21464
  }));
21045
21465
 
21046
- function harvestAaveRewards(_x90, _x91) {
21466
+ function harvestAaveRewards(_x108, _x109, _x110) {
21047
21467
  return _harvestAaveRewards.apply(this, arguments);
21048
21468
  }
21049
21469
 
@@ -21054,6 +21474,7 @@ var Pool = /*#__PURE__*/function () {
21054
21474
  * @param {string[]} assets Assets invested in Aave
21055
21475
  * @param {string} rewardAssets Reward token address
21056
21476
  * @param {any} options Transaction options
21477
+ * @param {boolean} estimateGas Simulate/estimate gas
21057
21478
  * @returns {Promise<any>} Transaction
21058
21479
  */
21059
21480
  ;
@@ -21061,7 +21482,7 @@ var Pool = /*#__PURE__*/function () {
21061
21482
  _proto.harvestAaveV3Rewards =
21062
21483
  /*#__PURE__*/
21063
21484
  function () {
21064
- var _harvestAaveV3Rewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee26(assets, rewardAsset, options) {
21485
+ var _harvestAaveV3Rewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee26(assets, rewardAsset, options, estimateGas) {
21065
21486
  var claimTxData, tx;
21066
21487
  return runtime_1.wrap(function _callee26$(_context26) {
21067
21488
  while (1) {
@@ -21071,19 +21492,23 @@ var Pool = /*#__PURE__*/function () {
21071
21492
  options = null;
21072
21493
  }
21073
21494
 
21074
- _context26.next = 3;
21495
+ if (estimateGas === void 0) {
21496
+ estimateGas = false;
21497
+ }
21498
+
21499
+ _context26.next = 4;
21075
21500
  return getAaveV3ClaimTxData(this, assets, rewardAsset);
21076
21501
 
21077
- case 3:
21502
+ case 4:
21078
21503
  claimTxData = _context26.sent;
21079
- _context26.next = 6;
21080
- return this.poolLogic.execTransaction(stakingAddress[this.network][Dapp.AAVEV3], claimTxData, options);
21504
+ _context26.next = 7;
21505
+ return getPoolTxOrGasEstimate(this, [stakingAddress[this.network][Dapp.AAVEV3], claimTxData, options], estimateGas);
21081
21506
 
21082
- case 6:
21507
+ case 7:
21083
21508
  tx = _context26.sent;
21084
21509
  return _context26.abrupt("return", tx);
21085
21510
 
21086
- case 8:
21511
+ case 9:
21087
21512
  case "end":
21088
21513
  return _context26.stop();
21089
21514
  }
@@ -21091,7 +21516,7 @@ var Pool = /*#__PURE__*/function () {
21091
21516
  }, _callee26, this);
21092
21517
  }));
21093
21518
 
21094
- function harvestAaveV3Rewards(_x92, _x93, _x94) {
21519
+ function harvestAaveV3Rewards(_x111, _x112, _x113, _x114) {
21095
21520
  return _harvestAaveV3Rewards.apply(this, arguments);
21096
21521
  }
21097
21522
 
@@ -21109,6 +21534,7 @@ var Pool = /*#__PURE__*/function () {
21109
21534
  * @param { number } maxTick Upper tick range
21110
21535
  * @param { FeeAmount } feeAmount Fee tier (Low 0.05%, Medium 0.3%, High 1%)
21111
21536
  * @param {any} options Transaction options
21537
+ * @param {boolean} estimateGas Simulate/estimate gas
21112
21538
  * @returns {Promise<any>} Transaction
21113
21539
  */
21114
21540
  ;
@@ -21116,7 +21542,7 @@ var Pool = /*#__PURE__*/function () {
21116
21542
  _proto.addLiquidityUniswapV3 =
21117
21543
  /*#__PURE__*/
21118
21544
  function () {
21119
- var _addLiquidityUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee27(assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount, options) {
21545
+ var _addLiquidityUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee27(assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount, options, estimateGas) {
21120
21546
  var iNonfungiblePositionManager, mintTxParams, mintTxData, tx;
21121
21547
  return runtime_1.wrap(function _callee27$(_context27) {
21122
21548
  while (1) {
@@ -21126,29 +21552,33 @@ var Pool = /*#__PURE__*/function () {
21126
21552
  options = null;
21127
21553
  }
21128
21554
 
21555
+ if (estimateGas === void 0) {
21556
+ estimateGas = false;
21557
+ }
21558
+
21129
21559
  if (!((minPrice === null || maxPrice === null) && (minTick === null || maxTick === null))) {
21130
- _context27.next = 3;
21560
+ _context27.next = 4;
21131
21561
  break;
21132
21562
  }
21133
21563
 
21134
21564
  throw new Error("Need to provide price or tick range");
21135
21565
 
21136
- case 3:
21566
+ case 4:
21137
21567
  iNonfungiblePositionManager = new ethers.utils.Interface(INonfungiblePositionManager.abi);
21138
- _context27.next = 6;
21568
+ _context27.next = 7;
21139
21569
  return getUniswapV3MintParams(this, assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount);
21140
21570
 
21141
- case 6:
21571
+ case 7:
21142
21572
  mintTxParams = _context27.sent;
21143
21573
  mintTxData = iNonfungiblePositionManager.encodeFunctionData(Transaction.MINT, [mintTxParams]);
21144
- _context27.next = 10;
21145
- return this.poolLogic.execTransaction(nonfungiblePositionManagerAddress[this.network], mintTxData, options);
21574
+ _context27.next = 11;
21575
+ return getPoolTxOrGasEstimate(this, [nonfungiblePositionManagerAddress[this.network], mintTxData, options], estimateGas);
21146
21576
 
21147
- case 10:
21577
+ case 11:
21148
21578
  tx = _context27.sent;
21149
21579
  return _context27.abrupt("return", tx);
21150
21580
 
21151
- case 12:
21581
+ case 13:
21152
21582
  case "end":
21153
21583
  return _context27.stop();
21154
21584
  }
@@ -21156,7 +21586,7 @@ var Pool = /*#__PURE__*/function () {
21156
21586
  }, _callee27, this);
21157
21587
  }));
21158
21588
 
21159
- function addLiquidityUniswapV3(_x95, _x96, _x97, _x98, _x99, _x100, _x101, _x102, _x103, _x104) {
21589
+ function addLiquidityUniswapV3(_x115, _x116, _x117, _x118, _x119, _x120, _x121, _x122, _x123, _x124, _x125) {
21160
21590
  return _addLiquidityUniswapV.apply(this, arguments);
21161
21591
  }
21162
21592
 
@@ -21168,6 +21598,7 @@ var Pool = /*#__PURE__*/function () {
21168
21598
  * @param {string} tokenId Token Id of UniswapV3 position
21169
21599
  * @param {number} amount Amount in percent of assets to be removed
21170
21600
  * @param {any} options Transaction options
21601
+ * @param {boolean} estimateGas Simulate/estimate gas
21171
21602
  * @returns {Promise<any>} Transaction
21172
21603
  */
21173
21604
  ;
@@ -21175,7 +21606,7 @@ var Pool = /*#__PURE__*/function () {
21175
21606
  _proto.decreaseLiquidity =
21176
21607
  /*#__PURE__*/
21177
21608
  function () {
21178
- var _decreaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee28(dapp, tokenId, amount, options) {
21609
+ var _decreaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee28(dapp, tokenId, amount, options, estimateGas) {
21179
21610
  var txData, dappAddress, abi, liquidity, decreaseLiquidityTxData, collectTxData, multicallParams, burnTxData, _abi, _liquidity, tx;
21180
21611
 
21181
21612
  return runtime_1.wrap(function _callee28$(_context28) {
@@ -21190,26 +21621,30 @@ var Pool = /*#__PURE__*/function () {
21190
21621
  options = null;
21191
21622
  }
21192
21623
 
21624
+ if (estimateGas === void 0) {
21625
+ estimateGas = false;
21626
+ }
21627
+
21193
21628
  if (!(dapp === Dapp.UNISWAPV3)) {
21194
- _context28.next = 24;
21629
+ _context28.next = 25;
21195
21630
  break;
21196
21631
  }
21197
21632
 
21198
21633
  dappAddress = nonfungiblePositionManagerAddress[this.network];
21199
21634
  abi = new ethers.utils.Interface(INonfungiblePositionManager.abi);
21200
- _context28.next = 7;
21635
+ _context28.next = 8;
21201
21636
  return getUniswapV3Liquidity(tokenId, this);
21202
21637
 
21203
- case 7:
21638
+ case 8:
21204
21639
  liquidity = _context28.sent.mul(Math.round(amount * 1e4)).div(1e6);
21205
21640
  _context28.t0 = abi;
21206
21641
  _context28.t1 = Transaction.DECREASE_LIQUIDITY;
21207
21642
  _context28.t2 = tokenId;
21208
21643
  _context28.t3 = liquidity;
21209
- _context28.next = 14;
21644
+ _context28.next = 15;
21210
21645
  return getDeadline(this);
21211
21646
 
21212
- case 14:
21647
+ case 15:
21213
21648
  _context28.t4 = _context28.sent;
21214
21649
  _context28.t5 = [_context28.t2, _context28.t3, 0, 0, _context28.t4];
21215
21650
  _context28.t6 = [_context28.t5];
@@ -21223,38 +21658,38 @@ var Pool = /*#__PURE__*/function () {
21223
21658
  }
21224
21659
 
21225
21660
  txData = abi.encodeFunctionData(Transaction.MULTI_CALL, [multicallParams]);
21226
- _context28.next = 34;
21661
+ _context28.next = 35;
21227
21662
  break;
21228
21663
 
21229
- case 24:
21664
+ case 25:
21230
21665
  if (!(dapp === Dapp.ARRAKIS)) {
21231
- _context28.next = 33;
21666
+ _context28.next = 34;
21232
21667
  break;
21233
21668
  }
21234
21669
 
21235
21670
  dappAddress = routerAddress[this.network][dapp];
21236
21671
  _abi = new ethers.utils.Interface(IArrakisV1RouterStaking.abi);
21237
- _context28.next = 29;
21672
+ _context28.next = 30;
21238
21673
  return this.utils.getBalance(tokenId, this.address);
21239
21674
 
21240
- case 29:
21675
+ case 30:
21241
21676
  _liquidity = _context28.sent.mul(Math.round(amount * 1e4)).div(1e6);
21242
21677
  txData = _abi.encodeFunctionData(Transaction.REMOVE_LIQUIDITY_UNSTAKE, [tokenId, _liquidity, 0, 0, this.address]);
21243
- _context28.next = 34;
21678
+ _context28.next = 35;
21244
21679
  break;
21245
21680
 
21246
- case 33:
21681
+ case 34:
21247
21682
  throw new Error("dapp not supported");
21248
21683
 
21249
- case 34:
21250
- _context28.next = 36;
21251
- return this.poolLogic.execTransaction(dappAddress, txData, options);
21684
+ case 35:
21685
+ _context28.next = 37;
21686
+ return getPoolTxOrGasEstimate(this, [dappAddress, txData, options], estimateGas);
21252
21687
 
21253
- case 36:
21688
+ case 37:
21254
21689
  tx = _context28.sent;
21255
21690
  return _context28.abrupt("return", tx);
21256
21691
 
21257
- case 38:
21692
+ case 39:
21258
21693
  case "end":
21259
21694
  return _context28.stop();
21260
21695
  }
@@ -21262,7 +21697,7 @@ var Pool = /*#__PURE__*/function () {
21262
21697
  }, _callee28, this);
21263
21698
  }));
21264
21699
 
21265
- function decreaseLiquidity(_x105, _x106, _x107, _x108) {
21700
+ function decreaseLiquidity(_x126, _x127, _x128, _x129, _x130) {
21266
21701
  return _decreaseLiquidity.apply(this, arguments);
21267
21702
  }
21268
21703
 
@@ -21275,6 +21710,7 @@ var Pool = /*#__PURE__*/function () {
21275
21710
  * @param {BigNumber | string} amountA Amount first asset
21276
21711
  * @param {BigNumber | string} amountB Amount second asset
21277
21712
  * @param {any} options Transaction options
21713
+ * @param {boolean} estimateGas Simulate/estimate gas
21278
21714
  * @returns {Promise<any>} Transaction
21279
21715
  */
21280
21716
  ;
@@ -21282,7 +21718,7 @@ var Pool = /*#__PURE__*/function () {
21282
21718
  _proto.increaseLiquidity =
21283
21719
  /*#__PURE__*/
21284
21720
  function () {
21285
- var _increaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee29(dapp, tokenId, amountA, amountB, options) {
21721
+ var _increaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee29(dapp, tokenId, amountA, amountB, options, estimateGas) {
21286
21722
  var txData, dappAddress, abi, _abi2, tx;
21287
21723
 
21288
21724
  return runtime_1.wrap(function _callee29$(_context29) {
@@ -21293,8 +21729,12 @@ var Pool = /*#__PURE__*/function () {
21293
21729
  options = null;
21294
21730
  }
21295
21731
 
21732
+ if (estimateGas === void 0) {
21733
+ estimateGas = false;
21734
+ }
21735
+
21296
21736
  if (!(dapp === Dapp.UNISWAPV3)) {
21297
- _context29.next = 17;
21737
+ _context29.next = 18;
21298
21738
  break;
21299
21739
  }
21300
21740
 
@@ -21305,41 +21745,41 @@ var Pool = /*#__PURE__*/function () {
21305
21745
  _context29.t2 = tokenId;
21306
21746
  _context29.t3 = amountA;
21307
21747
  _context29.t4 = amountB;
21308
- _context29.next = 11;
21748
+ _context29.next = 12;
21309
21749
  return getDeadline(this);
21310
21750
 
21311
- case 11:
21751
+ case 12:
21312
21752
  _context29.t5 = _context29.sent;
21313
21753
  _context29.t6 = [_context29.t2, _context29.t3, _context29.t4, 0, 0, _context29.t5];
21314
21754
  _context29.t7 = [_context29.t6];
21315
21755
  txData = _context29.t0.encodeFunctionData.call(_context29.t0, _context29.t1, _context29.t7);
21316
- _context29.next = 24;
21756
+ _context29.next = 25;
21317
21757
  break;
21318
21758
 
21319
- case 17:
21759
+ case 18:
21320
21760
  if (!(dapp === Dapp.ARRAKIS)) {
21321
- _context29.next = 23;
21761
+ _context29.next = 24;
21322
21762
  break;
21323
21763
  }
21324
21764
 
21325
21765
  dappAddress = routerAddress[this.network][dapp];
21326
21766
  _abi2 = new ethers.utils.Interface(IArrakisV1RouterStaking.abi);
21327
21767
  txData = _abi2.encodeFunctionData(Transaction.ADD_LIQUIDITY_STAKE, [tokenId, amountA, amountB, 0, 0, 0, this.address]);
21328
- _context29.next = 24;
21768
+ _context29.next = 25;
21329
21769
  break;
21330
21770
 
21331
- case 23:
21771
+ case 24:
21332
21772
  throw new Error("dapp not supported");
21333
21773
 
21334
- case 24:
21335
- _context29.next = 26;
21336
- return this.poolLogic.execTransaction(dappAddress, txData, options);
21774
+ case 25:
21775
+ _context29.next = 27;
21776
+ return getPoolTxOrGasEstimate(this, [dappAddress, txData, options], estimateGas);
21337
21777
 
21338
- case 26:
21778
+ case 27:
21339
21779
  tx = _context29.sent;
21340
21780
  return _context29.abrupt("return", tx);
21341
21781
 
21342
- case 28:
21782
+ case 29:
21343
21783
  case "end":
21344
21784
  return _context29.stop();
21345
21785
  }
@@ -21347,7 +21787,7 @@ var Pool = /*#__PURE__*/function () {
21347
21787
  }, _callee29, this);
21348
21788
  }));
21349
21789
 
21350
- function increaseLiquidity(_x109, _x110, _x111, _x112, _x113) {
21790
+ function increaseLiquidity(_x131, _x132, _x133, _x134, _x135, _x136) {
21351
21791
  return _increaseLiquidity.apply(this, arguments);
21352
21792
  }
21353
21793
 
@@ -21358,6 +21798,7 @@ var Pool = /*#__PURE__*/function () {
21358
21798
  * @param {Dapp} dapp Platform either UniswapV3 or Arrakis
21359
21799
  * @param {string} tokenId Token Id of UniswapV3 or Gauge address
21360
21800
  * @param {any} options Transaction option
21801
+ * @param {boolean} estimateGas Simulate/estimate gas
21361
21802
  * @returns {Promise<any>} Transaction
21362
21803
  */
21363
21804
  ;
@@ -21365,7 +21806,7 @@ var Pool = /*#__PURE__*/function () {
21365
21806
  _proto.claimFees =
21366
21807
  /*#__PURE__*/
21367
21808
  function () {
21368
- var _claimFees = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee30(dapp, tokenId, options) {
21809
+ var _claimFees = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee30(dapp, tokenId, options, estimateGas) {
21369
21810
  var txData, contractAddress, iNonfungiblePositionManager, abi, tx;
21370
21811
  return runtime_1.wrap(function _callee30$(_context30) {
21371
21812
  while (1) {
@@ -21375,44 +21816,48 @@ var Pool = /*#__PURE__*/function () {
21375
21816
  options = null;
21376
21817
  }
21377
21818
 
21819
+ if (estimateGas === void 0) {
21820
+ estimateGas = false;
21821
+ }
21822
+
21378
21823
  _context30.t0 = dapp;
21379
- _context30.next = _context30.t0 === Dapp.UNISWAPV3 ? 4 : _context30.t0 === Dapp.ARRAKIS ? 8 : _context30.t0 === Dapp.BALANCER ? 8 : _context30.t0 === Dapp.VELODROME ? 12 : _context30.t0 === Dapp.RAMSES ? 12 : _context30.t0 === Dapp.VELODROMEV2 ? 15 : 18;
21824
+ _context30.next = _context30.t0 === Dapp.UNISWAPV3 ? 5 : _context30.t0 === Dapp.ARRAKIS ? 9 : _context30.t0 === Dapp.BALANCER ? 9 : _context30.t0 === Dapp.VELODROME ? 13 : _context30.t0 === Dapp.RAMSES ? 13 : _context30.t0 === Dapp.VELODROMEV2 ? 16 : 19;
21380
21825
  break;
21381
21826
 
21382
- case 4:
21827
+ case 5:
21383
21828
  contractAddress = nonfungiblePositionManagerAddress[this.network];
21384
21829
  iNonfungiblePositionManager = new ethers.utils.Interface(INonfungiblePositionManager.abi);
21385
21830
  txData = iNonfungiblePositionManager.encodeFunctionData(Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
21386
- return _context30.abrupt("break", 19);
21831
+ return _context30.abrupt("break", 20);
21387
21832
 
21388
- case 8:
21833
+ case 9:
21389
21834
  contractAddress = tokenId;
21390
21835
  abi = new ethers.utils.Interface(ILiquidityGaugeV4.abi);
21391
21836
  txData = abi.encodeFunctionData("claim_rewards()", []);
21392
- return _context30.abrupt("break", 19);
21837
+ return _context30.abrupt("break", 20);
21393
21838
 
21394
- case 12:
21839
+ case 13:
21395
21840
  contractAddress = tokenId;
21396
21841
  txData = getVelodromeClaimTxData(this, tokenId, false);
21397
- return _context30.abrupt("break", 19);
21842
+ return _context30.abrupt("break", 20);
21398
21843
 
21399
- case 15:
21844
+ case 16:
21400
21845
  contractAddress = tokenId;
21401
21846
  txData = getVelodromeClaimTxData(this, tokenId, true);
21402
- return _context30.abrupt("break", 19);
21847
+ return _context30.abrupt("break", 20);
21403
21848
 
21404
- case 18:
21849
+ case 19:
21405
21850
  throw new Error("dapp not supported");
21406
21851
 
21407
- case 19:
21408
- _context30.next = 21;
21409
- return this.poolLogic.execTransaction(contractAddress, txData, options);
21852
+ case 20:
21853
+ _context30.next = 22;
21854
+ return getPoolTxOrGasEstimate(this, [contractAddress, txData, options], estimateGas);
21410
21855
 
21411
- case 21:
21856
+ case 22:
21412
21857
  tx = _context30.sent;
21413
21858
  return _context30.abrupt("return", tx);
21414
21859
 
21415
- case 23:
21860
+ case 24:
21416
21861
  case "end":
21417
21862
  return _context30.stop();
21418
21863
  }
@@ -21420,7 +21865,7 @@ var Pool = /*#__PURE__*/function () {
21420
21865
  }, _callee30, this);
21421
21866
  }));
21422
21867
 
21423
- function claimFees(_x114, _x115, _x116) {
21868
+ function claimFees(_x137, _x138, _x139, _x140) {
21424
21869
  return _claimFees.apply(this, arguments);
21425
21870
  }
21426
21871
 
@@ -21435,6 +21880,7 @@ var Pool = /*#__PURE__*/function () {
21435
21880
  * @param { FeeAmount } feeAmount Fee tier (Low 0.05%, Medium 0.3%, High 1%)
21436
21881
  * @param {number} slippage Slippage tolerance in %
21437
21882
  * @param {any} options Transaction options
21883
+ * @param {boolean} estimateGas Simulate/estimate gas
21438
21884
  * @returns {Promise<any>} Transaction
21439
21885
  */
21440
21886
  ;
@@ -21442,7 +21888,7 @@ var Pool = /*#__PURE__*/function () {
21442
21888
  _proto.tradeUniswapV3 =
21443
21889
  /*#__PURE__*/
21444
21890
  function () {
21445
- var _tradeUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee31(assetFrom, assetTo, amountIn, feeAmount, slippage, options) {
21891
+ var _tradeUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee31(assetFrom, assetTo, amountIn, feeAmount, slippage, options, estimateGas) {
21446
21892
  var swapxData, tx;
21447
21893
  return runtime_1.wrap(function _callee31$(_context31) {
21448
21894
  while (1) {
@@ -21456,19 +21902,23 @@ var Pool = /*#__PURE__*/function () {
21456
21902
  options = null;
21457
21903
  }
21458
21904
 
21459
- _context31.next = 4;
21905
+ if (estimateGas === void 0) {
21906
+ estimateGas = false;
21907
+ }
21908
+
21909
+ _context31.next = 5;
21460
21910
  return getUniswapV3SwapTxData(this, assetFrom, assetTo, amountIn, slippage, feeAmount);
21461
21911
 
21462
- case 4:
21912
+ case 5:
21463
21913
  swapxData = _context31.sent;
21464
- _context31.next = 7;
21465
- return this.poolLogic.execTransaction(routerAddress[this.network][Dapp.UNISWAPV3], swapxData, options);
21914
+ _context31.next = 8;
21915
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][Dapp.UNISWAPV3], swapxData, options], estimateGas);
21466
21916
 
21467
- case 7:
21917
+ case 8:
21468
21918
  tx = _context31.sent;
21469
21919
  return _context31.abrupt("return", tx);
21470
21920
 
21471
- case 9:
21921
+ case 10:
21472
21922
  case "end":
21473
21923
  return _context31.stop();
21474
21924
  }
@@ -21476,7 +21926,7 @@ var Pool = /*#__PURE__*/function () {
21476
21926
  }, _callee31, this);
21477
21927
  }));
21478
21928
 
21479
- function tradeUniswapV3(_x117, _x118, _x119, _x120, _x121, _x122) {
21929
+ function tradeUniswapV3(_x141, _x142, _x143, _x144, _x145, _x146, _x147) {
21480
21930
  return _tradeUniswapV.apply(this, arguments);
21481
21931
  }
21482
21932
 
@@ -21490,6 +21940,7 @@ var Pool = /*#__PURE__*/function () {
21490
21940
  * @param {BigNumber | string} amountB Amount second asset
21491
21941
  * @param { boolean } isStable Is stable pool
21492
21942
  * @param {any} options Transaction options
21943
+ * @param {boolean} estimateGas Simulate/estimate gas
21493
21944
  * @returns {Promise<any>} Transaction
21494
21945
  */
21495
21946
  ;
@@ -21497,7 +21948,7 @@ var Pool = /*#__PURE__*/function () {
21497
21948
  _proto.addLiquidityVelodrome =
21498
21949
  /*#__PURE__*/
21499
21950
  function () {
21500
- var _addLiquidityVelodrome = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee32(assetA, assetB, amountA, amountB, isStable, options) {
21951
+ var _addLiquidityVelodrome = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee32(assetA, assetB, amountA, amountB, isStable, options, estimateGas) {
21501
21952
  var tx;
21502
21953
  return runtime_1.wrap(function _callee32$(_context32) {
21503
21954
  while (1) {
@@ -21507,22 +21958,29 @@ var Pool = /*#__PURE__*/function () {
21507
21958
  options = null;
21508
21959
  }
21509
21960
 
21510
- _context32.t0 = this.poolLogic;
21511
- _context32.t1 = routerAddress[this.network][Dapp.VELODROME];
21512
- _context32.next = 5;
21961
+ if (estimateGas === void 0) {
21962
+ estimateGas = false;
21963
+ }
21964
+
21965
+ _context32.t0 = getPoolTxOrGasEstimate;
21966
+ _context32.t1 = this;
21967
+ _context32.t2 = routerAddress[this.network][Dapp.VELODROME];
21968
+ _context32.next = 7;
21513
21969
  return getVelodromeAddLiquidityTxData(this, assetA, assetB, amountA, amountB, isStable);
21514
21970
 
21515
- case 5:
21516
- _context32.t2 = _context32.sent;
21517
- _context32.t3 = options;
21518
- _context32.next = 9;
21519
- return _context32.t0.execTransaction.call(_context32.t0, _context32.t1, _context32.t2, _context32.t3);
21971
+ case 7:
21972
+ _context32.t3 = _context32.sent;
21973
+ _context32.t4 = options;
21974
+ _context32.t5 = [_context32.t2, _context32.t3, _context32.t4];
21975
+ _context32.t6 = estimateGas;
21976
+ _context32.next = 13;
21977
+ return (0, _context32.t0)(_context32.t1, _context32.t5, _context32.t6);
21520
21978
 
21521
- case 9:
21979
+ case 13:
21522
21980
  tx = _context32.sent;
21523
21981
  return _context32.abrupt("return", tx);
21524
21982
 
21525
- case 11:
21983
+ case 15:
21526
21984
  case "end":
21527
21985
  return _context32.stop();
21528
21986
  }
@@ -21530,7 +21988,7 @@ var Pool = /*#__PURE__*/function () {
21530
21988
  }, _callee32, this);
21531
21989
  }));
21532
21990
 
21533
- function addLiquidityVelodrome(_x123, _x124, _x125, _x126, _x127, _x128) {
21991
+ function addLiquidityVelodrome(_x148, _x149, _x150, _x151, _x152, _x153, _x154) {
21534
21992
  return _addLiquidityVelodrome.apply(this, arguments);
21535
21993
  }
21536
21994
 
@@ -21543,6 +22001,7 @@ var Pool = /*#__PURE__*/function () {
21543
22001
  * @param {BigNumber | string} amount Amount of LP tokens
21544
22002
  * @param { boolean } isStable Is stable pool
21545
22003
  * @param {any} options Transaction options
22004
+ * @param {boolean} estimateGas Simulate/estimate gas
21546
22005
  * @returns {Promise<any>} Transaction
21547
22006
  */
21548
22007
  ;
@@ -21550,7 +22009,7 @@ var Pool = /*#__PURE__*/function () {
21550
22009
  _proto.removeLiquidityVelodrome =
21551
22010
  /*#__PURE__*/
21552
22011
  function () {
21553
- var _removeLiquidityVelodrome = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee33(assetA, assetB, amount, isStable, options) {
22012
+ var _removeLiquidityVelodrome = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee33(assetA, assetB, amount, isStable, options, estimateGas) {
21554
22013
  var tx;
21555
22014
  return runtime_1.wrap(function _callee33$(_context33) {
21556
22015
  while (1) {
@@ -21560,22 +22019,29 @@ var Pool = /*#__PURE__*/function () {
21560
22019
  options = null;
21561
22020
  }
21562
22021
 
21563
- _context33.t0 = this.poolLogic;
21564
- _context33.t1 = routerAddress[this.network][Dapp.VELODROME];
21565
- _context33.next = 5;
22022
+ if (estimateGas === void 0) {
22023
+ estimateGas = false;
22024
+ }
22025
+
22026
+ _context33.t0 = getPoolTxOrGasEstimate;
22027
+ _context33.t1 = this;
22028
+ _context33.t2 = routerAddress[this.network][Dapp.VELODROME];
22029
+ _context33.next = 7;
21566
22030
  return getVelodromeRemoveLiquidityTxData(this, assetA, assetB, amount, isStable);
21567
22031
 
21568
- case 5:
21569
- _context33.t2 = _context33.sent;
21570
- _context33.t3 = options;
21571
- _context33.next = 9;
21572
- return _context33.t0.execTransaction.call(_context33.t0, _context33.t1, _context33.t2, _context33.t3);
22032
+ case 7:
22033
+ _context33.t3 = _context33.sent;
22034
+ _context33.t4 = options;
22035
+ _context33.t5 = [_context33.t2, _context33.t3, _context33.t4];
22036
+ _context33.t6 = estimateGas;
22037
+ _context33.next = 13;
22038
+ return (0, _context33.t0)(_context33.t1, _context33.t5, _context33.t6);
21573
22039
 
21574
- case 9:
22040
+ case 13:
21575
22041
  tx = _context33.sent;
21576
22042
  return _context33.abrupt("return", tx);
21577
22043
 
21578
- case 11:
22044
+ case 15:
21579
22045
  case "end":
21580
22046
  return _context33.stop();
21581
22047
  }
@@ -21583,7 +22049,7 @@ var Pool = /*#__PURE__*/function () {
21583
22049
  }, _callee33, this);
21584
22050
  }));
21585
22051
 
21586
- function removeLiquidityVelodrome(_x129, _x130, _x131, _x132, _x133) {
22052
+ function removeLiquidityVelodrome(_x155, _x156, _x157, _x158, _x159, _x160) {
21587
22053
  return _removeLiquidityVelodrome.apply(this, arguments);
21588
22054
  }
21589
22055
 
@@ -21597,6 +22063,7 @@ var Pool = /*#__PURE__*/function () {
21597
22063
  * @param {BigNumber | string} amountB Amount second asset
21598
22064
  * @param { boolean } isStable Is stable pool
21599
22065
  * @param {any} options Transaction options
22066
+ * @param {boolean} estimateGas Simulate/estimate gas
21600
22067
  * @returns {Promise<any>} Transaction
21601
22068
  */
21602
22069
  ;
@@ -21604,7 +22071,7 @@ var Pool = /*#__PURE__*/function () {
21604
22071
  _proto.addLiquidityVelodromeV2 =
21605
22072
  /*#__PURE__*/
21606
22073
  function () {
21607
- var _addLiquidityVelodromeV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee34(assetA, assetB, amountA, amountB, isStable, options) {
22074
+ var _addLiquidityVelodromeV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee34(assetA, assetB, amountA, amountB, isStable, options, estimateGas) {
21608
22075
  var tx;
21609
22076
  return runtime_1.wrap(function _callee34$(_context34) {
21610
22077
  while (1) {
@@ -21614,22 +22081,29 @@ var Pool = /*#__PURE__*/function () {
21614
22081
  options = null;
21615
22082
  }
21616
22083
 
21617
- _context34.t0 = this.poolLogic;
21618
- _context34.t1 = routerAddress[this.network][Dapp.VELODROMEV2];
21619
- _context34.next = 5;
22084
+ if (estimateGas === void 0) {
22085
+ estimateGas = false;
22086
+ }
22087
+
22088
+ _context34.t0 = getPoolTxOrGasEstimate;
22089
+ _context34.t1 = this;
22090
+ _context34.t2 = routerAddress[this.network][Dapp.VELODROMEV2];
22091
+ _context34.next = 7;
21620
22092
  return getVelodromeAddLiquidityTxData(this, assetA, assetB, amountA, amountB, isStable);
21621
22093
 
21622
- case 5:
21623
- _context34.t2 = _context34.sent;
21624
- _context34.t3 = options;
21625
- _context34.next = 9;
21626
- return _context34.t0.execTransaction.call(_context34.t0, _context34.t1, _context34.t2, _context34.t3);
22094
+ case 7:
22095
+ _context34.t3 = _context34.sent;
22096
+ _context34.t4 = options;
22097
+ _context34.t5 = [_context34.t2, _context34.t3, _context34.t4];
22098
+ _context34.t6 = estimateGas;
22099
+ _context34.next = 13;
22100
+ return (0, _context34.t0)(_context34.t1, _context34.t5, _context34.t6);
21627
22101
 
21628
- case 9:
22102
+ case 13:
21629
22103
  tx = _context34.sent;
21630
22104
  return _context34.abrupt("return", tx);
21631
22105
 
21632
- case 11:
22106
+ case 15:
21633
22107
  case "end":
21634
22108
  return _context34.stop();
21635
22109
  }
@@ -21637,7 +22111,7 @@ var Pool = /*#__PURE__*/function () {
21637
22111
  }, _callee34, this);
21638
22112
  }));
21639
22113
 
21640
- function addLiquidityVelodromeV2(_x134, _x135, _x136, _x137, _x138, _x139) {
22114
+ function addLiquidityVelodromeV2(_x161, _x162, _x163, _x164, _x165, _x166, _x167) {
21641
22115
  return _addLiquidityVelodromeV.apply(this, arguments);
21642
22116
  }
21643
22117
 
@@ -21650,6 +22124,7 @@ var Pool = /*#__PURE__*/function () {
21650
22124
  * @param {BigNumber | string} amount Amount of LP tokens
21651
22125
  * @param { boolean } isStable Is stable pool
21652
22126
  * @param {any} options Transaction options
22127
+ * @param {boolean} estimateGas Simulate/estimate gas
21653
22128
  * @returns {Promise<any>} Transaction
21654
22129
  */
21655
22130
  ;
@@ -21657,7 +22132,7 @@ var Pool = /*#__PURE__*/function () {
21657
22132
  _proto.removeLiquidityVelodromeV2 =
21658
22133
  /*#__PURE__*/
21659
22134
  function () {
21660
- var _removeLiquidityVelodromeV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee35(assetA, assetB, amount, isStable, options) {
22135
+ var _removeLiquidityVelodromeV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee35(assetA, assetB, amount, isStable, options, estimateGas) {
21661
22136
  var tx;
21662
22137
  return runtime_1.wrap(function _callee35$(_context35) {
21663
22138
  while (1) {
@@ -21667,22 +22142,29 @@ var Pool = /*#__PURE__*/function () {
21667
22142
  options = null;
21668
22143
  }
21669
22144
 
21670
- _context35.t0 = this.poolLogic;
21671
- _context35.t1 = routerAddress[this.network][Dapp.VELODROMEV2];
21672
- _context35.next = 5;
22145
+ if (estimateGas === void 0) {
22146
+ estimateGas = false;
22147
+ }
22148
+
22149
+ _context35.t0 = getPoolTxOrGasEstimate;
22150
+ _context35.t1 = this;
22151
+ _context35.t2 = routerAddress[this.network][Dapp.VELODROMEV2];
22152
+ _context35.next = 7;
21673
22153
  return getVelodromeRemoveLiquidityTxData(this, assetA, assetB, amount, isStable);
21674
22154
 
21675
- case 5:
21676
- _context35.t2 = _context35.sent;
21677
- _context35.t3 = options;
21678
- _context35.next = 9;
21679
- return _context35.t0.execTransaction.call(_context35.t0, _context35.t1, _context35.t2, _context35.t3);
22155
+ case 7:
22156
+ _context35.t3 = _context35.sent;
22157
+ _context35.t4 = options;
22158
+ _context35.t5 = [_context35.t2, _context35.t3, _context35.t4];
22159
+ _context35.t6 = estimateGas;
22160
+ _context35.next = 13;
22161
+ return (0, _context35.t0)(_context35.t1, _context35.t5, _context35.t6);
21680
22162
 
21681
- case 9:
22163
+ case 13:
21682
22164
  tx = _context35.sent;
21683
22165
  return _context35.abrupt("return", tx);
21684
22166
 
21685
- case 11:
22167
+ case 15:
21686
22168
  case "end":
21687
22169
  return _context35.stop();
21688
22170
  }
@@ -21690,7 +22172,7 @@ var Pool = /*#__PURE__*/function () {
21690
22172
  }, _callee35, this);
21691
22173
  }));
21692
22174
 
21693
- function removeLiquidityVelodromeV2(_x140, _x141, _x142, _x143, _x144) {
22175
+ function removeLiquidityVelodromeV2(_x168, _x169, _x170, _x171, _x172, _x173) {
21694
22176
  return _removeLiquidityVelodromeV.apply(this, arguments);
21695
22177
  }
21696
22178
 
@@ -21705,6 +22187,7 @@ var Pool = /*#__PURE__*/function () {
21705
22187
  * @param {BigNumber | string} amountB Amount second asset
21706
22188
  * @param { boolean } isStable Is stable pool
21707
22189
  * @param {any} options Transaction options
22190
+ * @param {boolean} estimateGas Simulate/estimate gas
21708
22191
  * @returns {Promise<any>} Transaction
21709
22192
  */
21710
22193
  ;
@@ -21712,7 +22195,7 @@ var Pool = /*#__PURE__*/function () {
21712
22195
  _proto.addLiquidityV2 =
21713
22196
  /*#__PURE__*/
21714
22197
  function () {
21715
- var _addLiquidityV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee36(dapp, assetA, assetB, amountA, amountB, isStable, options) {
22198
+ var _addLiquidityV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee36(dapp, assetA, assetB, amountA, amountB, isStable, options, estimateGas) {
21716
22199
  var tx;
21717
22200
  return runtime_1.wrap(function _callee36$(_context36) {
21718
22201
  while (1) {
@@ -21722,22 +22205,29 @@ var Pool = /*#__PURE__*/function () {
21722
22205
  options = null;
21723
22206
  }
21724
22207
 
21725
- _context36.t0 = this.poolLogic;
21726
- _context36.t1 = routerAddress[this.network][dapp];
21727
- _context36.next = 5;
22208
+ if (estimateGas === void 0) {
22209
+ estimateGas = false;
22210
+ }
22211
+
22212
+ _context36.t0 = getPoolTxOrGasEstimate;
22213
+ _context36.t1 = this;
22214
+ _context36.t2 = routerAddress[this.network][dapp];
22215
+ _context36.next = 7;
21728
22216
  return getVelodromeAddLiquidityTxData(this, assetA, assetB, amountA, amountB, isStable);
21729
22217
 
21730
- case 5:
21731
- _context36.t2 = _context36.sent;
21732
- _context36.t3 = options;
21733
- _context36.next = 9;
21734
- return _context36.t0.execTransaction.call(_context36.t0, _context36.t1, _context36.t2, _context36.t3);
22218
+ case 7:
22219
+ _context36.t3 = _context36.sent;
22220
+ _context36.t4 = options;
22221
+ _context36.t5 = [_context36.t2, _context36.t3, _context36.t4];
22222
+ _context36.t6 = estimateGas;
22223
+ _context36.next = 13;
22224
+ return (0, _context36.t0)(_context36.t1, _context36.t5, _context36.t6);
21735
22225
 
21736
- case 9:
22226
+ case 13:
21737
22227
  tx = _context36.sent;
21738
22228
  return _context36.abrupt("return", tx);
21739
22229
 
21740
- case 11:
22230
+ case 15:
21741
22231
  case "end":
21742
22232
  return _context36.stop();
21743
22233
  }
@@ -21745,7 +22235,7 @@ var Pool = /*#__PURE__*/function () {
21745
22235
  }, _callee36, this);
21746
22236
  }));
21747
22237
 
21748
- function addLiquidityV2(_x145, _x146, _x147, _x148, _x149, _x150, _x151) {
22238
+ function addLiquidityV2(_x174, _x175, _x176, _x177, _x178, _x179, _x180, _x181) {
21749
22239
  return _addLiquidityV.apply(this, arguments);
21750
22240
  }
21751
22241
 
@@ -21759,6 +22249,7 @@ var Pool = /*#__PURE__*/function () {
21759
22249
  * @param {BigNumber | string} amount Amount of LP tokens
21760
22250
  * @param { boolean } isStable Is stable pool
21761
22251
  * @param {any} options Transaction options
22252
+ * @param {boolean} estimateGas Simulate/estimate gas
21762
22253
  * @returns {Promise<any>} Transaction
21763
22254
  */
21764
22255
  ;
@@ -21766,7 +22257,7 @@ var Pool = /*#__PURE__*/function () {
21766
22257
  _proto.removeLiquidityV2 =
21767
22258
  /*#__PURE__*/
21768
22259
  function () {
21769
- var _removeLiquidityV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee37(dapp, assetA, assetB, amount, isStable, options) {
22260
+ var _removeLiquidityV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee37(dapp, assetA, assetB, amount, isStable, options, estimateGas) {
21770
22261
  var tx;
21771
22262
  return runtime_1.wrap(function _callee37$(_context37) {
21772
22263
  while (1) {
@@ -21776,22 +22267,29 @@ var Pool = /*#__PURE__*/function () {
21776
22267
  options = null;
21777
22268
  }
21778
22269
 
21779
- _context37.t0 = this.poolLogic;
21780
- _context37.t1 = routerAddress[this.network][dapp];
21781
- _context37.next = 5;
22270
+ if (estimateGas === void 0) {
22271
+ estimateGas = false;
22272
+ }
22273
+
22274
+ _context37.t0 = getPoolTxOrGasEstimate;
22275
+ _context37.t1 = this;
22276
+ _context37.t2 = routerAddress[this.network][dapp];
22277
+ _context37.next = 7;
21782
22278
  return getVelodromeRemoveLiquidityTxData(this, assetA, assetB, amount, isStable);
21783
22279
 
21784
- case 5:
21785
- _context37.t2 = _context37.sent;
21786
- _context37.t3 = options;
21787
- _context37.next = 9;
21788
- return _context37.t0.execTransaction.call(_context37.t0, _context37.t1, _context37.t2, _context37.t3);
22280
+ case 7:
22281
+ _context37.t3 = _context37.sent;
22282
+ _context37.t4 = options;
22283
+ _context37.t5 = [_context37.t2, _context37.t3, _context37.t4];
22284
+ _context37.t6 = estimateGas;
22285
+ _context37.next = 13;
22286
+ return (0, _context37.t0)(_context37.t1, _context37.t5, _context37.t6);
21789
22287
 
21790
- case 9:
22288
+ case 13:
21791
22289
  tx = _context37.sent;
21792
22290
  return _context37.abrupt("return", tx);
21793
22291
 
21794
- case 11:
22292
+ case 15:
21795
22293
  case "end":
21796
22294
  return _context37.stop();
21797
22295
  }
@@ -21799,7 +22297,7 @@ var Pool = /*#__PURE__*/function () {
21799
22297
  }, _callee37, this);
21800
22298
  }));
21801
22299
 
21802
- function removeLiquidityV2(_x152, _x153, _x154, _x155, _x156, _x157) {
22300
+ function removeLiquidityV2(_x182, _x183, _x184, _x185, _x186, _x187, _x188) {
21803
22301
  return _removeLiquidityV.apply(this, arguments);
21804
22302
  }
21805
22303
 
@@ -21817,6 +22315,7 @@ var Pool = /*#__PURE__*/function () {
21817
22315
  * @param {BigNumber | string } collateralChangeAmount Collateral amount to add when shorting options and to remove when covering shorts
21818
22316
  * @param {boolean} isCoveredCall Selling covered call options
21819
22317
  * @param {any} options Transaction options
22318
+ * @param {boolean} estimateGas Simulate/estimate gas
21820
22319
  * @returns {Promise<any>} Transaction
21821
22320
  */
21822
22321
  ;
@@ -21824,7 +22323,7 @@ var Pool = /*#__PURE__*/function () {
21824
22323
  _proto.tradeLyraOption =
21825
22324
  /*#__PURE__*/
21826
22325
  function () {
21827
- var _tradeLyraOption = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee38(market, expiry, strike, optionType, tradeType, optionAmount, assetIn, collateralChangeAmount, isCoveredCall, options) {
22326
+ var _tradeLyraOption = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee38(market, expiry, strike, optionType, tradeType, optionAmount, assetIn, collateralChangeAmount, isCoveredCall, options, estimateGas) {
21828
22327
  var swapxData, tx;
21829
22328
  return runtime_1.wrap(function _callee38$(_context38) {
21830
22329
  while (1) {
@@ -21842,19 +22341,23 @@ var Pool = /*#__PURE__*/function () {
21842
22341
  options = null;
21843
22342
  }
21844
22343
 
21845
- _context38.next = 5;
22344
+ if (estimateGas === void 0) {
22345
+ estimateGas = false;
22346
+ }
22347
+
22348
+ _context38.next = 6;
21846
22349
  return getLyraOptionTxData(this, market, optionType, expiry, strike, tradeType, optionAmount, assetIn, BigNumber.from(collateralChangeAmount), isCoveredCall);
21847
22350
 
21848
- case 5:
22351
+ case 6:
21849
22352
  swapxData = _context38.sent;
21850
- _context38.next = 8;
21851
- return this.poolLogic.execTransaction(routerAddress[this.network][Dapp.LYRA], swapxData, options);
22353
+ _context38.next = 9;
22354
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][Dapp.LYRA], swapxData, options], estimateGas);
21852
22355
 
21853
- case 8:
22356
+ case 9:
21854
22357
  tx = _context38.sent;
21855
22358
  return _context38.abrupt("return", tx);
21856
22359
 
21857
- case 10:
22360
+ case 11:
21858
22361
  case "end":
21859
22362
  return _context38.stop();
21860
22363
  }
@@ -21862,7 +22365,7 @@ var Pool = /*#__PURE__*/function () {
21862
22365
  }, _callee38, this);
21863
22366
  }));
21864
22367
 
21865
- function tradeLyraOption(_x158, _x159, _x160, _x161, _x162, _x163, _x164, _x165, _x166, _x167) {
22368
+ function tradeLyraOption(_x189, _x190, _x191, _x192, _x193, _x194, _x195, _x196, _x197, _x198, _x199) {
21866
22369
  return _tradeLyraOption.apply(this, arguments);
21867
22370
  }
21868
22371
 
@@ -21896,7 +22399,7 @@ var Pool = /*#__PURE__*/function () {
21896
22399
  }, _callee39, this);
21897
22400
  }));
21898
22401
 
21899
- function getLyraPositions(_x168) {
22402
+ function getLyraPositions(_x200) {
21900
22403
  return _getLyraPositions.apply(this, arguments);
21901
22404
  }
21902
22405
 
@@ -21907,6 +22410,7 @@ var Pool = /*#__PURE__*/function () {
21907
22410
  * @param {string} market Address of futures market
21908
22411
  * @param {BigNumber | string } changeAmount Amount to increase/decrease margin
21909
22412
  * @param {any} options Transaction options
22413
+ * @param {boolean} estimateGas Simulate/estimate gas
21910
22414
  * @returns {Promise<any>} Transaction
21911
22415
  */
21912
22416
  ;
@@ -21914,7 +22418,7 @@ var Pool = /*#__PURE__*/function () {
21914
22418
  _proto.changeFuturesMargin =
21915
22419
  /*#__PURE__*/
21916
22420
  function () {
21917
- var _changeFuturesMargin = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee40(market, changeAmount, options) {
22421
+ var _changeFuturesMargin = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee40(market, changeAmount, options, estimateGas) {
21918
22422
  var tx;
21919
22423
  return runtime_1.wrap(function _callee40$(_context40) {
21920
22424
  while (1) {
@@ -21924,14 +22428,18 @@ var Pool = /*#__PURE__*/function () {
21924
22428
  options = null;
21925
22429
  }
21926
22430
 
21927
- _context40.next = 3;
21928
- return this.poolLogic.execTransaction(market, getFuturesChangeMarginTxData(changeAmount), options);
22431
+ if (estimateGas === void 0) {
22432
+ estimateGas = false;
22433
+ }
21929
22434
 
21930
- case 3:
22435
+ _context40.next = 4;
22436
+ return getPoolTxOrGasEstimate(this, [market, getFuturesChangeMarginTxData(changeAmount), options], estimateGas);
22437
+
22438
+ case 4:
21931
22439
  tx = _context40.sent;
21932
22440
  return _context40.abrupt("return", tx);
21933
22441
 
21934
- case 5:
22442
+ case 6:
21935
22443
  case "end":
21936
22444
  return _context40.stop();
21937
22445
  }
@@ -21939,7 +22447,7 @@ var Pool = /*#__PURE__*/function () {
21939
22447
  }, _callee40, this);
21940
22448
  }));
21941
22449
 
21942
- function changeFuturesMargin(_x169, _x170, _x171) {
22450
+ function changeFuturesMargin(_x201, _x202, _x203, _x204) {
21943
22451
  return _changeFuturesMargin.apply(this, arguments);
21944
22452
  }
21945
22453
 
@@ -21950,6 +22458,7 @@ var Pool = /*#__PURE__*/function () {
21950
22458
  * @param {string} market Address of futures market
21951
22459
  * @param {BigNumber | string } changeAmount Negative for short, positive for long
21952
22460
  * @param {any} options Transaction options
22461
+ * @param {boolean} estimateGas Simulate/estimate gas
21953
22462
  * @returns {Promise<any>} Transaction
21954
22463
  */
21955
22464
  ;
@@ -21957,7 +22466,7 @@ var Pool = /*#__PURE__*/function () {
21957
22466
  _proto.changeFuturesPosition =
21958
22467
  /*#__PURE__*/
21959
22468
  function () {
21960
- var _changeFuturesPosition = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee41(market, changeAmount, options) {
22469
+ var _changeFuturesPosition = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee41(market, changeAmount, options, estimateGas) {
21961
22470
  var txData, tx;
21962
22471
  return runtime_1.wrap(function _callee41$(_context41) {
21963
22472
  while (1) {
@@ -21967,19 +22476,23 @@ var Pool = /*#__PURE__*/function () {
21967
22476
  options = null;
21968
22477
  }
21969
22478
 
21970
- _context41.next = 3;
22479
+ if (estimateGas === void 0) {
22480
+ estimateGas = false;
22481
+ }
22482
+
22483
+ _context41.next = 4;
21971
22484
  return getFuturesChangePositionTxData(changeAmount, market, this);
21972
22485
 
21973
- case 3:
22486
+ case 4:
21974
22487
  txData = _context41.sent;
21975
- _context41.next = 6;
21976
- return this.poolLogic.execTransaction(market, txData, options);
22488
+ _context41.next = 7;
22489
+ return getPoolTxOrGasEstimate(this, [market, txData, options], estimateGas);
21977
22490
 
21978
- case 6:
22491
+ case 7:
21979
22492
  tx = _context41.sent;
21980
22493
  return _context41.abrupt("return", tx);
21981
22494
 
21982
- case 8:
22495
+ case 9:
21983
22496
  case "end":
21984
22497
  return _context41.stop();
21985
22498
  }
@@ -21987,7 +22500,7 @@ var Pool = /*#__PURE__*/function () {
21987
22500
  }, _callee41, this);
21988
22501
  }));
21989
22502
 
21990
- function changeFuturesPosition(_x172, _x173, _x174) {
22503
+ function changeFuturesPosition(_x205, _x206, _x207, _x208) {
21991
22504
  return _changeFuturesPosition.apply(this, arguments);
21992
22505
  }
21993
22506
 
@@ -21997,6 +22510,7 @@ var Pool = /*#__PURE__*/function () {
21997
22510
  *
21998
22511
  * @param {string} market Address of futures market
21999
22512
  * @param {any} options Transaction options
22513
+ * @param {boolean} estimateGas Simulate/estimate gas
22000
22514
  * @returns {Promise<any>} Transaction
22001
22515
  */
22002
22516
  ;
@@ -22004,7 +22518,7 @@ var Pool = /*#__PURE__*/function () {
22004
22518
  _proto.cancelFuturesOrder =
22005
22519
  /*#__PURE__*/
22006
22520
  function () {
22007
- var _cancelFuturesOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee42(market, options) {
22521
+ var _cancelFuturesOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee42(market, options, estimateGas) {
22008
22522
  var txData, tx;
22009
22523
  return runtime_1.wrap(function _callee42$(_context42) {
22010
22524
  while (1) {
@@ -22014,19 +22528,23 @@ var Pool = /*#__PURE__*/function () {
22014
22528
  options = null;
22015
22529
  }
22016
22530
 
22017
- _context42.next = 3;
22531
+ if (estimateGas === void 0) {
22532
+ estimateGas = false;
22533
+ }
22534
+
22535
+ _context42.next = 4;
22018
22536
  return getFuturesCancelOrderTxData(this);
22019
22537
 
22020
- case 3:
22538
+ case 4:
22021
22539
  txData = _context42.sent;
22022
- _context42.next = 6;
22023
- return this.poolLogic.execTransaction(market, txData, options);
22540
+ _context42.next = 7;
22541
+ return getPoolTxOrGasEstimate(this, [market, txData, options], estimateGas);
22024
22542
 
22025
- case 6:
22543
+ case 7:
22026
22544
  tx = _context42.sent;
22027
22545
  return _context42.abrupt("return", tx);
22028
22546
 
22029
- case 8:
22547
+ case 9:
22030
22548
  case "end":
22031
22549
  return _context42.stop();
22032
22550
  }
@@ -22034,7 +22552,7 @@ var Pool = /*#__PURE__*/function () {
22034
22552
  }, _callee42, this);
22035
22553
  }));
22036
22554
 
22037
- function cancelFuturesOrder(_x175, _x176) {
22555
+ function cancelFuturesOrder(_x209, _x210, _x211) {
22038
22556
  return _cancelFuturesOrder.apply(this, arguments);
22039
22557
  }
22040
22558
 
@@ -22075,7 +22593,7 @@ var Pool = /*#__PURE__*/function () {
22075
22593
  }, _callee43, this);
22076
22594
  }));
22077
22595
 
22078
- function mintManagerFee(_x177) {
22596
+ function mintManagerFee(_x212) {
22079
22597
  return _mintManagerFee.apply(this, arguments);
22080
22598
  }
22081
22599
 
@@ -22122,6 +22640,7 @@ var Pool = /*#__PURE__*/function () {
22122
22640
  * @param {string} tokenAddress Address of the token to vest
22123
22641
  * @param {BigNumber | string } changeAmount Negative for short, positive for long
22124
22642
  * @param {any} options Transaction options
22643
+ * @param {boolean} estimateGas Simulate/estimate gas
22125
22644
  * @returns {Promise<any>} Transaction
22126
22645
  */
22127
22646
  ;
@@ -22129,7 +22648,7 @@ var Pool = /*#__PURE__*/function () {
22129
22648
  _proto.vestTokens =
22130
22649
  /*#__PURE__*/
22131
22650
  function () {
22132
- var _vestTokens = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee45(tokenAddress, amount, options) {
22651
+ var _vestTokens = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee45(tokenAddress, amount, options, estimateGas) {
22133
22652
  var txData, tx;
22134
22653
  return runtime_1.wrap(function _callee45$(_context45) {
22135
22654
  while (1) {
@@ -22139,19 +22658,23 @@ var Pool = /*#__PURE__*/function () {
22139
22658
  options = null;
22140
22659
  }
22141
22660
 
22142
- _context45.next = 3;
22661
+ if (estimateGas === void 0) {
22662
+ estimateGas = false;
22663
+ }
22664
+
22665
+ _context45.next = 4;
22143
22666
  return getCreateVestTxData(amount);
22144
22667
 
22145
- case 3:
22668
+ case 4:
22146
22669
  txData = _context45.sent;
22147
- _context45.next = 6;
22148
- return this.poolLogic.execTransaction(tokenAddress, txData, options);
22670
+ _context45.next = 7;
22671
+ return getPoolTxOrGasEstimate(this, [tokenAddress, txData, options], estimateGas);
22149
22672
 
22150
- case 6:
22673
+ case 7:
22151
22674
  tx = _context45.sent;
22152
22675
  return _context45.abrupt("return", tx);
22153
22676
 
22154
- case 8:
22677
+ case 9:
22155
22678
  case "end":
22156
22679
  return _context45.stop();
22157
22680
  }
@@ -22159,7 +22682,7 @@ var Pool = /*#__PURE__*/function () {
22159
22682
  }, _callee45, this);
22160
22683
  }));
22161
22684
 
22162
- function vestTokens(_x178, _x179, _x180) {
22685
+ function vestTokens(_x213, _x214, _x215, _x216) {
22163
22686
  return _vestTokens.apply(this, arguments);
22164
22687
  }
22165
22688
 
@@ -22170,6 +22693,7 @@ var Pool = /*#__PURE__*/function () {
22170
22693
  * @param {string} tokenAddress Address of the token to vest
22171
22694
  * @param {number } id position Id of the vested tokens
22172
22695
  * @param {any} options Transaction options
22696
+ * @param {boolean} estimateGas Simulate/estimate gas
22173
22697
  * @returns {Promise<any>} Transaction
22174
22698
  */
22175
22699
  ;
@@ -22177,7 +22701,7 @@ var Pool = /*#__PURE__*/function () {
22177
22701
  _proto.exitVestedToken =
22178
22702
  /*#__PURE__*/
22179
22703
  function () {
22180
- var _exitVestedToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee46(tokenAddress, id, options) {
22704
+ var _exitVestedToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee46(tokenAddress, id, options, estimateGas) {
22181
22705
  var txData, tx;
22182
22706
  return runtime_1.wrap(function _callee46$(_context46) {
22183
22707
  while (1) {
@@ -22187,19 +22711,23 @@ var Pool = /*#__PURE__*/function () {
22187
22711
  options = null;
22188
22712
  }
22189
22713
 
22190
- _context46.next = 3;
22714
+ if (estimateGas === void 0) {
22715
+ estimateGas = false;
22716
+ }
22717
+
22718
+ _context46.next = 4;
22191
22719
  return getExitVestTxData(id);
22192
22720
 
22193
- case 3:
22721
+ case 4:
22194
22722
  txData = _context46.sent;
22195
- _context46.next = 6;
22196
- return this.poolLogic.execTransaction(tokenAddress, txData, options);
22723
+ _context46.next = 7;
22724
+ return getPoolTxOrGasEstimate(this, [tokenAddress, txData, options], estimateGas);
22197
22725
 
22198
- case 6:
22726
+ case 7:
22199
22727
  tx = _context46.sent;
22200
22728
  return _context46.abrupt("return", tx);
22201
22729
 
22202
- case 8:
22730
+ case 9:
22203
22731
  case "end":
22204
22732
  return _context46.stop();
22205
22733
  }
@@ -22207,7 +22735,7 @@ var Pool = /*#__PURE__*/function () {
22207
22735
  }, _callee46, this);
22208
22736
  }));
22209
22737
 
22210
- function exitVestedToken(_x181, _x182, _x183) {
22738
+ function exitVestedToken(_x217, _x218, _x219, _x220) {
22211
22739
  return _exitVestedToken.apply(this, arguments);
22212
22740
  }
22213
22741