@dhedge/v2-sdk 1.9.4 → 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 = {
@@ -3903,6 +4192,7 @@ var Network;
3903
4192
  Network["POLYGON"] = "polygon";
3904
4193
  Network["OPTIMISM"] = "optimism";
3905
4194
  Network["ARBITRUM"] = "arbitrum";
4195
+ Network["BASE"] = "base";
3906
4196
  })(Network || (Network = {}));
3907
4197
 
3908
4198
  var Dapp;
@@ -3949,19 +4239,19 @@ var Transaction;
3949
4239
  Transaction["REMOVE_LIQUIDITY_UNSTAKE"] = "removeLiquidityAndUnstake";
3950
4240
  })(Transaction || (Transaction = {}));
3951
4241
 
3952
- var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _stakingAddress, _Network$POLYGON4, _Network$OPTIMISM2, _Network$ARBITRUM2, _aaveAddressProvider, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress, _lyraNetworkMap;
4242
+ var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _Network$BASE, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _stakingAddress, _Network$POLYGON4, _Network$OPTIMISM2, _Network$ARBITRUM2, _Network$BASE2, _aaveAddressProvider, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress, _lyraNetworkMap;
3953
4243
 
3954
4244
  require("dotenv").config();
3955
4245
 
3956
- var factoryAddress = (_factoryAddress = {}, _factoryAddress[Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress[Network.OPTIMISM] = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", _factoryAddress[Network.ARBITRUM] = "0xfffb5fb14606eb3a548c113026355020ddf27535", _factoryAddress);
3957
- var routerAddress = (_routerAddress = {}, _routerAddress[Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$POLYGON[Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[Dapp.ARRAKIS] = "0xc73fb100a995b33f9fa181d420f4c8d74506df66", _Network$POLYGON[Dapp.TOROS] = "0xB2F1498983bf9c9442c35F772e6C1AdE66a8DeDE", _Network$POLYGON[Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$POLYGON), _routerAddress[Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$OPTIMISM[Dapp.TOROS] = "0x3988513793bCE39f0167064A9F7fC3617FaF35AB", _Network$OPTIMISM[Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[Dapp.VELODROMEV2] = "0xa062ae8a9c5e11aaa026fc2670b0d65ccc8b2858", _Network$OPTIMISM[Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM[Dapp.ARRAKIS] = "0x9ce88a56d120300061593eF7AD074A1B710094d5", _Network$OPTIMISM[Dapp.ZEROEX] = "0xdef1abe32c034e558cdd535791643c58a13acc10", _Network$OPTIMISM), _routerAddress[Network.ARBITRUM] = (_Network$ARBITRUM = {}, _Network$ARBITRUM[Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$ARBITRUM[Dapp.UNISWAPV3] = "0xe592427a0aece92de3edee1f18e0157c05861564", _Network$ARBITRUM[Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM[Dapp.RAMSES] = "0xaaa87963efeb6f7e0a2711f397663105acb1805e", _Network$ARBITRUM), _routerAddress);
3958
- var dappFactoryAddress = (_dappFactoryAddress = {}, _dappFactoryAddress[Network.POLYGON] = (_Network$POLYGON2 = {}, _Network$POLYGON2[Dapp.SUSHISWAP] = "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", _Network$POLYGON2[Dapp.QUICKSWAP] = "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32", _Network$POLYGON2), _dappFactoryAddress[Network.OPTIMISM] = {}, _dappFactoryAddress[Network.ARBITRUM] = {}, _dappFactoryAddress);
3959
- var stakingAddress = (_stakingAddress = {}, _stakingAddress[Network.POLYGON] = (_Network$POLYGON3 = {}, _Network$POLYGON3[Dapp.SUSHISWAP] = "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F", _Network$POLYGON3[Dapp.BALANCER] = "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", _Network$POLYGON3[Dapp.AAVE] = "0x357D51124f59836DeD84c8a1730D72B749d8BC23", _Network$POLYGON3[Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$POLYGON3), _stakingAddress[Network.OPTIMISM] = {}, _stakingAddress[Network.ARBITRUM] = {}, _stakingAddress);
3960
- var aaveAddressProvider = (_aaveAddressProvider = {}, _aaveAddressProvider[Network.POLYGON] = (_Network$POLYGON4 = {}, _Network$POLYGON4[Dapp.AAVE] = "0xd05e3E715d945B59290df0ae8eF85c1BdB684744", _Network$POLYGON4[Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$POLYGON4), _aaveAddressProvider[Network.OPTIMISM] = (_Network$OPTIMISM2 = {}, _Network$OPTIMISM2[Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$OPTIMISM2), _aaveAddressProvider[Network.ARBITRUM] = (_Network$ARBITRUM2 = {}, _Network$ARBITRUM2[Dapp.AAVEV3] = "0xa97684ead0e402dc232d5a977953df7ecbab3cdb", _Network$ARBITRUM2), _aaveAddressProvider);
3961
- var nonfungiblePositionManagerAddress = (_nonfungiblePositionM = {}, _nonfungiblePositionM[Network.POLYGON] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM[Network.OPTIMISM] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM[Network.ARBITRUM] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM);
3962
- var networkChainIdMap = (_networkChainIdMap = {}, _networkChainIdMap[Network.POLYGON] = 137, _networkChainIdMap[Network.OPTIMISM] = 10, _networkChainIdMap[Network.ARBITRUM] = 42161, _networkChainIdMap);
3963
- var balancerSubgraph = (_balancerSubgraph = {}, _balancerSubgraph[Network.POLYGON] = "https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2", _balancerSubgraph[Network.OPTIMISM] = "", _balancerSubgraph[Network.ARBITRUM] = "", _balancerSubgraph);
3964
- var multiCallAddress = (_multiCallAddress = {}, _multiCallAddress[Network.POLYGON] = "0x275617327c958bD06b5D6b871E7f491D76113dd8", _multiCallAddress[Network.OPTIMISM] = "", _multiCallAddress[Network.ARBITRUM] = "", _multiCallAddress);
4246
+ var factoryAddress = (_factoryAddress = {}, _factoryAddress[Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress[Network.OPTIMISM] = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", _factoryAddress[Network.ARBITRUM] = "0xfffb5fb14606eb3a548c113026355020ddf27535", _factoryAddress[Network.BASE] = "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F", _factoryAddress);
4247
+ var routerAddress = (_routerAddress = {}, _routerAddress[Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$POLYGON[Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[Dapp.ARRAKIS] = "0xc73fb100a995b33f9fa181d420f4c8d74506df66", _Network$POLYGON[Dapp.TOROS] = "0xB2F1498983bf9c9442c35F772e6C1AdE66a8DeDE", _Network$POLYGON[Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$POLYGON), _routerAddress[Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$OPTIMISM[Dapp.TOROS] = "0x3988513793bCE39f0167064A9F7fC3617FaF35AB", _Network$OPTIMISM[Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[Dapp.VELODROMEV2] = "0xa062ae8a9c5e11aaa026fc2670b0d65ccc8b2858", _Network$OPTIMISM[Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM[Dapp.ARRAKIS] = "0x9ce88a56d120300061593eF7AD074A1B710094d5", _Network$OPTIMISM[Dapp.ZEROEX] = "0xdef1abe32c034e558cdd535791643c58a13acc10", _Network$OPTIMISM), _routerAddress[Network.ARBITRUM] = (_Network$ARBITRUM = {}, _Network$ARBITRUM[Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$ARBITRUM[Dapp.UNISWAPV3] = "0xe592427a0aece92de3edee1f18e0157c05861564", _Network$ARBITRUM[Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM[Dapp.RAMSES] = "0xaaa87963efeb6f7e0a2711f397663105acb1805e", _Network$ARBITRUM), _routerAddress[Network.BASE] = (_Network$BASE = {}, _Network$BASE[Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$BASE[Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$BASE), _routerAddress);
4248
+ var dappFactoryAddress = (_dappFactoryAddress = {}, _dappFactoryAddress[Network.POLYGON] = (_Network$POLYGON2 = {}, _Network$POLYGON2[Dapp.SUSHISWAP] = "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", _Network$POLYGON2[Dapp.QUICKSWAP] = "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32", _Network$POLYGON2), _dappFactoryAddress[Network.OPTIMISM] = {}, _dappFactoryAddress[Network.ARBITRUM] = {}, _dappFactoryAddress[Network.BASE] = {}, _dappFactoryAddress);
4249
+ var stakingAddress = (_stakingAddress = {}, _stakingAddress[Network.POLYGON] = (_Network$POLYGON3 = {}, _Network$POLYGON3[Dapp.SUSHISWAP] = "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F", _Network$POLYGON3[Dapp.BALANCER] = "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", _Network$POLYGON3[Dapp.AAVE] = "0x357D51124f59836DeD84c8a1730D72B749d8BC23", _Network$POLYGON3[Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$POLYGON3), _stakingAddress[Network.OPTIMISM] = {}, _stakingAddress[Network.ARBITRUM] = {}, _stakingAddress[Network.BASE] = {}, _stakingAddress);
4250
+ var aaveAddressProvider = (_aaveAddressProvider = {}, _aaveAddressProvider[Network.POLYGON] = (_Network$POLYGON4 = {}, _Network$POLYGON4[Dapp.AAVE] = "0xd05e3E715d945B59290df0ae8eF85c1BdB684744", _Network$POLYGON4[Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$POLYGON4), _aaveAddressProvider[Network.OPTIMISM] = (_Network$OPTIMISM2 = {}, _Network$OPTIMISM2[Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$OPTIMISM2), _aaveAddressProvider[Network.ARBITRUM] = (_Network$ARBITRUM2 = {}, _Network$ARBITRUM2[Dapp.AAVEV3] = "0xa97684ead0e402dc232d5a977953df7ecbab3cdb", _Network$ARBITRUM2), _aaveAddressProvider[Network.BASE] = (_Network$BASE2 = {}, _Network$BASE2[Dapp.AAVEV3] = "0xe20fCBdBfFC4Dd138cE8b2E6FBb6CB49777ad64D", _Network$BASE2), _aaveAddressProvider);
4251
+ var nonfungiblePositionManagerAddress = (_nonfungiblePositionM = {}, _nonfungiblePositionM[Network.POLYGON] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM[Network.OPTIMISM] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM[Network.ARBITRUM] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM[Network.BASE] = "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1", _nonfungiblePositionM);
4252
+ var networkChainIdMap = (_networkChainIdMap = {}, _networkChainIdMap[Network.POLYGON] = 137, _networkChainIdMap[Network.OPTIMISM] = 10, _networkChainIdMap[Network.ARBITRUM] = 42161, _networkChainIdMap[Network.BASE] = 8453, _networkChainIdMap);
4253
+ var balancerSubgraph = (_balancerSubgraph = {}, _balancerSubgraph[Network.POLYGON] = "https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2", _balancerSubgraph[Network.OPTIMISM] = "", _balancerSubgraph[Network.ARBITRUM] = "", _balancerSubgraph[Network.BASE] = "", _balancerSubgraph);
4254
+ var multiCallAddress = (_multiCallAddress = {}, _multiCallAddress[Network.POLYGON] = "0x275617327c958bD06b5D6b871E7f491D76113dd8", _multiCallAddress[Network.OPTIMISM] = "", _multiCallAddress[Network.ARBITRUM] = "", _multiCallAddress[Network.BASE] = "", _multiCallAddress);
3965
4255
  var lyraNetworkMap = (_lyraNetworkMap = {}, _lyraNetworkMap[Network.OPTIMISM] = Deployment.Mainnet, _lyraNetworkMap);
3966
4256
  var MaxUint128 = "0xffffffffffffffffffffffffffffffff";
3967
4257
  var UNISWAPV3_QUOTER_ADDRESS = "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6";
@@ -14814,35 +15104,71 @@ function call(_x, _x2, _x3, _x4) {
14814
15104
  }
14815
15105
 
14816
15106
  function _call() {
14817
- _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) {
14818
15108
  var contract, params;
14819
- return runtime_1.wrap(function _callee2$(_context2) {
15109
+ return runtime_1.wrap(function _callee3$(_context3) {
14820
15110
  while (1) {
14821
- switch (_context2.prev = _context2.next) {
15111
+ switch (_context3.prev = _context3.next) {
14822
15112
  case 0:
14823
15113
  contract = new ethers.Contract(call[0], abi, provider);
14824
- _context2.prev = 1;
15114
+ _context3.prev = 1;
14825
15115
  params = call[2] || [];
14826
- _context2.next = 5;
15116
+ _context3.next = 5;
14827
15117
  return contract[call[1]].apply(contract, params.concat([options || {}]));
14828
15118
 
14829
15119
  case 5:
14830
- return _context2.abrupt("return", _context2.sent);
15120
+ return _context3.abrupt("return", _context3.sent);
14831
15121
 
14832
15122
  case 8:
14833
- _context2.prev = 8;
14834
- _context2.t0 = _context2["catch"](1);
14835
- 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));
14836
15126
 
14837
15127
  case 11:
14838
15128
  case "end":
14839
- return _context2.stop();
15129
+ return _context3.stop();
14840
15130
  }
14841
15131
  }
14842
- }, _callee2, null, [[1, 8]]);
15132
+ }, _callee3, null, [[1, 8]]);
14843
15133
  }));
14844
15134
  return _call.apply(this, arguments);
14845
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
+ }();
14846
15172
 
14847
15173
  var iVelodromeGaugeV1 = /*#__PURE__*/new ethers.utils.Interface(IVelodromeGaugeV1.abi);
14848
15174
  var iVelodromeGaugeV2 = /*#__PURE__*/new ethers.utils.Interface(IVelodromeGaugeV2.abi);
@@ -19924,8 +20250,9 @@ var Pool = /*#__PURE__*/function () {
19924
20250
  * Approve the asset for trading and providing liquidity
19925
20251
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
19926
20252
  * @param {string} asset Address of asset
19927
- * @param @param {BigNumber | string} Amount to be approved
20253
+ * @param {BigNumber | string} Amount to be approved
19928
20254
  * @param {any} options Transaction options
20255
+ * @param {boolean} estimateGas Simulate/estimate gas
19929
20256
  * @returns {Promise<any>} Transaction
19930
20257
  */
19931
20258
  ;
@@ -19933,7 +20260,7 @@ var Pool = /*#__PURE__*/function () {
19933
20260
  _proto.approve =
19934
20261
  /*#__PURE__*/
19935
20262
  function () {
19936
- 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) {
19937
20264
  var iERC20, approveTxData, tx;
19938
20265
  return runtime_1.wrap(function _callee5$(_context5) {
19939
20266
  while (1) {
@@ -19943,16 +20270,20 @@ var Pool = /*#__PURE__*/function () {
19943
20270
  options = null;
19944
20271
  }
19945
20272
 
20273
+ if (estimateGas === void 0) {
20274
+ estimateGas = false;
20275
+ }
20276
+
19946
20277
  iERC20 = new ethers.utils.Interface(IERC20.abi);
19947
20278
  approveTxData = iERC20.encodeFunctionData("approve", [routerAddress[this.network][dapp], amount]);
19948
- _context5.next = 5;
19949
- return this.poolLogic.execTransaction(asset, approveTxData, options);
20279
+ _context5.next = 6;
20280
+ return getPoolTxOrGasEstimate(this, [asset, approveTxData, options], estimateGas);
19950
20281
 
19951
- case 5:
20282
+ case 6:
19952
20283
  tx = _context5.sent;
19953
20284
  return _context5.abrupt("return", tx);
19954
20285
 
19955
- case 7:
20286
+ case 8:
19956
20287
  case "end":
19957
20288
  return _context5.stop();
19958
20289
  }
@@ -19960,7 +20291,7 @@ var Pool = /*#__PURE__*/function () {
19960
20291
  }, _callee5, this);
19961
20292
  }));
19962
20293
 
19963
- function approve(_x9, _x10, _x11, _x12) {
20294
+ function approve(_x9, _x10, _x11, _x12, _x13) {
19964
20295
  return _approve.apply(this, arguments);
19965
20296
  }
19966
20297
 
@@ -19972,6 +20303,7 @@ var Pool = /*#__PURE__*/function () {
19972
20303
  * @param {string} asset Address of liquidity pool token
19973
20304
  * @param {BigNumber | string} amount Aamount to be approved
19974
20305
  * @param {any} options Transaction options
20306
+ * @param {boolean} estimateGas Simulate/estimate gas
19975
20307
  * @returns {Promise<any>} Transaction
19976
20308
  */
19977
20309
  ;
@@ -19979,7 +20311,7 @@ var Pool = /*#__PURE__*/function () {
19979
20311
  _proto.approveStaking =
19980
20312
  /*#__PURE__*/
19981
20313
  function () {
19982
- 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) {
19983
20315
  var iERC20, approveTxData, tx;
19984
20316
  return runtime_1.wrap(function _callee6$(_context6) {
19985
20317
  while (1) {
@@ -19989,16 +20321,20 @@ var Pool = /*#__PURE__*/function () {
19989
20321
  options = null;
19990
20322
  }
19991
20323
 
20324
+ if (estimateGas === void 0) {
20325
+ estimateGas = false;
20326
+ }
20327
+
19992
20328
  iERC20 = new ethers.utils.Interface(IERC20.abi);
19993
20329
  approveTxData = iERC20.encodeFunctionData("approve", [stakingAddress[this.network][dapp], amount]);
19994
- _context6.next = 5;
19995
- return this.poolLogic.execTransaction(asset, approveTxData, options);
20330
+ _context6.next = 6;
20331
+ return getPoolTxOrGasEstimate(this, [asset, approveTxData, options], estimateGas);
19996
20332
 
19997
- case 5:
20333
+ case 6:
19998
20334
  tx = _context6.sent;
19999
20335
  return _context6.abrupt("return", tx);
20000
20336
 
20001
- case 7:
20337
+ case 8:
20002
20338
  case "end":
20003
20339
  return _context6.stop();
20004
20340
  }
@@ -20006,7 +20342,7 @@ var Pool = /*#__PURE__*/function () {
20006
20342
  }, _callee6, this);
20007
20343
  }));
20008
20344
 
20009
- function approveStaking(_x13, _x14, _x15, _x16) {
20345
+ function approveStaking(_x14, _x15, _x16, _x17, _x18) {
20010
20346
  return _approveStaking.apply(this, arguments);
20011
20347
  }
20012
20348
 
@@ -20018,6 +20354,7 @@ var Pool = /*#__PURE__*/function () {
20018
20354
  * @param {string} asset Address of liquidity pool token
20019
20355
  * @param {BigNumber | string} amount Aamount to be approved
20020
20356
  * @param {any} options Transaction options
20357
+ * @param {boolean} estimateGas Simulate/estimate gas
20021
20358
  * @returns {Promise<any>} Transaction
20022
20359
  */
20023
20360
  ;
@@ -20025,7 +20362,7 @@ var Pool = /*#__PURE__*/function () {
20025
20362
  _proto.approveUniswapV3Liquidity =
20026
20363
  /*#__PURE__*/
20027
20364
  function () {
20028
- 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) {
20029
20366
  var iERC20, approveTxData, tx;
20030
20367
  return runtime_1.wrap(function _callee7$(_context7) {
20031
20368
  while (1) {
@@ -20035,16 +20372,20 @@ var Pool = /*#__PURE__*/function () {
20035
20372
  options = null;
20036
20373
  }
20037
20374
 
20375
+ if (estimateGas === void 0) {
20376
+ estimateGas = false;
20377
+ }
20378
+
20038
20379
  iERC20 = new ethers.utils.Interface(IERC20.abi);
20039
20380
  approveTxData = iERC20.encodeFunctionData("approve", [nonfungiblePositionManagerAddress[this.network], amount]);
20040
- _context7.next = 5;
20041
- return this.poolLogic.execTransaction(asset, approveTxData, options);
20381
+ _context7.next = 6;
20382
+ return getPoolTxOrGasEstimate(this, [asset, approveTxData, options], estimateGas);
20042
20383
 
20043
- case 5:
20384
+ case 6:
20044
20385
  tx = _context7.sent;
20045
20386
  return _context7.abrupt("return", tx);
20046
20387
 
20047
- case 7:
20388
+ case 8:
20048
20389
  case "end":
20049
20390
  return _context7.stop();
20050
20391
  }
@@ -20052,7 +20393,7 @@ var Pool = /*#__PURE__*/function () {
20052
20393
  }, _callee7, this);
20053
20394
  }));
20054
20395
 
20055
- function approveUniswapV3Liquidity(_x17, _x18, _x19) {
20396
+ function approveUniswapV3Liquidity(_x19, _x20, _x21, _x22) {
20056
20397
  return _approveUniswapV3Liquidity.apply(this, arguments);
20057
20398
  }
20058
20399
 
@@ -20064,6 +20405,7 @@ var Pool = /*#__PURE__*/function () {
20064
20405
  * @param {string} asset Address of asset
20065
20406
  * @param {BigNumber | string} amount to be approved
20066
20407
  * @param {any} options Transaction options
20408
+ * @param {boolean} estimateGas Simulate/estimate gas
20067
20409
  * @returns {Promise<any>} Transaction
20068
20410
  */
20069
20411
  ;
@@ -20071,7 +20413,7 @@ var Pool = /*#__PURE__*/function () {
20071
20413
  _proto.approveSpender =
20072
20414
  /*#__PURE__*/
20073
20415
  function () {
20074
- 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) {
20075
20417
  var iERC20, approveTxData, tx;
20076
20418
  return runtime_1.wrap(function _callee8$(_context8) {
20077
20419
  while (1) {
@@ -20081,16 +20423,20 @@ var Pool = /*#__PURE__*/function () {
20081
20423
  options = null;
20082
20424
  }
20083
20425
 
20426
+ if (estimateGas === void 0) {
20427
+ estimateGas = false;
20428
+ }
20429
+
20084
20430
  iERC20 = new ethers.utils.Interface(IERC20.abi);
20085
20431
  approveTxData = iERC20.encodeFunctionData("approve", [spender, amount]);
20086
- _context8.next = 5;
20087
- return this.poolLogic.execTransaction(asset, approveTxData, options);
20432
+ _context8.next = 6;
20433
+ return getPoolTxOrGasEstimate(this, [asset, approveTxData, options], estimateGas);
20088
20434
 
20089
- case 5:
20435
+ case 6:
20090
20436
  tx = _context8.sent;
20091
20437
  return _context8.abrupt("return", tx);
20092
20438
 
20093
- case 7:
20439
+ case 8:
20094
20440
  case "end":
20095
20441
  return _context8.stop();
20096
20442
  }
@@ -20098,7 +20444,7 @@ var Pool = /*#__PURE__*/function () {
20098
20444
  }, _callee8, this);
20099
20445
  }));
20100
20446
 
20101
- function approveSpender(_x20, _x21, _x22, _x23) {
20447
+ function approveSpender(_x23, _x24, _x25, _x26, _x27) {
20102
20448
  return _approveSpender.apply(this, arguments);
20103
20449
  }
20104
20450
 
@@ -20112,6 +20458,7 @@ var Pool = /*#__PURE__*/function () {
20112
20458
  * @param {BigNumber | string} amountIn Amount
20113
20459
  * @param {number} slippage Slippage tolerance in %
20114
20460
  * @param {any} options Transaction options
20461
+ * @param {boolean} estimateGas Simulate/estimate gas
20115
20462
  * @returns {Promise<any>} Transaction
20116
20463
  */
20117
20464
  ;
@@ -20119,7 +20466,7 @@ var Pool = /*#__PURE__*/function () {
20119
20466
  _proto.trade =
20120
20467
  /*#__PURE__*/
20121
20468
  function () {
20122
- 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) {
20123
20470
  var swapTxData, iSynthetix, assets, daoAddress, iUniswapV2Router, minAmountOut, tx;
20124
20471
  return runtime_1.wrap(function _callee9$(_context9) {
20125
20472
  while (1) {
@@ -20133,61 +20480,65 @@ var Pool = /*#__PURE__*/function () {
20133
20480
  options = null;
20134
20481
  }
20135
20482
 
20483
+ if (estimateGas === void 0) {
20484
+ estimateGas = false;
20485
+ }
20486
+
20136
20487
  _context9.t0 = dapp;
20137
- _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;
20138
20489
  break;
20139
20490
 
20140
- case 5:
20141
- _context9.next = 7;
20491
+ case 6:
20492
+ _context9.next = 8;
20142
20493
  return getZeroExTradeTxData(this.network, assetFrom, assetTo, amountIn, slippage, this.address);
20143
20494
 
20144
- case 7:
20495
+ case 8:
20145
20496
  swapTxData = _context9.sent;
20146
- return _context9.abrupt("break", 43);
20497
+ return _context9.abrupt("break", 44);
20147
20498
 
20148
- case 9:
20149
- _context9.next = 11;
20499
+ case 10:
20500
+ _context9.next = 12;
20150
20501
  return getOneInchSwapTxData(this, assetFrom, assetTo, amountIn, slippage);
20151
20502
 
20152
- case 11:
20503
+ case 12:
20153
20504
  swapTxData = _context9.sent;
20154
- return _context9.abrupt("break", 43);
20505
+ return _context9.abrupt("break", 44);
20155
20506
 
20156
- case 13:
20157
- _context9.next = 15;
20507
+ case 14:
20508
+ _context9.next = 16;
20158
20509
  return this.utils.getBalancerSwapTx(this, assetFrom, assetTo, amountIn, slippage);
20159
20510
 
20160
- case 15:
20511
+ case 16:
20161
20512
  swapTxData = _context9.sent;
20162
- return _context9.abrupt("break", 43);
20513
+ return _context9.abrupt("break", 44);
20163
20514
 
20164
- case 17:
20515
+ case 18:
20165
20516
  iSynthetix = new ethers.utils.Interface(ISynthetix.abi);
20166
20517
  assets = [assetFrom, assetTo].map(function (asset) {
20167
20518
  return ethers.utils.formatBytes32String(asset);
20168
20519
  });
20169
- _context9.next = 21;
20520
+ _context9.next = 22;
20170
20521
  return this.factory.owner();
20171
20522
 
20172
- case 21:
20523
+ case 22:
20173
20524
  daoAddress = _context9.sent;
20174
20525
  swapTxData = iSynthetix.encodeFunctionData(Transaction.SWAP_SYNTHS, [assets[0], amountIn, assets[1], daoAddress, SYNTHETIX_TRACKING_CODE]);
20175
- return _context9.abrupt("break", 43);
20526
+ return _context9.abrupt("break", 44);
20176
20527
 
20177
- case 24:
20178
- _context9.next = 26;
20528
+ case 25:
20529
+ _context9.next = 27;
20179
20530
  return getEasySwapperTxData(this, assetFrom, assetTo, ethers.BigNumber.from(amountIn), slippage);
20180
20531
 
20181
- case 26:
20532
+ case 27:
20182
20533
  swapTxData = _context9.sent;
20183
- return _context9.abrupt("break", 43);
20534
+ return _context9.abrupt("break", 44);
20184
20535
 
20185
- case 28:
20536
+ case 29:
20186
20537
  iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
20187
- _context9.next = 31;
20538
+ _context9.next = 32;
20188
20539
  return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
20189
20540
 
20190
- case 31:
20541
+ case 32:
20191
20542
  minAmountOut = _context9.sent;
20192
20543
  _context9.t1 = iUniswapV2Router;
20193
20544
  _context9.t2 = Transaction.SWAP;
@@ -20195,23 +20546,23 @@ var Pool = /*#__PURE__*/function () {
20195
20546
  _context9.t4 = minAmountOut;
20196
20547
  _context9.t5 = [assetFrom, assetTo];
20197
20548
  _context9.t6 = this.address;
20198
- _context9.next = 40;
20549
+ _context9.next = 41;
20199
20550
  return getDeadline(this);
20200
20551
 
20201
- case 40:
20552
+ case 41:
20202
20553
  _context9.t7 = _context9.sent;
20203
20554
  _context9.t8 = [_context9.t3, _context9.t4, _context9.t5, _context9.t6, _context9.t7];
20204
20555
  swapTxData = _context9.t1.encodeFunctionData.call(_context9.t1, _context9.t2, _context9.t8);
20205
20556
 
20206
- case 43:
20207
- _context9.next = 45;
20208
- 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);
20209
20560
 
20210
- case 45:
20561
+ case 46:
20211
20562
  tx = _context9.sent;
20212
20563
  return _context9.abrupt("return", tx);
20213
20564
 
20214
- case 47:
20565
+ case 48:
20215
20566
  case "end":
20216
20567
  return _context9.stop();
20217
20568
  }
@@ -20219,7 +20570,7 @@ var Pool = /*#__PURE__*/function () {
20219
20570
  }, _callee9, this);
20220
20571
  }));
20221
20572
 
20222
- function trade(_x24, _x25, _x26, _x27, _x28, _x29) {
20573
+ function trade(_x28, _x29, _x30, _x31, _x32, _x33, _x34) {
20223
20574
  return _trade.apply(this, arguments);
20224
20575
  }
20225
20576
 
@@ -20233,6 +20584,7 @@ var Pool = /*#__PURE__*/function () {
20233
20584
  * @param {BigNumber | string} amountA Amount first asset
20234
20585
  * @param {BigNumber | string} amountB Amount second asset
20235
20586
  * @param {any} options Transaction options
20587
+ * @param {boolean} estimateGas Simulate/estimate gas
20236
20588
  * @returns {Promise<any>} Transaction
20237
20589
  */
20238
20590
  ;
@@ -20240,7 +20592,7 @@ var Pool = /*#__PURE__*/function () {
20240
20592
  _proto.addLiquidity =
20241
20593
  /*#__PURE__*/
20242
20594
  function () {
20243
- 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) {
20244
20596
  var iUniswapV2Router, addLiquidityTxData, tx;
20245
20597
  return runtime_1.wrap(function _callee10$(_context10) {
20246
20598
  while (1) {
@@ -20250,6 +20602,10 @@ var Pool = /*#__PURE__*/function () {
20250
20602
  options = null;
20251
20603
  }
20252
20604
 
20605
+ if (estimateGas === void 0) {
20606
+ estimateGas = false;
20607
+ }
20608
+
20253
20609
  iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
20254
20610
  _context10.t0 = iUniswapV2Router;
20255
20611
  _context10.t1 = Transaction.ADD_LIQUIDITY;
@@ -20258,21 +20614,21 @@ var Pool = /*#__PURE__*/function () {
20258
20614
  _context10.t4 = amountA;
20259
20615
  _context10.t5 = amountB;
20260
20616
  _context10.t6 = this.address;
20261
- _context10.next = 11;
20617
+ _context10.next = 12;
20262
20618
  return getDeadline(this);
20263
20619
 
20264
- case 11:
20620
+ case 12:
20265
20621
  _context10.t7 = _context10.sent;
20266
20622
  _context10.t8 = [_context10.t2, _context10.t3, _context10.t4, _context10.t5, 0, 0, _context10.t6, _context10.t7];
20267
20623
  addLiquidityTxData = _context10.t0.encodeFunctionData.call(_context10.t0, _context10.t1, _context10.t8);
20268
- _context10.next = 16;
20269
- 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);
20270
20626
 
20271
- case 16:
20627
+ case 17:
20272
20628
  tx = _context10.sent;
20273
20629
  return _context10.abrupt("return", tx);
20274
20630
 
20275
- case 18:
20631
+ case 19:
20276
20632
  case "end":
20277
20633
  return _context10.stop();
20278
20634
  }
@@ -20280,7 +20636,7 @@ var Pool = /*#__PURE__*/function () {
20280
20636
  }, _callee10, this);
20281
20637
  }));
20282
20638
 
20283
- function addLiquidity(_x30, _x31, _x32, _x33, _x34, _x35) {
20639
+ function addLiquidity(_x35, _x36, _x37, _x38, _x39, _x40, _x41) {
20284
20640
  return _addLiquidity.apply(this, arguments);
20285
20641
  }
20286
20642
 
@@ -20293,6 +20649,7 @@ var Pool = /*#__PURE__*/function () {
20293
20649
  * @param {string} assetB Second asset
20294
20650
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20295
20651
  * @param {any} options Transaction options
20652
+ * @param {boolean} estimateGas Simulate/estimate gas
20296
20653
  * @returns {Promise<any>} Transaction
20297
20654
  */
20298
20655
  ;
@@ -20300,7 +20657,7 @@ var Pool = /*#__PURE__*/function () {
20300
20657
  _proto.removeLiquidity =
20301
20658
  /*#__PURE__*/
20302
20659
  function () {
20303
- 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) {
20304
20661
  var iUniswapV2Router, removeLiquidityTxData, tx;
20305
20662
  return runtime_1.wrap(function _callee11$(_context11) {
20306
20663
  while (1) {
@@ -20310,6 +20667,10 @@ var Pool = /*#__PURE__*/function () {
20310
20667
  options = null;
20311
20668
  }
20312
20669
 
20670
+ if (estimateGas === void 0) {
20671
+ estimateGas = false;
20672
+ }
20673
+
20313
20674
  iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
20314
20675
  _context11.t0 = iUniswapV2Router;
20315
20676
  _context11.t1 = Transaction.REMOVE_LIQUIDITY;
@@ -20317,21 +20678,21 @@ var Pool = /*#__PURE__*/function () {
20317
20678
  _context11.t3 = assetB;
20318
20679
  _context11.t4 = amount;
20319
20680
  _context11.t5 = this.address;
20320
- _context11.next = 10;
20681
+ _context11.next = 11;
20321
20682
  return getDeadline(this);
20322
20683
 
20323
- case 10:
20684
+ case 11:
20324
20685
  _context11.t6 = _context11.sent;
20325
20686
  _context11.t7 = [_context11.t2, _context11.t3, _context11.t4, 0, 0, _context11.t5, _context11.t6];
20326
20687
  removeLiquidityTxData = _context11.t0.encodeFunctionData.call(_context11.t0, _context11.t1, _context11.t7);
20327
- _context11.next = 15;
20328
- 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);
20329
20690
 
20330
- case 15:
20691
+ case 16:
20331
20692
  tx = _context11.sent;
20332
20693
  return _context11.abrupt("return", tx);
20333
20694
 
20334
- case 17:
20695
+ case 18:
20335
20696
  case "end":
20336
20697
  return _context11.stop();
20337
20698
  }
@@ -20339,7 +20700,7 @@ var Pool = /*#__PURE__*/function () {
20339
20700
  }, _callee11, this);
20340
20701
  }));
20341
20702
 
20342
- function removeLiquidity(_x36, _x37, _x38, _x39, _x40) {
20703
+ function removeLiquidity(_x42, _x43, _x44, _x45, _x46, _x47) {
20343
20704
  return _removeLiquidity.apply(this, arguments);
20344
20705
  }
20345
20706
 
@@ -20351,6 +20712,7 @@ var Pool = /*#__PURE__*/function () {
20351
20712
  * @param {string} asset Liquidity pool token
20352
20713
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20353
20714
  * @param {any} options Transaction options
20715
+ * @param {boolean} estimateGas Simulate/estimate gas
20354
20716
  * @returns {Promise<any>} Transaction
20355
20717
  */
20356
20718
  ;
@@ -20358,7 +20720,7 @@ var Pool = /*#__PURE__*/function () {
20358
20720
  _proto.stake =
20359
20721
  /*#__PURE__*/
20360
20722
  function () {
20361
- 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) {
20362
20724
  var iMiniChefV2, poolId, stakeTxData, tx;
20363
20725
  return runtime_1.wrap(function _callee12$(_context12) {
20364
20726
  while (1) {
@@ -20368,21 +20730,25 @@ var Pool = /*#__PURE__*/function () {
20368
20730
  options = null;
20369
20731
  }
20370
20732
 
20733
+ if (estimateGas === void 0) {
20734
+ estimateGas = false;
20735
+ }
20736
+
20371
20737
  iMiniChefV2 = new ethers.utils.Interface(IMiniChefV2.abi);
20372
- _context12.next = 4;
20738
+ _context12.next = 5;
20373
20739
  return this.utils.getLpPoolId(dapp, asset);
20374
20740
 
20375
- case 4:
20741
+ case 5:
20376
20742
  poolId = _context12.sent;
20377
20743
  stakeTxData = iMiniChefV2.encodeFunctionData(Transaction.DEPOSIT, [poolId, amount, this.address]);
20378
- _context12.next = 8;
20379
- 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);
20380
20746
 
20381
- case 8:
20747
+ case 9:
20382
20748
  tx = _context12.sent;
20383
20749
  return _context12.abrupt("return", tx);
20384
20750
 
20385
- case 10:
20751
+ case 11:
20386
20752
  case "end":
20387
20753
  return _context12.stop();
20388
20754
  }
@@ -20390,7 +20756,7 @@ var Pool = /*#__PURE__*/function () {
20390
20756
  }, _callee12, this);
20391
20757
  }));
20392
20758
 
20393
- function stake(_x41, _x42, _x43, _x44) {
20759
+ function stake(_x48, _x49, _x50, _x51, _x52) {
20394
20760
  return _stake.apply(this, arguments);
20395
20761
  }
20396
20762
 
@@ -20402,6 +20768,7 @@ var Pool = /*#__PURE__*/function () {
20402
20768
  * @param {string} gauge Gauge contract address
20403
20769
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20404
20770
  * @param {any} options Transaction options
20771
+ * @param {boolean} estimateGas Simulate/estimate gas
20405
20772
  * @returns {Promise<any>} Transaction
20406
20773
  */
20407
20774
  ;
@@ -20409,7 +20776,7 @@ var Pool = /*#__PURE__*/function () {
20409
20776
  _proto.stakeInGauge =
20410
20777
  /*#__PURE__*/
20411
20778
  function () {
20412
- 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) {
20413
20780
  var stakeTxData, rewardsGauge, tx;
20414
20781
  return runtime_1.wrap(function _callee13$(_context13) {
20415
20782
  while (1) {
@@ -20419,35 +20786,39 @@ var Pool = /*#__PURE__*/function () {
20419
20786
  options = null;
20420
20787
  }
20421
20788
 
20789
+ if (estimateGas === void 0) {
20790
+ estimateGas = false;
20791
+ }
20792
+
20422
20793
  _context13.t0 = dapp;
20423
- _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;
20424
20795
  break;
20425
20796
 
20426
- case 4:
20797
+ case 5:
20427
20798
  rewardsGauge = new ethers.utils.Interface(IBalancerRewardsGauge.abi);
20428
20799
  stakeTxData = rewardsGauge.encodeFunctionData("deposit(uint256)", [amount]);
20429
- return _context13.abrupt("break", 12);
20800
+ return _context13.abrupt("break", 13);
20430
20801
 
20431
- case 7:
20802
+ case 8:
20432
20803
  stakeTxData = getVelodromeStakeTxData(amount, false);
20433
- return _context13.abrupt("break", 12);
20804
+ return _context13.abrupt("break", 13);
20434
20805
 
20435
- case 9:
20806
+ case 10:
20436
20807
  stakeTxData = getVelodromeStakeTxData(amount, true);
20437
- return _context13.abrupt("break", 12);
20808
+ return _context13.abrupt("break", 13);
20438
20809
 
20439
- case 11:
20810
+ case 12:
20440
20811
  throw new Error("dapp not supported");
20441
20812
 
20442
- case 12:
20443
- _context13.next = 14;
20444
- return this.poolLogic.execTransaction(gauge, stakeTxData, options);
20813
+ case 13:
20814
+ _context13.next = 15;
20815
+ return getPoolTxOrGasEstimate(this, [gauge, stakeTxData, options], estimateGas);
20445
20816
 
20446
- case 14:
20817
+ case 15:
20447
20818
  tx = _context13.sent;
20448
20819
  return _context13.abrupt("return", tx);
20449
20820
 
20450
- case 16:
20821
+ case 17:
20451
20822
  case "end":
20452
20823
  return _context13.stop();
20453
20824
  }
@@ -20455,7 +20826,7 @@ var Pool = /*#__PURE__*/function () {
20455
20826
  }, _callee13, this);
20456
20827
  }));
20457
20828
 
20458
- function stakeInGauge(_x45, _x46, _x47, _x48) {
20829
+ function stakeInGauge(_x53, _x54, _x55, _x56, _x57) {
20459
20830
  return _stakeInGauge.apply(this, arguments);
20460
20831
  }
20461
20832
 
@@ -20467,6 +20838,7 @@ var Pool = /*#__PURE__*/function () {
20467
20838
  * @param {string} asset Liquidity pool token
20468
20839
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20469
20840
  * @param {any} options Transaction options
20841
+ * @param {boolean} estimateGas Simulate/estimate gas
20470
20842
  * @returns {Promise<any>} Transaction
20471
20843
  */
20472
20844
  ;
@@ -20474,7 +20846,7 @@ var Pool = /*#__PURE__*/function () {
20474
20846
  _proto.unStake =
20475
20847
  /*#__PURE__*/
20476
20848
  function () {
20477
- 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) {
20478
20850
  var iMiniChefV2, poolId, unStakeTxData, tx;
20479
20851
  return runtime_1.wrap(function _callee14$(_context14) {
20480
20852
  while (1) {
@@ -20484,21 +20856,25 @@ var Pool = /*#__PURE__*/function () {
20484
20856
  options = null;
20485
20857
  }
20486
20858
 
20859
+ if (estimateGas === void 0) {
20860
+ estimateGas = false;
20861
+ }
20862
+
20487
20863
  iMiniChefV2 = new ethers.utils.Interface(IMiniChefV2.abi);
20488
- _context14.next = 4;
20864
+ _context14.next = 5;
20489
20865
  return this.utils.getLpPoolId(dapp, asset);
20490
20866
 
20491
- case 4:
20867
+ case 5:
20492
20868
  poolId = _context14.sent;
20493
20869
  unStakeTxData = iMiniChefV2.encodeFunctionData(Transaction.WITHDRAW, [poolId, amount, this.address]);
20494
- _context14.next = 8;
20495
- 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);
20496
20872
 
20497
- case 8:
20873
+ case 9:
20498
20874
  tx = _context14.sent;
20499
20875
  return _context14.abrupt("return", tx);
20500
20876
 
20501
- case 10:
20877
+ case 11:
20502
20878
  case "end":
20503
20879
  return _context14.stop();
20504
20880
  }
@@ -20506,7 +20882,7 @@ var Pool = /*#__PURE__*/function () {
20506
20882
  }, _callee14, this);
20507
20883
  }));
20508
20884
 
20509
- function unStake(_x49, _x50, _x51, _x52) {
20885
+ function unStake(_x58, _x59, _x60, _x61, _x62) {
20510
20886
  return _unStake.apply(this, arguments);
20511
20887
  }
20512
20888
 
@@ -20517,6 +20893,7 @@ var Pool = /*#__PURE__*/function () {
20517
20893
  * @param {string} gauge Gauge contract address
20518
20894
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20519
20895
  * @param {any} options Transaction options
20896
+ * @param {boolean} estimateGas Simulate/estimate gas
20520
20897
  * @returns {Promise<any>} Transaction
20521
20898
  */
20522
20899
  ;
@@ -20524,7 +20901,7 @@ var Pool = /*#__PURE__*/function () {
20524
20901
  _proto.unstakeFromGauge =
20525
20902
  /*#__PURE__*/
20526
20903
  function () {
20527
- 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) {
20528
20905
  var rewardsGauge, unstakeTxData, tx;
20529
20906
  return runtime_1.wrap(function _callee15$(_context15) {
20530
20907
  while (1) {
@@ -20534,16 +20911,20 @@ var Pool = /*#__PURE__*/function () {
20534
20911
  options = null;
20535
20912
  }
20536
20913
 
20914
+ if (estimateGas === void 0) {
20915
+ estimateGas = false;
20916
+ }
20917
+
20537
20918
  rewardsGauge = new ethers.utils.Interface(IBalancerRewardsGauge.abi);
20538
20919
  unstakeTxData = rewardsGauge.encodeFunctionData("withdraw(uint256)", [amount]);
20539
- _context15.next = 5;
20540
- return this.poolLogic.execTransaction(gauge, unstakeTxData, options);
20920
+ _context15.next = 6;
20921
+ return getPoolTxOrGasEstimate(this, [gauge, unstakeTxData, options], estimateGas);
20541
20922
 
20542
- case 5:
20923
+ case 6:
20543
20924
  tx = _context15.sent;
20544
20925
  return _context15.abrupt("return", tx);
20545
20926
 
20546
- case 7:
20927
+ case 8:
20547
20928
  case "end":
20548
20929
  return _context15.stop();
20549
20930
  }
@@ -20551,7 +20932,7 @@ var Pool = /*#__PURE__*/function () {
20551
20932
  }, _callee15, this);
20552
20933
  }));
20553
20934
 
20554
- function unstakeFromGauge(_x53, _x54, _x55) {
20935
+ function unstakeFromGauge(_x63, _x64, _x65, _x66) {
20555
20936
  return _unstakeFromGauge.apply(this, arguments);
20556
20937
  }
20557
20938
 
@@ -20564,6 +20945,7 @@ var Pool = /*#__PURE__*/function () {
20564
20945
  * @param {BigNumber | string} amount Amount of asset to lend
20565
20946
  * @param {number} referralCode Code from Aave referral program
20566
20947
  * @param {any} options Transaction options
20948
+ * @param {boolean} estimateGas Simulate/estimate gas
20567
20949
  * @returns {Promise<any>} Transaction
20568
20950
  */
20569
20951
  ;
@@ -20571,7 +20953,7 @@ var Pool = /*#__PURE__*/function () {
20571
20953
  _proto.lend =
20572
20954
  /*#__PURE__*/
20573
20955
  function () {
20574
- 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) {
20575
20957
  var iLendingPool, depositTxData, tx;
20576
20958
  return runtime_1.wrap(function _callee16$(_context16) {
20577
20959
  while (1) {
@@ -20585,16 +20967,20 @@ var Pool = /*#__PURE__*/function () {
20585
20967
  options = null;
20586
20968
  }
20587
20969
 
20970
+ if (estimateGas === void 0) {
20971
+ estimateGas = false;
20972
+ }
20973
+
20588
20974
  iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
20589
20975
  depositTxData = iLendingPool.encodeFunctionData(Transaction.DEPOSIT, [asset, amount, this.address, referralCode]);
20590
- _context16.next = 6;
20591
- 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);
20592
20978
 
20593
- case 6:
20979
+ case 7:
20594
20980
  tx = _context16.sent;
20595
20981
  return _context16.abrupt("return", tx);
20596
20982
 
20597
- case 8:
20983
+ case 9:
20598
20984
  case "end":
20599
20985
  return _context16.stop();
20600
20986
  }
@@ -20602,7 +20988,7 @@ var Pool = /*#__PURE__*/function () {
20602
20988
  }, _callee16, this);
20603
20989
  }));
20604
20990
 
20605
- function lend(_x56, _x57, _x58, _x59, _x60) {
20991
+ function lend(_x67, _x68, _x69, _x70, _x71, _x72) {
20606
20992
  return _lend.apply(this, arguments);
20607
20993
  }
20608
20994
 
@@ -20614,6 +21000,7 @@ var Pool = /*#__PURE__*/function () {
20614
21000
  * @param {string} asset Asset
20615
21001
  * @param {BigNumber | string} amount Amount of asset to lend
20616
21002
  * @param {any} options Transaction options
21003
+ * @param {boolean} estimateGas Simulate/estimate gas
20617
21004
  * @returns {Promise<any>} Transaction
20618
21005
  */
20619
21006
  ;
@@ -20621,7 +21008,7 @@ var Pool = /*#__PURE__*/function () {
20621
21008
  _proto.withdrawDeposit =
20622
21009
  /*#__PURE__*/
20623
21010
  function () {
20624
- 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) {
20625
21012
  var iLendingPool, withdrawTxData, tx;
20626
21013
  return runtime_1.wrap(function _callee17$(_context17) {
20627
21014
  while (1) {
@@ -20631,16 +21018,20 @@ var Pool = /*#__PURE__*/function () {
20631
21018
  options = null;
20632
21019
  }
20633
21020
 
21021
+ if (estimateGas === void 0) {
21022
+ estimateGas = false;
21023
+ }
21024
+
20634
21025
  iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
20635
21026
  withdrawTxData = iLendingPool.encodeFunctionData(Transaction.WITHDRAW, [asset, amount, this.address]);
20636
- _context17.next = 5;
20637
- 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);
20638
21029
 
20639
- case 5:
21030
+ case 6:
20640
21031
  tx = _context17.sent;
20641
21032
  return _context17.abrupt("return", tx);
20642
21033
 
20643
- case 7:
21034
+ case 8:
20644
21035
  case "end":
20645
21036
  return _context17.stop();
20646
21037
  }
@@ -20648,7 +21039,7 @@ var Pool = /*#__PURE__*/function () {
20648
21039
  }, _callee17, this);
20649
21040
  }));
20650
21041
 
20651
- function withdrawDeposit(_x61, _x62, _x63, _x64) {
21042
+ function withdrawDeposit(_x73, _x74, _x75, _x76, _x77) {
20652
21043
  return _withdrawDeposit.apply(this, arguments);
20653
21044
  }
20654
21045
 
@@ -20661,6 +21052,7 @@ var Pool = /*#__PURE__*/function () {
20661
21052
  * @param {BigNumber | string} amount Amount of asset to lend
20662
21053
  * @param {number} referralCode Code from Aave referral program
20663
21054
  * @param {any} options Transaction options
21055
+ * @param {boolean} estimateGas Simulate/estimate gas
20664
21056
  * @returns {Promise<any>} Transaction
20665
21057
  */
20666
21058
  ;
@@ -20668,7 +21060,7 @@ var Pool = /*#__PURE__*/function () {
20668
21060
  _proto.borrow =
20669
21061
  /*#__PURE__*/
20670
21062
  function () {
20671
- 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) {
20672
21064
  var iLendingPool, borrowTxData, tx;
20673
21065
  return runtime_1.wrap(function _callee18$(_context18) {
20674
21066
  while (1) {
@@ -20682,16 +21074,20 @@ var Pool = /*#__PURE__*/function () {
20682
21074
  options = null;
20683
21075
  }
20684
21076
 
21077
+ if (estimateGas === void 0) {
21078
+ estimateGas = false;
21079
+ }
21080
+
20685
21081
  iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
20686
21082
  borrowTxData = iLendingPool.encodeFunctionData(Transaction.BORROW, [asset, amount, 2, referralCode, this.address]);
20687
- _context18.next = 6;
20688
- 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);
20689
21085
 
20690
- case 6:
21086
+ case 7:
20691
21087
  tx = _context18.sent;
20692
21088
  return _context18.abrupt("return", tx);
20693
21089
 
20694
- case 8:
21090
+ case 9:
20695
21091
  case "end":
20696
21092
  return _context18.stop();
20697
21093
  }
@@ -20699,7 +21095,7 @@ var Pool = /*#__PURE__*/function () {
20699
21095
  }, _callee18, this);
20700
21096
  }));
20701
21097
 
20702
- function borrow(_x65, _x66, _x67, _x68, _x69) {
21098
+ function borrow(_x78, _x79, _x80, _x81, _x82, _x83) {
20703
21099
  return _borrow.apply(this, arguments);
20704
21100
  }
20705
21101
 
@@ -20711,6 +21107,7 @@ var Pool = /*#__PURE__*/function () {
20711
21107
  * @param {string} asset Asset
20712
21108
  * @param {BigNumber | string} amount Amount of asset to lend
20713
21109
  * @param {any} options Transaction options
21110
+ * @param {boolean} estimateGas Simulate/estimate gas
20714
21111
  * @returns {Promise<any>} Transaction
20715
21112
  */
20716
21113
  ;
@@ -20718,7 +21115,7 @@ var Pool = /*#__PURE__*/function () {
20718
21115
  _proto.repay =
20719
21116
  /*#__PURE__*/
20720
21117
  function () {
20721
- 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) {
20722
21119
  var iLendingPool, repayTxData, tx;
20723
21120
  return runtime_1.wrap(function _callee19$(_context19) {
20724
21121
  while (1) {
@@ -20728,16 +21125,20 @@ var Pool = /*#__PURE__*/function () {
20728
21125
  options = null;
20729
21126
  }
20730
21127
 
21128
+ if (estimateGas === void 0) {
21129
+ estimateGas = false;
21130
+ }
21131
+
20731
21132
  iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
20732
21133
  repayTxData = iLendingPool.encodeFunctionData(Transaction.REPAY, [asset, amount, 2, this.address]);
20733
- _context19.next = 5;
20734
- 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);
20735
21136
 
20736
- case 5:
21137
+ case 6:
20737
21138
  tx = _context19.sent;
20738
21139
  return _context19.abrupt("return", tx);
20739
21140
 
20740
- case 7:
21141
+ case 8:
20741
21142
  case "end":
20742
21143
  return _context19.stop();
20743
21144
  }
@@ -20745,7 +21146,7 @@ var Pool = /*#__PURE__*/function () {
20745
21146
  }, _callee19, this);
20746
21147
  }));
20747
21148
 
20748
- function repay(_x70, _x71, _x72, _x73) {
21149
+ function repay(_x84, _x85, _x86, _x87, _x88) {
20749
21150
  return _repay.apply(this, arguments);
20750
21151
  }
20751
21152
 
@@ -20755,7 +21156,8 @@ var Pool = /*#__PURE__*/function () {
20755
21156
  * Claim rewards of staked liquidity pool tokens
20756
21157
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
20757
21158
  * @param {string} asset Liquidity pool token
20758
- * @param {any} options Transaction options
21159
+ * @param {any} options Transaction option
21160
+ * @param {boolean} estimateGas Simulate/estimate gas
20759
21161
  * @returns {Promise<any>} Transaction
20760
21162
  */
20761
21163
  ;
@@ -20763,7 +21165,7 @@ var Pool = /*#__PURE__*/function () {
20763
21165
  _proto.harvestRewards =
20764
21166
  /*#__PURE__*/
20765
21167
  function () {
20766
- 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) {
20767
21169
  var iMiniChefV2, poolId, harvestTxData, tx;
20768
21170
  return runtime_1.wrap(function _callee20$(_context20) {
20769
21171
  while (1) {
@@ -20773,21 +21175,25 @@ var Pool = /*#__PURE__*/function () {
20773
21175
  options = null;
20774
21176
  }
20775
21177
 
21178
+ if (estimateGas === void 0) {
21179
+ estimateGas = false;
21180
+ }
21181
+
20776
21182
  iMiniChefV2 = new ethers.utils.Interface(IMiniChefV2.abi);
20777
- _context20.next = 4;
21183
+ _context20.next = 5;
20778
21184
  return this.utils.getLpPoolId(dapp, asset);
20779
21185
 
20780
- case 4:
21186
+ case 5:
20781
21187
  poolId = _context20.sent;
20782
21188
  harvestTxData = iMiniChefV2.encodeFunctionData(Transaction.HARVEST, [poolId, this.address]);
20783
- _context20.next = 8;
20784
- 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);
20785
21191
 
20786
- case 8:
21192
+ case 9:
20787
21193
  tx = _context20.sent;
20788
21194
  return _context20.abrupt("return", tx);
20789
21195
 
20790
- case 10:
21196
+ case 11:
20791
21197
  case "end":
20792
21198
  return _context20.stop();
20793
21199
  }
@@ -20795,7 +21201,7 @@ var Pool = /*#__PURE__*/function () {
20795
21201
  }, _callee20, this);
20796
21202
  }));
20797
21203
 
20798
- function harvestRewards(_x74, _x75, _x76) {
21204
+ function harvestRewards(_x89, _x90, _x91, _x92) {
20799
21205
  return _harvestRewards.apply(this, arguments);
20800
21206
  }
20801
21207
 
@@ -20854,7 +21260,7 @@ var Pool = /*#__PURE__*/function () {
20854
21260
  }, _callee21, this);
20855
21261
  }));
20856
21262
 
20857
- function changeAssets(_x77, _x78) {
21263
+ function changeAssets(_x93, _x94) {
20858
21264
  return _changeAssets.apply(this, arguments);
20859
21265
  }
20860
21266
 
@@ -20896,7 +21302,7 @@ var Pool = /*#__PURE__*/function () {
20896
21302
  }, _callee22, this);
20897
21303
  }));
20898
21304
 
20899
- function setTrader(_x79, _x80) {
21305
+ function setTrader(_x95, _x96) {
20900
21306
  return _setTrader.apply(this, arguments);
20901
21307
  }
20902
21308
 
@@ -20908,6 +21314,7 @@ var Pool = /*#__PURE__*/function () {
20908
21314
  * @param {string[] | } assetsIn Array of balancer pool assets
20909
21315
  * @param {BigNumber[] | string[]} amountsIn Array of maximum amounts to provide to pool
20910
21316
  * @param {any} options Transaction options
21317
+ * @param {boolean} estimateGas Simulate/estimate gas
20911
21318
  * @returns {Promise<any>} Transaction
20912
21319
  */
20913
21320
  ;
@@ -20915,7 +21322,7 @@ var Pool = /*#__PURE__*/function () {
20915
21322
  _proto.joinBalancerPool =
20916
21323
  /*#__PURE__*/
20917
21324
  function () {
20918
- 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) {
20919
21326
  var joinPoolTxData, tx;
20920
21327
  return runtime_1.wrap(function _callee23$(_context23) {
20921
21328
  while (1) {
@@ -20925,15 +21332,19 @@ var Pool = /*#__PURE__*/function () {
20925
21332
  options = null;
20926
21333
  }
20927
21334
 
21335
+ if (estimateGas === void 0) {
21336
+ estimateGas = false;
21337
+ }
21338
+
20928
21339
  joinPoolTxData = this.utils.getBalancerJoinPoolTx(this, poolId, assets, amountsIn);
20929
- _context23.next = 4;
20930
- 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);
20931
21342
 
20932
- case 4:
21343
+ case 5:
20933
21344
  tx = _context23.sent;
20934
21345
  return _context23.abrupt("return", tx);
20935
21346
 
20936
- case 6:
21347
+ case 7:
20937
21348
  case "end":
20938
21349
  return _context23.stop();
20939
21350
  }
@@ -20941,7 +21352,7 @@ var Pool = /*#__PURE__*/function () {
20941
21352
  }, _callee23, this);
20942
21353
  }));
20943
21354
 
20944
- function joinBalancerPool(_x81, _x82, _x83, _x84) {
21355
+ function joinBalancerPool(_x97, _x98, _x99, _x100, _x101) {
20945
21356
  return _joinBalancerPool.apply(this, arguments);
20946
21357
  }
20947
21358
 
@@ -20954,6 +21365,7 @@ var Pool = /*#__PURE__*/function () {
20954
21365
  * @param {BigNumber | string } amount Amount of pool tokens to withdraw
20955
21366
  * @param { null | number } singleExitAssetIndex Index of asset to withdraw to
20956
21367
  * @param {any} options Transaction options
21368
+ * @param {boolean} estimateGas Simulate/estimate gas
20957
21369
  * @returns {Promise<any>} Transaction
20958
21370
  */
20959
21371
  ;
@@ -20961,7 +21373,7 @@ var Pool = /*#__PURE__*/function () {
20961
21373
  _proto.exitBalancerPool =
20962
21374
  /*#__PURE__*/
20963
21375
  function () {
20964
- 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) {
20965
21377
  var exitPoolTxData, tx;
20966
21378
  return runtime_1.wrap(function _callee24$(_context24) {
20967
21379
  while (1) {
@@ -20975,15 +21387,19 @@ var Pool = /*#__PURE__*/function () {
20975
21387
  options = null;
20976
21388
  }
20977
21389
 
21390
+ if (estimateGas === void 0) {
21391
+ estimateGas = false;
21392
+ }
21393
+
20978
21394
  exitPoolTxData = this.utils.getBalancerExitPoolTx(this, poolId, assets, singleExitAssetIndex, amount);
20979
- _context24.next = 5;
20980
- 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);
20981
21397
 
20982
- case 5:
21398
+ case 6:
20983
21399
  tx = _context24.sent;
20984
21400
  return _context24.abrupt("return", tx);
20985
21401
 
20986
- case 7:
21402
+ case 8:
20987
21403
  case "end":
20988
21404
  return _context24.stop();
20989
21405
  }
@@ -20991,7 +21407,7 @@ var Pool = /*#__PURE__*/function () {
20991
21407
  }, _callee24, this);
20992
21408
  }));
20993
21409
 
20994
- function exitBalancerPool(_x85, _x86, _x87, _x88, _x89) {
21410
+ function exitBalancerPool(_x102, _x103, _x104, _x105, _x106, _x107) {
20995
21411
  return _exitBalancerPool.apply(this, arguments);
20996
21412
  }
20997
21413
 
@@ -21001,6 +21417,7 @@ var Pool = /*#__PURE__*/function () {
21001
21417
  * Claim rewards from Aave platform
21002
21418
  * @param {string[]} assets Aave tokens (deposit/debt) hold by pool
21003
21419
  * @param {any} options Transaction options
21420
+ * @param {boolean} estimateGas Simulate/estimate gas
21004
21421
  * @returns {Promise<any>} Transaction
21005
21422
  */
21006
21423
  ;
@@ -21008,7 +21425,7 @@ var Pool = /*#__PURE__*/function () {
21008
21425
  _proto.harvestAaveRewards =
21009
21426
  /*#__PURE__*/
21010
21427
  function () {
21011
- 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) {
21012
21429
  var aaveIncentivesAddress, iAaveIncentivesController, aaveIncentivesController, amount, claimTxData, tx;
21013
21430
  return runtime_1.wrap(function _callee25$(_context25) {
21014
21431
  while (1) {
@@ -21018,23 +21435,27 @@ var Pool = /*#__PURE__*/function () {
21018
21435
  options = null;
21019
21436
  }
21020
21437
 
21438
+ if (estimateGas === void 0) {
21439
+ estimateGas = false;
21440
+ }
21441
+
21021
21442
  aaveIncentivesAddress = stakingAddress[this.network][Dapp.AAVE];
21022
21443
  iAaveIncentivesController = new ethers.utils.Interface(IAaveIncentivesController.abi);
21023
21444
  aaveIncentivesController = new ethers.Contract(aaveIncentivesAddress, iAaveIncentivesController, this.signer);
21024
- _context25.next = 6;
21445
+ _context25.next = 7;
21025
21446
  return aaveIncentivesController.getUserUnclaimedRewards(this.address);
21026
21447
 
21027
- case 6:
21448
+ case 7:
21028
21449
  amount = _context25.sent;
21029
21450
  claimTxData = iAaveIncentivesController.encodeFunctionData(Transaction.CLAIM_REWARDS, [assets, amount, this.address]);
21030
- _context25.next = 10;
21031
- return this.poolLogic.execTransaction(aaveIncentivesAddress, claimTxData, options);
21451
+ _context25.next = 11;
21452
+ return getPoolTxOrGasEstimate(this, [aaveIncentivesAddress, claimTxData, options], estimateGas);
21032
21453
 
21033
- case 10:
21454
+ case 11:
21034
21455
  tx = _context25.sent;
21035
21456
  return _context25.abrupt("return", tx);
21036
21457
 
21037
- case 12:
21458
+ case 13:
21038
21459
  case "end":
21039
21460
  return _context25.stop();
21040
21461
  }
@@ -21042,7 +21463,7 @@ var Pool = /*#__PURE__*/function () {
21042
21463
  }, _callee25, this);
21043
21464
  }));
21044
21465
 
21045
- function harvestAaveRewards(_x90, _x91) {
21466
+ function harvestAaveRewards(_x108, _x109, _x110) {
21046
21467
  return _harvestAaveRewards.apply(this, arguments);
21047
21468
  }
21048
21469
 
@@ -21053,6 +21474,7 @@ var Pool = /*#__PURE__*/function () {
21053
21474
  * @param {string[]} assets Assets invested in Aave
21054
21475
  * @param {string} rewardAssets Reward token address
21055
21476
  * @param {any} options Transaction options
21477
+ * @param {boolean} estimateGas Simulate/estimate gas
21056
21478
  * @returns {Promise<any>} Transaction
21057
21479
  */
21058
21480
  ;
@@ -21060,7 +21482,7 @@ var Pool = /*#__PURE__*/function () {
21060
21482
  _proto.harvestAaveV3Rewards =
21061
21483
  /*#__PURE__*/
21062
21484
  function () {
21063
- 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) {
21064
21486
  var claimTxData, tx;
21065
21487
  return runtime_1.wrap(function _callee26$(_context26) {
21066
21488
  while (1) {
@@ -21070,19 +21492,23 @@ var Pool = /*#__PURE__*/function () {
21070
21492
  options = null;
21071
21493
  }
21072
21494
 
21073
- _context26.next = 3;
21495
+ if (estimateGas === void 0) {
21496
+ estimateGas = false;
21497
+ }
21498
+
21499
+ _context26.next = 4;
21074
21500
  return getAaveV3ClaimTxData(this, assets, rewardAsset);
21075
21501
 
21076
- case 3:
21502
+ case 4:
21077
21503
  claimTxData = _context26.sent;
21078
- _context26.next = 6;
21079
- 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);
21080
21506
 
21081
- case 6:
21507
+ case 7:
21082
21508
  tx = _context26.sent;
21083
21509
  return _context26.abrupt("return", tx);
21084
21510
 
21085
- case 8:
21511
+ case 9:
21086
21512
  case "end":
21087
21513
  return _context26.stop();
21088
21514
  }
@@ -21090,7 +21516,7 @@ var Pool = /*#__PURE__*/function () {
21090
21516
  }, _callee26, this);
21091
21517
  }));
21092
21518
 
21093
- function harvestAaveV3Rewards(_x92, _x93, _x94) {
21519
+ function harvestAaveV3Rewards(_x111, _x112, _x113, _x114) {
21094
21520
  return _harvestAaveV3Rewards.apply(this, arguments);
21095
21521
  }
21096
21522
 
@@ -21108,6 +21534,7 @@ var Pool = /*#__PURE__*/function () {
21108
21534
  * @param { number } maxTick Upper tick range
21109
21535
  * @param { FeeAmount } feeAmount Fee tier (Low 0.05%, Medium 0.3%, High 1%)
21110
21536
  * @param {any} options Transaction options
21537
+ * @param {boolean} estimateGas Simulate/estimate gas
21111
21538
  * @returns {Promise<any>} Transaction
21112
21539
  */
21113
21540
  ;
@@ -21115,7 +21542,7 @@ var Pool = /*#__PURE__*/function () {
21115
21542
  _proto.addLiquidityUniswapV3 =
21116
21543
  /*#__PURE__*/
21117
21544
  function () {
21118
- 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) {
21119
21546
  var iNonfungiblePositionManager, mintTxParams, mintTxData, tx;
21120
21547
  return runtime_1.wrap(function _callee27$(_context27) {
21121
21548
  while (1) {
@@ -21125,29 +21552,33 @@ var Pool = /*#__PURE__*/function () {
21125
21552
  options = null;
21126
21553
  }
21127
21554
 
21555
+ if (estimateGas === void 0) {
21556
+ estimateGas = false;
21557
+ }
21558
+
21128
21559
  if (!((minPrice === null || maxPrice === null) && (minTick === null || maxTick === null))) {
21129
- _context27.next = 3;
21560
+ _context27.next = 4;
21130
21561
  break;
21131
21562
  }
21132
21563
 
21133
21564
  throw new Error("Need to provide price or tick range");
21134
21565
 
21135
- case 3:
21566
+ case 4:
21136
21567
  iNonfungiblePositionManager = new ethers.utils.Interface(INonfungiblePositionManager.abi);
21137
- _context27.next = 6;
21568
+ _context27.next = 7;
21138
21569
  return getUniswapV3MintParams(this, assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount);
21139
21570
 
21140
- case 6:
21571
+ case 7:
21141
21572
  mintTxParams = _context27.sent;
21142
21573
  mintTxData = iNonfungiblePositionManager.encodeFunctionData(Transaction.MINT, [mintTxParams]);
21143
- _context27.next = 10;
21144
- return this.poolLogic.execTransaction(nonfungiblePositionManagerAddress[this.network], mintTxData, options);
21574
+ _context27.next = 11;
21575
+ return getPoolTxOrGasEstimate(this, [nonfungiblePositionManagerAddress[this.network], mintTxData, options], estimateGas);
21145
21576
 
21146
- case 10:
21577
+ case 11:
21147
21578
  tx = _context27.sent;
21148
21579
  return _context27.abrupt("return", tx);
21149
21580
 
21150
- case 12:
21581
+ case 13:
21151
21582
  case "end":
21152
21583
  return _context27.stop();
21153
21584
  }
@@ -21155,7 +21586,7 @@ var Pool = /*#__PURE__*/function () {
21155
21586
  }, _callee27, this);
21156
21587
  }));
21157
21588
 
21158
- 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) {
21159
21590
  return _addLiquidityUniswapV.apply(this, arguments);
21160
21591
  }
21161
21592
 
@@ -21167,6 +21598,7 @@ var Pool = /*#__PURE__*/function () {
21167
21598
  * @param {string} tokenId Token Id of UniswapV3 position
21168
21599
  * @param {number} amount Amount in percent of assets to be removed
21169
21600
  * @param {any} options Transaction options
21601
+ * @param {boolean} estimateGas Simulate/estimate gas
21170
21602
  * @returns {Promise<any>} Transaction
21171
21603
  */
21172
21604
  ;
@@ -21174,7 +21606,7 @@ var Pool = /*#__PURE__*/function () {
21174
21606
  _proto.decreaseLiquidity =
21175
21607
  /*#__PURE__*/
21176
21608
  function () {
21177
- 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) {
21178
21610
  var txData, dappAddress, abi, liquidity, decreaseLiquidityTxData, collectTxData, multicallParams, burnTxData, _abi, _liquidity, tx;
21179
21611
 
21180
21612
  return runtime_1.wrap(function _callee28$(_context28) {
@@ -21189,26 +21621,30 @@ var Pool = /*#__PURE__*/function () {
21189
21621
  options = null;
21190
21622
  }
21191
21623
 
21624
+ if (estimateGas === void 0) {
21625
+ estimateGas = false;
21626
+ }
21627
+
21192
21628
  if (!(dapp === Dapp.UNISWAPV3)) {
21193
- _context28.next = 24;
21629
+ _context28.next = 25;
21194
21630
  break;
21195
21631
  }
21196
21632
 
21197
21633
  dappAddress = nonfungiblePositionManagerAddress[this.network];
21198
21634
  abi = new ethers.utils.Interface(INonfungiblePositionManager.abi);
21199
- _context28.next = 7;
21635
+ _context28.next = 8;
21200
21636
  return getUniswapV3Liquidity(tokenId, this);
21201
21637
 
21202
- case 7:
21638
+ case 8:
21203
21639
  liquidity = _context28.sent.mul(Math.round(amount * 1e4)).div(1e6);
21204
21640
  _context28.t0 = abi;
21205
21641
  _context28.t1 = Transaction.DECREASE_LIQUIDITY;
21206
21642
  _context28.t2 = tokenId;
21207
21643
  _context28.t3 = liquidity;
21208
- _context28.next = 14;
21644
+ _context28.next = 15;
21209
21645
  return getDeadline(this);
21210
21646
 
21211
- case 14:
21647
+ case 15:
21212
21648
  _context28.t4 = _context28.sent;
21213
21649
  _context28.t5 = [_context28.t2, _context28.t3, 0, 0, _context28.t4];
21214
21650
  _context28.t6 = [_context28.t5];
@@ -21222,38 +21658,38 @@ var Pool = /*#__PURE__*/function () {
21222
21658
  }
21223
21659
 
21224
21660
  txData = abi.encodeFunctionData(Transaction.MULTI_CALL, [multicallParams]);
21225
- _context28.next = 34;
21661
+ _context28.next = 35;
21226
21662
  break;
21227
21663
 
21228
- case 24:
21664
+ case 25:
21229
21665
  if (!(dapp === Dapp.ARRAKIS)) {
21230
- _context28.next = 33;
21666
+ _context28.next = 34;
21231
21667
  break;
21232
21668
  }
21233
21669
 
21234
21670
  dappAddress = routerAddress[this.network][dapp];
21235
21671
  _abi = new ethers.utils.Interface(IArrakisV1RouterStaking.abi);
21236
- _context28.next = 29;
21672
+ _context28.next = 30;
21237
21673
  return this.utils.getBalance(tokenId, this.address);
21238
21674
 
21239
- case 29:
21675
+ case 30:
21240
21676
  _liquidity = _context28.sent.mul(Math.round(amount * 1e4)).div(1e6);
21241
21677
  txData = _abi.encodeFunctionData(Transaction.REMOVE_LIQUIDITY_UNSTAKE, [tokenId, _liquidity, 0, 0, this.address]);
21242
- _context28.next = 34;
21678
+ _context28.next = 35;
21243
21679
  break;
21244
21680
 
21245
- case 33:
21681
+ case 34:
21246
21682
  throw new Error("dapp not supported");
21247
21683
 
21248
- case 34:
21249
- _context28.next = 36;
21250
- return this.poolLogic.execTransaction(dappAddress, txData, options);
21684
+ case 35:
21685
+ _context28.next = 37;
21686
+ return getPoolTxOrGasEstimate(this, [dappAddress, txData, options], estimateGas);
21251
21687
 
21252
- case 36:
21688
+ case 37:
21253
21689
  tx = _context28.sent;
21254
21690
  return _context28.abrupt("return", tx);
21255
21691
 
21256
- case 38:
21692
+ case 39:
21257
21693
  case "end":
21258
21694
  return _context28.stop();
21259
21695
  }
@@ -21261,7 +21697,7 @@ var Pool = /*#__PURE__*/function () {
21261
21697
  }, _callee28, this);
21262
21698
  }));
21263
21699
 
21264
- function decreaseLiquidity(_x105, _x106, _x107, _x108) {
21700
+ function decreaseLiquidity(_x126, _x127, _x128, _x129, _x130) {
21265
21701
  return _decreaseLiquidity.apply(this, arguments);
21266
21702
  }
21267
21703
 
@@ -21274,6 +21710,7 @@ var Pool = /*#__PURE__*/function () {
21274
21710
  * @param {BigNumber | string} amountA Amount first asset
21275
21711
  * @param {BigNumber | string} amountB Amount second asset
21276
21712
  * @param {any} options Transaction options
21713
+ * @param {boolean} estimateGas Simulate/estimate gas
21277
21714
  * @returns {Promise<any>} Transaction
21278
21715
  */
21279
21716
  ;
@@ -21281,7 +21718,7 @@ var Pool = /*#__PURE__*/function () {
21281
21718
  _proto.increaseLiquidity =
21282
21719
  /*#__PURE__*/
21283
21720
  function () {
21284
- 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) {
21285
21722
  var txData, dappAddress, abi, _abi2, tx;
21286
21723
 
21287
21724
  return runtime_1.wrap(function _callee29$(_context29) {
@@ -21292,8 +21729,12 @@ var Pool = /*#__PURE__*/function () {
21292
21729
  options = null;
21293
21730
  }
21294
21731
 
21732
+ if (estimateGas === void 0) {
21733
+ estimateGas = false;
21734
+ }
21735
+
21295
21736
  if (!(dapp === Dapp.UNISWAPV3)) {
21296
- _context29.next = 17;
21737
+ _context29.next = 18;
21297
21738
  break;
21298
21739
  }
21299
21740
 
@@ -21304,41 +21745,41 @@ var Pool = /*#__PURE__*/function () {
21304
21745
  _context29.t2 = tokenId;
21305
21746
  _context29.t3 = amountA;
21306
21747
  _context29.t4 = amountB;
21307
- _context29.next = 11;
21748
+ _context29.next = 12;
21308
21749
  return getDeadline(this);
21309
21750
 
21310
- case 11:
21751
+ case 12:
21311
21752
  _context29.t5 = _context29.sent;
21312
21753
  _context29.t6 = [_context29.t2, _context29.t3, _context29.t4, 0, 0, _context29.t5];
21313
21754
  _context29.t7 = [_context29.t6];
21314
21755
  txData = _context29.t0.encodeFunctionData.call(_context29.t0, _context29.t1, _context29.t7);
21315
- _context29.next = 24;
21756
+ _context29.next = 25;
21316
21757
  break;
21317
21758
 
21318
- case 17:
21759
+ case 18:
21319
21760
  if (!(dapp === Dapp.ARRAKIS)) {
21320
- _context29.next = 23;
21761
+ _context29.next = 24;
21321
21762
  break;
21322
21763
  }
21323
21764
 
21324
21765
  dappAddress = routerAddress[this.network][dapp];
21325
21766
  _abi2 = new ethers.utils.Interface(IArrakisV1RouterStaking.abi);
21326
21767
  txData = _abi2.encodeFunctionData(Transaction.ADD_LIQUIDITY_STAKE, [tokenId, amountA, amountB, 0, 0, 0, this.address]);
21327
- _context29.next = 24;
21768
+ _context29.next = 25;
21328
21769
  break;
21329
21770
 
21330
- case 23:
21771
+ case 24:
21331
21772
  throw new Error("dapp not supported");
21332
21773
 
21333
- case 24:
21334
- _context29.next = 26;
21335
- return this.poolLogic.execTransaction(dappAddress, txData, options);
21774
+ case 25:
21775
+ _context29.next = 27;
21776
+ return getPoolTxOrGasEstimate(this, [dappAddress, txData, options], estimateGas);
21336
21777
 
21337
- case 26:
21778
+ case 27:
21338
21779
  tx = _context29.sent;
21339
21780
  return _context29.abrupt("return", tx);
21340
21781
 
21341
- case 28:
21782
+ case 29:
21342
21783
  case "end":
21343
21784
  return _context29.stop();
21344
21785
  }
@@ -21346,7 +21787,7 @@ var Pool = /*#__PURE__*/function () {
21346
21787
  }, _callee29, this);
21347
21788
  }));
21348
21789
 
21349
- function increaseLiquidity(_x109, _x110, _x111, _x112, _x113) {
21790
+ function increaseLiquidity(_x131, _x132, _x133, _x134, _x135, _x136) {
21350
21791
  return _increaseLiquidity.apply(this, arguments);
21351
21792
  }
21352
21793
 
@@ -21357,6 +21798,7 @@ var Pool = /*#__PURE__*/function () {
21357
21798
  * @param {Dapp} dapp Platform either UniswapV3 or Arrakis
21358
21799
  * @param {string} tokenId Token Id of UniswapV3 or Gauge address
21359
21800
  * @param {any} options Transaction option
21801
+ * @param {boolean} estimateGas Simulate/estimate gas
21360
21802
  * @returns {Promise<any>} Transaction
21361
21803
  */
21362
21804
  ;
@@ -21364,7 +21806,7 @@ var Pool = /*#__PURE__*/function () {
21364
21806
  _proto.claimFees =
21365
21807
  /*#__PURE__*/
21366
21808
  function () {
21367
- 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) {
21368
21810
  var txData, contractAddress, iNonfungiblePositionManager, abi, tx;
21369
21811
  return runtime_1.wrap(function _callee30$(_context30) {
21370
21812
  while (1) {
@@ -21374,44 +21816,48 @@ var Pool = /*#__PURE__*/function () {
21374
21816
  options = null;
21375
21817
  }
21376
21818
 
21819
+ if (estimateGas === void 0) {
21820
+ estimateGas = false;
21821
+ }
21822
+
21377
21823
  _context30.t0 = dapp;
21378
- _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;
21379
21825
  break;
21380
21826
 
21381
- case 4:
21827
+ case 5:
21382
21828
  contractAddress = nonfungiblePositionManagerAddress[this.network];
21383
21829
  iNonfungiblePositionManager = new ethers.utils.Interface(INonfungiblePositionManager.abi);
21384
21830
  txData = iNonfungiblePositionManager.encodeFunctionData(Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
21385
- return _context30.abrupt("break", 19);
21831
+ return _context30.abrupt("break", 20);
21386
21832
 
21387
- case 8:
21833
+ case 9:
21388
21834
  contractAddress = tokenId;
21389
21835
  abi = new ethers.utils.Interface(ILiquidityGaugeV4.abi);
21390
21836
  txData = abi.encodeFunctionData("claim_rewards()", []);
21391
- return _context30.abrupt("break", 19);
21837
+ return _context30.abrupt("break", 20);
21392
21838
 
21393
- case 12:
21839
+ case 13:
21394
21840
  contractAddress = tokenId;
21395
21841
  txData = getVelodromeClaimTxData(this, tokenId, false);
21396
- return _context30.abrupt("break", 19);
21842
+ return _context30.abrupt("break", 20);
21397
21843
 
21398
- case 15:
21844
+ case 16:
21399
21845
  contractAddress = tokenId;
21400
21846
  txData = getVelodromeClaimTxData(this, tokenId, true);
21401
- return _context30.abrupt("break", 19);
21847
+ return _context30.abrupt("break", 20);
21402
21848
 
21403
- case 18:
21849
+ case 19:
21404
21850
  throw new Error("dapp not supported");
21405
21851
 
21406
- case 19:
21407
- _context30.next = 21;
21408
- return this.poolLogic.execTransaction(contractAddress, txData, options);
21852
+ case 20:
21853
+ _context30.next = 22;
21854
+ return getPoolTxOrGasEstimate(this, [contractAddress, txData, options], estimateGas);
21409
21855
 
21410
- case 21:
21856
+ case 22:
21411
21857
  tx = _context30.sent;
21412
21858
  return _context30.abrupt("return", tx);
21413
21859
 
21414
- case 23:
21860
+ case 24:
21415
21861
  case "end":
21416
21862
  return _context30.stop();
21417
21863
  }
@@ -21419,7 +21865,7 @@ var Pool = /*#__PURE__*/function () {
21419
21865
  }, _callee30, this);
21420
21866
  }));
21421
21867
 
21422
- function claimFees(_x114, _x115, _x116) {
21868
+ function claimFees(_x137, _x138, _x139, _x140) {
21423
21869
  return _claimFees.apply(this, arguments);
21424
21870
  }
21425
21871
 
@@ -21434,6 +21880,7 @@ var Pool = /*#__PURE__*/function () {
21434
21880
  * @param { FeeAmount } feeAmount Fee tier (Low 0.05%, Medium 0.3%, High 1%)
21435
21881
  * @param {number} slippage Slippage tolerance in %
21436
21882
  * @param {any} options Transaction options
21883
+ * @param {boolean} estimateGas Simulate/estimate gas
21437
21884
  * @returns {Promise<any>} Transaction
21438
21885
  */
21439
21886
  ;
@@ -21441,7 +21888,7 @@ var Pool = /*#__PURE__*/function () {
21441
21888
  _proto.tradeUniswapV3 =
21442
21889
  /*#__PURE__*/
21443
21890
  function () {
21444
- 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) {
21445
21892
  var swapxData, tx;
21446
21893
  return runtime_1.wrap(function _callee31$(_context31) {
21447
21894
  while (1) {
@@ -21455,19 +21902,23 @@ var Pool = /*#__PURE__*/function () {
21455
21902
  options = null;
21456
21903
  }
21457
21904
 
21458
- _context31.next = 4;
21905
+ if (estimateGas === void 0) {
21906
+ estimateGas = false;
21907
+ }
21908
+
21909
+ _context31.next = 5;
21459
21910
  return getUniswapV3SwapTxData(this, assetFrom, assetTo, amountIn, slippage, feeAmount);
21460
21911
 
21461
- case 4:
21912
+ case 5:
21462
21913
  swapxData = _context31.sent;
21463
- _context31.next = 7;
21464
- 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);
21465
21916
 
21466
- case 7:
21917
+ case 8:
21467
21918
  tx = _context31.sent;
21468
21919
  return _context31.abrupt("return", tx);
21469
21920
 
21470
- case 9:
21921
+ case 10:
21471
21922
  case "end":
21472
21923
  return _context31.stop();
21473
21924
  }
@@ -21475,7 +21926,7 @@ var Pool = /*#__PURE__*/function () {
21475
21926
  }, _callee31, this);
21476
21927
  }));
21477
21928
 
21478
- function tradeUniswapV3(_x117, _x118, _x119, _x120, _x121, _x122) {
21929
+ function tradeUniswapV3(_x141, _x142, _x143, _x144, _x145, _x146, _x147) {
21479
21930
  return _tradeUniswapV.apply(this, arguments);
21480
21931
  }
21481
21932
 
@@ -21489,6 +21940,7 @@ var Pool = /*#__PURE__*/function () {
21489
21940
  * @param {BigNumber | string} amountB Amount second asset
21490
21941
  * @param { boolean } isStable Is stable pool
21491
21942
  * @param {any} options Transaction options
21943
+ * @param {boolean} estimateGas Simulate/estimate gas
21492
21944
  * @returns {Promise<any>} Transaction
21493
21945
  */
21494
21946
  ;
@@ -21496,7 +21948,7 @@ var Pool = /*#__PURE__*/function () {
21496
21948
  _proto.addLiquidityVelodrome =
21497
21949
  /*#__PURE__*/
21498
21950
  function () {
21499
- 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) {
21500
21952
  var tx;
21501
21953
  return runtime_1.wrap(function _callee32$(_context32) {
21502
21954
  while (1) {
@@ -21506,22 +21958,29 @@ var Pool = /*#__PURE__*/function () {
21506
21958
  options = null;
21507
21959
  }
21508
21960
 
21509
- _context32.t0 = this.poolLogic;
21510
- _context32.t1 = routerAddress[this.network][Dapp.VELODROME];
21511
- _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;
21512
21969
  return getVelodromeAddLiquidityTxData(this, assetA, assetB, amountA, amountB, isStable);
21513
21970
 
21514
- case 5:
21515
- _context32.t2 = _context32.sent;
21516
- _context32.t3 = options;
21517
- _context32.next = 9;
21518
- 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);
21519
21978
 
21520
- case 9:
21979
+ case 13:
21521
21980
  tx = _context32.sent;
21522
21981
  return _context32.abrupt("return", tx);
21523
21982
 
21524
- case 11:
21983
+ case 15:
21525
21984
  case "end":
21526
21985
  return _context32.stop();
21527
21986
  }
@@ -21529,7 +21988,7 @@ var Pool = /*#__PURE__*/function () {
21529
21988
  }, _callee32, this);
21530
21989
  }));
21531
21990
 
21532
- function addLiquidityVelodrome(_x123, _x124, _x125, _x126, _x127, _x128) {
21991
+ function addLiquidityVelodrome(_x148, _x149, _x150, _x151, _x152, _x153, _x154) {
21533
21992
  return _addLiquidityVelodrome.apply(this, arguments);
21534
21993
  }
21535
21994
 
@@ -21542,6 +22001,7 @@ var Pool = /*#__PURE__*/function () {
21542
22001
  * @param {BigNumber | string} amount Amount of LP tokens
21543
22002
  * @param { boolean } isStable Is stable pool
21544
22003
  * @param {any} options Transaction options
22004
+ * @param {boolean} estimateGas Simulate/estimate gas
21545
22005
  * @returns {Promise<any>} Transaction
21546
22006
  */
21547
22007
  ;
@@ -21549,7 +22009,7 @@ var Pool = /*#__PURE__*/function () {
21549
22009
  _proto.removeLiquidityVelodrome =
21550
22010
  /*#__PURE__*/
21551
22011
  function () {
21552
- 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) {
21553
22013
  var tx;
21554
22014
  return runtime_1.wrap(function _callee33$(_context33) {
21555
22015
  while (1) {
@@ -21559,22 +22019,29 @@ var Pool = /*#__PURE__*/function () {
21559
22019
  options = null;
21560
22020
  }
21561
22021
 
21562
- _context33.t0 = this.poolLogic;
21563
- _context33.t1 = routerAddress[this.network][Dapp.VELODROME];
21564
- _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;
21565
22030
  return getVelodromeRemoveLiquidityTxData(this, assetA, assetB, amount, isStable);
21566
22031
 
21567
- case 5:
21568
- _context33.t2 = _context33.sent;
21569
- _context33.t3 = options;
21570
- _context33.next = 9;
21571
- 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);
21572
22039
 
21573
- case 9:
22040
+ case 13:
21574
22041
  tx = _context33.sent;
21575
22042
  return _context33.abrupt("return", tx);
21576
22043
 
21577
- case 11:
22044
+ case 15:
21578
22045
  case "end":
21579
22046
  return _context33.stop();
21580
22047
  }
@@ -21582,7 +22049,7 @@ var Pool = /*#__PURE__*/function () {
21582
22049
  }, _callee33, this);
21583
22050
  }));
21584
22051
 
21585
- function removeLiquidityVelodrome(_x129, _x130, _x131, _x132, _x133) {
22052
+ function removeLiquidityVelodrome(_x155, _x156, _x157, _x158, _x159, _x160) {
21586
22053
  return _removeLiquidityVelodrome.apply(this, arguments);
21587
22054
  }
21588
22055
 
@@ -21596,6 +22063,7 @@ var Pool = /*#__PURE__*/function () {
21596
22063
  * @param {BigNumber | string} amountB Amount second asset
21597
22064
  * @param { boolean } isStable Is stable pool
21598
22065
  * @param {any} options Transaction options
22066
+ * @param {boolean} estimateGas Simulate/estimate gas
21599
22067
  * @returns {Promise<any>} Transaction
21600
22068
  */
21601
22069
  ;
@@ -21603,7 +22071,7 @@ var Pool = /*#__PURE__*/function () {
21603
22071
  _proto.addLiquidityVelodromeV2 =
21604
22072
  /*#__PURE__*/
21605
22073
  function () {
21606
- 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) {
21607
22075
  var tx;
21608
22076
  return runtime_1.wrap(function _callee34$(_context34) {
21609
22077
  while (1) {
@@ -21613,22 +22081,29 @@ var Pool = /*#__PURE__*/function () {
21613
22081
  options = null;
21614
22082
  }
21615
22083
 
21616
- _context34.t0 = this.poolLogic;
21617
- _context34.t1 = routerAddress[this.network][Dapp.VELODROMEV2];
21618
- _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;
21619
22092
  return getVelodromeAddLiquidityTxData(this, assetA, assetB, amountA, amountB, isStable);
21620
22093
 
21621
- case 5:
21622
- _context34.t2 = _context34.sent;
21623
- _context34.t3 = options;
21624
- _context34.next = 9;
21625
- 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);
21626
22101
 
21627
- case 9:
22102
+ case 13:
21628
22103
  tx = _context34.sent;
21629
22104
  return _context34.abrupt("return", tx);
21630
22105
 
21631
- case 11:
22106
+ case 15:
21632
22107
  case "end":
21633
22108
  return _context34.stop();
21634
22109
  }
@@ -21636,7 +22111,7 @@ var Pool = /*#__PURE__*/function () {
21636
22111
  }, _callee34, this);
21637
22112
  }));
21638
22113
 
21639
- function addLiquidityVelodromeV2(_x134, _x135, _x136, _x137, _x138, _x139) {
22114
+ function addLiquidityVelodromeV2(_x161, _x162, _x163, _x164, _x165, _x166, _x167) {
21640
22115
  return _addLiquidityVelodromeV.apply(this, arguments);
21641
22116
  }
21642
22117
 
@@ -21649,6 +22124,7 @@ var Pool = /*#__PURE__*/function () {
21649
22124
  * @param {BigNumber | string} amount Amount of LP tokens
21650
22125
  * @param { boolean } isStable Is stable pool
21651
22126
  * @param {any} options Transaction options
22127
+ * @param {boolean} estimateGas Simulate/estimate gas
21652
22128
  * @returns {Promise<any>} Transaction
21653
22129
  */
21654
22130
  ;
@@ -21656,7 +22132,7 @@ var Pool = /*#__PURE__*/function () {
21656
22132
  _proto.removeLiquidityVelodromeV2 =
21657
22133
  /*#__PURE__*/
21658
22134
  function () {
21659
- 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) {
21660
22136
  var tx;
21661
22137
  return runtime_1.wrap(function _callee35$(_context35) {
21662
22138
  while (1) {
@@ -21666,22 +22142,29 @@ var Pool = /*#__PURE__*/function () {
21666
22142
  options = null;
21667
22143
  }
21668
22144
 
21669
- _context35.t0 = this.poolLogic;
21670
- _context35.t1 = routerAddress[this.network][Dapp.VELODROMEV2];
21671
- _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;
21672
22153
  return getVelodromeRemoveLiquidityTxData(this, assetA, assetB, amount, isStable);
21673
22154
 
21674
- case 5:
21675
- _context35.t2 = _context35.sent;
21676
- _context35.t3 = options;
21677
- _context35.next = 9;
21678
- 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);
21679
22162
 
21680
- case 9:
22163
+ case 13:
21681
22164
  tx = _context35.sent;
21682
22165
  return _context35.abrupt("return", tx);
21683
22166
 
21684
- case 11:
22167
+ case 15:
21685
22168
  case "end":
21686
22169
  return _context35.stop();
21687
22170
  }
@@ -21689,7 +22172,7 @@ var Pool = /*#__PURE__*/function () {
21689
22172
  }, _callee35, this);
21690
22173
  }));
21691
22174
 
21692
- function removeLiquidityVelodromeV2(_x140, _x141, _x142, _x143, _x144) {
22175
+ function removeLiquidityVelodromeV2(_x168, _x169, _x170, _x171, _x172, _x173) {
21693
22176
  return _removeLiquidityVelodromeV.apply(this, arguments);
21694
22177
  }
21695
22178
 
@@ -21704,6 +22187,7 @@ var Pool = /*#__PURE__*/function () {
21704
22187
  * @param {BigNumber | string} amountB Amount second asset
21705
22188
  * @param { boolean } isStable Is stable pool
21706
22189
  * @param {any} options Transaction options
22190
+ * @param {boolean} estimateGas Simulate/estimate gas
21707
22191
  * @returns {Promise<any>} Transaction
21708
22192
  */
21709
22193
  ;
@@ -21711,7 +22195,7 @@ var Pool = /*#__PURE__*/function () {
21711
22195
  _proto.addLiquidityV2 =
21712
22196
  /*#__PURE__*/
21713
22197
  function () {
21714
- 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) {
21715
22199
  var tx;
21716
22200
  return runtime_1.wrap(function _callee36$(_context36) {
21717
22201
  while (1) {
@@ -21721,22 +22205,29 @@ var Pool = /*#__PURE__*/function () {
21721
22205
  options = null;
21722
22206
  }
21723
22207
 
21724
- _context36.t0 = this.poolLogic;
21725
- _context36.t1 = routerAddress[this.network][dapp];
21726
- _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;
21727
22216
  return getVelodromeAddLiquidityTxData(this, assetA, assetB, amountA, amountB, isStable);
21728
22217
 
21729
- case 5:
21730
- _context36.t2 = _context36.sent;
21731
- _context36.t3 = options;
21732
- _context36.next = 9;
21733
- 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);
21734
22225
 
21735
- case 9:
22226
+ case 13:
21736
22227
  tx = _context36.sent;
21737
22228
  return _context36.abrupt("return", tx);
21738
22229
 
21739
- case 11:
22230
+ case 15:
21740
22231
  case "end":
21741
22232
  return _context36.stop();
21742
22233
  }
@@ -21744,7 +22235,7 @@ var Pool = /*#__PURE__*/function () {
21744
22235
  }, _callee36, this);
21745
22236
  }));
21746
22237
 
21747
- function addLiquidityV2(_x145, _x146, _x147, _x148, _x149, _x150, _x151) {
22238
+ function addLiquidityV2(_x174, _x175, _x176, _x177, _x178, _x179, _x180, _x181) {
21748
22239
  return _addLiquidityV.apply(this, arguments);
21749
22240
  }
21750
22241
 
@@ -21758,6 +22249,7 @@ var Pool = /*#__PURE__*/function () {
21758
22249
  * @param {BigNumber | string} amount Amount of LP tokens
21759
22250
  * @param { boolean } isStable Is stable pool
21760
22251
  * @param {any} options Transaction options
22252
+ * @param {boolean} estimateGas Simulate/estimate gas
21761
22253
  * @returns {Promise<any>} Transaction
21762
22254
  */
21763
22255
  ;
@@ -21765,7 +22257,7 @@ var Pool = /*#__PURE__*/function () {
21765
22257
  _proto.removeLiquidityV2 =
21766
22258
  /*#__PURE__*/
21767
22259
  function () {
21768
- 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) {
21769
22261
  var tx;
21770
22262
  return runtime_1.wrap(function _callee37$(_context37) {
21771
22263
  while (1) {
@@ -21775,22 +22267,29 @@ var Pool = /*#__PURE__*/function () {
21775
22267
  options = null;
21776
22268
  }
21777
22269
 
21778
- _context37.t0 = this.poolLogic;
21779
- _context37.t1 = routerAddress[this.network][dapp];
21780
- _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;
21781
22278
  return getVelodromeRemoveLiquidityTxData(this, assetA, assetB, amount, isStable);
21782
22279
 
21783
- case 5:
21784
- _context37.t2 = _context37.sent;
21785
- _context37.t3 = options;
21786
- _context37.next = 9;
21787
- 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);
21788
22287
 
21789
- case 9:
22288
+ case 13:
21790
22289
  tx = _context37.sent;
21791
22290
  return _context37.abrupt("return", tx);
21792
22291
 
21793
- case 11:
22292
+ case 15:
21794
22293
  case "end":
21795
22294
  return _context37.stop();
21796
22295
  }
@@ -21798,7 +22297,7 @@ var Pool = /*#__PURE__*/function () {
21798
22297
  }, _callee37, this);
21799
22298
  }));
21800
22299
 
21801
- function removeLiquidityV2(_x152, _x153, _x154, _x155, _x156, _x157) {
22300
+ function removeLiquidityV2(_x182, _x183, _x184, _x185, _x186, _x187, _x188) {
21802
22301
  return _removeLiquidityV.apply(this, arguments);
21803
22302
  }
21804
22303
 
@@ -21816,6 +22315,7 @@ var Pool = /*#__PURE__*/function () {
21816
22315
  * @param {BigNumber | string } collateralChangeAmount Collateral amount to add when shorting options and to remove when covering shorts
21817
22316
  * @param {boolean} isCoveredCall Selling covered call options
21818
22317
  * @param {any} options Transaction options
22318
+ * @param {boolean} estimateGas Simulate/estimate gas
21819
22319
  * @returns {Promise<any>} Transaction
21820
22320
  */
21821
22321
  ;
@@ -21823,7 +22323,7 @@ var Pool = /*#__PURE__*/function () {
21823
22323
  _proto.tradeLyraOption =
21824
22324
  /*#__PURE__*/
21825
22325
  function () {
21826
- 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) {
21827
22327
  var swapxData, tx;
21828
22328
  return runtime_1.wrap(function _callee38$(_context38) {
21829
22329
  while (1) {
@@ -21841,19 +22341,23 @@ var Pool = /*#__PURE__*/function () {
21841
22341
  options = null;
21842
22342
  }
21843
22343
 
21844
- _context38.next = 5;
22344
+ if (estimateGas === void 0) {
22345
+ estimateGas = false;
22346
+ }
22347
+
22348
+ _context38.next = 6;
21845
22349
  return getLyraOptionTxData(this, market, optionType, expiry, strike, tradeType, optionAmount, assetIn, BigNumber.from(collateralChangeAmount), isCoveredCall);
21846
22350
 
21847
- case 5:
22351
+ case 6:
21848
22352
  swapxData = _context38.sent;
21849
- _context38.next = 8;
21850
- 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);
21851
22355
 
21852
- case 8:
22356
+ case 9:
21853
22357
  tx = _context38.sent;
21854
22358
  return _context38.abrupt("return", tx);
21855
22359
 
21856
- case 10:
22360
+ case 11:
21857
22361
  case "end":
21858
22362
  return _context38.stop();
21859
22363
  }
@@ -21861,7 +22365,7 @@ var Pool = /*#__PURE__*/function () {
21861
22365
  }, _callee38, this);
21862
22366
  }));
21863
22367
 
21864
- 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) {
21865
22369
  return _tradeLyraOption.apply(this, arguments);
21866
22370
  }
21867
22371
 
@@ -21895,7 +22399,7 @@ var Pool = /*#__PURE__*/function () {
21895
22399
  }, _callee39, this);
21896
22400
  }));
21897
22401
 
21898
- function getLyraPositions(_x168) {
22402
+ function getLyraPositions(_x200) {
21899
22403
  return _getLyraPositions.apply(this, arguments);
21900
22404
  }
21901
22405
 
@@ -21906,6 +22410,7 @@ var Pool = /*#__PURE__*/function () {
21906
22410
  * @param {string} market Address of futures market
21907
22411
  * @param {BigNumber | string } changeAmount Amount to increase/decrease margin
21908
22412
  * @param {any} options Transaction options
22413
+ * @param {boolean} estimateGas Simulate/estimate gas
21909
22414
  * @returns {Promise<any>} Transaction
21910
22415
  */
21911
22416
  ;
@@ -21913,7 +22418,7 @@ var Pool = /*#__PURE__*/function () {
21913
22418
  _proto.changeFuturesMargin =
21914
22419
  /*#__PURE__*/
21915
22420
  function () {
21916
- 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) {
21917
22422
  var tx;
21918
22423
  return runtime_1.wrap(function _callee40$(_context40) {
21919
22424
  while (1) {
@@ -21923,14 +22428,18 @@ var Pool = /*#__PURE__*/function () {
21923
22428
  options = null;
21924
22429
  }
21925
22430
 
21926
- _context40.next = 3;
21927
- return this.poolLogic.execTransaction(market, getFuturesChangeMarginTxData(changeAmount), options);
22431
+ if (estimateGas === void 0) {
22432
+ estimateGas = false;
22433
+ }
21928
22434
 
21929
- case 3:
22435
+ _context40.next = 4;
22436
+ return getPoolTxOrGasEstimate(this, [market, getFuturesChangeMarginTxData(changeAmount), options], estimateGas);
22437
+
22438
+ case 4:
21930
22439
  tx = _context40.sent;
21931
22440
  return _context40.abrupt("return", tx);
21932
22441
 
21933
- case 5:
22442
+ case 6:
21934
22443
  case "end":
21935
22444
  return _context40.stop();
21936
22445
  }
@@ -21938,7 +22447,7 @@ var Pool = /*#__PURE__*/function () {
21938
22447
  }, _callee40, this);
21939
22448
  }));
21940
22449
 
21941
- function changeFuturesMargin(_x169, _x170, _x171) {
22450
+ function changeFuturesMargin(_x201, _x202, _x203, _x204) {
21942
22451
  return _changeFuturesMargin.apply(this, arguments);
21943
22452
  }
21944
22453
 
@@ -21949,6 +22458,7 @@ var Pool = /*#__PURE__*/function () {
21949
22458
  * @param {string} market Address of futures market
21950
22459
  * @param {BigNumber | string } changeAmount Negative for short, positive for long
21951
22460
  * @param {any} options Transaction options
22461
+ * @param {boolean} estimateGas Simulate/estimate gas
21952
22462
  * @returns {Promise<any>} Transaction
21953
22463
  */
21954
22464
  ;
@@ -21956,7 +22466,7 @@ var Pool = /*#__PURE__*/function () {
21956
22466
  _proto.changeFuturesPosition =
21957
22467
  /*#__PURE__*/
21958
22468
  function () {
21959
- 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) {
21960
22470
  var txData, tx;
21961
22471
  return runtime_1.wrap(function _callee41$(_context41) {
21962
22472
  while (1) {
@@ -21966,19 +22476,23 @@ var Pool = /*#__PURE__*/function () {
21966
22476
  options = null;
21967
22477
  }
21968
22478
 
21969
- _context41.next = 3;
22479
+ if (estimateGas === void 0) {
22480
+ estimateGas = false;
22481
+ }
22482
+
22483
+ _context41.next = 4;
21970
22484
  return getFuturesChangePositionTxData(changeAmount, market, this);
21971
22485
 
21972
- case 3:
22486
+ case 4:
21973
22487
  txData = _context41.sent;
21974
- _context41.next = 6;
21975
- return this.poolLogic.execTransaction(market, txData, options);
22488
+ _context41.next = 7;
22489
+ return getPoolTxOrGasEstimate(this, [market, txData, options], estimateGas);
21976
22490
 
21977
- case 6:
22491
+ case 7:
21978
22492
  tx = _context41.sent;
21979
22493
  return _context41.abrupt("return", tx);
21980
22494
 
21981
- case 8:
22495
+ case 9:
21982
22496
  case "end":
21983
22497
  return _context41.stop();
21984
22498
  }
@@ -21986,7 +22500,7 @@ var Pool = /*#__PURE__*/function () {
21986
22500
  }, _callee41, this);
21987
22501
  }));
21988
22502
 
21989
- function changeFuturesPosition(_x172, _x173, _x174) {
22503
+ function changeFuturesPosition(_x205, _x206, _x207, _x208) {
21990
22504
  return _changeFuturesPosition.apply(this, arguments);
21991
22505
  }
21992
22506
 
@@ -21996,6 +22510,7 @@ var Pool = /*#__PURE__*/function () {
21996
22510
  *
21997
22511
  * @param {string} market Address of futures market
21998
22512
  * @param {any} options Transaction options
22513
+ * @param {boolean} estimateGas Simulate/estimate gas
21999
22514
  * @returns {Promise<any>} Transaction
22000
22515
  */
22001
22516
  ;
@@ -22003,7 +22518,7 @@ var Pool = /*#__PURE__*/function () {
22003
22518
  _proto.cancelFuturesOrder =
22004
22519
  /*#__PURE__*/
22005
22520
  function () {
22006
- 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) {
22007
22522
  var txData, tx;
22008
22523
  return runtime_1.wrap(function _callee42$(_context42) {
22009
22524
  while (1) {
@@ -22013,19 +22528,23 @@ var Pool = /*#__PURE__*/function () {
22013
22528
  options = null;
22014
22529
  }
22015
22530
 
22016
- _context42.next = 3;
22531
+ if (estimateGas === void 0) {
22532
+ estimateGas = false;
22533
+ }
22534
+
22535
+ _context42.next = 4;
22017
22536
  return getFuturesCancelOrderTxData(this);
22018
22537
 
22019
- case 3:
22538
+ case 4:
22020
22539
  txData = _context42.sent;
22021
- _context42.next = 6;
22022
- return this.poolLogic.execTransaction(market, txData, options);
22540
+ _context42.next = 7;
22541
+ return getPoolTxOrGasEstimate(this, [market, txData, options], estimateGas);
22023
22542
 
22024
- case 6:
22543
+ case 7:
22025
22544
  tx = _context42.sent;
22026
22545
  return _context42.abrupt("return", tx);
22027
22546
 
22028
- case 8:
22547
+ case 9:
22029
22548
  case "end":
22030
22549
  return _context42.stop();
22031
22550
  }
@@ -22033,7 +22552,7 @@ var Pool = /*#__PURE__*/function () {
22033
22552
  }, _callee42, this);
22034
22553
  }));
22035
22554
 
22036
- function cancelFuturesOrder(_x175, _x176) {
22555
+ function cancelFuturesOrder(_x209, _x210, _x211) {
22037
22556
  return _cancelFuturesOrder.apply(this, arguments);
22038
22557
  }
22039
22558
 
@@ -22074,7 +22593,7 @@ var Pool = /*#__PURE__*/function () {
22074
22593
  }, _callee43, this);
22075
22594
  }));
22076
22595
 
22077
- function mintManagerFee(_x177) {
22596
+ function mintManagerFee(_x212) {
22078
22597
  return _mintManagerFee.apply(this, arguments);
22079
22598
  }
22080
22599
 
@@ -22121,6 +22640,7 @@ var Pool = /*#__PURE__*/function () {
22121
22640
  * @param {string} tokenAddress Address of the token to vest
22122
22641
  * @param {BigNumber | string } changeAmount Negative for short, positive for long
22123
22642
  * @param {any} options Transaction options
22643
+ * @param {boolean} estimateGas Simulate/estimate gas
22124
22644
  * @returns {Promise<any>} Transaction
22125
22645
  */
22126
22646
  ;
@@ -22128,7 +22648,7 @@ var Pool = /*#__PURE__*/function () {
22128
22648
  _proto.vestTokens =
22129
22649
  /*#__PURE__*/
22130
22650
  function () {
22131
- 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) {
22132
22652
  var txData, tx;
22133
22653
  return runtime_1.wrap(function _callee45$(_context45) {
22134
22654
  while (1) {
@@ -22138,19 +22658,23 @@ var Pool = /*#__PURE__*/function () {
22138
22658
  options = null;
22139
22659
  }
22140
22660
 
22141
- _context45.next = 3;
22661
+ if (estimateGas === void 0) {
22662
+ estimateGas = false;
22663
+ }
22664
+
22665
+ _context45.next = 4;
22142
22666
  return getCreateVestTxData(amount);
22143
22667
 
22144
- case 3:
22668
+ case 4:
22145
22669
  txData = _context45.sent;
22146
- _context45.next = 6;
22147
- return this.poolLogic.execTransaction(tokenAddress, txData, options);
22670
+ _context45.next = 7;
22671
+ return getPoolTxOrGasEstimate(this, [tokenAddress, txData, options], estimateGas);
22148
22672
 
22149
- case 6:
22673
+ case 7:
22150
22674
  tx = _context45.sent;
22151
22675
  return _context45.abrupt("return", tx);
22152
22676
 
22153
- case 8:
22677
+ case 9:
22154
22678
  case "end":
22155
22679
  return _context45.stop();
22156
22680
  }
@@ -22158,7 +22682,7 @@ var Pool = /*#__PURE__*/function () {
22158
22682
  }, _callee45, this);
22159
22683
  }));
22160
22684
 
22161
- function vestTokens(_x178, _x179, _x180) {
22685
+ function vestTokens(_x213, _x214, _x215, _x216) {
22162
22686
  return _vestTokens.apply(this, arguments);
22163
22687
  }
22164
22688
 
@@ -22169,6 +22693,7 @@ var Pool = /*#__PURE__*/function () {
22169
22693
  * @param {string} tokenAddress Address of the token to vest
22170
22694
  * @param {number } id position Id of the vested tokens
22171
22695
  * @param {any} options Transaction options
22696
+ * @param {boolean} estimateGas Simulate/estimate gas
22172
22697
  * @returns {Promise<any>} Transaction
22173
22698
  */
22174
22699
  ;
@@ -22176,7 +22701,7 @@ var Pool = /*#__PURE__*/function () {
22176
22701
  _proto.exitVestedToken =
22177
22702
  /*#__PURE__*/
22178
22703
  function () {
22179
- 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) {
22180
22705
  var txData, tx;
22181
22706
  return runtime_1.wrap(function _callee46$(_context46) {
22182
22707
  while (1) {
@@ -22186,19 +22711,23 @@ var Pool = /*#__PURE__*/function () {
22186
22711
  options = null;
22187
22712
  }
22188
22713
 
22189
- _context46.next = 3;
22714
+ if (estimateGas === void 0) {
22715
+ estimateGas = false;
22716
+ }
22717
+
22718
+ _context46.next = 4;
22190
22719
  return getExitVestTxData(id);
22191
22720
 
22192
- case 3:
22721
+ case 4:
22193
22722
  txData = _context46.sent;
22194
- _context46.next = 6;
22195
- return this.poolLogic.execTransaction(tokenAddress, txData, options);
22723
+ _context46.next = 7;
22724
+ return getPoolTxOrGasEstimate(this, [tokenAddress, txData, options], estimateGas);
22196
22725
 
22197
- case 6:
22726
+ case 7:
22198
22727
  tx = _context46.sent;
22199
22728
  return _context46.abrupt("return", tx);
22200
22729
 
22201
- case 8:
22730
+ case 9:
22202
22731
  case "end":
22203
22732
  return _context46.stop();
22204
22733
  }
@@ -22206,7 +22735,7 @@ var Pool = /*#__PURE__*/function () {
22206
22735
  }, _callee46, this);
22207
22736
  }));
22208
22737
 
22209
- function exitVestedToken(_x181, _x182, _x183) {
22738
+ function exitVestedToken(_x217, _x218, _x219, _x220) {
22210
22739
  return _exitVestedToken.apply(this, arguments);
22211
22740
  }
22212
22741