@dhedge/v2-sdk 1.9.5 → 1.9.7

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.
@@ -2381,7 +2381,7 @@ var abi$1 = [
2381
2381
  },
2382
2382
  {
2383
2383
  internalType: "bool",
2384
- name: "withdrawProcessed",
2384
+ name: "externalWithdrawProcessed",
2385
2385
  type: "bool"
2386
2386
  }
2387
2387
  ],
@@ -2455,7 +2455,7 @@ var abi$1 = [
2455
2455
  outputs: [
2456
2456
  {
2457
2457
  internalType: "uint256",
2458
- name: "",
2458
+ name: "fee",
2459
2459
  type: "uint256"
2460
2460
  }
2461
2461
  ],
@@ -2481,6 +2481,69 @@ var abi$1 = [
2481
2481
  stateMutability: "view",
2482
2482
  type: "function"
2483
2483
  },
2484
+ {
2485
+ inputs: [
2486
+ {
2487
+ internalType: "uint256",
2488
+ name: "fundValue",
2489
+ type: "uint256"
2490
+ }
2491
+ ],
2492
+ name: "calculateAvailableManagerFee",
2493
+ outputs: [
2494
+ {
2495
+ internalType: "uint256",
2496
+ name: "fee",
2497
+ type: "uint256"
2498
+ }
2499
+ ],
2500
+ stateMutability: "view",
2501
+ type: "function"
2502
+ },
2503
+ {
2504
+ inputs: [
2505
+ {
2506
+ internalType: "uint256",
2507
+ name: "currentBalance",
2508
+ type: "uint256"
2509
+ },
2510
+ {
2511
+ internalType: "uint256",
2512
+ name: "liquidityMinted",
2513
+ type: "uint256"
2514
+ },
2515
+ {
2516
+ internalType: "uint256",
2517
+ name: "newCooldown",
2518
+ type: "uint256"
2519
+ },
2520
+ {
2521
+ internalType: "uint256",
2522
+ name: "lastCooldown",
2523
+ type: "uint256"
2524
+ },
2525
+ {
2526
+ internalType: "uint256",
2527
+ name: "lastDepositTime",
2528
+ type: "uint256"
2529
+ },
2530
+ {
2531
+ internalType: "uint256",
2532
+ name: "blockTimestamp",
2533
+ type: "uint256"
2534
+ }
2535
+ ],
2536
+ name: "calculateCooldown",
2537
+ outputs: [
2538
+ {
2539
+ internalType: "uint256",
2540
+ name: "cooldown",
2541
+ type: "uint256"
2542
+ }
2543
+ ],
2544
+ stateMutability: "pure",
2545
+ type: "function"
2546
+ },
2484
2547
  {
2485
2548
  inputs: [
2486
2549
  ],
@@ -2564,7 +2627,70 @@ var abi$1 = [
2564
2627
  outputs: [
2565
2628
  {
2566
2629
  internalType: "uint256",
2567
- name: "",
2630
+ name: "liquidityMinted",
2631
+ type: "uint256"
2632
+ }
2633
+ ],
2634
+ stateMutability: "nonpayable",
2635
+ type: "function"
2636
+ },
2637
+ {
2638
+ inputs: [
2639
+ {
2640
+ internalType: "address",
2641
+ name: "_recipient",
2642
+ type: "address"
2643
+ },
2644
+ {
2645
+ internalType: "address",
2646
+ name: "_asset",
2647
+ type: "address"
2648
+ },
2649
+ {
2650
+ internalType: "uint256",
2651
+ name: "_amount",
2652
+ type: "uint256"
2653
+ }
2654
+ ],
2655
+ name: "depositFor",
2656
+ outputs: [
2657
+ {
2658
+ internalType: "uint256",
2659
+ name: "liquidityMinted",
2660
+ type: "uint256"
2661
+ }
2662
+ ],
2663
+ stateMutability: "nonpayable",
2664
+ type: "function"
2665
+ },
2666
+ {
2667
+ inputs: [
2668
+ {
2669
+ internalType: "address",
2670
+ name: "_recipient",
2671
+ type: "address"
2672
+ },
2673
+ {
2674
+ internalType: "address",
2675
+ name: "_asset",
2676
+ type: "address"
2677
+ },
2678
+ {
2679
+ internalType: "uint256",
2680
+ name: "_amount",
2681
+ type: "uint256"
2682
+ },
2683
+ {
2684
+ internalType: "uint256",
2685
+ name: "_cooldown",
2686
+ type: "uint256"
2687
+ }
2688
+ ],
2689
+ name: "depositForWithCustomCooldown",
2690
+ outputs: [
2691
+ {
2692
+ internalType: "uint256",
2693
+ name: "liquidityMinted",
2568
2694
  type: "uint256"
2569
2695
  }
2570
2696
  ],
@@ -2595,6 +2721,37 @@ var abi$1 = [
2595
2721
  stateMutability: "nonpayable",
2596
2722
  type: "function"
2597
2723
  },
2724
+ {
2725
+ inputs: [
2726
+ {
2727
+ components: [
2728
+ {
2729
+ internalType: "address",
2730
+ name: "to",
2731
+ type: "address"
2732
+ },
2733
+ {
2734
+ internalType: "bytes",
2735
+ name: "data",
2736
+ type: "bytes"
2737
+ }
2738
+ ],
2739
+ internalType: "struct PoolLogic.TxToExecute[]",
2740
+ name: "txs",
2741
+ type: "tuple[]"
2742
+ }
2743
+ ],
2744
+ name: "execTransactions",
2745
+ outputs: [
2746
+ {
2747
+ internalType: "bool",
2748
+ name: "success",
2749
+ type: "bool"
2750
+ }
2751
+ ],
2752
+ stateMutability: "nonpayable",
2753
+ type: "function"
2754
+ },
2598
2755
  {
2599
2756
  inputs: [
2600
2757
  {
@@ -2627,7 +2784,7 @@ var abi$1 = [
2627
2784
  outputs: [
2628
2785
  {
2629
2786
  internalType: "bool",
2630
- name: "",
2787
+ name: "success",
2631
2788
  type: "bool"
2632
2789
  }
2633
2790
  ],
@@ -2648,20 +2805,6 @@ var abi$1 = [
2648
2805
  stateMutability: "view",
2649
2806
  type: "function"
2650
2807
  },
2651
- {
2652
- inputs: [
2653
- ],
2654
- name: "getExitCooldown",
2655
- outputs: [
2656
- {
2657
- internalType: "uint256",
2658
- name: "",
2659
- type: "uint256"
2660
- }
2661
- ],
2662
- stateMutability: "view",
2663
- type: "function"
2664
- },
2665
2808
  {
2666
2809
  inputs: [
2667
2810
  {
@@ -2674,7 +2817,7 @@ var abi$1 = [
2674
2817
  outputs: [
2675
2818
  {
2676
2819
  internalType: "uint256",
2677
- name: "",
2820
+ name: "remaining",
2678
2821
  type: "uint256"
2679
2822
  }
2680
2823
  ],
@@ -2687,49 +2830,76 @@ var abi$1 = [
2687
2830
  name: "getFundSummary",
2688
2831
  outputs: [
2689
2832
  {
2690
- internalType: "string",
2691
- name: "",
2692
- type: "string"
2693
- },
2694
- {
2695
- internalType: "uint256",
2696
- name: "",
2697
- type: "uint256"
2698
- },
2699
- {
2700
- internalType: "uint256",
2701
- name: "",
2702
- type: "uint256"
2703
- },
2704
- {
2705
- internalType: "address",
2706
- name: "",
2707
- type: "address"
2708
- },
2709
- {
2710
- internalType: "string",
2711
- name: "",
2712
- type: "string"
2713
- },
2714
- {
2715
- internalType: "uint256",
2716
- name: "",
2717
- type: "uint256"
2718
- },
2719
- {
2720
- internalType: "bool",
2721
- name: "",
2722
- type: "bool"
2723
- },
2724
- {
2725
- internalType: "uint256",
2726
- name: "",
2727
- type: "uint256"
2728
- },
2729
- {
2730
- internalType: "uint256",
2833
+ components: [
2834
+ {
2835
+ internalType: "string",
2836
+ name: "name",
2837
+ type: "string"
2838
+ },
2839
+ {
2840
+ internalType: "uint256",
2841
+ name: "totalSupply",
2842
+ type: "uint256"
2843
+ },
2844
+ {
2845
+ internalType: "uint256",
2846
+ name: "totalFundValue",
2847
+ type: "uint256"
2848
+ },
2849
+ {
2850
+ internalType: "address",
2851
+ name: "manager",
2852
+ type: "address"
2853
+ },
2854
+ {
2855
+ internalType: "string",
2856
+ name: "managerName",
2857
+ type: "string"
2858
+ },
2859
+ {
2860
+ internalType: "uint256",
2861
+ name: "creationTime",
2862
+ type: "uint256"
2863
+ },
2864
+ {
2865
+ internalType: "bool",
2866
+ name: "privatePool",
2867
+ type: "bool"
2868
+ },
2869
+ {
2870
+ internalType: "uint256",
2871
+ name: "performanceFeeNumerator",
2872
+ type: "uint256"
2873
+ },
2874
+ {
2875
+ internalType: "uint256",
2876
+ name: "managerFeeNumerator",
2877
+ type: "uint256"
2878
+ },
2879
+ {
2880
+ internalType: "uint256",
2881
+ name: "managerFeeDenominator",
2882
+ type: "uint256"
2883
+ },
2884
+ {
2885
+ internalType: "uint256",
2886
+ name: "exitFeeNumerator",
2887
+ type: "uint256"
2888
+ },
2889
+ {
2890
+ internalType: "uint256",
2891
+ name: "exitFeeDenominator",
2892
+ type: "uint256"
2893
+ },
2894
+ {
2895
+ internalType: "uint256",
2896
+ name: "entryFeeNumerator",
2897
+ type: "uint256"
2898
+ }
2899
+ ],
2900
+ internalType: "struct PoolLogic.FundSummary",
2731
2901
  name: "",
2732
- type: "uint256"
2902
+ type: "tuple"
2733
2903
  }
2734
2904
  ],
2735
2905
  stateMutability: "view",
@@ -2785,23 +2955,75 @@ var abi$1 = [
2785
2955
  name: "initialize",
2786
2956
  outputs: [
2787
2957
  ],
2788
- stateMutability: "nonpayable",
2958
+ stateMutability: "nonpayable",
2959
+ type: "function"
2960
+ },
2961
+ {
2962
+ inputs: [
2963
+ {
2964
+ internalType: "address",
2965
+ name: "member",
2966
+ type: "address"
2967
+ }
2968
+ ],
2969
+ name: "isMemberAllowed",
2970
+ outputs: [
2971
+ {
2972
+ internalType: "bool",
2973
+ name: "",
2974
+ type: "bool"
2975
+ }
2976
+ ],
2977
+ stateMutability: "view",
2978
+ type: "function"
2979
+ },
2980
+ {
2981
+ inputs: [
2982
+ {
2983
+ internalType: "address",
2984
+ name: "",
2985
+ type: "address"
2986
+ }
2987
+ ],
2988
+ name: "lastDeposit",
2989
+ outputs: [
2990
+ {
2991
+ internalType: "uint256",
2992
+ name: "",
2993
+ type: "uint256"
2994
+ }
2995
+ ],
2996
+ stateMutability: "view",
2997
+ type: "function"
2998
+ },
2999
+ {
3000
+ inputs: [
3001
+ {
3002
+ internalType: "address",
3003
+ name: "",
3004
+ type: "address"
3005
+ }
3006
+ ],
3007
+ name: "lastExitCooldown",
3008
+ outputs: [
3009
+ {
3010
+ internalType: "uint256",
3011
+ name: "",
3012
+ type: "uint256"
3013
+ }
3014
+ ],
3015
+ stateMutability: "view",
2789
3016
  type: "function"
2790
3017
  },
2791
3018
  {
2792
3019
  inputs: [
2793
- {
2794
- internalType: "address",
2795
- name: "member",
2796
- type: "address"
2797
- }
2798
3020
  ],
2799
- name: "isMemberAllowed",
3021
+ name: "lastFeeMintTime",
2800
3022
  outputs: [
2801
3023
  {
2802
- internalType: "bool",
3024
+ internalType: "uint256",
2803
3025
  name: "",
2804
- type: "bool"
3026
+ type: "uint256"
2805
3027
  }
2806
3028
  ],
2807
3029
  stateMutability: "view",
@@ -2815,7 +3037,7 @@ var abi$1 = [
2815
3037
  type: "address"
2816
3038
  }
2817
3039
  ],
2818
- name: "lastDeposit",
3040
+ name: "lastWhitelistTransfer",
2819
3041
  outputs: [
2820
3042
  {
2821
3043
  internalType: "uint256",
@@ -2833,7 +3055,7 @@ var abi$1 = [
2833
3055
  outputs: [
2834
3056
  {
2835
3057
  internalType: "string",
2836
- name: "",
3058
+ name: "_managerName",
2837
3059
  type: "string"
2838
3060
  }
2839
3061
  ],
@@ -2863,6 +3085,40 @@ var abi$1 = [
2863
3085
  stateMutability: "view",
2864
3086
  type: "function"
2865
3087
  },
3088
+ {
3089
+ inputs: [
3090
+ {
3091
+ internalType: "address",
3092
+ name: "operator",
3093
+ type: "address"
3094
+ },
3095
+ {
3096
+ internalType: "address",
3097
+ name: "from",
3098
+ type: "address"
3099
+ },
3100
+ {
3101
+ internalType: "uint256",
3102
+ name: "tokenId",
3103
+ type: "uint256"
3104
+ },
3105
+ {
3106
+ internalType: "bytes",
3107
+ name: "data",
3108
+ type: "bytes"
3109
+ }
3110
+ ],
3111
+ name: "onERC721Received",
3112
+ outputs: [
3113
+ {
3114
+ internalType: "bytes4",
3115
+ name: "magicSelector",
3116
+ type: "bytes4"
3117
+ }
3118
+ ],
3119
+ stateMutability: "nonpayable",
3120
+ type: "function"
3121
+ },
2866
3122
  {
2867
3123
  inputs: [
2868
3124
  ],
@@ -2945,7 +3201,7 @@ var abi$1 = [
2945
3201
  outputs: [
2946
3202
  {
2947
3203
  internalType: "uint256",
2948
- name: "",
3204
+ name: "price",
2949
3205
  type: "uint256"
2950
3206
  }
2951
3207
  ],
@@ -2966,6 +3222,20 @@ var abi$1 = [
2966
3222
  stateMutability: "view",
2967
3223
  type: "function"
2968
3224
  },
3225
+ {
3226
+ inputs: [
3227
+ ],
3228
+ name: "tokenPriceWithoutManagerFee",
3229
+ outputs: [
3230
+ {
3231
+ internalType: "uint256",
3232
+ name: "price",
3233
+ type: "uint256"
3234
+ }
3235
+ ],
3236
+ stateMutability: "view",
3237
+ type: "function"
3238
+ },
2969
3239
  {
2970
3240
  inputs: [
2971
3241
  ],
@@ -3046,6 +3316,25 @@ var abi$1 = [
3046
3316
  ],
3047
3317
  stateMutability: "nonpayable",
3048
3318
  type: "function"
3319
+ },
3320
+ {
3321
+ inputs: [
3322
+ {
3323
+ internalType: "address",
3324
+ name: "_recipient",
3325
+ type: "address"
3326
+ },
3327
+ {
3328
+ internalType: "uint256",
3329
+ name: "_fundTokenAmount",
3330
+ type: "uint256"
3331
+ }
3332
+ ],
3333
+ name: "withdrawTo",
3334
+ outputs: [
3335
+ ],
3336
+ stateMutability: "nonpayable",
3337
+ type: "function"
3049
3338
  }
3050
3339
  ];
3051
3340
  var PoolLogic = {
@@ -3955,7 +4244,7 @@ var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _Network$ARBITRUM, _Ne
3955
4244
  require("dotenv").config();
3956
4245
 
3957
4246
  var factoryAddress = (_factoryAddress = {}, _factoryAddress[exports.Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress[exports.Network.OPTIMISM] = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", _factoryAddress[exports.Network.ARBITRUM] = "0xfffb5fb14606eb3a548c113026355020ddf27535", _factoryAddress[exports.Network.BASE] = "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F", _factoryAddress);
3958
- var routerAddress = (_routerAddress = {}, _routerAddress[exports.Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[exports.Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[exports.Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[exports.Dapp.ARRAKIS] = "0xc73fb100a995b33f9fa181d420f4c8d74506df66", _Network$POLYGON[exports.Dapp.TOROS] = "0xB2F1498983bf9c9442c35F772e6C1AdE66a8DeDE", _Network$POLYGON[exports.Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$POLYGON), _routerAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[exports.Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$OPTIMISM[exports.Dapp.TOROS] = "0x3988513793bCE39f0167064A9F7fC3617FaF35AB", _Network$OPTIMISM[exports.Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[exports.Dapp.VELODROMEV2] = "0xa062ae8a9c5e11aaa026fc2670b0d65ccc8b2858", _Network$OPTIMISM[exports.Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM[exports.Dapp.ARRAKIS] = "0x9ce88a56d120300061593eF7AD074A1B710094d5", _Network$OPTIMISM[exports.Dapp.ZEROEX] = "0xdef1abe32c034e558cdd535791643c58a13acc10", _Network$OPTIMISM), _routerAddress[exports.Network.ARBITRUM] = (_Network$ARBITRUM = {}, _Network$ARBITRUM[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$ARBITRUM[exports.Dapp.UNISWAPV3] = "0xe592427a0aece92de3edee1f18e0157c05861564", _Network$ARBITRUM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM[exports.Dapp.RAMSES] = "0xaaa87963efeb6f7e0a2711f397663105acb1805e", _Network$ARBITRUM), _routerAddress[exports.Network.BASE] = (_Network$BASE = {}, _Network$BASE[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$BASE[exports.Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$BASE), _routerAddress);
4247
+ var routerAddress = (_routerAddress = {}, _routerAddress[exports.Network.POLYGON] = (_Network$POLYGON = {}, _Network$POLYGON[exports.Dapp.SUSHISWAP] = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", _Network$POLYGON[exports.Dapp.AAVE] = "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf", _Network$POLYGON[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$POLYGON[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[exports.Dapp.ARRAKIS] = "0xc73fb100a995b33f9fa181d420f4c8d74506df66", _Network$POLYGON[exports.Dapp.TOROS] = "0xB2F1498983bf9c9442c35F772e6C1AdE66a8DeDE", _Network$POLYGON[exports.Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$POLYGON), _routerAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[exports.Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$OPTIMISM[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$OPTIMISM[exports.Dapp.TOROS] = "0x3988513793bCE39f0167064A9F7fC3617FaF35AB", _Network$OPTIMISM[exports.Dapp.VELODROME] = "0x9c12939390052919aF3155f41Bf4160Fd3666A6f", _Network$OPTIMISM[exports.Dapp.VELODROMEV2] = "0xa062ae8a9c5e11aaa026fc2670b0d65ccc8b2858", _Network$OPTIMISM[exports.Dapp.LYRA] = "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B", _Network$OPTIMISM[exports.Dapp.ARRAKIS] = "0x9ce88a56d120300061593eF7AD074A1B710094d5", _Network$OPTIMISM[exports.Dapp.ZEROEX] = "0xdef1abe32c034e558cdd535791643c58a13acc10", _Network$OPTIMISM), _routerAddress[exports.Network.ARBITRUM] = (_Network$ARBITRUM = {}, _Network$ARBITRUM[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$ARBITRUM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$ARBITRUM[exports.Dapp.AAVEV3] = "0x794a61358D6845594F94dc1DB02A252b5b4814aD", _Network$ARBITRUM[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$ARBITRUM[exports.Dapp.RAMSES] = "0xaaa87963efeb6f7e0a2711f397663105acb1805e", _Network$ARBITRUM), _routerAddress[exports.Network.BASE] = (_Network$BASE = {}, _Network$BASE[exports.Dapp.ONEINCH] = "0x1111111254EEB25477B68fb85Ed929f73A960582", _Network$BASE[exports.Dapp.ZEROEX] = "0xdef1c0ded9bec7f1a1670819833240f027b25eff", _Network$BASE), _routerAddress);
3959
4248
  var dappFactoryAddress = (_dappFactoryAddress = {}, _dappFactoryAddress[exports.Network.POLYGON] = (_Network$POLYGON2 = {}, _Network$POLYGON2[exports.Dapp.SUSHISWAP] = "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", _Network$POLYGON2[exports.Dapp.QUICKSWAP] = "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32", _Network$POLYGON2), _dappFactoryAddress[exports.Network.OPTIMISM] = {}, _dappFactoryAddress[exports.Network.ARBITRUM] = {}, _dappFactoryAddress[exports.Network.BASE] = {}, _dappFactoryAddress);
3960
4249
  var stakingAddress = (_stakingAddress = {}, _stakingAddress[exports.Network.POLYGON] = (_Network$POLYGON3 = {}, _Network$POLYGON3[exports.Dapp.SUSHISWAP] = "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F", _Network$POLYGON3[exports.Dapp.BALANCER] = "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", _Network$POLYGON3[exports.Dapp.AAVE] = "0x357D51124f59836DeD84c8a1730D72B749d8BC23", _Network$POLYGON3[exports.Dapp.AAVEV3] = "0x929EC64c34a17401F460460D4B9390518E5B473e", _Network$POLYGON3), _stakingAddress[exports.Network.OPTIMISM] = {}, _stakingAddress[exports.Network.ARBITRUM] = {}, _stakingAddress[exports.Network.BASE] = {}, _stakingAddress);
3961
4250
  var aaveAddressProvider = (_aaveAddressProvider = {}, _aaveAddressProvider[exports.Network.POLYGON] = (_Network$POLYGON4 = {}, _Network$POLYGON4[exports.Dapp.AAVE] = "0xd05e3E715d945B59290df0ae8eF85c1BdB684744", _Network$POLYGON4[exports.Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$POLYGON4), _aaveAddressProvider[exports.Network.OPTIMISM] = (_Network$OPTIMISM2 = {}, _Network$OPTIMISM2[exports.Dapp.AAVEV3] = "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb", _Network$OPTIMISM2), _aaveAddressProvider[exports.Network.ARBITRUM] = (_Network$ARBITRUM2 = {}, _Network$ARBITRUM2[exports.Dapp.AAVEV3] = "0xa97684ead0e402dc232d5a977953df7ecbab3cdb", _Network$ARBITRUM2), _aaveAddressProvider[exports.Network.BASE] = (_Network$BASE2 = {}, _Network$BASE2[exports.Dapp.AAVEV3] = "0xe20fCBdBfFC4Dd138cE8b2E6FBb6CB49777ad64D", _Network$BASE2), _aaveAddressProvider);
@@ -14815,35 +15104,71 @@ function call(_x, _x2, _x3, _x4) {
14815
15104
  }
14816
15105
 
14817
15106
  function _call() {
14818
- _call = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(provider, abi, call, options) {
15107
+ _call = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(provider, abi, call, options) {
14819
15108
  var contract, params;
14820
- return runtime_1.wrap(function _callee2$(_context2) {
15109
+ return runtime_1.wrap(function _callee3$(_context3) {
14821
15110
  while (1) {
14822
- switch (_context2.prev = _context2.next) {
15111
+ switch (_context3.prev = _context3.next) {
14823
15112
  case 0:
14824
15113
  contract = new ethers.ethers.Contract(call[0], abi, provider);
14825
- _context2.prev = 1;
15114
+ _context3.prev = 1;
14826
15115
  params = call[2] || [];
14827
- _context2.next = 5;
15116
+ _context3.next = 5;
14828
15117
  return contract[call[1]].apply(contract, params.concat([options || {}]));
14829
15118
 
14830
15119
  case 5:
14831
- return _context2.abrupt("return", _context2.sent);
15120
+ return _context3.abrupt("return", _context3.sent);
14832
15121
 
14833
15122
  case 8:
14834
- _context2.prev = 8;
14835
- _context2.t0 = _context2["catch"](1);
14836
- return _context2.abrupt("return", Promise.reject(_context2.t0));
15123
+ _context3.prev = 8;
15124
+ _context3.t0 = _context3["catch"](1);
15125
+ return _context3.abrupt("return", Promise.reject(_context3.t0));
14837
15126
 
14838
15127
  case 11:
14839
15128
  case "end":
14840
- return _context2.stop();
15129
+ return _context3.stop();
14841
15130
  }
14842
15131
  }
14843
- }, _callee2, null, [[1, 8]]);
15132
+ }, _callee3, null, [[1, 8]]);
14844
15133
  }));
14845
15134
  return _call.apply(this, arguments);
14846
15135
  }
15136
+ var getPoolTxOrGasEstimate = /*#__PURE__*/function () {
15137
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(pool, args, estimateGas) {
15138
+ return runtime_1.wrap(function _callee2$(_context2) {
15139
+ while (1) {
15140
+ switch (_context2.prev = _context2.next) {
15141
+ case 0:
15142
+ if (!estimateGas) {
15143
+ _context2.next = 6;
15144
+ break;
15145
+ }
15146
+
15147
+ _context2.next = 3;
15148
+ return pool.poolLogic.estimateGas.execTransaction(args[0], args[1], args[2]);
15149
+
15150
+ case 3:
15151
+ return _context2.abrupt("return", _context2.sent);
15152
+
15153
+ case 6:
15154
+ _context2.next = 8;
15155
+ return pool.poolLogic.execTransaction(args[0], args[1], args[2]);
15156
+
15157
+ case 8:
15158
+ return _context2.abrupt("return", _context2.sent);
15159
+
15160
+ case 9:
15161
+ case "end":
15162
+ return _context2.stop();
15163
+ }
15164
+ }
15165
+ }, _callee2);
15166
+ }));
15167
+
15168
+ return function getPoolTxOrGasEstimate(_x12, _x13, _x14) {
15169
+ return _ref.apply(this, arguments);
15170
+ };
15171
+ }();
14847
15172
 
14848
15173
  var iVelodromeGaugeV1 = /*#__PURE__*/new ethers.ethers.utils.Interface(IVelodromeGaugeV1.abi);
14849
15174
  var iVelodromeGaugeV2 = /*#__PURE__*/new ethers.ethers.utils.Interface(IVelodromeGaugeV2.abi);
@@ -19796,6 +20121,7 @@ var Pool = /*#__PURE__*/function () {
19796
20121
  * @param {string} nasset Address of deposit asset
19797
20122
  * @param {BigNumber | string} amount Amount to be approved
19798
20123
  * @param {any} options Transaction options
20124
+ * @param {boolean} estimateGas Simulate/estimate gas
19799
20125
  * @returns {Promise<any>} Transaction
19800
20126
  */
19801
20127
  ;
@@ -19803,7 +20129,7 @@ var Pool = /*#__PURE__*/function () {
19803
20129
  _proto.approveDeposit =
19804
20130
  /*#__PURE__*/
19805
20131
  function () {
19806
- var _approveDeposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(asset, amount, options) {
20132
+ var _approveDeposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(asset, amount, options, estimateGas) {
19807
20133
  var iERC20, tx;
19808
20134
  return runtime_1.wrap(function _callee2$(_context2) {
19809
20135
  while (1) {
@@ -19813,15 +20139,32 @@ var Pool = /*#__PURE__*/function () {
19813
20139
  options = null;
19814
20140
  }
19815
20141
 
20142
+ if (estimateGas === void 0) {
20143
+ estimateGas = false;
20144
+ }
20145
+
19816
20146
  iERC20 = new ethers.ethers.Contract(asset, IERC20.abi, this.signer);
19817
- _context2.next = 4;
20147
+
20148
+ if (!estimateGas) {
20149
+ _context2.next = 7;
20150
+ break;
20151
+ }
20152
+
20153
+ _context2.next = 6;
20154
+ return iERC20.estimateGas.approve(this.address, amount, options);
20155
+
20156
+ case 6:
20157
+ return _context2.abrupt("return", _context2.sent);
20158
+
20159
+ case 7:
20160
+ _context2.next = 9;
19818
20161
  return iERC20.approve(this.address, amount, options);
19819
20162
 
19820
- case 4:
20163
+ case 9:
19821
20164
  tx = _context2.sent;
19822
20165
  return _context2.abrupt("return", tx);
19823
20166
 
19824
- case 6:
20167
+ case 11:
19825
20168
  case "end":
19826
20169
  return _context2.stop();
19827
20170
  }
@@ -19829,7 +20172,7 @@ var Pool = /*#__PURE__*/function () {
19829
20172
  }, _callee2, this);
19830
20173
  }));
19831
20174
 
19832
- function approveDeposit(_x, _x2, _x3) {
20175
+ function approveDeposit(_x, _x2, _x3, _x4) {
19833
20176
  return _approveDeposit.apply(this, arguments);
19834
20177
  }
19835
20178
 
@@ -19840,6 +20183,7 @@ var Pool = /*#__PURE__*/function () {
19840
20183
  * @param {string} asset Address of asset
19841
20184
  * @param {BigNumber | string} amount Amount to be deposited
19842
20185
  * @param {any} options Transaction options
20186
+ * @param {boolean} estimateGas Simulate/estimate gas
19843
20187
  * @returns {Promise<any>} Transaction
19844
20188
  */
19845
20189
  ;
@@ -19847,7 +20191,7 @@ var Pool = /*#__PURE__*/function () {
19847
20191
  _proto.deposit =
19848
20192
  /*#__PURE__*/
19849
20193
  function () {
19850
- var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(asset, amount, options) {
20194
+ var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(asset, amount, options, estimateGas) {
19851
20195
  var tx;
19852
20196
  return runtime_1.wrap(function _callee3$(_context3) {
19853
20197
  while (1) {
@@ -19857,14 +20201,30 @@ var Pool = /*#__PURE__*/function () {
19857
20201
  options = null;
19858
20202
  }
19859
20203
 
19860
- _context3.next = 3;
20204
+ if (estimateGas === void 0) {
20205
+ estimateGas = false;
20206
+ }
20207
+
20208
+ if (!estimateGas) {
20209
+ _context3.next = 6;
20210
+ break;
20211
+ }
20212
+
20213
+ _context3.next = 5;
20214
+ return this.poolLogic.estimateGas.deposit(asset, amount, options);
20215
+
20216
+ case 5:
20217
+ return _context3.abrupt("return", _context3.sent);
20218
+
20219
+ case 6:
20220
+ _context3.next = 8;
19861
20221
  return this.poolLogic.deposit(asset, amount, options);
19862
20222
 
19863
- case 3:
20223
+ case 8:
19864
20224
  tx = _context3.sent;
19865
20225
  return _context3.abrupt("return", tx);
19866
20226
 
19867
- case 5:
20227
+ case 10:
19868
20228
  case "end":
19869
20229
  return _context3.stop();
19870
20230
  }
@@ -19872,7 +20232,7 @@ var Pool = /*#__PURE__*/function () {
19872
20232
  }, _callee3, this);
19873
20233
  }));
19874
20234
 
19875
- function deposit(_x4, _x5, _x6) {
20235
+ function deposit(_x5, _x6, _x7, _x8) {
19876
20236
  return _deposit.apply(this, arguments);
19877
20237
  }
19878
20238
 
@@ -19882,6 +20242,7 @@ var Pool = /*#__PURE__*/function () {
19882
20242
  * Withdraw assets from a pool
19883
20243
  * @param fundTokenAmount Amount of pool tokens to be withdrawn
19884
20244
  * @param {any} options Transaction options
20245
+ * @param {boolean} estimateGas Simulate/estimate gas
19885
20246
  * @returns {Promise<any>} Transaction
19886
20247
  */
19887
20248
  ;
@@ -19889,7 +20250,7 @@ var Pool = /*#__PURE__*/function () {
19889
20250
  _proto.withdraw =
19890
20251
  /*#__PURE__*/
19891
20252
  function () {
19892
- var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(fundTokenAmount, options) {
20253
+ var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(fundTokenAmount, options, estimateGas) {
19893
20254
  var tx;
19894
20255
  return runtime_1.wrap(function _callee4$(_context4) {
19895
20256
  while (1) {
@@ -19899,14 +20260,30 @@ var Pool = /*#__PURE__*/function () {
19899
20260
  options = null;
19900
20261
  }
19901
20262
 
19902
- _context4.next = 3;
20263
+ if (estimateGas === void 0) {
20264
+ estimateGas = false;
20265
+ }
20266
+
20267
+ if (!estimateGas) {
20268
+ _context4.next = 6;
20269
+ break;
20270
+ }
20271
+
20272
+ _context4.next = 5;
20273
+ return this.poolLogic.estimateGas.withdraw(fundTokenAmount, options);
20274
+
20275
+ case 5:
20276
+ return _context4.abrupt("return", _context4.sent);
20277
+
20278
+ case 6:
20279
+ _context4.next = 8;
19903
20280
  return this.poolLogic.withdraw(fundTokenAmount, options);
19904
20281
 
19905
- case 3:
20282
+ case 8:
19906
20283
  tx = _context4.sent;
19907
20284
  return _context4.abrupt("return", tx);
19908
20285
 
19909
- case 5:
20286
+ case 10:
19910
20287
  case "end":
19911
20288
  return _context4.stop();
19912
20289
  }
@@ -19914,7 +20291,7 @@ var Pool = /*#__PURE__*/function () {
19914
20291
  }, _callee4, this);
19915
20292
  }));
19916
20293
 
19917
- function withdraw(_x7, _x8) {
20294
+ function withdraw(_x9, _x10, _x11) {
19918
20295
  return _withdraw.apply(this, arguments);
19919
20296
  }
19920
20297
 
@@ -19925,8 +20302,9 @@ var Pool = /*#__PURE__*/function () {
19925
20302
  * Approve the asset for trading and providing liquidity
19926
20303
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
19927
20304
  * @param {string} asset Address of asset
19928
- * @param @param {BigNumber | string} Amount to be approved
20305
+ * @param {BigNumber | string} Amount to be approved
19929
20306
  * @param {any} options Transaction options
20307
+ * @param {boolean} estimateGas Simulate/estimate gas
19930
20308
  * @returns {Promise<any>} Transaction
19931
20309
  */
19932
20310
  ;
@@ -19934,7 +20312,7 @@ var Pool = /*#__PURE__*/function () {
19934
20312
  _proto.approve =
19935
20313
  /*#__PURE__*/
19936
20314
  function () {
19937
- var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(dapp, asset, amount, options) {
20315
+ var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(dapp, asset, amount, options, estimateGas) {
19938
20316
  var iERC20, approveTxData, tx;
19939
20317
  return runtime_1.wrap(function _callee5$(_context5) {
19940
20318
  while (1) {
@@ -19944,16 +20322,20 @@ var Pool = /*#__PURE__*/function () {
19944
20322
  options = null;
19945
20323
  }
19946
20324
 
20325
+ if (estimateGas === void 0) {
20326
+ estimateGas = false;
20327
+ }
20328
+
19947
20329
  iERC20 = new ethers.ethers.utils.Interface(IERC20.abi);
19948
20330
  approveTxData = iERC20.encodeFunctionData("approve", [routerAddress[this.network][dapp], amount]);
19949
- _context5.next = 5;
19950
- return this.poolLogic.execTransaction(asset, approveTxData, options);
20331
+ _context5.next = 6;
20332
+ return getPoolTxOrGasEstimate(this, [asset, approveTxData, options], estimateGas);
19951
20333
 
19952
- case 5:
20334
+ case 6:
19953
20335
  tx = _context5.sent;
19954
20336
  return _context5.abrupt("return", tx);
19955
20337
 
19956
- case 7:
20338
+ case 8:
19957
20339
  case "end":
19958
20340
  return _context5.stop();
19959
20341
  }
@@ -19961,7 +20343,7 @@ var Pool = /*#__PURE__*/function () {
19961
20343
  }, _callee5, this);
19962
20344
  }));
19963
20345
 
19964
- function approve(_x9, _x10, _x11, _x12) {
20346
+ function approve(_x12, _x13, _x14, _x15, _x16) {
19965
20347
  return _approve.apply(this, arguments);
19966
20348
  }
19967
20349
 
@@ -19973,6 +20355,7 @@ var Pool = /*#__PURE__*/function () {
19973
20355
  * @param {string} asset Address of liquidity pool token
19974
20356
  * @param {BigNumber | string} amount Aamount to be approved
19975
20357
  * @param {any} options Transaction options
20358
+ * @param {boolean} estimateGas Simulate/estimate gas
19976
20359
  * @returns {Promise<any>} Transaction
19977
20360
  */
19978
20361
  ;
@@ -19980,7 +20363,7 @@ var Pool = /*#__PURE__*/function () {
19980
20363
  _proto.approveStaking =
19981
20364
  /*#__PURE__*/
19982
20365
  function () {
19983
- var _approveStaking = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(dapp, asset, amount, options) {
20366
+ var _approveStaking = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(dapp, asset, amount, options, estimateGas) {
19984
20367
  var iERC20, approveTxData, tx;
19985
20368
  return runtime_1.wrap(function _callee6$(_context6) {
19986
20369
  while (1) {
@@ -19990,16 +20373,20 @@ var Pool = /*#__PURE__*/function () {
19990
20373
  options = null;
19991
20374
  }
19992
20375
 
20376
+ if (estimateGas === void 0) {
20377
+ estimateGas = false;
20378
+ }
20379
+
19993
20380
  iERC20 = new ethers.ethers.utils.Interface(IERC20.abi);
19994
20381
  approveTxData = iERC20.encodeFunctionData("approve", [stakingAddress[this.network][dapp], amount]);
19995
- _context6.next = 5;
19996
- return this.poolLogic.execTransaction(asset, approveTxData, options);
20382
+ _context6.next = 6;
20383
+ return getPoolTxOrGasEstimate(this, [asset, approveTxData, options], estimateGas);
19997
20384
 
19998
- case 5:
20385
+ case 6:
19999
20386
  tx = _context6.sent;
20000
20387
  return _context6.abrupt("return", tx);
20001
20388
 
20002
- case 7:
20389
+ case 8:
20003
20390
  case "end":
20004
20391
  return _context6.stop();
20005
20392
  }
@@ -20007,7 +20394,7 @@ var Pool = /*#__PURE__*/function () {
20007
20394
  }, _callee6, this);
20008
20395
  }));
20009
20396
 
20010
- function approveStaking(_x13, _x14, _x15, _x16) {
20397
+ function approveStaking(_x17, _x18, _x19, _x20, _x21) {
20011
20398
  return _approveStaking.apply(this, arguments);
20012
20399
  }
20013
20400
 
@@ -20019,6 +20406,7 @@ var Pool = /*#__PURE__*/function () {
20019
20406
  * @param {string} asset Address of liquidity pool token
20020
20407
  * @param {BigNumber | string} amount Aamount to be approved
20021
20408
  * @param {any} options Transaction options
20409
+ * @param {boolean} estimateGas Simulate/estimate gas
20022
20410
  * @returns {Promise<any>} Transaction
20023
20411
  */
20024
20412
  ;
@@ -20026,7 +20414,7 @@ var Pool = /*#__PURE__*/function () {
20026
20414
  _proto.approveUniswapV3Liquidity =
20027
20415
  /*#__PURE__*/
20028
20416
  function () {
20029
- var _approveUniswapV3Liquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(asset, amount, options) {
20417
+ var _approveUniswapV3Liquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(asset, amount, options, estimateGas) {
20030
20418
  var iERC20, approveTxData, tx;
20031
20419
  return runtime_1.wrap(function _callee7$(_context7) {
20032
20420
  while (1) {
@@ -20036,16 +20424,20 @@ var Pool = /*#__PURE__*/function () {
20036
20424
  options = null;
20037
20425
  }
20038
20426
 
20427
+ if (estimateGas === void 0) {
20428
+ estimateGas = false;
20429
+ }
20430
+
20039
20431
  iERC20 = new ethers.ethers.utils.Interface(IERC20.abi);
20040
20432
  approveTxData = iERC20.encodeFunctionData("approve", [nonfungiblePositionManagerAddress[this.network], amount]);
20041
- _context7.next = 5;
20042
- return this.poolLogic.execTransaction(asset, approveTxData, options);
20433
+ _context7.next = 6;
20434
+ return getPoolTxOrGasEstimate(this, [asset, approveTxData, options], estimateGas);
20043
20435
 
20044
- case 5:
20436
+ case 6:
20045
20437
  tx = _context7.sent;
20046
20438
  return _context7.abrupt("return", tx);
20047
20439
 
20048
- case 7:
20440
+ case 8:
20049
20441
  case "end":
20050
20442
  return _context7.stop();
20051
20443
  }
@@ -20053,7 +20445,7 @@ var Pool = /*#__PURE__*/function () {
20053
20445
  }, _callee7, this);
20054
20446
  }));
20055
20447
 
20056
- function approveUniswapV3Liquidity(_x17, _x18, _x19) {
20448
+ function approveUniswapV3Liquidity(_x22, _x23, _x24, _x25) {
20057
20449
  return _approveUniswapV3Liquidity.apply(this, arguments);
20058
20450
  }
20059
20451
 
@@ -20065,6 +20457,7 @@ var Pool = /*#__PURE__*/function () {
20065
20457
  * @param {string} asset Address of asset
20066
20458
  * @param {BigNumber | string} amount to be approved
20067
20459
  * @param {any} options Transaction options
20460
+ * @param {boolean} estimateGas Simulate/estimate gas
20068
20461
  * @returns {Promise<any>} Transaction
20069
20462
  */
20070
20463
  ;
@@ -20072,7 +20465,7 @@ var Pool = /*#__PURE__*/function () {
20072
20465
  _proto.approveSpender =
20073
20466
  /*#__PURE__*/
20074
20467
  function () {
20075
- var _approveSpender = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(spender, asset, amount, options) {
20468
+ var _approveSpender = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(spender, asset, amount, options, estimateGas) {
20076
20469
  var iERC20, approveTxData, tx;
20077
20470
  return runtime_1.wrap(function _callee8$(_context8) {
20078
20471
  while (1) {
@@ -20082,16 +20475,20 @@ var Pool = /*#__PURE__*/function () {
20082
20475
  options = null;
20083
20476
  }
20084
20477
 
20478
+ if (estimateGas === void 0) {
20479
+ estimateGas = false;
20480
+ }
20481
+
20085
20482
  iERC20 = new ethers.ethers.utils.Interface(IERC20.abi);
20086
20483
  approveTxData = iERC20.encodeFunctionData("approve", [spender, amount]);
20087
- _context8.next = 5;
20088
- return this.poolLogic.execTransaction(asset, approveTxData, options);
20484
+ _context8.next = 6;
20485
+ return getPoolTxOrGasEstimate(this, [asset, approveTxData, options], estimateGas);
20089
20486
 
20090
- case 5:
20487
+ case 6:
20091
20488
  tx = _context8.sent;
20092
20489
  return _context8.abrupt("return", tx);
20093
20490
 
20094
- case 7:
20491
+ case 8:
20095
20492
  case "end":
20096
20493
  return _context8.stop();
20097
20494
  }
@@ -20099,7 +20496,7 @@ var Pool = /*#__PURE__*/function () {
20099
20496
  }, _callee8, this);
20100
20497
  }));
20101
20498
 
20102
- function approveSpender(_x20, _x21, _x22, _x23) {
20499
+ function approveSpender(_x26, _x27, _x28, _x29, _x30) {
20103
20500
  return _approveSpender.apply(this, arguments);
20104
20501
  }
20105
20502
 
@@ -20113,6 +20510,7 @@ var Pool = /*#__PURE__*/function () {
20113
20510
  * @param {BigNumber | string} amountIn Amount
20114
20511
  * @param {number} slippage Slippage tolerance in %
20115
20512
  * @param {any} options Transaction options
20513
+ * @param {boolean} estimateGas Simulate/estimate gas
20116
20514
  * @returns {Promise<any>} Transaction
20117
20515
  */
20118
20516
  ;
@@ -20120,7 +20518,7 @@ var Pool = /*#__PURE__*/function () {
20120
20518
  _proto.trade =
20121
20519
  /*#__PURE__*/
20122
20520
  function () {
20123
- var _trade = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(dapp, assetFrom, assetTo, amountIn, slippage, options) {
20521
+ var _trade = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(dapp, assetFrom, assetTo, amountIn, slippage, options, estimateGas) {
20124
20522
  var swapTxData, iSynthetix, assets, daoAddress, iUniswapV2Router, minAmountOut, tx;
20125
20523
  return runtime_1.wrap(function _callee9$(_context9) {
20126
20524
  while (1) {
@@ -20134,61 +20532,65 @@ var Pool = /*#__PURE__*/function () {
20134
20532
  options = null;
20135
20533
  }
20136
20534
 
20535
+ if (estimateGas === void 0) {
20536
+ estimateGas = false;
20537
+ }
20538
+
20137
20539
  _context9.t0 = dapp;
20138
- _context9.next = _context9.t0 === exports.Dapp.ZEROEX ? 5 : _context9.t0 === exports.Dapp.ONEINCH ? 9 : _context9.t0 === exports.Dapp.BALANCER ? 13 : _context9.t0 === exports.Dapp.SYNTHETIX ? 17 : _context9.t0 === exports.Dapp.TOROS ? 24 : 28;
20540
+ _context9.next = _context9.t0 === exports.Dapp.ZEROEX ? 6 : _context9.t0 === exports.Dapp.ONEINCH ? 10 : _context9.t0 === exports.Dapp.BALANCER ? 14 : _context9.t0 === exports.Dapp.SYNTHETIX ? 18 : _context9.t0 === exports.Dapp.TOROS ? 25 : 29;
20139
20541
  break;
20140
20542
 
20141
- case 5:
20142
- _context9.next = 7;
20543
+ case 6:
20544
+ _context9.next = 8;
20143
20545
  return getZeroExTradeTxData(this.network, assetFrom, assetTo, amountIn, slippage, this.address);
20144
20546
 
20145
- case 7:
20547
+ case 8:
20146
20548
  swapTxData = _context9.sent;
20147
- return _context9.abrupt("break", 43);
20549
+ return _context9.abrupt("break", 44);
20148
20550
 
20149
- case 9:
20150
- _context9.next = 11;
20551
+ case 10:
20552
+ _context9.next = 12;
20151
20553
  return getOneInchSwapTxData(this, assetFrom, assetTo, amountIn, slippage);
20152
20554
 
20153
- case 11:
20555
+ case 12:
20154
20556
  swapTxData = _context9.sent;
20155
- return _context9.abrupt("break", 43);
20557
+ return _context9.abrupt("break", 44);
20156
20558
 
20157
- case 13:
20158
- _context9.next = 15;
20559
+ case 14:
20560
+ _context9.next = 16;
20159
20561
  return this.utils.getBalancerSwapTx(this, assetFrom, assetTo, amountIn, slippage);
20160
20562
 
20161
- case 15:
20563
+ case 16:
20162
20564
  swapTxData = _context9.sent;
20163
- return _context9.abrupt("break", 43);
20565
+ return _context9.abrupt("break", 44);
20164
20566
 
20165
- case 17:
20567
+ case 18:
20166
20568
  iSynthetix = new ethers.ethers.utils.Interface(ISynthetix.abi);
20167
20569
  assets = [assetFrom, assetTo].map(function (asset) {
20168
20570
  return ethers.ethers.utils.formatBytes32String(asset);
20169
20571
  });
20170
- _context9.next = 21;
20572
+ _context9.next = 22;
20171
20573
  return this.factory.owner();
20172
20574
 
20173
- case 21:
20575
+ case 22:
20174
20576
  daoAddress = _context9.sent;
20175
20577
  swapTxData = iSynthetix.encodeFunctionData(exports.Transaction.SWAP_SYNTHS, [assets[0], amountIn, assets[1], daoAddress, SYNTHETIX_TRACKING_CODE]);
20176
- return _context9.abrupt("break", 43);
20578
+ return _context9.abrupt("break", 44);
20177
20579
 
20178
- case 24:
20179
- _context9.next = 26;
20580
+ case 25:
20581
+ _context9.next = 27;
20180
20582
  return getEasySwapperTxData(this, assetFrom, assetTo, ethers.ethers.BigNumber.from(amountIn), slippage);
20181
20583
 
20182
- case 26:
20584
+ case 27:
20183
20585
  swapTxData = _context9.sent;
20184
- return _context9.abrupt("break", 43);
20586
+ return _context9.abrupt("break", 44);
20185
20587
 
20186
- case 28:
20588
+ case 29:
20187
20589
  iUniswapV2Router = new ethers.ethers.utils.Interface(IUniswapV2Router.abi);
20188
- _context9.next = 31;
20590
+ _context9.next = 32;
20189
20591
  return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
20190
20592
 
20191
- case 31:
20593
+ case 32:
20192
20594
  minAmountOut = _context9.sent;
20193
20595
  _context9.t1 = iUniswapV2Router;
20194
20596
  _context9.t2 = exports.Transaction.SWAP;
@@ -20196,23 +20598,23 @@ var Pool = /*#__PURE__*/function () {
20196
20598
  _context9.t4 = minAmountOut;
20197
20599
  _context9.t5 = [assetFrom, assetTo];
20198
20600
  _context9.t6 = this.address;
20199
- _context9.next = 40;
20601
+ _context9.next = 41;
20200
20602
  return getDeadline(this);
20201
20603
 
20202
- case 40:
20604
+ case 41:
20203
20605
  _context9.t7 = _context9.sent;
20204
20606
  _context9.t8 = [_context9.t3, _context9.t4, _context9.t5, _context9.t6, _context9.t7];
20205
20607
  swapTxData = _context9.t1.encodeFunctionData.call(_context9.t1, _context9.t2, _context9.t8);
20206
20608
 
20207
- case 43:
20208
- _context9.next = 45;
20209
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], swapTxData, options);
20609
+ case 44:
20610
+ _context9.next = 46;
20611
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], swapTxData, options], estimateGas);
20210
20612
 
20211
- case 45:
20613
+ case 46:
20212
20614
  tx = _context9.sent;
20213
20615
  return _context9.abrupt("return", tx);
20214
20616
 
20215
- case 47:
20617
+ case 48:
20216
20618
  case "end":
20217
20619
  return _context9.stop();
20218
20620
  }
@@ -20220,7 +20622,7 @@ var Pool = /*#__PURE__*/function () {
20220
20622
  }, _callee9, this);
20221
20623
  }));
20222
20624
 
20223
- function trade(_x24, _x25, _x26, _x27, _x28, _x29) {
20625
+ function trade(_x31, _x32, _x33, _x34, _x35, _x36, _x37) {
20224
20626
  return _trade.apply(this, arguments);
20225
20627
  }
20226
20628
 
@@ -20234,6 +20636,7 @@ var Pool = /*#__PURE__*/function () {
20234
20636
  * @param {BigNumber | string} amountA Amount first asset
20235
20637
  * @param {BigNumber | string} amountB Amount second asset
20236
20638
  * @param {any} options Transaction options
20639
+ * @param {boolean} estimateGas Simulate/estimate gas
20237
20640
  * @returns {Promise<any>} Transaction
20238
20641
  */
20239
20642
  ;
@@ -20241,7 +20644,7 @@ var Pool = /*#__PURE__*/function () {
20241
20644
  _proto.addLiquidity =
20242
20645
  /*#__PURE__*/
20243
20646
  function () {
20244
- var _addLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(dapp, assetA, assetB, amountA, amountB, options) {
20647
+ var _addLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(dapp, assetA, assetB, amountA, amountB, options, estimateGas) {
20245
20648
  var iUniswapV2Router, addLiquidityTxData, tx;
20246
20649
  return runtime_1.wrap(function _callee10$(_context10) {
20247
20650
  while (1) {
@@ -20251,6 +20654,10 @@ var Pool = /*#__PURE__*/function () {
20251
20654
  options = null;
20252
20655
  }
20253
20656
 
20657
+ if (estimateGas === void 0) {
20658
+ estimateGas = false;
20659
+ }
20660
+
20254
20661
  iUniswapV2Router = new ethers.ethers.utils.Interface(IUniswapV2Router.abi);
20255
20662
  _context10.t0 = iUniswapV2Router;
20256
20663
  _context10.t1 = exports.Transaction.ADD_LIQUIDITY;
@@ -20259,21 +20666,21 @@ var Pool = /*#__PURE__*/function () {
20259
20666
  _context10.t4 = amountA;
20260
20667
  _context10.t5 = amountB;
20261
20668
  _context10.t6 = this.address;
20262
- _context10.next = 11;
20669
+ _context10.next = 12;
20263
20670
  return getDeadline(this);
20264
20671
 
20265
- case 11:
20672
+ case 12:
20266
20673
  _context10.t7 = _context10.sent;
20267
20674
  _context10.t8 = [_context10.t2, _context10.t3, _context10.t4, _context10.t5, 0, 0, _context10.t6, _context10.t7];
20268
20675
  addLiquidityTxData = _context10.t0.encodeFunctionData.call(_context10.t0, _context10.t1, _context10.t8);
20269
- _context10.next = 16;
20270
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], addLiquidityTxData, options);
20676
+ _context10.next = 17;
20677
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], addLiquidityTxData, options], estimateGas);
20271
20678
 
20272
- case 16:
20679
+ case 17:
20273
20680
  tx = _context10.sent;
20274
20681
  return _context10.abrupt("return", tx);
20275
20682
 
20276
- case 18:
20683
+ case 19:
20277
20684
  case "end":
20278
20685
  return _context10.stop();
20279
20686
  }
@@ -20281,7 +20688,7 @@ var Pool = /*#__PURE__*/function () {
20281
20688
  }, _callee10, this);
20282
20689
  }));
20283
20690
 
20284
- function addLiquidity(_x30, _x31, _x32, _x33, _x34, _x35) {
20691
+ function addLiquidity(_x38, _x39, _x40, _x41, _x42, _x43, _x44) {
20285
20692
  return _addLiquidity.apply(this, arguments);
20286
20693
  }
20287
20694
 
@@ -20294,6 +20701,7 @@ var Pool = /*#__PURE__*/function () {
20294
20701
  * @param {string} assetB Second asset
20295
20702
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20296
20703
  * @param {any} options Transaction options
20704
+ * @param {boolean} estimateGas Simulate/estimate gas
20297
20705
  * @returns {Promise<any>} Transaction
20298
20706
  */
20299
20707
  ;
@@ -20301,7 +20709,7 @@ var Pool = /*#__PURE__*/function () {
20301
20709
  _proto.removeLiquidity =
20302
20710
  /*#__PURE__*/
20303
20711
  function () {
20304
- var _removeLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(dapp, assetA, assetB, amount, options) {
20712
+ var _removeLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(dapp, assetA, assetB, amount, options, estimateGas) {
20305
20713
  var iUniswapV2Router, removeLiquidityTxData, tx;
20306
20714
  return runtime_1.wrap(function _callee11$(_context11) {
20307
20715
  while (1) {
@@ -20311,6 +20719,10 @@ var Pool = /*#__PURE__*/function () {
20311
20719
  options = null;
20312
20720
  }
20313
20721
 
20722
+ if (estimateGas === void 0) {
20723
+ estimateGas = false;
20724
+ }
20725
+
20314
20726
  iUniswapV2Router = new ethers.ethers.utils.Interface(IUniswapV2Router.abi);
20315
20727
  _context11.t0 = iUniswapV2Router;
20316
20728
  _context11.t1 = exports.Transaction.REMOVE_LIQUIDITY;
@@ -20318,21 +20730,21 @@ var Pool = /*#__PURE__*/function () {
20318
20730
  _context11.t3 = assetB;
20319
20731
  _context11.t4 = amount;
20320
20732
  _context11.t5 = this.address;
20321
- _context11.next = 10;
20733
+ _context11.next = 11;
20322
20734
  return getDeadline(this);
20323
20735
 
20324
- case 10:
20736
+ case 11:
20325
20737
  _context11.t6 = _context11.sent;
20326
20738
  _context11.t7 = [_context11.t2, _context11.t3, _context11.t4, 0, 0, _context11.t5, _context11.t6];
20327
20739
  removeLiquidityTxData = _context11.t0.encodeFunctionData.call(_context11.t0, _context11.t1, _context11.t7);
20328
- _context11.next = 15;
20329
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], removeLiquidityTxData, options);
20740
+ _context11.next = 16;
20741
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], removeLiquidityTxData, options], estimateGas);
20330
20742
 
20331
- case 15:
20743
+ case 16:
20332
20744
  tx = _context11.sent;
20333
20745
  return _context11.abrupt("return", tx);
20334
20746
 
20335
- case 17:
20747
+ case 18:
20336
20748
  case "end":
20337
20749
  return _context11.stop();
20338
20750
  }
@@ -20340,7 +20752,7 @@ var Pool = /*#__PURE__*/function () {
20340
20752
  }, _callee11, this);
20341
20753
  }));
20342
20754
 
20343
- function removeLiquidity(_x36, _x37, _x38, _x39, _x40) {
20755
+ function removeLiquidity(_x45, _x46, _x47, _x48, _x49, _x50) {
20344
20756
  return _removeLiquidity.apply(this, arguments);
20345
20757
  }
20346
20758
 
@@ -20352,6 +20764,7 @@ var Pool = /*#__PURE__*/function () {
20352
20764
  * @param {string} asset Liquidity pool token
20353
20765
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20354
20766
  * @param {any} options Transaction options
20767
+ * @param {boolean} estimateGas Simulate/estimate gas
20355
20768
  * @returns {Promise<any>} Transaction
20356
20769
  */
20357
20770
  ;
@@ -20359,7 +20772,7 @@ var Pool = /*#__PURE__*/function () {
20359
20772
  _proto.stake =
20360
20773
  /*#__PURE__*/
20361
20774
  function () {
20362
- var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(dapp, asset, amount, options) {
20775
+ var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(dapp, asset, amount, options, estimateGas) {
20363
20776
  var iMiniChefV2, poolId, stakeTxData, tx;
20364
20777
  return runtime_1.wrap(function _callee12$(_context12) {
20365
20778
  while (1) {
@@ -20369,21 +20782,25 @@ var Pool = /*#__PURE__*/function () {
20369
20782
  options = null;
20370
20783
  }
20371
20784
 
20785
+ if (estimateGas === void 0) {
20786
+ estimateGas = false;
20787
+ }
20788
+
20372
20789
  iMiniChefV2 = new ethers.ethers.utils.Interface(IMiniChefV2.abi);
20373
- _context12.next = 4;
20790
+ _context12.next = 5;
20374
20791
  return this.utils.getLpPoolId(dapp, asset);
20375
20792
 
20376
- case 4:
20793
+ case 5:
20377
20794
  poolId = _context12.sent;
20378
20795
  stakeTxData = iMiniChefV2.encodeFunctionData(exports.Transaction.DEPOSIT, [poolId, amount, this.address]);
20379
- _context12.next = 8;
20380
- return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], stakeTxData, options);
20796
+ _context12.next = 9;
20797
+ return getPoolTxOrGasEstimate(this, [stakingAddress[this.network][dapp], stakeTxData, options], estimateGas);
20381
20798
 
20382
- case 8:
20799
+ case 9:
20383
20800
  tx = _context12.sent;
20384
20801
  return _context12.abrupt("return", tx);
20385
20802
 
20386
- case 10:
20803
+ case 11:
20387
20804
  case "end":
20388
20805
  return _context12.stop();
20389
20806
  }
@@ -20391,7 +20808,7 @@ var Pool = /*#__PURE__*/function () {
20391
20808
  }, _callee12, this);
20392
20809
  }));
20393
20810
 
20394
- function stake(_x41, _x42, _x43, _x44) {
20811
+ function stake(_x51, _x52, _x53, _x54, _x55) {
20395
20812
  return _stake.apply(this, arguments);
20396
20813
  }
20397
20814
 
@@ -20403,6 +20820,7 @@ var Pool = /*#__PURE__*/function () {
20403
20820
  * @param {string} gauge Gauge contract address
20404
20821
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20405
20822
  * @param {any} options Transaction options
20823
+ * @param {boolean} estimateGas Simulate/estimate gas
20406
20824
  * @returns {Promise<any>} Transaction
20407
20825
  */
20408
20826
  ;
@@ -20410,7 +20828,7 @@ var Pool = /*#__PURE__*/function () {
20410
20828
  _proto.stakeInGauge =
20411
20829
  /*#__PURE__*/
20412
20830
  function () {
20413
- var _stakeInGauge = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(dapp, gauge, amount, options) {
20831
+ var _stakeInGauge = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(dapp, gauge, amount, options, estimateGas) {
20414
20832
  var stakeTxData, rewardsGauge, tx;
20415
20833
  return runtime_1.wrap(function _callee13$(_context13) {
20416
20834
  while (1) {
@@ -20420,35 +20838,39 @@ var Pool = /*#__PURE__*/function () {
20420
20838
  options = null;
20421
20839
  }
20422
20840
 
20841
+ if (estimateGas === void 0) {
20842
+ estimateGas = false;
20843
+ }
20844
+
20423
20845
  _context13.t0 = dapp;
20424
- _context13.next = _context13.t0 === exports.Dapp.BALANCER ? 4 : _context13.t0 === exports.Dapp.VELODROME ? 7 : _context13.t0 === exports.Dapp.RAMSES ? 7 : _context13.t0 === exports.Dapp.VELODROMEV2 ? 9 : 11;
20846
+ _context13.next = _context13.t0 === exports.Dapp.BALANCER ? 5 : _context13.t0 === exports.Dapp.VELODROME ? 8 : _context13.t0 === exports.Dapp.RAMSES ? 8 : _context13.t0 === exports.Dapp.VELODROMEV2 ? 10 : 12;
20425
20847
  break;
20426
20848
 
20427
- case 4:
20849
+ case 5:
20428
20850
  rewardsGauge = new ethers.ethers.utils.Interface(IBalancerRewardsGauge.abi);
20429
20851
  stakeTxData = rewardsGauge.encodeFunctionData("deposit(uint256)", [amount]);
20430
- return _context13.abrupt("break", 12);
20852
+ return _context13.abrupt("break", 13);
20431
20853
 
20432
- case 7:
20854
+ case 8:
20433
20855
  stakeTxData = getVelodromeStakeTxData(amount, false);
20434
- return _context13.abrupt("break", 12);
20856
+ return _context13.abrupt("break", 13);
20435
20857
 
20436
- case 9:
20858
+ case 10:
20437
20859
  stakeTxData = getVelodromeStakeTxData(amount, true);
20438
- return _context13.abrupt("break", 12);
20860
+ return _context13.abrupt("break", 13);
20439
20861
 
20440
- case 11:
20862
+ case 12:
20441
20863
  throw new Error("dapp not supported");
20442
20864
 
20443
- case 12:
20444
- _context13.next = 14;
20445
- return this.poolLogic.execTransaction(gauge, stakeTxData, options);
20865
+ case 13:
20866
+ _context13.next = 15;
20867
+ return getPoolTxOrGasEstimate(this, [gauge, stakeTxData, options], estimateGas);
20446
20868
 
20447
- case 14:
20869
+ case 15:
20448
20870
  tx = _context13.sent;
20449
20871
  return _context13.abrupt("return", tx);
20450
20872
 
20451
- case 16:
20873
+ case 17:
20452
20874
  case "end":
20453
20875
  return _context13.stop();
20454
20876
  }
@@ -20456,7 +20878,7 @@ var Pool = /*#__PURE__*/function () {
20456
20878
  }, _callee13, this);
20457
20879
  }));
20458
20880
 
20459
- function stakeInGauge(_x45, _x46, _x47, _x48) {
20881
+ function stakeInGauge(_x56, _x57, _x58, _x59, _x60) {
20460
20882
  return _stakeInGauge.apply(this, arguments);
20461
20883
  }
20462
20884
 
@@ -20468,6 +20890,7 @@ var Pool = /*#__PURE__*/function () {
20468
20890
  * @param {string} asset Liquidity pool token
20469
20891
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20470
20892
  * @param {any} options Transaction options
20893
+ * @param {boolean} estimateGas Simulate/estimate gas
20471
20894
  * @returns {Promise<any>} Transaction
20472
20895
  */
20473
20896
  ;
@@ -20475,7 +20898,7 @@ var Pool = /*#__PURE__*/function () {
20475
20898
  _proto.unStake =
20476
20899
  /*#__PURE__*/
20477
20900
  function () {
20478
- var _unStake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(dapp, asset, amount, options) {
20901
+ var _unStake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(dapp, asset, amount, options, estimateGas) {
20479
20902
  var iMiniChefV2, poolId, unStakeTxData, tx;
20480
20903
  return runtime_1.wrap(function _callee14$(_context14) {
20481
20904
  while (1) {
@@ -20485,21 +20908,25 @@ var Pool = /*#__PURE__*/function () {
20485
20908
  options = null;
20486
20909
  }
20487
20910
 
20911
+ if (estimateGas === void 0) {
20912
+ estimateGas = false;
20913
+ }
20914
+
20488
20915
  iMiniChefV2 = new ethers.ethers.utils.Interface(IMiniChefV2.abi);
20489
- _context14.next = 4;
20916
+ _context14.next = 5;
20490
20917
  return this.utils.getLpPoolId(dapp, asset);
20491
20918
 
20492
- case 4:
20919
+ case 5:
20493
20920
  poolId = _context14.sent;
20494
20921
  unStakeTxData = iMiniChefV2.encodeFunctionData(exports.Transaction.WITHDRAW, [poolId, amount, this.address]);
20495
- _context14.next = 8;
20496
- return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], unStakeTxData, options);
20922
+ _context14.next = 9;
20923
+ return getPoolTxOrGasEstimate(this, [stakingAddress[this.network][dapp], unStakeTxData, options], estimateGas);
20497
20924
 
20498
- case 8:
20925
+ case 9:
20499
20926
  tx = _context14.sent;
20500
20927
  return _context14.abrupt("return", tx);
20501
20928
 
20502
- case 10:
20929
+ case 11:
20503
20930
  case "end":
20504
20931
  return _context14.stop();
20505
20932
  }
@@ -20507,7 +20934,7 @@ var Pool = /*#__PURE__*/function () {
20507
20934
  }, _callee14, this);
20508
20935
  }));
20509
20936
 
20510
- function unStake(_x49, _x50, _x51, _x52) {
20937
+ function unStake(_x61, _x62, _x63, _x64, _x65) {
20511
20938
  return _unStake.apply(this, arguments);
20512
20939
  }
20513
20940
 
@@ -20518,6 +20945,7 @@ var Pool = /*#__PURE__*/function () {
20518
20945
  * @param {string} gauge Gauge contract address
20519
20946
  * @param {BigNumber | string} amount Amount of liquidity pool tokens
20520
20947
  * @param {any} options Transaction options
20948
+ * @param {boolean} estimateGas Simulate/estimate gas
20521
20949
  * @returns {Promise<any>} Transaction
20522
20950
  */
20523
20951
  ;
@@ -20525,7 +20953,7 @@ var Pool = /*#__PURE__*/function () {
20525
20953
  _proto.unstakeFromGauge =
20526
20954
  /*#__PURE__*/
20527
20955
  function () {
20528
- var _unstakeFromGauge = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(gauge, amount, options) {
20956
+ var _unstakeFromGauge = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(gauge, amount, options, estimateGas) {
20529
20957
  var rewardsGauge, unstakeTxData, tx;
20530
20958
  return runtime_1.wrap(function _callee15$(_context15) {
20531
20959
  while (1) {
@@ -20535,16 +20963,20 @@ var Pool = /*#__PURE__*/function () {
20535
20963
  options = null;
20536
20964
  }
20537
20965
 
20966
+ if (estimateGas === void 0) {
20967
+ estimateGas = false;
20968
+ }
20969
+
20538
20970
  rewardsGauge = new ethers.ethers.utils.Interface(IBalancerRewardsGauge.abi);
20539
20971
  unstakeTxData = rewardsGauge.encodeFunctionData("withdraw(uint256)", [amount]);
20540
- _context15.next = 5;
20541
- return this.poolLogic.execTransaction(gauge, unstakeTxData, options);
20972
+ _context15.next = 6;
20973
+ return getPoolTxOrGasEstimate(this, [gauge, unstakeTxData, options], estimateGas);
20542
20974
 
20543
- case 5:
20975
+ case 6:
20544
20976
  tx = _context15.sent;
20545
20977
  return _context15.abrupt("return", tx);
20546
20978
 
20547
- case 7:
20979
+ case 8:
20548
20980
  case "end":
20549
20981
  return _context15.stop();
20550
20982
  }
@@ -20552,7 +20984,7 @@ var Pool = /*#__PURE__*/function () {
20552
20984
  }, _callee15, this);
20553
20985
  }));
20554
20986
 
20555
- function unstakeFromGauge(_x53, _x54, _x55) {
20987
+ function unstakeFromGauge(_x66, _x67, _x68, _x69) {
20556
20988
  return _unstakeFromGauge.apply(this, arguments);
20557
20989
  }
20558
20990
 
@@ -20565,6 +20997,7 @@ var Pool = /*#__PURE__*/function () {
20565
20997
  * @param {BigNumber | string} amount Amount of asset to lend
20566
20998
  * @param {number} referralCode Code from Aave referral program
20567
20999
  * @param {any} options Transaction options
21000
+ * @param {boolean} estimateGas Simulate/estimate gas
20568
21001
  * @returns {Promise<any>} Transaction
20569
21002
  */
20570
21003
  ;
@@ -20572,7 +21005,7 @@ var Pool = /*#__PURE__*/function () {
20572
21005
  _proto.lend =
20573
21006
  /*#__PURE__*/
20574
21007
  function () {
20575
- var _lend = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16(dapp, asset, amount, referralCode, options) {
21008
+ var _lend = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16(dapp, asset, amount, referralCode, options, estimateGas) {
20576
21009
  var iLendingPool, depositTxData, tx;
20577
21010
  return runtime_1.wrap(function _callee16$(_context16) {
20578
21011
  while (1) {
@@ -20586,16 +21019,20 @@ var Pool = /*#__PURE__*/function () {
20586
21019
  options = null;
20587
21020
  }
20588
21021
 
21022
+ if (estimateGas === void 0) {
21023
+ estimateGas = false;
21024
+ }
21025
+
20589
21026
  iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
20590
21027
  depositTxData = iLendingPool.encodeFunctionData(exports.Transaction.DEPOSIT, [asset, amount, this.address, referralCode]);
20591
- _context16.next = 6;
20592
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], depositTxData, options);
21028
+ _context16.next = 7;
21029
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], depositTxData, options], estimateGas);
20593
21030
 
20594
- case 6:
21031
+ case 7:
20595
21032
  tx = _context16.sent;
20596
21033
  return _context16.abrupt("return", tx);
20597
21034
 
20598
- case 8:
21035
+ case 9:
20599
21036
  case "end":
20600
21037
  return _context16.stop();
20601
21038
  }
@@ -20603,7 +21040,7 @@ var Pool = /*#__PURE__*/function () {
20603
21040
  }, _callee16, this);
20604
21041
  }));
20605
21042
 
20606
- function lend(_x56, _x57, _x58, _x59, _x60) {
21043
+ function lend(_x70, _x71, _x72, _x73, _x74, _x75) {
20607
21044
  return _lend.apply(this, arguments);
20608
21045
  }
20609
21046
 
@@ -20615,6 +21052,7 @@ var Pool = /*#__PURE__*/function () {
20615
21052
  * @param {string} asset Asset
20616
21053
  * @param {BigNumber | string} amount Amount of asset to lend
20617
21054
  * @param {any} options Transaction options
21055
+ * @param {boolean} estimateGas Simulate/estimate gas
20618
21056
  * @returns {Promise<any>} Transaction
20619
21057
  */
20620
21058
  ;
@@ -20622,7 +21060,7 @@ var Pool = /*#__PURE__*/function () {
20622
21060
  _proto.withdrawDeposit =
20623
21061
  /*#__PURE__*/
20624
21062
  function () {
20625
- var _withdrawDeposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17(dapp, asset, amount, options) {
21063
+ var _withdrawDeposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17(dapp, asset, amount, options, estimateGas) {
20626
21064
  var iLendingPool, withdrawTxData, tx;
20627
21065
  return runtime_1.wrap(function _callee17$(_context17) {
20628
21066
  while (1) {
@@ -20632,16 +21070,20 @@ var Pool = /*#__PURE__*/function () {
20632
21070
  options = null;
20633
21071
  }
20634
21072
 
21073
+ if (estimateGas === void 0) {
21074
+ estimateGas = false;
21075
+ }
21076
+
20635
21077
  iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
20636
21078
  withdrawTxData = iLendingPool.encodeFunctionData(exports.Transaction.WITHDRAW, [asset, amount, this.address]);
20637
- _context17.next = 5;
20638
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], withdrawTxData, options);
21079
+ _context17.next = 6;
21080
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], withdrawTxData, options], estimateGas);
20639
21081
 
20640
- case 5:
21082
+ case 6:
20641
21083
  tx = _context17.sent;
20642
21084
  return _context17.abrupt("return", tx);
20643
21085
 
20644
- case 7:
21086
+ case 8:
20645
21087
  case "end":
20646
21088
  return _context17.stop();
20647
21089
  }
@@ -20649,7 +21091,7 @@ var Pool = /*#__PURE__*/function () {
20649
21091
  }, _callee17, this);
20650
21092
  }));
20651
21093
 
20652
- function withdrawDeposit(_x61, _x62, _x63, _x64) {
21094
+ function withdrawDeposit(_x76, _x77, _x78, _x79, _x80) {
20653
21095
  return _withdrawDeposit.apply(this, arguments);
20654
21096
  }
20655
21097
 
@@ -20662,6 +21104,7 @@ var Pool = /*#__PURE__*/function () {
20662
21104
  * @param {BigNumber | string} amount Amount of asset to lend
20663
21105
  * @param {number} referralCode Code from Aave referral program
20664
21106
  * @param {any} options Transaction options
21107
+ * @param {boolean} estimateGas Simulate/estimate gas
20665
21108
  * @returns {Promise<any>} Transaction
20666
21109
  */
20667
21110
  ;
@@ -20669,7 +21112,7 @@ var Pool = /*#__PURE__*/function () {
20669
21112
  _proto.borrow =
20670
21113
  /*#__PURE__*/
20671
21114
  function () {
20672
- var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee18(dapp, asset, amount, referralCode, options) {
21115
+ var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee18(dapp, asset, amount, referralCode, options, estimateGas) {
20673
21116
  var iLendingPool, borrowTxData, tx;
20674
21117
  return runtime_1.wrap(function _callee18$(_context18) {
20675
21118
  while (1) {
@@ -20683,16 +21126,20 @@ var Pool = /*#__PURE__*/function () {
20683
21126
  options = null;
20684
21127
  }
20685
21128
 
21129
+ if (estimateGas === void 0) {
21130
+ estimateGas = false;
21131
+ }
21132
+
20686
21133
  iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
20687
21134
  borrowTxData = iLendingPool.encodeFunctionData(exports.Transaction.BORROW, [asset, amount, 2, referralCode, this.address]);
20688
- _context18.next = 6;
20689
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], borrowTxData, options);
21135
+ _context18.next = 7;
21136
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], borrowTxData, options], estimateGas);
20690
21137
 
20691
- case 6:
21138
+ case 7:
20692
21139
  tx = _context18.sent;
20693
21140
  return _context18.abrupt("return", tx);
20694
21141
 
20695
- case 8:
21142
+ case 9:
20696
21143
  case "end":
20697
21144
  return _context18.stop();
20698
21145
  }
@@ -20700,7 +21147,7 @@ var Pool = /*#__PURE__*/function () {
20700
21147
  }, _callee18, this);
20701
21148
  }));
20702
21149
 
20703
- function borrow(_x65, _x66, _x67, _x68, _x69) {
21150
+ function borrow(_x81, _x82, _x83, _x84, _x85, _x86) {
20704
21151
  return _borrow.apply(this, arguments);
20705
21152
  }
20706
21153
 
@@ -20712,6 +21159,7 @@ var Pool = /*#__PURE__*/function () {
20712
21159
  * @param {string} asset Asset
20713
21160
  * @param {BigNumber | string} amount Amount of asset to lend
20714
21161
  * @param {any} options Transaction options
21162
+ * @param {boolean} estimateGas Simulate/estimate gas
20715
21163
  * @returns {Promise<any>} Transaction
20716
21164
  */
20717
21165
  ;
@@ -20719,7 +21167,7 @@ var Pool = /*#__PURE__*/function () {
20719
21167
  _proto.repay =
20720
21168
  /*#__PURE__*/
20721
21169
  function () {
20722
- var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19(dapp, asset, amount, options) {
21170
+ var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19(dapp, asset, amount, options, estimateGas) {
20723
21171
  var iLendingPool, repayTxData, tx;
20724
21172
  return runtime_1.wrap(function _callee19$(_context19) {
20725
21173
  while (1) {
@@ -20729,16 +21177,20 @@ var Pool = /*#__PURE__*/function () {
20729
21177
  options = null;
20730
21178
  }
20731
21179
 
21180
+ if (estimateGas === void 0) {
21181
+ estimateGas = false;
21182
+ }
21183
+
20732
21184
  iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
20733
21185
  repayTxData = iLendingPool.encodeFunctionData(exports.Transaction.REPAY, [asset, amount, 2, this.address]);
20734
- _context19.next = 5;
20735
- return this.poolLogic.execTransaction(routerAddress[this.network][dapp], repayTxData, options);
21186
+ _context19.next = 6;
21187
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][dapp], repayTxData, options], estimateGas);
20736
21188
 
20737
- case 5:
21189
+ case 6:
20738
21190
  tx = _context19.sent;
20739
21191
  return _context19.abrupt("return", tx);
20740
21192
 
20741
- case 7:
21193
+ case 8:
20742
21194
  case "end":
20743
21195
  return _context19.stop();
20744
21196
  }
@@ -20746,7 +21198,7 @@ var Pool = /*#__PURE__*/function () {
20746
21198
  }, _callee19, this);
20747
21199
  }));
20748
21200
 
20749
- function repay(_x70, _x71, _x72, _x73) {
21201
+ function repay(_x87, _x88, _x89, _x90, _x91) {
20750
21202
  return _repay.apply(this, arguments);
20751
21203
  }
20752
21204
 
@@ -20756,7 +21208,8 @@ var Pool = /*#__PURE__*/function () {
20756
21208
  * Claim rewards of staked liquidity pool tokens
20757
21209
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
20758
21210
  * @param {string} asset Liquidity pool token
20759
- * @param {any} options Transaction options
21211
+ * @param {any} options Transaction option
21212
+ * @param {boolean} estimateGas Simulate/estimate gas
20760
21213
  * @returns {Promise<any>} Transaction
20761
21214
  */
20762
21215
  ;
@@ -20764,7 +21217,7 @@ var Pool = /*#__PURE__*/function () {
20764
21217
  _proto.harvestRewards =
20765
21218
  /*#__PURE__*/
20766
21219
  function () {
20767
- var _harvestRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee20(dapp, asset, options) {
21220
+ var _harvestRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee20(dapp, asset, options, estimateGas) {
20768
21221
  var iMiniChefV2, poolId, harvestTxData, tx;
20769
21222
  return runtime_1.wrap(function _callee20$(_context20) {
20770
21223
  while (1) {
@@ -20774,21 +21227,25 @@ var Pool = /*#__PURE__*/function () {
20774
21227
  options = null;
20775
21228
  }
20776
21229
 
21230
+ if (estimateGas === void 0) {
21231
+ estimateGas = false;
21232
+ }
21233
+
20777
21234
  iMiniChefV2 = new ethers.ethers.utils.Interface(IMiniChefV2.abi);
20778
- _context20.next = 4;
21235
+ _context20.next = 5;
20779
21236
  return this.utils.getLpPoolId(dapp, asset);
20780
21237
 
20781
- case 4:
21238
+ case 5:
20782
21239
  poolId = _context20.sent;
20783
21240
  harvestTxData = iMiniChefV2.encodeFunctionData(exports.Transaction.HARVEST, [poolId, this.address]);
20784
- _context20.next = 8;
20785
- return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], harvestTxData, options);
21241
+ _context20.next = 9;
21242
+ return getPoolTxOrGasEstimate(this, [stakingAddress[this.network][dapp], harvestTxData, options], estimateGas);
20786
21243
 
20787
- case 8:
21244
+ case 9:
20788
21245
  tx = _context20.sent;
20789
21246
  return _context20.abrupt("return", tx);
20790
21247
 
20791
- case 10:
21248
+ case 11:
20792
21249
  case "end":
20793
21250
  return _context20.stop();
20794
21251
  }
@@ -20796,7 +21253,7 @@ var Pool = /*#__PURE__*/function () {
20796
21253
  }, _callee20, this);
20797
21254
  }));
20798
21255
 
20799
- function harvestRewards(_x74, _x75, _x76) {
21256
+ function harvestRewards(_x92, _x93, _x94, _x95) {
20800
21257
  return _harvestRewards.apply(this, arguments);
20801
21258
  }
20802
21259
 
@@ -20806,6 +21263,7 @@ var Pool = /*#__PURE__*/function () {
20806
21263
  * Change enabled pool assets
20807
21264
  * @param {AssetEnabled[]} assets New pool assets
20808
21265
  * @param {any} options Transaction options
21266
+ * @param {boolean} estimateGas Simulate/estimate gas
20809
21267
  * @returns {Promise<any>} Transaction
20810
21268
  */
20811
21269
  ;
@@ -20813,7 +21271,7 @@ var Pool = /*#__PURE__*/function () {
20813
21271
  _proto.changeAssets =
20814
21272
  /*#__PURE__*/
20815
21273
  function () {
20816
- var _changeAssets = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee21(assets, options) {
21274
+ var _changeAssets = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee21(assets, options, estimateGas) {
20817
21275
  var currentAssetsEnabled, currentAssets, newAssets, removedAssets, changedAssets, tx;
20818
21276
  return runtime_1.wrap(function _callee21$(_context21) {
20819
21277
  while (1) {
@@ -20823,10 +21281,14 @@ var Pool = /*#__PURE__*/function () {
20823
21281
  options = null;
20824
21282
  }
20825
21283
 
20826
- _context21.next = 3;
21284
+ if (estimateGas === void 0) {
21285
+ estimateGas = false;
21286
+ }
21287
+
21288
+ _context21.next = 4;
20827
21289
  return this.getComposition();
20828
21290
 
20829
- case 3:
21291
+ case 4:
20830
21292
  currentAssetsEnabled = _context21.sent;
20831
21293
  currentAssets = currentAssetsEnabled.map(function (e) {
20832
21294
  return e.asset.toLocaleLowerCase();
@@ -20840,14 +21302,27 @@ var Pool = /*#__PURE__*/function () {
20840
21302
  changedAssets = assets.map(function (e) {
20841
21303
  return [e.asset, e.isDeposit];
20842
21304
  });
20843
- _context21.next = 10;
21305
+
21306
+ if (!estimateGas) {
21307
+ _context21.next = 13;
21308
+ break;
21309
+ }
21310
+
21311
+ _context21.next = 12;
21312
+ return this.managerLogic.estimateGas.changeAssets(changedAssets, removedAssets, options);
21313
+
21314
+ case 12:
21315
+ return _context21.abrupt("return", _context21.sent);
21316
+
21317
+ case 13:
21318
+ _context21.next = 15;
20844
21319
  return this.managerLogic.changeAssets(changedAssets, removedAssets, options);
20845
21320
 
20846
- case 10:
21321
+ case 15:
20847
21322
  tx = _context21.sent;
20848
21323
  return _context21.abrupt("return", tx);
20849
21324
 
20850
- case 12:
21325
+ case 17:
20851
21326
  case "end":
20852
21327
  return _context21.stop();
20853
21328
  }
@@ -20855,7 +21330,7 @@ var Pool = /*#__PURE__*/function () {
20855
21330
  }, _callee21, this);
20856
21331
  }));
20857
21332
 
20858
- function changeAssets(_x77, _x78) {
21333
+ function changeAssets(_x96, _x97, _x98) {
20859
21334
  return _changeAssets.apply(this, arguments);
20860
21335
  }
20861
21336
 
@@ -20865,6 +21340,7 @@ var Pool = /*#__PURE__*/function () {
20865
21340
  * Set a new trader with trading permissions
20866
21341
  * @param {string} trader Address trader account
20867
21342
  * @param {any} options Transaction options
21343
+ * @param {boolean} estimateGas Simulate/estimate gas
20868
21344
  * @returns {Promise<any>} Transaction
20869
21345
  */
20870
21346
  ;
@@ -20872,7 +21348,7 @@ var Pool = /*#__PURE__*/function () {
20872
21348
  _proto.setTrader =
20873
21349
  /*#__PURE__*/
20874
21350
  function () {
20875
- var _setTrader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee22(trader, options) {
21351
+ var _setTrader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee22(trader, options, estimateGas) {
20876
21352
  var tx;
20877
21353
  return runtime_1.wrap(function _callee22$(_context22) {
20878
21354
  while (1) {
@@ -20882,14 +21358,30 @@ var Pool = /*#__PURE__*/function () {
20882
21358
  options = null;
20883
21359
  }
20884
21360
 
20885
- _context22.next = 3;
21361
+ if (estimateGas === void 0) {
21362
+ estimateGas = false;
21363
+ }
21364
+
21365
+ if (!estimateGas) {
21366
+ _context22.next = 6;
21367
+ break;
21368
+ }
21369
+
21370
+ _context22.next = 5;
21371
+ return this.managerLogic.estimateGas.setTrader(trader, options);
21372
+
21373
+ case 5:
21374
+ return _context22.abrupt("return", _context22.sent);
21375
+
21376
+ case 6:
21377
+ _context22.next = 8;
20886
21378
  return this.managerLogic.setTrader(trader, options);
20887
21379
 
20888
- case 3:
21380
+ case 8:
20889
21381
  tx = _context22.sent;
20890
21382
  return _context22.abrupt("return", tx);
20891
21383
 
20892
- case 5:
21384
+ case 10:
20893
21385
  case "end":
20894
21386
  return _context22.stop();
20895
21387
  }
@@ -20897,7 +21389,7 @@ var Pool = /*#__PURE__*/function () {
20897
21389
  }, _callee22, this);
20898
21390
  }));
20899
21391
 
20900
- function setTrader(_x79, _x80) {
21392
+ function setTrader(_x99, _x100, _x101) {
20901
21393
  return _setTrader.apply(this, arguments);
20902
21394
  }
20903
21395
 
@@ -20909,6 +21401,7 @@ var Pool = /*#__PURE__*/function () {
20909
21401
  * @param {string[] | } assetsIn Array of balancer pool assets
20910
21402
  * @param {BigNumber[] | string[]} amountsIn Array of maximum amounts to provide to pool
20911
21403
  * @param {any} options Transaction options
21404
+ * @param {boolean} estimateGas Simulate/estimate gas
20912
21405
  * @returns {Promise<any>} Transaction
20913
21406
  */
20914
21407
  ;
@@ -20916,7 +21409,7 @@ var Pool = /*#__PURE__*/function () {
20916
21409
  _proto.joinBalancerPool =
20917
21410
  /*#__PURE__*/
20918
21411
  function () {
20919
- var _joinBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee23(poolId, assets, amountsIn, options) {
21412
+ var _joinBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee23(poolId, assets, amountsIn, options, estimateGas) {
20920
21413
  var joinPoolTxData, tx;
20921
21414
  return runtime_1.wrap(function _callee23$(_context23) {
20922
21415
  while (1) {
@@ -20926,15 +21419,19 @@ var Pool = /*#__PURE__*/function () {
20926
21419
  options = null;
20927
21420
  }
20928
21421
 
21422
+ if (estimateGas === void 0) {
21423
+ estimateGas = false;
21424
+ }
21425
+
20929
21426
  joinPoolTxData = this.utils.getBalancerJoinPoolTx(this, poolId, assets, amountsIn);
20930
- _context23.next = 4;
20931
- return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.BALANCER], joinPoolTxData, options);
21427
+ _context23.next = 5;
21428
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][exports.Dapp.BALANCER], joinPoolTxData, options], estimateGas);
20932
21429
 
20933
- case 4:
21430
+ case 5:
20934
21431
  tx = _context23.sent;
20935
21432
  return _context23.abrupt("return", tx);
20936
21433
 
20937
- case 6:
21434
+ case 7:
20938
21435
  case "end":
20939
21436
  return _context23.stop();
20940
21437
  }
@@ -20942,7 +21439,7 @@ var Pool = /*#__PURE__*/function () {
20942
21439
  }, _callee23, this);
20943
21440
  }));
20944
21441
 
20945
- function joinBalancerPool(_x81, _x82, _x83, _x84) {
21442
+ function joinBalancerPool(_x102, _x103, _x104, _x105, _x106) {
20946
21443
  return _joinBalancerPool.apply(this, arguments);
20947
21444
  }
20948
21445
 
@@ -20955,6 +21452,7 @@ var Pool = /*#__PURE__*/function () {
20955
21452
  * @param {BigNumber | string } amount Amount of pool tokens to withdraw
20956
21453
  * @param { null | number } singleExitAssetIndex Index of asset to withdraw to
20957
21454
  * @param {any} options Transaction options
21455
+ * @param {boolean} estimateGas Simulate/estimate gas
20958
21456
  * @returns {Promise<any>} Transaction
20959
21457
  */
20960
21458
  ;
@@ -20962,7 +21460,7 @@ var Pool = /*#__PURE__*/function () {
20962
21460
  _proto.exitBalancerPool =
20963
21461
  /*#__PURE__*/
20964
21462
  function () {
20965
- var _exitBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee24(poolId, assets, amount, singleExitAssetIndex, options) {
21463
+ var _exitBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee24(poolId, assets, amount, singleExitAssetIndex, options, estimateGas) {
20966
21464
  var exitPoolTxData, tx;
20967
21465
  return runtime_1.wrap(function _callee24$(_context24) {
20968
21466
  while (1) {
@@ -20976,15 +21474,19 @@ var Pool = /*#__PURE__*/function () {
20976
21474
  options = null;
20977
21475
  }
20978
21476
 
21477
+ if (estimateGas === void 0) {
21478
+ estimateGas = false;
21479
+ }
21480
+
20979
21481
  exitPoolTxData = this.utils.getBalancerExitPoolTx(this, poolId, assets, singleExitAssetIndex, amount);
20980
- _context24.next = 5;
20981
- return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.BALANCER], exitPoolTxData, options);
21482
+ _context24.next = 6;
21483
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][exports.Dapp.BALANCER], exitPoolTxData, options], estimateGas);
20982
21484
 
20983
- case 5:
21485
+ case 6:
20984
21486
  tx = _context24.sent;
20985
21487
  return _context24.abrupt("return", tx);
20986
21488
 
20987
- case 7:
21489
+ case 8:
20988
21490
  case "end":
20989
21491
  return _context24.stop();
20990
21492
  }
@@ -20992,7 +21494,7 @@ var Pool = /*#__PURE__*/function () {
20992
21494
  }, _callee24, this);
20993
21495
  }));
20994
21496
 
20995
- function exitBalancerPool(_x85, _x86, _x87, _x88, _x89) {
21497
+ function exitBalancerPool(_x107, _x108, _x109, _x110, _x111, _x112) {
20996
21498
  return _exitBalancerPool.apply(this, arguments);
20997
21499
  }
20998
21500
 
@@ -21002,6 +21504,7 @@ var Pool = /*#__PURE__*/function () {
21002
21504
  * Claim rewards from Aave platform
21003
21505
  * @param {string[]} assets Aave tokens (deposit/debt) hold by pool
21004
21506
  * @param {any} options Transaction options
21507
+ * @param {boolean} estimateGas Simulate/estimate gas
21005
21508
  * @returns {Promise<any>} Transaction
21006
21509
  */
21007
21510
  ;
@@ -21009,7 +21512,7 @@ var Pool = /*#__PURE__*/function () {
21009
21512
  _proto.harvestAaveRewards =
21010
21513
  /*#__PURE__*/
21011
21514
  function () {
21012
- var _harvestAaveRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee25(assets, options) {
21515
+ var _harvestAaveRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee25(assets, options, estimateGas) {
21013
21516
  var aaveIncentivesAddress, iAaveIncentivesController, aaveIncentivesController, amount, claimTxData, tx;
21014
21517
  return runtime_1.wrap(function _callee25$(_context25) {
21015
21518
  while (1) {
@@ -21019,23 +21522,27 @@ var Pool = /*#__PURE__*/function () {
21019
21522
  options = null;
21020
21523
  }
21021
21524
 
21525
+ if (estimateGas === void 0) {
21526
+ estimateGas = false;
21527
+ }
21528
+
21022
21529
  aaveIncentivesAddress = stakingAddress[this.network][exports.Dapp.AAVE];
21023
21530
  iAaveIncentivesController = new ethers.ethers.utils.Interface(IAaveIncentivesController.abi);
21024
21531
  aaveIncentivesController = new ethers.ethers.Contract(aaveIncentivesAddress, iAaveIncentivesController, this.signer);
21025
- _context25.next = 6;
21532
+ _context25.next = 7;
21026
21533
  return aaveIncentivesController.getUserUnclaimedRewards(this.address);
21027
21534
 
21028
- case 6:
21535
+ case 7:
21029
21536
  amount = _context25.sent;
21030
21537
  claimTxData = iAaveIncentivesController.encodeFunctionData(exports.Transaction.CLAIM_REWARDS, [assets, amount, this.address]);
21031
- _context25.next = 10;
21032
- return this.poolLogic.execTransaction(aaveIncentivesAddress, claimTxData, options);
21538
+ _context25.next = 11;
21539
+ return getPoolTxOrGasEstimate(this, [aaveIncentivesAddress, claimTxData, options], estimateGas);
21033
21540
 
21034
- case 10:
21541
+ case 11:
21035
21542
  tx = _context25.sent;
21036
21543
  return _context25.abrupt("return", tx);
21037
21544
 
21038
- case 12:
21545
+ case 13:
21039
21546
  case "end":
21040
21547
  return _context25.stop();
21041
21548
  }
@@ -21043,7 +21550,7 @@ var Pool = /*#__PURE__*/function () {
21043
21550
  }, _callee25, this);
21044
21551
  }));
21045
21552
 
21046
- function harvestAaveRewards(_x90, _x91) {
21553
+ function harvestAaveRewards(_x113, _x114, _x115) {
21047
21554
  return _harvestAaveRewards.apply(this, arguments);
21048
21555
  }
21049
21556
 
@@ -21054,6 +21561,7 @@ var Pool = /*#__PURE__*/function () {
21054
21561
  * @param {string[]} assets Assets invested in Aave
21055
21562
  * @param {string} rewardAssets Reward token address
21056
21563
  * @param {any} options Transaction options
21564
+ * @param {boolean} estimateGas Simulate/estimate gas
21057
21565
  * @returns {Promise<any>} Transaction
21058
21566
  */
21059
21567
  ;
@@ -21061,7 +21569,7 @@ var Pool = /*#__PURE__*/function () {
21061
21569
  _proto.harvestAaveV3Rewards =
21062
21570
  /*#__PURE__*/
21063
21571
  function () {
21064
- var _harvestAaveV3Rewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee26(assets, rewardAsset, options) {
21572
+ var _harvestAaveV3Rewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee26(assets, rewardAsset, options, estimateGas) {
21065
21573
  var claimTxData, tx;
21066
21574
  return runtime_1.wrap(function _callee26$(_context26) {
21067
21575
  while (1) {
@@ -21071,19 +21579,23 @@ var Pool = /*#__PURE__*/function () {
21071
21579
  options = null;
21072
21580
  }
21073
21581
 
21074
- _context26.next = 3;
21582
+ if (estimateGas === void 0) {
21583
+ estimateGas = false;
21584
+ }
21585
+
21586
+ _context26.next = 4;
21075
21587
  return getAaveV3ClaimTxData(this, assets, rewardAsset);
21076
21588
 
21077
- case 3:
21589
+ case 4:
21078
21590
  claimTxData = _context26.sent;
21079
- _context26.next = 6;
21080
- return this.poolLogic.execTransaction(stakingAddress[this.network][exports.Dapp.AAVEV3], claimTxData, options);
21591
+ _context26.next = 7;
21592
+ return getPoolTxOrGasEstimate(this, [stakingAddress[this.network][exports.Dapp.AAVEV3], claimTxData, options], estimateGas);
21081
21593
 
21082
- case 6:
21594
+ case 7:
21083
21595
  tx = _context26.sent;
21084
21596
  return _context26.abrupt("return", tx);
21085
21597
 
21086
- case 8:
21598
+ case 9:
21087
21599
  case "end":
21088
21600
  return _context26.stop();
21089
21601
  }
@@ -21091,7 +21603,7 @@ var Pool = /*#__PURE__*/function () {
21091
21603
  }, _callee26, this);
21092
21604
  }));
21093
21605
 
21094
- function harvestAaveV3Rewards(_x92, _x93, _x94) {
21606
+ function harvestAaveV3Rewards(_x116, _x117, _x118, _x119) {
21095
21607
  return _harvestAaveV3Rewards.apply(this, arguments);
21096
21608
  }
21097
21609
 
@@ -21109,6 +21621,7 @@ var Pool = /*#__PURE__*/function () {
21109
21621
  * @param { number } maxTick Upper tick range
21110
21622
  * @param { FeeAmount } feeAmount Fee tier (Low 0.05%, Medium 0.3%, High 1%)
21111
21623
  * @param {any} options Transaction options
21624
+ * @param {boolean} estimateGas Simulate/estimate gas
21112
21625
  * @returns {Promise<any>} Transaction
21113
21626
  */
21114
21627
  ;
@@ -21116,7 +21629,7 @@ var Pool = /*#__PURE__*/function () {
21116
21629
  _proto.addLiquidityUniswapV3 =
21117
21630
  /*#__PURE__*/
21118
21631
  function () {
21119
- var _addLiquidityUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee27(assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount, options) {
21632
+ var _addLiquidityUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee27(assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount, options, estimateGas) {
21120
21633
  var iNonfungiblePositionManager, mintTxParams, mintTxData, tx;
21121
21634
  return runtime_1.wrap(function _callee27$(_context27) {
21122
21635
  while (1) {
@@ -21126,29 +21639,33 @@ var Pool = /*#__PURE__*/function () {
21126
21639
  options = null;
21127
21640
  }
21128
21641
 
21642
+ if (estimateGas === void 0) {
21643
+ estimateGas = false;
21644
+ }
21645
+
21129
21646
  if (!((minPrice === null || maxPrice === null) && (minTick === null || maxTick === null))) {
21130
- _context27.next = 3;
21647
+ _context27.next = 4;
21131
21648
  break;
21132
21649
  }
21133
21650
 
21134
21651
  throw new Error("Need to provide price or tick range");
21135
21652
 
21136
- case 3:
21653
+ case 4:
21137
21654
  iNonfungiblePositionManager = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
21138
- _context27.next = 6;
21655
+ _context27.next = 7;
21139
21656
  return getUniswapV3MintParams(this, assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount);
21140
21657
 
21141
- case 6:
21658
+ case 7:
21142
21659
  mintTxParams = _context27.sent;
21143
21660
  mintTxData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.MINT, [mintTxParams]);
21144
- _context27.next = 10;
21145
- return this.poolLogic.execTransaction(nonfungiblePositionManagerAddress[this.network], mintTxData, options);
21661
+ _context27.next = 11;
21662
+ return getPoolTxOrGasEstimate(this, [nonfungiblePositionManagerAddress[this.network], mintTxData, options], estimateGas);
21146
21663
 
21147
- case 10:
21664
+ case 11:
21148
21665
  tx = _context27.sent;
21149
21666
  return _context27.abrupt("return", tx);
21150
21667
 
21151
- case 12:
21668
+ case 13:
21152
21669
  case "end":
21153
21670
  return _context27.stop();
21154
21671
  }
@@ -21156,7 +21673,7 @@ var Pool = /*#__PURE__*/function () {
21156
21673
  }, _callee27, this);
21157
21674
  }));
21158
21675
 
21159
- function addLiquidityUniswapV3(_x95, _x96, _x97, _x98, _x99, _x100, _x101, _x102, _x103, _x104) {
21676
+ function addLiquidityUniswapV3(_x120, _x121, _x122, _x123, _x124, _x125, _x126, _x127, _x128, _x129, _x130) {
21160
21677
  return _addLiquidityUniswapV.apply(this, arguments);
21161
21678
  }
21162
21679
 
@@ -21168,6 +21685,7 @@ var Pool = /*#__PURE__*/function () {
21168
21685
  * @param {string} tokenId Token Id of UniswapV3 position
21169
21686
  * @param {number} amount Amount in percent of assets to be removed
21170
21687
  * @param {any} options Transaction options
21688
+ * @param {boolean} estimateGas Simulate/estimate gas
21171
21689
  * @returns {Promise<any>} Transaction
21172
21690
  */
21173
21691
  ;
@@ -21175,7 +21693,7 @@ var Pool = /*#__PURE__*/function () {
21175
21693
  _proto.decreaseLiquidity =
21176
21694
  /*#__PURE__*/
21177
21695
  function () {
21178
- var _decreaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee28(dapp, tokenId, amount, options) {
21696
+ var _decreaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee28(dapp, tokenId, amount, options, estimateGas) {
21179
21697
  var txData, dappAddress, abi, liquidity, decreaseLiquidityTxData, collectTxData, multicallParams, burnTxData, _abi, _liquidity, tx;
21180
21698
 
21181
21699
  return runtime_1.wrap(function _callee28$(_context28) {
@@ -21190,26 +21708,30 @@ var Pool = /*#__PURE__*/function () {
21190
21708
  options = null;
21191
21709
  }
21192
21710
 
21711
+ if (estimateGas === void 0) {
21712
+ estimateGas = false;
21713
+ }
21714
+
21193
21715
  if (!(dapp === exports.Dapp.UNISWAPV3)) {
21194
- _context28.next = 24;
21716
+ _context28.next = 25;
21195
21717
  break;
21196
21718
  }
21197
21719
 
21198
21720
  dappAddress = nonfungiblePositionManagerAddress[this.network];
21199
21721
  abi = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
21200
- _context28.next = 7;
21722
+ _context28.next = 8;
21201
21723
  return getUniswapV3Liquidity(tokenId, this);
21202
21724
 
21203
- case 7:
21725
+ case 8:
21204
21726
  liquidity = _context28.sent.mul(Math.round(amount * 1e4)).div(1e6);
21205
21727
  _context28.t0 = abi;
21206
21728
  _context28.t1 = exports.Transaction.DECREASE_LIQUIDITY;
21207
21729
  _context28.t2 = tokenId;
21208
21730
  _context28.t3 = liquidity;
21209
- _context28.next = 14;
21731
+ _context28.next = 15;
21210
21732
  return getDeadline(this);
21211
21733
 
21212
- case 14:
21734
+ case 15:
21213
21735
  _context28.t4 = _context28.sent;
21214
21736
  _context28.t5 = [_context28.t2, _context28.t3, 0, 0, _context28.t4];
21215
21737
  _context28.t6 = [_context28.t5];
@@ -21223,38 +21745,38 @@ var Pool = /*#__PURE__*/function () {
21223
21745
  }
21224
21746
 
21225
21747
  txData = abi.encodeFunctionData(exports.Transaction.MULTI_CALL, [multicallParams]);
21226
- _context28.next = 34;
21748
+ _context28.next = 35;
21227
21749
  break;
21228
21750
 
21229
- case 24:
21751
+ case 25:
21230
21752
  if (!(dapp === exports.Dapp.ARRAKIS)) {
21231
- _context28.next = 33;
21753
+ _context28.next = 34;
21232
21754
  break;
21233
21755
  }
21234
21756
 
21235
21757
  dappAddress = routerAddress[this.network][dapp];
21236
21758
  _abi = new ethers.ethers.utils.Interface(IArrakisV1RouterStaking.abi);
21237
- _context28.next = 29;
21759
+ _context28.next = 30;
21238
21760
  return this.utils.getBalance(tokenId, this.address);
21239
21761
 
21240
- case 29:
21762
+ case 30:
21241
21763
  _liquidity = _context28.sent.mul(Math.round(amount * 1e4)).div(1e6);
21242
21764
  txData = _abi.encodeFunctionData(exports.Transaction.REMOVE_LIQUIDITY_UNSTAKE, [tokenId, _liquidity, 0, 0, this.address]);
21243
- _context28.next = 34;
21765
+ _context28.next = 35;
21244
21766
  break;
21245
21767
 
21246
- case 33:
21768
+ case 34:
21247
21769
  throw new Error("dapp not supported");
21248
21770
 
21249
- case 34:
21250
- _context28.next = 36;
21251
- return this.poolLogic.execTransaction(dappAddress, txData, options);
21771
+ case 35:
21772
+ _context28.next = 37;
21773
+ return getPoolTxOrGasEstimate(this, [dappAddress, txData, options], estimateGas);
21252
21774
 
21253
- case 36:
21775
+ case 37:
21254
21776
  tx = _context28.sent;
21255
21777
  return _context28.abrupt("return", tx);
21256
21778
 
21257
- case 38:
21779
+ case 39:
21258
21780
  case "end":
21259
21781
  return _context28.stop();
21260
21782
  }
@@ -21262,7 +21784,7 @@ var Pool = /*#__PURE__*/function () {
21262
21784
  }, _callee28, this);
21263
21785
  }));
21264
21786
 
21265
- function decreaseLiquidity(_x105, _x106, _x107, _x108) {
21787
+ function decreaseLiquidity(_x131, _x132, _x133, _x134, _x135) {
21266
21788
  return _decreaseLiquidity.apply(this, arguments);
21267
21789
  }
21268
21790
 
@@ -21275,6 +21797,7 @@ var Pool = /*#__PURE__*/function () {
21275
21797
  * @param {BigNumber | string} amountA Amount first asset
21276
21798
  * @param {BigNumber | string} amountB Amount second asset
21277
21799
  * @param {any} options Transaction options
21800
+ * @param {boolean} estimateGas Simulate/estimate gas
21278
21801
  * @returns {Promise<any>} Transaction
21279
21802
  */
21280
21803
  ;
@@ -21282,7 +21805,7 @@ var Pool = /*#__PURE__*/function () {
21282
21805
  _proto.increaseLiquidity =
21283
21806
  /*#__PURE__*/
21284
21807
  function () {
21285
- var _increaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee29(dapp, tokenId, amountA, amountB, options) {
21808
+ var _increaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee29(dapp, tokenId, amountA, amountB, options, estimateGas) {
21286
21809
  var txData, dappAddress, abi, _abi2, tx;
21287
21810
 
21288
21811
  return runtime_1.wrap(function _callee29$(_context29) {
@@ -21293,8 +21816,12 @@ var Pool = /*#__PURE__*/function () {
21293
21816
  options = null;
21294
21817
  }
21295
21818
 
21819
+ if (estimateGas === void 0) {
21820
+ estimateGas = false;
21821
+ }
21822
+
21296
21823
  if (!(dapp === exports.Dapp.UNISWAPV3)) {
21297
- _context29.next = 17;
21824
+ _context29.next = 18;
21298
21825
  break;
21299
21826
  }
21300
21827
 
@@ -21305,41 +21832,41 @@ var Pool = /*#__PURE__*/function () {
21305
21832
  _context29.t2 = tokenId;
21306
21833
  _context29.t3 = amountA;
21307
21834
  _context29.t4 = amountB;
21308
- _context29.next = 11;
21835
+ _context29.next = 12;
21309
21836
  return getDeadline(this);
21310
21837
 
21311
- case 11:
21838
+ case 12:
21312
21839
  _context29.t5 = _context29.sent;
21313
21840
  _context29.t6 = [_context29.t2, _context29.t3, _context29.t4, 0, 0, _context29.t5];
21314
21841
  _context29.t7 = [_context29.t6];
21315
21842
  txData = _context29.t0.encodeFunctionData.call(_context29.t0, _context29.t1, _context29.t7);
21316
- _context29.next = 24;
21843
+ _context29.next = 25;
21317
21844
  break;
21318
21845
 
21319
- case 17:
21846
+ case 18:
21320
21847
  if (!(dapp === exports.Dapp.ARRAKIS)) {
21321
- _context29.next = 23;
21848
+ _context29.next = 24;
21322
21849
  break;
21323
21850
  }
21324
21851
 
21325
21852
  dappAddress = routerAddress[this.network][dapp];
21326
21853
  _abi2 = new ethers.ethers.utils.Interface(IArrakisV1RouterStaking.abi);
21327
21854
  txData = _abi2.encodeFunctionData(exports.Transaction.ADD_LIQUIDITY_STAKE, [tokenId, amountA, amountB, 0, 0, 0, this.address]);
21328
- _context29.next = 24;
21855
+ _context29.next = 25;
21329
21856
  break;
21330
21857
 
21331
- case 23:
21858
+ case 24:
21332
21859
  throw new Error("dapp not supported");
21333
21860
 
21334
- case 24:
21335
- _context29.next = 26;
21336
- return this.poolLogic.execTransaction(dappAddress, txData, options);
21861
+ case 25:
21862
+ _context29.next = 27;
21863
+ return getPoolTxOrGasEstimate(this, [dappAddress, txData, options], estimateGas);
21337
21864
 
21338
- case 26:
21865
+ case 27:
21339
21866
  tx = _context29.sent;
21340
21867
  return _context29.abrupt("return", tx);
21341
21868
 
21342
- case 28:
21869
+ case 29:
21343
21870
  case "end":
21344
21871
  return _context29.stop();
21345
21872
  }
@@ -21347,7 +21874,7 @@ var Pool = /*#__PURE__*/function () {
21347
21874
  }, _callee29, this);
21348
21875
  }));
21349
21876
 
21350
- function increaseLiquidity(_x109, _x110, _x111, _x112, _x113) {
21877
+ function increaseLiquidity(_x136, _x137, _x138, _x139, _x140, _x141) {
21351
21878
  return _increaseLiquidity.apply(this, arguments);
21352
21879
  }
21353
21880
 
@@ -21358,6 +21885,7 @@ var Pool = /*#__PURE__*/function () {
21358
21885
  * @param {Dapp} dapp Platform either UniswapV3 or Arrakis
21359
21886
  * @param {string} tokenId Token Id of UniswapV3 or Gauge address
21360
21887
  * @param {any} options Transaction option
21888
+ * @param {boolean} estimateGas Simulate/estimate gas
21361
21889
  * @returns {Promise<any>} Transaction
21362
21890
  */
21363
21891
  ;
@@ -21365,7 +21893,7 @@ var Pool = /*#__PURE__*/function () {
21365
21893
  _proto.claimFees =
21366
21894
  /*#__PURE__*/
21367
21895
  function () {
21368
- var _claimFees = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee30(dapp, tokenId, options) {
21896
+ var _claimFees = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee30(dapp, tokenId, options, estimateGas) {
21369
21897
  var txData, contractAddress, iNonfungiblePositionManager, abi, tx;
21370
21898
  return runtime_1.wrap(function _callee30$(_context30) {
21371
21899
  while (1) {
@@ -21375,44 +21903,48 @@ var Pool = /*#__PURE__*/function () {
21375
21903
  options = null;
21376
21904
  }
21377
21905
 
21906
+ if (estimateGas === void 0) {
21907
+ estimateGas = false;
21908
+ }
21909
+
21378
21910
  _context30.t0 = dapp;
21379
- _context30.next = _context30.t0 === exports.Dapp.UNISWAPV3 ? 4 : _context30.t0 === exports.Dapp.ARRAKIS ? 8 : _context30.t0 === exports.Dapp.BALANCER ? 8 : _context30.t0 === exports.Dapp.VELODROME ? 12 : _context30.t0 === exports.Dapp.RAMSES ? 12 : _context30.t0 === exports.Dapp.VELODROMEV2 ? 15 : 18;
21911
+ _context30.next = _context30.t0 === exports.Dapp.UNISWAPV3 ? 5 : _context30.t0 === exports.Dapp.ARRAKIS ? 9 : _context30.t0 === exports.Dapp.BALANCER ? 9 : _context30.t0 === exports.Dapp.VELODROME ? 13 : _context30.t0 === exports.Dapp.RAMSES ? 13 : _context30.t0 === exports.Dapp.VELODROMEV2 ? 16 : 19;
21380
21912
  break;
21381
21913
 
21382
- case 4:
21914
+ case 5:
21383
21915
  contractAddress = nonfungiblePositionManagerAddress[this.network];
21384
21916
  iNonfungiblePositionManager = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
21385
21917
  txData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
21386
- return _context30.abrupt("break", 19);
21918
+ return _context30.abrupt("break", 20);
21387
21919
 
21388
- case 8:
21920
+ case 9:
21389
21921
  contractAddress = tokenId;
21390
21922
  abi = new ethers.ethers.utils.Interface(ILiquidityGaugeV4.abi);
21391
21923
  txData = abi.encodeFunctionData("claim_rewards()", []);
21392
- return _context30.abrupt("break", 19);
21924
+ return _context30.abrupt("break", 20);
21393
21925
 
21394
- case 12:
21926
+ case 13:
21395
21927
  contractAddress = tokenId;
21396
21928
  txData = getVelodromeClaimTxData(this, tokenId, false);
21397
- return _context30.abrupt("break", 19);
21929
+ return _context30.abrupt("break", 20);
21398
21930
 
21399
- case 15:
21931
+ case 16:
21400
21932
  contractAddress = tokenId;
21401
21933
  txData = getVelodromeClaimTxData(this, tokenId, true);
21402
- return _context30.abrupt("break", 19);
21934
+ return _context30.abrupt("break", 20);
21403
21935
 
21404
- case 18:
21936
+ case 19:
21405
21937
  throw new Error("dapp not supported");
21406
21938
 
21407
- case 19:
21408
- _context30.next = 21;
21409
- return this.poolLogic.execTransaction(contractAddress, txData, options);
21939
+ case 20:
21940
+ _context30.next = 22;
21941
+ return getPoolTxOrGasEstimate(this, [contractAddress, txData, options], estimateGas);
21410
21942
 
21411
- case 21:
21943
+ case 22:
21412
21944
  tx = _context30.sent;
21413
21945
  return _context30.abrupt("return", tx);
21414
21946
 
21415
- case 23:
21947
+ case 24:
21416
21948
  case "end":
21417
21949
  return _context30.stop();
21418
21950
  }
@@ -21420,7 +21952,7 @@ var Pool = /*#__PURE__*/function () {
21420
21952
  }, _callee30, this);
21421
21953
  }));
21422
21954
 
21423
- function claimFees(_x114, _x115, _x116) {
21955
+ function claimFees(_x142, _x143, _x144, _x145) {
21424
21956
  return _claimFees.apply(this, arguments);
21425
21957
  }
21426
21958
 
@@ -21435,6 +21967,7 @@ var Pool = /*#__PURE__*/function () {
21435
21967
  * @param { FeeAmount } feeAmount Fee tier (Low 0.05%, Medium 0.3%, High 1%)
21436
21968
  * @param {number} slippage Slippage tolerance in %
21437
21969
  * @param {any} options Transaction options
21970
+ * @param {boolean} estimateGas Simulate/estimate gas
21438
21971
  * @returns {Promise<any>} Transaction
21439
21972
  */
21440
21973
  ;
@@ -21442,7 +21975,7 @@ var Pool = /*#__PURE__*/function () {
21442
21975
  _proto.tradeUniswapV3 =
21443
21976
  /*#__PURE__*/
21444
21977
  function () {
21445
- var _tradeUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee31(assetFrom, assetTo, amountIn, feeAmount, slippage, options) {
21978
+ var _tradeUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee31(assetFrom, assetTo, amountIn, feeAmount, slippage, options, estimateGas) {
21446
21979
  var swapxData, tx;
21447
21980
  return runtime_1.wrap(function _callee31$(_context31) {
21448
21981
  while (1) {
@@ -21456,19 +21989,23 @@ var Pool = /*#__PURE__*/function () {
21456
21989
  options = null;
21457
21990
  }
21458
21991
 
21459
- _context31.next = 4;
21992
+ if (estimateGas === void 0) {
21993
+ estimateGas = false;
21994
+ }
21995
+
21996
+ _context31.next = 5;
21460
21997
  return getUniswapV3SwapTxData(this, assetFrom, assetTo, amountIn, slippage, feeAmount);
21461
21998
 
21462
- case 4:
21999
+ case 5:
21463
22000
  swapxData = _context31.sent;
21464
- _context31.next = 7;
21465
- return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.UNISWAPV3], swapxData, options);
22001
+ _context31.next = 8;
22002
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][exports.Dapp.UNISWAPV3], swapxData, options], estimateGas);
21466
22003
 
21467
- case 7:
22004
+ case 8:
21468
22005
  tx = _context31.sent;
21469
22006
  return _context31.abrupt("return", tx);
21470
22007
 
21471
- case 9:
22008
+ case 10:
21472
22009
  case "end":
21473
22010
  return _context31.stop();
21474
22011
  }
@@ -21476,7 +22013,7 @@ var Pool = /*#__PURE__*/function () {
21476
22013
  }, _callee31, this);
21477
22014
  }));
21478
22015
 
21479
- function tradeUniswapV3(_x117, _x118, _x119, _x120, _x121, _x122) {
22016
+ function tradeUniswapV3(_x146, _x147, _x148, _x149, _x150, _x151, _x152) {
21480
22017
  return _tradeUniswapV.apply(this, arguments);
21481
22018
  }
21482
22019
 
@@ -21490,6 +22027,7 @@ var Pool = /*#__PURE__*/function () {
21490
22027
  * @param {BigNumber | string} amountB Amount second asset
21491
22028
  * @param { boolean } isStable Is stable pool
21492
22029
  * @param {any} options Transaction options
22030
+ * @param {boolean} estimateGas Simulate/estimate gas
21493
22031
  * @returns {Promise<any>} Transaction
21494
22032
  */
21495
22033
  ;
@@ -21497,7 +22035,7 @@ var Pool = /*#__PURE__*/function () {
21497
22035
  _proto.addLiquidityVelodrome =
21498
22036
  /*#__PURE__*/
21499
22037
  function () {
21500
- var _addLiquidityVelodrome = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee32(assetA, assetB, amountA, amountB, isStable, options) {
22038
+ var _addLiquidityVelodrome = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee32(assetA, assetB, amountA, amountB, isStable, options, estimateGas) {
21501
22039
  var tx;
21502
22040
  return runtime_1.wrap(function _callee32$(_context32) {
21503
22041
  while (1) {
@@ -21507,22 +22045,29 @@ var Pool = /*#__PURE__*/function () {
21507
22045
  options = null;
21508
22046
  }
21509
22047
 
21510
- _context32.t0 = this.poolLogic;
21511
- _context32.t1 = routerAddress[this.network][exports.Dapp.VELODROME];
21512
- _context32.next = 5;
22048
+ if (estimateGas === void 0) {
22049
+ estimateGas = false;
22050
+ }
22051
+
22052
+ _context32.t0 = getPoolTxOrGasEstimate;
22053
+ _context32.t1 = this;
22054
+ _context32.t2 = routerAddress[this.network][exports.Dapp.VELODROME];
22055
+ _context32.next = 7;
21513
22056
  return getVelodromeAddLiquidityTxData(this, assetA, assetB, amountA, amountB, isStable);
21514
22057
 
21515
- case 5:
21516
- _context32.t2 = _context32.sent;
21517
- _context32.t3 = options;
21518
- _context32.next = 9;
21519
- return _context32.t0.execTransaction.call(_context32.t0, _context32.t1, _context32.t2, _context32.t3);
22058
+ case 7:
22059
+ _context32.t3 = _context32.sent;
22060
+ _context32.t4 = options;
22061
+ _context32.t5 = [_context32.t2, _context32.t3, _context32.t4];
22062
+ _context32.t6 = estimateGas;
22063
+ _context32.next = 13;
22064
+ return (0, _context32.t0)(_context32.t1, _context32.t5, _context32.t6);
21520
22065
 
21521
- case 9:
22066
+ case 13:
21522
22067
  tx = _context32.sent;
21523
22068
  return _context32.abrupt("return", tx);
21524
22069
 
21525
- case 11:
22070
+ case 15:
21526
22071
  case "end":
21527
22072
  return _context32.stop();
21528
22073
  }
@@ -21530,7 +22075,7 @@ var Pool = /*#__PURE__*/function () {
21530
22075
  }, _callee32, this);
21531
22076
  }));
21532
22077
 
21533
- function addLiquidityVelodrome(_x123, _x124, _x125, _x126, _x127, _x128) {
22078
+ function addLiquidityVelodrome(_x153, _x154, _x155, _x156, _x157, _x158, _x159) {
21534
22079
  return _addLiquidityVelodrome.apply(this, arguments);
21535
22080
  }
21536
22081
 
@@ -21543,6 +22088,7 @@ var Pool = /*#__PURE__*/function () {
21543
22088
  * @param {BigNumber | string} amount Amount of LP tokens
21544
22089
  * @param { boolean } isStable Is stable pool
21545
22090
  * @param {any} options Transaction options
22091
+ * @param {boolean} estimateGas Simulate/estimate gas
21546
22092
  * @returns {Promise<any>} Transaction
21547
22093
  */
21548
22094
  ;
@@ -21550,7 +22096,7 @@ var Pool = /*#__PURE__*/function () {
21550
22096
  _proto.removeLiquidityVelodrome =
21551
22097
  /*#__PURE__*/
21552
22098
  function () {
21553
- var _removeLiquidityVelodrome = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee33(assetA, assetB, amount, isStable, options) {
22099
+ var _removeLiquidityVelodrome = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee33(assetA, assetB, amount, isStable, options, estimateGas) {
21554
22100
  var tx;
21555
22101
  return runtime_1.wrap(function _callee33$(_context33) {
21556
22102
  while (1) {
@@ -21560,22 +22106,29 @@ var Pool = /*#__PURE__*/function () {
21560
22106
  options = null;
21561
22107
  }
21562
22108
 
21563
- _context33.t0 = this.poolLogic;
21564
- _context33.t1 = routerAddress[this.network][exports.Dapp.VELODROME];
21565
- _context33.next = 5;
22109
+ if (estimateGas === void 0) {
22110
+ estimateGas = false;
22111
+ }
22112
+
22113
+ _context33.t0 = getPoolTxOrGasEstimate;
22114
+ _context33.t1 = this;
22115
+ _context33.t2 = routerAddress[this.network][exports.Dapp.VELODROME];
22116
+ _context33.next = 7;
21566
22117
  return getVelodromeRemoveLiquidityTxData(this, assetA, assetB, amount, isStable);
21567
22118
 
21568
- case 5:
21569
- _context33.t2 = _context33.sent;
21570
- _context33.t3 = options;
21571
- _context33.next = 9;
21572
- return _context33.t0.execTransaction.call(_context33.t0, _context33.t1, _context33.t2, _context33.t3);
22119
+ case 7:
22120
+ _context33.t3 = _context33.sent;
22121
+ _context33.t4 = options;
22122
+ _context33.t5 = [_context33.t2, _context33.t3, _context33.t4];
22123
+ _context33.t6 = estimateGas;
22124
+ _context33.next = 13;
22125
+ return (0, _context33.t0)(_context33.t1, _context33.t5, _context33.t6);
21573
22126
 
21574
- case 9:
22127
+ case 13:
21575
22128
  tx = _context33.sent;
21576
22129
  return _context33.abrupt("return", tx);
21577
22130
 
21578
- case 11:
22131
+ case 15:
21579
22132
  case "end":
21580
22133
  return _context33.stop();
21581
22134
  }
@@ -21583,7 +22136,7 @@ var Pool = /*#__PURE__*/function () {
21583
22136
  }, _callee33, this);
21584
22137
  }));
21585
22138
 
21586
- function removeLiquidityVelodrome(_x129, _x130, _x131, _x132, _x133) {
22139
+ function removeLiquidityVelodrome(_x160, _x161, _x162, _x163, _x164, _x165) {
21587
22140
  return _removeLiquidityVelodrome.apply(this, arguments);
21588
22141
  }
21589
22142
 
@@ -21597,6 +22150,7 @@ var Pool = /*#__PURE__*/function () {
21597
22150
  * @param {BigNumber | string} amountB Amount second asset
21598
22151
  * @param { boolean } isStable Is stable pool
21599
22152
  * @param {any} options Transaction options
22153
+ * @param {boolean} estimateGas Simulate/estimate gas
21600
22154
  * @returns {Promise<any>} Transaction
21601
22155
  */
21602
22156
  ;
@@ -21604,7 +22158,7 @@ var Pool = /*#__PURE__*/function () {
21604
22158
  _proto.addLiquidityVelodromeV2 =
21605
22159
  /*#__PURE__*/
21606
22160
  function () {
21607
- var _addLiquidityVelodromeV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee34(assetA, assetB, amountA, amountB, isStable, options) {
22161
+ var _addLiquidityVelodromeV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee34(assetA, assetB, amountA, amountB, isStable, options, estimateGas) {
21608
22162
  var tx;
21609
22163
  return runtime_1.wrap(function _callee34$(_context34) {
21610
22164
  while (1) {
@@ -21614,22 +22168,29 @@ var Pool = /*#__PURE__*/function () {
21614
22168
  options = null;
21615
22169
  }
21616
22170
 
21617
- _context34.t0 = this.poolLogic;
21618
- _context34.t1 = routerAddress[this.network][exports.Dapp.VELODROMEV2];
21619
- _context34.next = 5;
22171
+ if (estimateGas === void 0) {
22172
+ estimateGas = false;
22173
+ }
22174
+
22175
+ _context34.t0 = getPoolTxOrGasEstimate;
22176
+ _context34.t1 = this;
22177
+ _context34.t2 = routerAddress[this.network][exports.Dapp.VELODROMEV2];
22178
+ _context34.next = 7;
21620
22179
  return getVelodromeAddLiquidityTxData(this, assetA, assetB, amountA, amountB, isStable);
21621
22180
 
21622
- case 5:
21623
- _context34.t2 = _context34.sent;
21624
- _context34.t3 = options;
21625
- _context34.next = 9;
21626
- return _context34.t0.execTransaction.call(_context34.t0, _context34.t1, _context34.t2, _context34.t3);
22181
+ case 7:
22182
+ _context34.t3 = _context34.sent;
22183
+ _context34.t4 = options;
22184
+ _context34.t5 = [_context34.t2, _context34.t3, _context34.t4];
22185
+ _context34.t6 = estimateGas;
22186
+ _context34.next = 13;
22187
+ return (0, _context34.t0)(_context34.t1, _context34.t5, _context34.t6);
21627
22188
 
21628
- case 9:
22189
+ case 13:
21629
22190
  tx = _context34.sent;
21630
22191
  return _context34.abrupt("return", tx);
21631
22192
 
21632
- case 11:
22193
+ case 15:
21633
22194
  case "end":
21634
22195
  return _context34.stop();
21635
22196
  }
@@ -21637,7 +22198,7 @@ var Pool = /*#__PURE__*/function () {
21637
22198
  }, _callee34, this);
21638
22199
  }));
21639
22200
 
21640
- function addLiquidityVelodromeV2(_x134, _x135, _x136, _x137, _x138, _x139) {
22201
+ function addLiquidityVelodromeV2(_x166, _x167, _x168, _x169, _x170, _x171, _x172) {
21641
22202
  return _addLiquidityVelodromeV.apply(this, arguments);
21642
22203
  }
21643
22204
 
@@ -21650,6 +22211,7 @@ var Pool = /*#__PURE__*/function () {
21650
22211
  * @param {BigNumber | string} amount Amount of LP tokens
21651
22212
  * @param { boolean } isStable Is stable pool
21652
22213
  * @param {any} options Transaction options
22214
+ * @param {boolean} estimateGas Simulate/estimate gas
21653
22215
  * @returns {Promise<any>} Transaction
21654
22216
  */
21655
22217
  ;
@@ -21657,7 +22219,7 @@ var Pool = /*#__PURE__*/function () {
21657
22219
  _proto.removeLiquidityVelodromeV2 =
21658
22220
  /*#__PURE__*/
21659
22221
  function () {
21660
- var _removeLiquidityVelodromeV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee35(assetA, assetB, amount, isStable, options) {
22222
+ var _removeLiquidityVelodromeV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee35(assetA, assetB, amount, isStable, options, estimateGas) {
21661
22223
  var tx;
21662
22224
  return runtime_1.wrap(function _callee35$(_context35) {
21663
22225
  while (1) {
@@ -21667,22 +22229,29 @@ var Pool = /*#__PURE__*/function () {
21667
22229
  options = null;
21668
22230
  }
21669
22231
 
21670
- _context35.t0 = this.poolLogic;
21671
- _context35.t1 = routerAddress[this.network][exports.Dapp.VELODROMEV2];
21672
- _context35.next = 5;
22232
+ if (estimateGas === void 0) {
22233
+ estimateGas = false;
22234
+ }
22235
+
22236
+ _context35.t0 = getPoolTxOrGasEstimate;
22237
+ _context35.t1 = this;
22238
+ _context35.t2 = routerAddress[this.network][exports.Dapp.VELODROMEV2];
22239
+ _context35.next = 7;
21673
22240
  return getVelodromeRemoveLiquidityTxData(this, assetA, assetB, amount, isStable);
21674
22241
 
21675
- case 5:
21676
- _context35.t2 = _context35.sent;
21677
- _context35.t3 = options;
21678
- _context35.next = 9;
21679
- return _context35.t0.execTransaction.call(_context35.t0, _context35.t1, _context35.t2, _context35.t3);
22242
+ case 7:
22243
+ _context35.t3 = _context35.sent;
22244
+ _context35.t4 = options;
22245
+ _context35.t5 = [_context35.t2, _context35.t3, _context35.t4];
22246
+ _context35.t6 = estimateGas;
22247
+ _context35.next = 13;
22248
+ return (0, _context35.t0)(_context35.t1, _context35.t5, _context35.t6);
21680
22249
 
21681
- case 9:
22250
+ case 13:
21682
22251
  tx = _context35.sent;
21683
22252
  return _context35.abrupt("return", tx);
21684
22253
 
21685
- case 11:
22254
+ case 15:
21686
22255
  case "end":
21687
22256
  return _context35.stop();
21688
22257
  }
@@ -21690,7 +22259,7 @@ var Pool = /*#__PURE__*/function () {
21690
22259
  }, _callee35, this);
21691
22260
  }));
21692
22261
 
21693
- function removeLiquidityVelodromeV2(_x140, _x141, _x142, _x143, _x144) {
22262
+ function removeLiquidityVelodromeV2(_x173, _x174, _x175, _x176, _x177, _x178) {
21694
22263
  return _removeLiquidityVelodromeV.apply(this, arguments);
21695
22264
  }
21696
22265
 
@@ -21705,6 +22274,7 @@ var Pool = /*#__PURE__*/function () {
21705
22274
  * @param {BigNumber | string} amountB Amount second asset
21706
22275
  * @param { boolean } isStable Is stable pool
21707
22276
  * @param {any} options Transaction options
22277
+ * @param {boolean} estimateGas Simulate/estimate gas
21708
22278
  * @returns {Promise<any>} Transaction
21709
22279
  */
21710
22280
  ;
@@ -21712,7 +22282,7 @@ var Pool = /*#__PURE__*/function () {
21712
22282
  _proto.addLiquidityV2 =
21713
22283
  /*#__PURE__*/
21714
22284
  function () {
21715
- var _addLiquidityV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee36(dapp, assetA, assetB, amountA, amountB, isStable, options) {
22285
+ var _addLiquidityV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee36(dapp, assetA, assetB, amountA, amountB, isStable, options, estimateGas) {
21716
22286
  var tx;
21717
22287
  return runtime_1.wrap(function _callee36$(_context36) {
21718
22288
  while (1) {
@@ -21722,22 +22292,29 @@ var Pool = /*#__PURE__*/function () {
21722
22292
  options = null;
21723
22293
  }
21724
22294
 
21725
- _context36.t0 = this.poolLogic;
21726
- _context36.t1 = routerAddress[this.network][dapp];
21727
- _context36.next = 5;
22295
+ if (estimateGas === void 0) {
22296
+ estimateGas = false;
22297
+ }
22298
+
22299
+ _context36.t0 = getPoolTxOrGasEstimate;
22300
+ _context36.t1 = this;
22301
+ _context36.t2 = routerAddress[this.network][dapp];
22302
+ _context36.next = 7;
21728
22303
  return getVelodromeAddLiquidityTxData(this, assetA, assetB, amountA, amountB, isStable);
21729
22304
 
21730
- case 5:
21731
- _context36.t2 = _context36.sent;
21732
- _context36.t3 = options;
21733
- _context36.next = 9;
21734
- return _context36.t0.execTransaction.call(_context36.t0, _context36.t1, _context36.t2, _context36.t3);
22305
+ case 7:
22306
+ _context36.t3 = _context36.sent;
22307
+ _context36.t4 = options;
22308
+ _context36.t5 = [_context36.t2, _context36.t3, _context36.t4];
22309
+ _context36.t6 = estimateGas;
22310
+ _context36.next = 13;
22311
+ return (0, _context36.t0)(_context36.t1, _context36.t5, _context36.t6);
21735
22312
 
21736
- case 9:
22313
+ case 13:
21737
22314
  tx = _context36.sent;
21738
22315
  return _context36.abrupt("return", tx);
21739
22316
 
21740
- case 11:
22317
+ case 15:
21741
22318
  case "end":
21742
22319
  return _context36.stop();
21743
22320
  }
@@ -21745,7 +22322,7 @@ var Pool = /*#__PURE__*/function () {
21745
22322
  }, _callee36, this);
21746
22323
  }));
21747
22324
 
21748
- function addLiquidityV2(_x145, _x146, _x147, _x148, _x149, _x150, _x151) {
22325
+ function addLiquidityV2(_x179, _x180, _x181, _x182, _x183, _x184, _x185, _x186) {
21749
22326
  return _addLiquidityV.apply(this, arguments);
21750
22327
  }
21751
22328
 
@@ -21759,6 +22336,7 @@ var Pool = /*#__PURE__*/function () {
21759
22336
  * @param {BigNumber | string} amount Amount of LP tokens
21760
22337
  * @param { boolean } isStable Is stable pool
21761
22338
  * @param {any} options Transaction options
22339
+ * @param {boolean} estimateGas Simulate/estimate gas
21762
22340
  * @returns {Promise<any>} Transaction
21763
22341
  */
21764
22342
  ;
@@ -21766,7 +22344,7 @@ var Pool = /*#__PURE__*/function () {
21766
22344
  _proto.removeLiquidityV2 =
21767
22345
  /*#__PURE__*/
21768
22346
  function () {
21769
- var _removeLiquidityV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee37(dapp, assetA, assetB, amount, isStable, options) {
22347
+ var _removeLiquidityV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee37(dapp, assetA, assetB, amount, isStable, options, estimateGas) {
21770
22348
  var tx;
21771
22349
  return runtime_1.wrap(function _callee37$(_context37) {
21772
22350
  while (1) {
@@ -21776,22 +22354,29 @@ var Pool = /*#__PURE__*/function () {
21776
22354
  options = null;
21777
22355
  }
21778
22356
 
21779
- _context37.t0 = this.poolLogic;
21780
- _context37.t1 = routerAddress[this.network][dapp];
21781
- _context37.next = 5;
22357
+ if (estimateGas === void 0) {
22358
+ estimateGas = false;
22359
+ }
22360
+
22361
+ _context37.t0 = getPoolTxOrGasEstimate;
22362
+ _context37.t1 = this;
22363
+ _context37.t2 = routerAddress[this.network][dapp];
22364
+ _context37.next = 7;
21782
22365
  return getVelodromeRemoveLiquidityTxData(this, assetA, assetB, amount, isStable);
21783
22366
 
21784
- case 5:
21785
- _context37.t2 = _context37.sent;
21786
- _context37.t3 = options;
21787
- _context37.next = 9;
21788
- return _context37.t0.execTransaction.call(_context37.t0, _context37.t1, _context37.t2, _context37.t3);
22367
+ case 7:
22368
+ _context37.t3 = _context37.sent;
22369
+ _context37.t4 = options;
22370
+ _context37.t5 = [_context37.t2, _context37.t3, _context37.t4];
22371
+ _context37.t6 = estimateGas;
22372
+ _context37.next = 13;
22373
+ return (0, _context37.t0)(_context37.t1, _context37.t5, _context37.t6);
21789
22374
 
21790
- case 9:
22375
+ case 13:
21791
22376
  tx = _context37.sent;
21792
22377
  return _context37.abrupt("return", tx);
21793
22378
 
21794
- case 11:
22379
+ case 15:
21795
22380
  case "end":
21796
22381
  return _context37.stop();
21797
22382
  }
@@ -21799,7 +22384,7 @@ var Pool = /*#__PURE__*/function () {
21799
22384
  }, _callee37, this);
21800
22385
  }));
21801
22386
 
21802
- function removeLiquidityV2(_x152, _x153, _x154, _x155, _x156, _x157) {
22387
+ function removeLiquidityV2(_x187, _x188, _x189, _x190, _x191, _x192, _x193) {
21803
22388
  return _removeLiquidityV.apply(this, arguments);
21804
22389
  }
21805
22390
 
@@ -21817,6 +22402,7 @@ var Pool = /*#__PURE__*/function () {
21817
22402
  * @param {BigNumber | string } collateralChangeAmount Collateral amount to add when shorting options and to remove when covering shorts
21818
22403
  * @param {boolean} isCoveredCall Selling covered call options
21819
22404
  * @param {any} options Transaction options
22405
+ * @param {boolean} estimateGas Simulate/estimate gas
21820
22406
  * @returns {Promise<any>} Transaction
21821
22407
  */
21822
22408
  ;
@@ -21824,7 +22410,7 @@ var Pool = /*#__PURE__*/function () {
21824
22410
  _proto.tradeLyraOption =
21825
22411
  /*#__PURE__*/
21826
22412
  function () {
21827
- var _tradeLyraOption = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee38(market, expiry, strike, optionType, tradeType, optionAmount, assetIn, collateralChangeAmount, isCoveredCall, options) {
22413
+ var _tradeLyraOption = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee38(market, expiry, strike, optionType, tradeType, optionAmount, assetIn, collateralChangeAmount, isCoveredCall, options, estimateGas) {
21828
22414
  var swapxData, tx;
21829
22415
  return runtime_1.wrap(function _callee38$(_context38) {
21830
22416
  while (1) {
@@ -21842,19 +22428,23 @@ var Pool = /*#__PURE__*/function () {
21842
22428
  options = null;
21843
22429
  }
21844
22430
 
21845
- _context38.next = 5;
22431
+ if (estimateGas === void 0) {
22432
+ estimateGas = false;
22433
+ }
22434
+
22435
+ _context38.next = 6;
21846
22436
  return getLyraOptionTxData(this, market, optionType, expiry, strike, tradeType, optionAmount, assetIn, ethers.BigNumber.from(collateralChangeAmount), isCoveredCall);
21847
22437
 
21848
- case 5:
22438
+ case 6:
21849
22439
  swapxData = _context38.sent;
21850
- _context38.next = 8;
21851
- return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.LYRA], swapxData, options);
22440
+ _context38.next = 9;
22441
+ return getPoolTxOrGasEstimate(this, [routerAddress[this.network][exports.Dapp.LYRA], swapxData, options], estimateGas);
21852
22442
 
21853
- case 8:
22443
+ case 9:
21854
22444
  tx = _context38.sent;
21855
22445
  return _context38.abrupt("return", tx);
21856
22446
 
21857
- case 10:
22447
+ case 11:
21858
22448
  case "end":
21859
22449
  return _context38.stop();
21860
22450
  }
@@ -21862,7 +22452,7 @@ var Pool = /*#__PURE__*/function () {
21862
22452
  }, _callee38, this);
21863
22453
  }));
21864
22454
 
21865
- function tradeLyraOption(_x158, _x159, _x160, _x161, _x162, _x163, _x164, _x165, _x166, _x167) {
22455
+ function tradeLyraOption(_x194, _x195, _x196, _x197, _x198, _x199, _x200, _x201, _x202, _x203, _x204) {
21866
22456
  return _tradeLyraOption.apply(this, arguments);
21867
22457
  }
21868
22458
 
@@ -21896,7 +22486,7 @@ var Pool = /*#__PURE__*/function () {
21896
22486
  }, _callee39, this);
21897
22487
  }));
21898
22488
 
21899
- function getLyraPositions(_x168) {
22489
+ function getLyraPositions(_x205) {
21900
22490
  return _getLyraPositions.apply(this, arguments);
21901
22491
  }
21902
22492
 
@@ -21907,6 +22497,7 @@ var Pool = /*#__PURE__*/function () {
21907
22497
  * @param {string} market Address of futures market
21908
22498
  * @param {BigNumber | string } changeAmount Amount to increase/decrease margin
21909
22499
  * @param {any} options Transaction options
22500
+ * @param {boolean} estimateGas Simulate/estimate gas
21910
22501
  * @returns {Promise<any>} Transaction
21911
22502
  */
21912
22503
  ;
@@ -21914,7 +22505,7 @@ var Pool = /*#__PURE__*/function () {
21914
22505
  _proto.changeFuturesMargin =
21915
22506
  /*#__PURE__*/
21916
22507
  function () {
21917
- var _changeFuturesMargin = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee40(market, changeAmount, options) {
22508
+ var _changeFuturesMargin = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee40(market, changeAmount, options, estimateGas) {
21918
22509
  var tx;
21919
22510
  return runtime_1.wrap(function _callee40$(_context40) {
21920
22511
  while (1) {
@@ -21924,14 +22515,18 @@ var Pool = /*#__PURE__*/function () {
21924
22515
  options = null;
21925
22516
  }
21926
22517
 
21927
- _context40.next = 3;
21928
- return this.poolLogic.execTransaction(market, getFuturesChangeMarginTxData(changeAmount), options);
22518
+ if (estimateGas === void 0) {
22519
+ estimateGas = false;
22520
+ }
22521
+
22522
+ _context40.next = 4;
22523
+ return getPoolTxOrGasEstimate(this, [market, getFuturesChangeMarginTxData(changeAmount), options], estimateGas);
21929
22524
 
21930
- case 3:
22525
+ case 4:
21931
22526
  tx = _context40.sent;
21932
22527
  return _context40.abrupt("return", tx);
21933
22528
 
21934
- case 5:
22529
+ case 6:
21935
22530
  case "end":
21936
22531
  return _context40.stop();
21937
22532
  }
@@ -21939,7 +22534,7 @@ var Pool = /*#__PURE__*/function () {
21939
22534
  }, _callee40, this);
21940
22535
  }));
21941
22536
 
21942
- function changeFuturesMargin(_x169, _x170, _x171) {
22537
+ function changeFuturesMargin(_x206, _x207, _x208, _x209) {
21943
22538
  return _changeFuturesMargin.apply(this, arguments);
21944
22539
  }
21945
22540
 
@@ -21950,6 +22545,7 @@ var Pool = /*#__PURE__*/function () {
21950
22545
  * @param {string} market Address of futures market
21951
22546
  * @param {BigNumber | string } changeAmount Negative for short, positive for long
21952
22547
  * @param {any} options Transaction options
22548
+ * @param {boolean} estimateGas Simulate/estimate gas
21953
22549
  * @returns {Promise<any>} Transaction
21954
22550
  */
21955
22551
  ;
@@ -21957,7 +22553,7 @@ var Pool = /*#__PURE__*/function () {
21957
22553
  _proto.changeFuturesPosition =
21958
22554
  /*#__PURE__*/
21959
22555
  function () {
21960
- var _changeFuturesPosition = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee41(market, changeAmount, options) {
22556
+ var _changeFuturesPosition = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee41(market, changeAmount, options, estimateGas) {
21961
22557
  var txData, tx;
21962
22558
  return runtime_1.wrap(function _callee41$(_context41) {
21963
22559
  while (1) {
@@ -21967,19 +22563,23 @@ var Pool = /*#__PURE__*/function () {
21967
22563
  options = null;
21968
22564
  }
21969
22565
 
21970
- _context41.next = 3;
22566
+ if (estimateGas === void 0) {
22567
+ estimateGas = false;
22568
+ }
22569
+
22570
+ _context41.next = 4;
21971
22571
  return getFuturesChangePositionTxData(changeAmount, market, this);
21972
22572
 
21973
- case 3:
22573
+ case 4:
21974
22574
  txData = _context41.sent;
21975
- _context41.next = 6;
21976
- return this.poolLogic.execTransaction(market, txData, options);
22575
+ _context41.next = 7;
22576
+ return getPoolTxOrGasEstimate(this, [market, txData, options], estimateGas);
21977
22577
 
21978
- case 6:
22578
+ case 7:
21979
22579
  tx = _context41.sent;
21980
22580
  return _context41.abrupt("return", tx);
21981
22581
 
21982
- case 8:
22582
+ case 9:
21983
22583
  case "end":
21984
22584
  return _context41.stop();
21985
22585
  }
@@ -21987,7 +22587,7 @@ var Pool = /*#__PURE__*/function () {
21987
22587
  }, _callee41, this);
21988
22588
  }));
21989
22589
 
21990
- function changeFuturesPosition(_x172, _x173, _x174) {
22590
+ function changeFuturesPosition(_x210, _x211, _x212, _x213) {
21991
22591
  return _changeFuturesPosition.apply(this, arguments);
21992
22592
  }
21993
22593
 
@@ -21997,6 +22597,7 @@ var Pool = /*#__PURE__*/function () {
21997
22597
  *
21998
22598
  * @param {string} market Address of futures market
21999
22599
  * @param {any} options Transaction options
22600
+ * @param {boolean} estimateGas Simulate/estimate gas
22000
22601
  * @returns {Promise<any>} Transaction
22001
22602
  */
22002
22603
  ;
@@ -22004,7 +22605,7 @@ var Pool = /*#__PURE__*/function () {
22004
22605
  _proto.cancelFuturesOrder =
22005
22606
  /*#__PURE__*/
22006
22607
  function () {
22007
- var _cancelFuturesOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee42(market, options) {
22608
+ var _cancelFuturesOrder = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee42(market, options, estimateGas) {
22008
22609
  var txData, tx;
22009
22610
  return runtime_1.wrap(function _callee42$(_context42) {
22010
22611
  while (1) {
@@ -22014,19 +22615,23 @@ var Pool = /*#__PURE__*/function () {
22014
22615
  options = null;
22015
22616
  }
22016
22617
 
22017
- _context42.next = 3;
22618
+ if (estimateGas === void 0) {
22619
+ estimateGas = false;
22620
+ }
22621
+
22622
+ _context42.next = 4;
22018
22623
  return getFuturesCancelOrderTxData(this);
22019
22624
 
22020
- case 3:
22625
+ case 4:
22021
22626
  txData = _context42.sent;
22022
- _context42.next = 6;
22023
- return this.poolLogic.execTransaction(market, txData, options);
22627
+ _context42.next = 7;
22628
+ return getPoolTxOrGasEstimate(this, [market, txData, options], estimateGas);
22024
22629
 
22025
- case 6:
22630
+ case 7:
22026
22631
  tx = _context42.sent;
22027
22632
  return _context42.abrupt("return", tx);
22028
22633
 
22029
- case 8:
22634
+ case 9:
22030
22635
  case "end":
22031
22636
  return _context42.stop();
22032
22637
  }
@@ -22034,7 +22639,7 @@ var Pool = /*#__PURE__*/function () {
22034
22639
  }, _callee42, this);
22035
22640
  }));
22036
22641
 
22037
- function cancelFuturesOrder(_x175, _x176) {
22642
+ function cancelFuturesOrder(_x214, _x215, _x216) {
22038
22643
  return _cancelFuturesOrder.apply(this, arguments);
22039
22644
  }
22040
22645
 
@@ -22043,6 +22648,7 @@ var Pool = /*#__PURE__*/function () {
22043
22648
  /**
22044
22649
  * mintManagerFee
22045
22650
  * @param {any} options Transaction options
22651
+ * @param {boolean} estimateGas Simulate/estimate gas
22046
22652
  * @returns {Promise<any>} Transaction
22047
22653
  */
22048
22654
  ;
@@ -22050,7 +22656,7 @@ var Pool = /*#__PURE__*/function () {
22050
22656
  _proto.mintManagerFee =
22051
22657
  /*#__PURE__*/
22052
22658
  function () {
22053
- var _mintManagerFee = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee43(options) {
22659
+ var _mintManagerFee = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee43(options, estimateGas) {
22054
22660
  var tx;
22055
22661
  return runtime_1.wrap(function _callee43$(_context43) {
22056
22662
  while (1) {
@@ -22060,14 +22666,30 @@ var Pool = /*#__PURE__*/function () {
22060
22666
  options = null;
22061
22667
  }
22062
22668
 
22063
- _context43.next = 3;
22669
+ if (estimateGas === void 0) {
22670
+ estimateGas = false;
22671
+ }
22672
+
22673
+ if (!estimateGas) {
22674
+ _context43.next = 6;
22675
+ break;
22676
+ }
22677
+
22678
+ _context43.next = 5;
22679
+ return this.poolLogic.estimateGas.mintManagerFee(options);
22680
+
22681
+ case 5:
22682
+ return _context43.abrupt("return", _context43.sent);
22683
+
22684
+ case 6:
22685
+ _context43.next = 8;
22064
22686
  return this.poolLogic.mintManagerFee(options);
22065
22687
 
22066
- case 3:
22688
+ case 8:
22067
22689
  tx = _context43.sent;
22068
22690
  return _context43.abrupt("return", tx);
22069
22691
 
22070
- case 5:
22692
+ case 10:
22071
22693
  case "end":
22072
22694
  return _context43.stop();
22073
22695
  }
@@ -22075,7 +22697,7 @@ var Pool = /*#__PURE__*/function () {
22075
22697
  }, _callee43, this);
22076
22698
  }));
22077
22699
 
22078
- function mintManagerFee(_x177) {
22700
+ function mintManagerFee(_x217, _x218) {
22079
22701
  return _mintManagerFee.apply(this, arguments);
22080
22702
  }
22081
22703
 
@@ -22122,6 +22744,7 @@ var Pool = /*#__PURE__*/function () {
22122
22744
  * @param {string} tokenAddress Address of the token to vest
22123
22745
  * @param {BigNumber | string } changeAmount Negative for short, positive for long
22124
22746
  * @param {any} options Transaction options
22747
+ * @param {boolean} estimateGas Simulate/estimate gas
22125
22748
  * @returns {Promise<any>} Transaction
22126
22749
  */
22127
22750
  ;
@@ -22129,7 +22752,7 @@ var Pool = /*#__PURE__*/function () {
22129
22752
  _proto.vestTokens =
22130
22753
  /*#__PURE__*/
22131
22754
  function () {
22132
- var _vestTokens = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee45(tokenAddress, amount, options) {
22755
+ var _vestTokens = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee45(tokenAddress, amount, options, estimateGas) {
22133
22756
  var txData, tx;
22134
22757
  return runtime_1.wrap(function _callee45$(_context45) {
22135
22758
  while (1) {
@@ -22139,19 +22762,23 @@ var Pool = /*#__PURE__*/function () {
22139
22762
  options = null;
22140
22763
  }
22141
22764
 
22142
- _context45.next = 3;
22765
+ if (estimateGas === void 0) {
22766
+ estimateGas = false;
22767
+ }
22768
+
22769
+ _context45.next = 4;
22143
22770
  return getCreateVestTxData(amount);
22144
22771
 
22145
- case 3:
22772
+ case 4:
22146
22773
  txData = _context45.sent;
22147
- _context45.next = 6;
22148
- return this.poolLogic.execTransaction(tokenAddress, txData, options);
22774
+ _context45.next = 7;
22775
+ return getPoolTxOrGasEstimate(this, [tokenAddress, txData, options], estimateGas);
22149
22776
 
22150
- case 6:
22777
+ case 7:
22151
22778
  tx = _context45.sent;
22152
22779
  return _context45.abrupt("return", tx);
22153
22780
 
22154
- case 8:
22781
+ case 9:
22155
22782
  case "end":
22156
22783
  return _context45.stop();
22157
22784
  }
@@ -22159,7 +22786,7 @@ var Pool = /*#__PURE__*/function () {
22159
22786
  }, _callee45, this);
22160
22787
  }));
22161
22788
 
22162
- function vestTokens(_x178, _x179, _x180) {
22789
+ function vestTokens(_x219, _x220, _x221, _x222) {
22163
22790
  return _vestTokens.apply(this, arguments);
22164
22791
  }
22165
22792
 
@@ -22170,6 +22797,7 @@ var Pool = /*#__PURE__*/function () {
22170
22797
  * @param {string} tokenAddress Address of the token to vest
22171
22798
  * @param {number } id position Id of the vested tokens
22172
22799
  * @param {any} options Transaction options
22800
+ * @param {boolean} estimateGas Simulate/estimate gas
22173
22801
  * @returns {Promise<any>} Transaction
22174
22802
  */
22175
22803
  ;
@@ -22177,7 +22805,7 @@ var Pool = /*#__PURE__*/function () {
22177
22805
  _proto.exitVestedToken =
22178
22806
  /*#__PURE__*/
22179
22807
  function () {
22180
- var _exitVestedToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee46(tokenAddress, id, options) {
22808
+ var _exitVestedToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee46(tokenAddress, id, options, estimateGas) {
22181
22809
  var txData, tx;
22182
22810
  return runtime_1.wrap(function _callee46$(_context46) {
22183
22811
  while (1) {
@@ -22187,19 +22815,23 @@ var Pool = /*#__PURE__*/function () {
22187
22815
  options = null;
22188
22816
  }
22189
22817
 
22190
- _context46.next = 3;
22818
+ if (estimateGas === void 0) {
22819
+ estimateGas = false;
22820
+ }
22821
+
22822
+ _context46.next = 4;
22191
22823
  return getExitVestTxData(id);
22192
22824
 
22193
- case 3:
22825
+ case 4:
22194
22826
  txData = _context46.sent;
22195
- _context46.next = 6;
22196
- return this.poolLogic.execTransaction(tokenAddress, txData, options);
22827
+ _context46.next = 7;
22828
+ return getPoolTxOrGasEstimate(this, [tokenAddress, txData, options], estimateGas);
22197
22829
 
22198
- case 6:
22830
+ case 7:
22199
22831
  tx = _context46.sent;
22200
22832
  return _context46.abrupt("return", tx);
22201
22833
 
22202
- case 8:
22834
+ case 9:
22203
22835
  case "end":
22204
22836
  return _context46.stop();
22205
22837
  }
@@ -22207,7 +22839,7 @@ var Pool = /*#__PURE__*/function () {
22207
22839
  }, _callee46, this);
22208
22840
  }));
22209
22841
 
22210
- function exitVestedToken(_x181, _x182, _x183) {
22842
+ function exitVestedToken(_x223, _x224, _x225, _x226) {
22211
22843
  return _exitVestedToken.apply(this, arguments);
22212
22844
  }
22213
22845