@dhedge/v2-sdk 1.3.0 → 1.4.2

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.
@@ -9,7 +9,7 @@ var axios = _interopDefault(require('axios'));
9
9
  var lodash = require('lodash');
10
10
  var address = require('@ethersproject/address');
11
11
  require('lodash/set');
12
- var abi$g = require('@ethersproject/abi');
12
+ var abi$j = require('@ethersproject/abi');
13
13
  var BigNumber = _interopDefault(require('bignumber.js'));
14
14
  var web3Utils = require('web3-utils');
15
15
  var ethereumjsUtil = require('ethereumjs-util');
@@ -3838,6 +3838,8 @@ var ManagerLogic = {
3838
3838
  Dapp["BALANCER"] = "balancer";
3839
3839
  Dapp["UNISWAPV3"] = "uniswapV3";
3840
3840
  Dapp["SYNTHETIX"] = "synthetix";
3841
+ Dapp["AAVEV3"] = "aavev3";
3842
+ Dapp["ARRAKIS"] = "arrakis";
3841
3843
  })(exports.Dapp || (exports.Dapp = {}));
3842
3844
 
3843
3845
  (function (Transaction) {
@@ -3858,6 +3860,8 @@ var ManagerLogic = {
3858
3860
  Transaction["MINT"] = "mint";
3859
3861
  Transaction["BURN"] = "burn";
3860
3862
  Transaction["SWAP_SYNTHS"] = "exchangeWithTracking";
3863
+ Transaction["ADD_LIQUIDITY_STAKE"] = "addLiquidityAndStake";
3864
+ Transaction["REMOVE_LIQUIDITY_UNSTAKE"] = "removeLiquidityAndUnstake";
3861
3865
  })(exports.Transaction || (exports.Transaction = {}));
3862
3866
 
3863
3867
  var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _routerAddress, _Network$POLYGON2, _dappFactoryAddress, _Network$POLYGON3, _stakingAddress, _nonfungiblePositionM, _networkChainIdMap, _balancerSubgraph, _multiCallAddress;
@@ -3865,7 +3869,7 @@ var _factoryAddress, _Network$POLYGON, _Network$OPTIMISM, _routerAddress, _Netwo
3865
3869
  require("dotenv").config();
3866
3870
 
3867
3871
  var factoryAddress = (_factoryAddress = {}, _factoryAddress[exports.Network.POLYGON] = process.env.STAGING_CONTRACTS ? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53" : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", _factoryAddress[exports.Network.OPTIMISM] = "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", _factoryAddress);
3868
- 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.ONEINCH] = "0x1111111254fb6c44bac0bed2854e76f90643097d", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON), _routerAddress[exports.Network.OPTIMISM] = (_Network$OPTIMISM = {}, _Network$OPTIMISM[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$OPTIMISM[exports.Dapp.SYNTHETIX] = "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", _Network$OPTIMISM), _routerAddress);
3872
+ 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] = "0x1111111254fb6c44bac0bed2854e76f90643097d", _Network$POLYGON[exports.Dapp.QUICKSWAP] = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff", _Network$POLYGON[exports.Dapp.BALANCER] = "0xBA12222222228d8Ba445958a75a0704d566BF2C8", _Network$POLYGON[exports.Dapp.UNISWAPV3] = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", _Network$POLYGON[exports.Dapp.ARRAKIS] = "0xbc91a120cCD8F80b819EAF32F0996daC3Fa76a6C", _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] = "0x1111111254760F7ab3F16433eea9304126DCd199", _Network$OPTIMISM), _routerAddress);
3869
3873
  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);
3870
3874
  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), _stakingAddress[exports.Network.OPTIMISM] = {}, _stakingAddress);
3871
3875
  var nonfungiblePositionManagerAddress = (_nonfungiblePositionM = {}, _nonfungiblePositionM[exports.Network.POLYGON] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM[exports.Network.OPTIMISM] = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", _nonfungiblePositionM);
@@ -7535,6 +7539,530 @@ var IAaveIncentivesController = {
7535
7539
  deployedLinkReferences: deployedLinkReferences
7536
7540
  };
7537
7541
 
7542
+ var abi$b = [
7543
+ {
7544
+ inputs: [
7545
+ {
7546
+ internalType: "address",
7547
+ name: "gauge",
7548
+ type: "address"
7549
+ },
7550
+ {
7551
+ internalType: "uint256",
7552
+ name: "amount0Max",
7553
+ type: "uint256"
7554
+ },
7555
+ {
7556
+ internalType: "uint256",
7557
+ name: "amount1Max",
7558
+ type: "uint256"
7559
+ },
7560
+ {
7561
+ internalType: "uint256",
7562
+ name: "amount0Min",
7563
+ type: "uint256"
7564
+ },
7565
+ {
7566
+ internalType: "uint256",
7567
+ name: "amount1Min",
7568
+ type: "uint256"
7569
+ },
7570
+ {
7571
+ internalType: "address",
7572
+ name: "receiver",
7573
+ type: "address"
7574
+ }
7575
+ ],
7576
+ name: "addLiquidityAndStake",
7577
+ outputs: [
7578
+ {
7579
+ internalType: "uint256",
7580
+ name: "amount0",
7581
+ type: "uint256"
7582
+ },
7583
+ {
7584
+ internalType: "uint256",
7585
+ name: "amount1",
7586
+ type: "uint256"
7587
+ },
7588
+ {
7589
+ internalType: "uint256",
7590
+ name: "mintAmount",
7591
+ type: "uint256"
7592
+ }
7593
+ ],
7594
+ stateMutability: "nonpayable",
7595
+ type: "function"
7596
+ },
7597
+ {
7598
+ inputs: [
7599
+ {
7600
+ internalType: "address",
7601
+ name: "gauge",
7602
+ type: "address"
7603
+ },
7604
+ {
7605
+ internalType: "uint256",
7606
+ name: "burnAmount",
7607
+ type: "uint256"
7608
+ },
7609
+ {
7610
+ internalType: "uint256",
7611
+ name: "amount0Min",
7612
+ type: "uint256"
7613
+ },
7614
+ {
7615
+ internalType: "uint256",
7616
+ name: "amount1Min",
7617
+ type: "uint256"
7618
+ },
7619
+ {
7620
+ internalType: "address",
7621
+ name: "receiver",
7622
+ type: "address"
7623
+ }
7624
+ ],
7625
+ name: "removeLiquidityAndUnstake",
7626
+ outputs: [
7627
+ {
7628
+ internalType: "uint256",
7629
+ name: "amount0",
7630
+ type: "uint256"
7631
+ },
7632
+ {
7633
+ internalType: "uint256",
7634
+ name: "amount1",
7635
+ type: "uint256"
7636
+ },
7637
+ {
7638
+ internalType: "uint128",
7639
+ name: "liquidityBurned",
7640
+ type: "uint128"
7641
+ }
7642
+ ],
7643
+ stateMutability: "nonpayable",
7644
+ type: "function"
7645
+ }
7646
+ ];
7647
+ var IArrakisV1RouterStaking = {
7648
+ abi: abi$b
7649
+ };
7650
+
7651
+ var abi$c = [
7652
+ {
7653
+ inputs: [
7654
+ {
7655
+ internalType: "address",
7656
+ name: "user",
7657
+ type: "address"
7658
+ }
7659
+ ],
7660
+ name: "claim_rewards",
7661
+ outputs: [
7662
+ ],
7663
+ stateMutability: "nonpayable",
7664
+ type: "function"
7665
+ },
7666
+ {
7667
+ inputs: [
7668
+ {
7669
+ internalType: "address",
7670
+ name: "user",
7671
+ type: "address"
7672
+ },
7673
+ {
7674
+ internalType: "address",
7675
+ name: "receiver",
7676
+ type: "address"
7677
+ }
7678
+ ],
7679
+ name: "claim_rewards",
7680
+ outputs: [
7681
+ ],
7682
+ stateMutability: "nonpayable",
7683
+ type: "function"
7684
+ },
7685
+ {
7686
+ inputs: [
7687
+ ],
7688
+ name: "claim_rewards",
7689
+ outputs: [
7690
+ ],
7691
+ stateMutability: "nonpayable",
7692
+ type: "function"
7693
+ },
7694
+ {
7695
+ inputs: [
7696
+ {
7697
+ internalType: "address",
7698
+ name: "user",
7699
+ type: "address"
7700
+ },
7701
+ {
7702
+ internalType: "address",
7703
+ name: "rewardToken",
7704
+ type: "address"
7705
+ }
7706
+ ],
7707
+ name: "claimable_reward",
7708
+ outputs: [
7709
+ {
7710
+ internalType: "uint256",
7711
+ name: "",
7712
+ type: "uint256"
7713
+ }
7714
+ ],
7715
+ stateMutability: "view",
7716
+ type: "function"
7717
+ },
7718
+ {
7719
+ inputs: [
7720
+ ],
7721
+ name: "reward_count",
7722
+ outputs: [
7723
+ {
7724
+ internalType: "uint256",
7725
+ name: "",
7726
+ type: "uint256"
7727
+ }
7728
+ ],
7729
+ stateMutability: "view",
7730
+ type: "function"
7731
+ },
7732
+ {
7733
+ inputs: [
7734
+ {
7735
+ internalType: "address",
7736
+ name: "token",
7737
+ type: "address"
7738
+ }
7739
+ ],
7740
+ name: "reward_data",
7741
+ outputs: [
7742
+ {
7743
+ internalType: "address",
7744
+ name: "",
7745
+ type: "address"
7746
+ },
7747
+ {
7748
+ internalType: "address",
7749
+ name: "",
7750
+ type: "address"
7751
+ },
7752
+ {
7753
+ internalType: "uint256",
7754
+ name: "",
7755
+ type: "uint256"
7756
+ },
7757
+ {
7758
+ internalType: "uint256",
7759
+ name: "",
7760
+ type: "uint256"
7761
+ },
7762
+ {
7763
+ internalType: "uint256",
7764
+ name: "",
7765
+ type: "uint256"
7766
+ },
7767
+ {
7768
+ internalType: "uint256",
7769
+ name: "",
7770
+ type: "uint256"
7771
+ }
7772
+ ],
7773
+ stateMutability: "view",
7774
+ type: "function"
7775
+ },
7776
+ {
7777
+ inputs: [
7778
+ {
7779
+ internalType: "uint256",
7780
+ name: "index",
7781
+ type: "uint256"
7782
+ }
7783
+ ],
7784
+ name: "reward_tokens",
7785
+ outputs: [
7786
+ {
7787
+ internalType: "address",
7788
+ name: "",
7789
+ type: "address"
7790
+ }
7791
+ ],
7792
+ stateMutability: "view",
7793
+ type: "function"
7794
+ },
7795
+ {
7796
+ inputs: [
7797
+ ],
7798
+ name: "staking_token",
7799
+ outputs: [
7800
+ {
7801
+ internalType: "address",
7802
+ name: "",
7803
+ type: "address"
7804
+ }
7805
+ ],
7806
+ stateMutability: "view",
7807
+ type: "function"
7808
+ }
7809
+ ];
7810
+ var ILiquidityGaugeV4 = {
7811
+ abi: abi$c
7812
+ };
7813
+
7814
+ var abi$d = [
7815
+ {
7816
+ inputs: [
7817
+ {
7818
+ internalType: "address",
7819
+ name: "user",
7820
+ type: "address"
7821
+ }
7822
+ ],
7823
+ name: "balanceOf",
7824
+ outputs: [
7825
+ {
7826
+ internalType: "uint256",
7827
+ name: "",
7828
+ type: "uint256"
7829
+ }
7830
+ ],
7831
+ stateMutability: "view",
7832
+ type: "function"
7833
+ },
7834
+ {
7835
+ inputs: [
7836
+ {
7837
+ internalType: "address",
7838
+ name: "user",
7839
+ type: "address"
7840
+ }
7841
+ ],
7842
+ name: "claim_rewards",
7843
+ outputs: [
7844
+ ],
7845
+ stateMutability: "nonpayable",
7846
+ type: "function"
7847
+ },
7848
+ {
7849
+ inputs: [
7850
+ {
7851
+ internalType: "address",
7852
+ name: "user",
7853
+ type: "address"
7854
+ },
7855
+ {
7856
+ internalType: "address",
7857
+ name: "receiver",
7858
+ type: "address"
7859
+ }
7860
+ ],
7861
+ name: "claim_rewards",
7862
+ outputs: [
7863
+ ],
7864
+ stateMutability: "nonpayable",
7865
+ type: "function"
7866
+ },
7867
+ {
7868
+ inputs: [
7869
+ ],
7870
+ name: "claim_rewards",
7871
+ outputs: [
7872
+ ],
7873
+ stateMutability: "nonpayable",
7874
+ type: "function"
7875
+ },
7876
+ {
7877
+ inputs: [
7878
+ {
7879
+ internalType: "address",
7880
+ name: "user",
7881
+ type: "address"
7882
+ },
7883
+ {
7884
+ internalType: "address",
7885
+ name: "rewardToken",
7886
+ type: "address"
7887
+ }
7888
+ ],
7889
+ name: "claimable_reward",
7890
+ outputs: [
7891
+ {
7892
+ internalType: "uint256",
7893
+ name: "",
7894
+ type: "uint256"
7895
+ }
7896
+ ],
7897
+ stateMutability: "view",
7898
+ type: "function"
7899
+ },
7900
+ {
7901
+ inputs: [
7902
+ {
7903
+ internalType: "address",
7904
+ name: "user",
7905
+ type: "address"
7906
+ },
7907
+ {
7908
+ internalType: "address",
7909
+ name: "rewardToken",
7910
+ type: "address"
7911
+ }
7912
+ ],
7913
+ name: "claimable_reward_write",
7914
+ outputs: [
7915
+ {
7916
+ internalType: "uint256",
7917
+ name: "",
7918
+ type: "uint256"
7919
+ }
7920
+ ],
7921
+ stateMutability: "nonpayable",
7922
+ type: "function"
7923
+ },
7924
+ {
7925
+ inputs: [
7926
+ {
7927
+ internalType: "uint256",
7928
+ name: "amount",
7929
+ type: "uint256"
7930
+ },
7931
+ {
7932
+ internalType: "address",
7933
+ name: "user",
7934
+ type: "address"
7935
+ }
7936
+ ],
7937
+ name: "deposit",
7938
+ outputs: [
7939
+ ],
7940
+ stateMutability: "nonpayable",
7941
+ type: "function"
7942
+ },
7943
+ {
7944
+ inputs: [
7945
+ {
7946
+ internalType: "uint256",
7947
+ name: "amount",
7948
+ type: "uint256"
7949
+ },
7950
+ {
7951
+ internalType: "address",
7952
+ name: "onBehalf",
7953
+ type: "address"
7954
+ },
7955
+ {
7956
+ internalType: "bool",
7957
+ name: "isClaimRewards",
7958
+ type: "bool"
7959
+ }
7960
+ ],
7961
+ name: "deposit",
7962
+ outputs: [
7963
+ ],
7964
+ stateMutability: "nonpayable",
7965
+ type: "function"
7966
+ },
7967
+ {
7968
+ inputs: [
7969
+ {
7970
+ internalType: "uint256",
7971
+ name: "amount",
7972
+ type: "uint256"
7973
+ }
7974
+ ],
7975
+ name: "deposit",
7976
+ outputs: [
7977
+ ],
7978
+ stateMutability: "nonpayable",
7979
+ type: "function"
7980
+ },
7981
+ {
7982
+ inputs: [
7983
+ ],
7984
+ name: "lp_token",
7985
+ outputs: [
7986
+ {
7987
+ internalType: "address",
7988
+ name: "",
7989
+ type: "address"
7990
+ }
7991
+ ],
7992
+ stateMutability: "view",
7993
+ type: "function"
7994
+ },
7995
+ {
7996
+ inputs: [
7997
+ ],
7998
+ name: "reward_contract",
7999
+ outputs: [
8000
+ {
8001
+ internalType: "address",
8002
+ name: "",
8003
+ type: "address"
8004
+ }
8005
+ ],
8006
+ stateMutability: "view",
8007
+ type: "function"
8008
+ },
8009
+ {
8010
+ inputs: [
8011
+ {
8012
+ internalType: "uint256",
8013
+ name: "index",
8014
+ type: "uint256"
8015
+ }
8016
+ ],
8017
+ name: "reward_tokens",
8018
+ outputs: [
8019
+ {
8020
+ internalType: "address",
8021
+ name: "",
8022
+ type: "address"
8023
+ }
8024
+ ],
8025
+ stateMutability: "view",
8026
+ type: "function"
8027
+ },
8028
+ {
8029
+ inputs: [
8030
+ {
8031
+ internalType: "uint256",
8032
+ name: "amount",
8033
+ type: "uint256"
8034
+ }
8035
+ ],
8036
+ name: "withdraw",
8037
+ outputs: [
8038
+ ],
8039
+ stateMutability: "nonpayable",
8040
+ type: "function"
8041
+ },
8042
+ {
8043
+ inputs: [
8044
+ {
8045
+ internalType: "uint256",
8046
+ name: "amount",
8047
+ type: "uint256"
8048
+ },
8049
+ {
8050
+ internalType: "bool",
8051
+ name: "isClaimRewards",
8052
+ type: "bool"
8053
+ }
8054
+ ],
8055
+ name: "withdraw",
8056
+ outputs: [
8057
+ ],
8058
+ stateMutability: "nonpayable",
8059
+ type: "function"
8060
+ }
8061
+ ];
8062
+ var IBalancerRewardsGauge = {
8063
+ abi: abi$d
8064
+ };
8065
+
7538
8066
  function multicall(_x5, _x6, _x7, _x8, _x9, _x10) {
7539
8067
  return _multicall.apply(this, arguments);
7540
8068
  }
@@ -7555,7 +8083,7 @@ function _multicall() {
7555
8083
  }
7556
8084
 
7557
8085
  multi = new ethers.ethers.Contract(multiCallAddress[network], ["function tryAggregate(bool requireSuccess, tuple(address, bytes)[] memory calls) public view returns (tuple(bool, bytes)[] memory returnData)"], provider);
7558
- itf = new abi$g.Interface(abi);
8086
+ itf = new abi$j.Interface(abi);
7559
8087
  _context3.prev = 4;
7560
8088
  _context3.next = 7;
7561
8089
  return multi.tryAggregate( // if false, allows individual calls to fail without causing entire multicall to fail
@@ -8338,7 +8866,7 @@ function _getUniswapV3Liquidity() {
8338
8866
  return _getUniswapV3Liquidity.apply(this, arguments);
8339
8867
  }
8340
8868
 
8341
- var abi$b = [
8869
+ var abi$e = [
8342
8870
  {
8343
8871
  inputs: [
8344
8872
  {
@@ -8559,10 +9087,10 @@ var abi$b = [
8559
9087
  }
8560
9088
  ];
8561
9089
  var IUniswapV3Router = {
8562
- abi: abi$b
9090
+ abi: abi$e
8563
9091
  };
8564
9092
 
8565
- var abi$c = [
9093
+ var abi$f = [
8566
9094
  {
8567
9095
  inputs: [
8568
9096
  {
@@ -8759,7 +9287,7 @@ var abi$c = [
8759
9287
  }
8760
9288
  ];
8761
9289
  var IUniswapV3Quoter = {
8762
- abi: abi$c
9290
+ abi: abi$f
8763
9291
  };
8764
9292
 
8765
9293
  function getUniswapV3SwapTxData(_x, _x2, _x3, _x4, _x5, _x6) {
@@ -9122,6 +9650,52 @@ var Pool = /*#__PURE__*/function () {
9122
9650
 
9123
9651
  return approveUniswapV3Liquidity;
9124
9652
  }()
9653
+ /**
9654
+ * Approve the asset for provided spender address
9655
+ * @param {string} spender Spender address
9656
+ * @param {string} asset Address of asset
9657
+ * @param {BigNumber | string} amount to be approved
9658
+ * @param {any} options Transaction options
9659
+ * @returns {Promise<any>} Transaction
9660
+ */
9661
+ ;
9662
+
9663
+ _proto.approveSpender =
9664
+ /*#__PURE__*/
9665
+ function () {
9666
+ var _approveSpender = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(spender, asset, amount, options) {
9667
+ var iERC20, approveTxData, tx;
9668
+ return runtime_1.wrap(function _callee8$(_context8) {
9669
+ while (1) {
9670
+ switch (_context8.prev = _context8.next) {
9671
+ case 0:
9672
+ if (options === void 0) {
9673
+ options = null;
9674
+ }
9675
+
9676
+ iERC20 = new ethers.ethers.utils.Interface(IERC20.abi);
9677
+ approveTxData = iERC20.encodeFunctionData("approve", [spender, amount]);
9678
+ _context8.next = 5;
9679
+ return this.poolLogic.execTransaction(asset, approveTxData, options);
9680
+
9681
+ case 5:
9682
+ tx = _context8.sent;
9683
+ return _context8.abrupt("return", tx);
9684
+
9685
+ case 7:
9686
+ case "end":
9687
+ return _context8.stop();
9688
+ }
9689
+ }
9690
+ }, _callee8, this);
9691
+ }));
9692
+
9693
+ function approveSpender(_x20, _x21, _x22, _x23) {
9694
+ return _approveSpender.apply(this, arguments);
9695
+ }
9696
+
9697
+ return approveSpender;
9698
+ }()
9125
9699
  /**
9126
9700
  * Trade an asset into another asset
9127
9701
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
@@ -9137,11 +9711,11 @@ var Pool = /*#__PURE__*/function () {
9137
9711
  _proto.trade =
9138
9712
  /*#__PURE__*/
9139
9713
  function () {
9140
- var _trade = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(dapp, assetFrom, assetTo, amountIn, slippage, options) {
9141
- var swapTxData, apiUrl, response, iSynthetix, assets, daoAddress, iUniswapV2Router, minAmountOut, tx;
9142
- return runtime_1.wrap(function _callee8$(_context8) {
9714
+ var _trade = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(dapp, assetFrom, assetTo, amountIn, slippage, options) {
9715
+ var swapTxData, chainId, apiUrl, response, iSynthetix, assets, daoAddress, iUniswapV2Router, minAmountOut, tx;
9716
+ return runtime_1.wrap(function _callee9$(_context9) {
9143
9717
  while (1) {
9144
- switch (_context8.prev = _context8.next) {
9718
+ switch (_context9.prev = _context9.next) {
9145
9719
  case 0:
9146
9720
  if (slippage === void 0) {
9147
9721
  slippage = 0.5;
@@ -9152,37 +9726,38 @@ var Pool = /*#__PURE__*/function () {
9152
9726
  }
9153
9727
 
9154
9728
  if (!(dapp === exports.Dapp.ONEINCH)) {
9155
- _context8.next = 10;
9729
+ _context9.next = 11;
9156
9730
  break;
9157
9731
  }
9158
9732
 
9159
- apiUrl = "https://api.1inch.exchange/v4.0/137/swap?fromTokenAddress=" + assetFrom + "&toTokenAddress=" + assetTo + "&amount=" + amountIn.toString() + "&fromAddress=" + this.address + "&destReceiver=" + this.address + "&slippage=" + slippage.toString() + "&disableEstimate=true";
9160
- _context8.next = 6;
9733
+ chainId = networkChainIdMap[this.network];
9734
+ apiUrl = "https://api.1inch.exchange/v4.0/" + chainId + "/swap?fromTokenAddress=" + assetFrom + "&toTokenAddress=" + assetTo + "&amount=" + amountIn.toString() + "&fromAddress=" + this.address + "&destReceiver=" + this.address + "&slippage=" + slippage.toString() + "&disableEstimate=true";
9735
+ _context9.next = 7;
9161
9736
  return axios.get(apiUrl);
9162
9737
 
9163
- case 6:
9164
- response = _context8.sent;
9738
+ case 7:
9739
+ response = _context9.sent;
9165
9740
  swapTxData = response.data.tx.data;
9166
- _context8.next = 30;
9741
+ _context9.next = 31;
9167
9742
  break;
9168
9743
 
9169
- case 10:
9744
+ case 11:
9170
9745
  if (!(dapp === exports.Dapp.BALANCER)) {
9171
- _context8.next = 16;
9746
+ _context9.next = 17;
9172
9747
  break;
9173
9748
  }
9174
9749
 
9175
- _context8.next = 13;
9750
+ _context9.next = 14;
9176
9751
  return this.utils.getBalancerSwapTx(this, assetFrom, assetTo, amountIn, slippage);
9177
9752
 
9178
- case 13:
9179
- swapTxData = _context8.sent;
9180
- _context8.next = 30;
9753
+ case 14:
9754
+ swapTxData = _context9.sent;
9755
+ _context9.next = 31;
9181
9756
  break;
9182
9757
 
9183
- case 16:
9758
+ case 17:
9184
9759
  if (!(dapp === exports.Dapp.SYNTHETIX)) {
9185
- _context8.next = 25;
9760
+ _context9.next = 26;
9186
9761
  break;
9187
9762
  }
9188
9763
 
@@ -9190,41 +9765,41 @@ var Pool = /*#__PURE__*/function () {
9190
9765
  assets = [assetFrom, assetTo].map(function (asset) {
9191
9766
  return ethers.ethers.utils.formatBytes32String(asset);
9192
9767
  });
9193
- _context8.next = 21;
9768
+ _context9.next = 22;
9194
9769
  return this.factory.owner();
9195
9770
 
9196
- case 21:
9197
- daoAddress = _context8.sent;
9771
+ case 22:
9772
+ daoAddress = _context9.sent;
9198
9773
  swapTxData = iSynthetix.encodeFunctionData(exports.Transaction.SWAP_SYNTHS, [assets[0], amountIn, assets[1], daoAddress, SYNTHETIX_TRACKING_CODE]);
9199
- _context8.next = 30;
9774
+ _context9.next = 31;
9200
9775
  break;
9201
9776
 
9202
- case 25:
9777
+ case 26:
9203
9778
  iUniswapV2Router = new ethers.ethers.utils.Interface(IUniswapV2Router.abi);
9204
- _context8.next = 28;
9779
+ _context9.next = 29;
9205
9780
  return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
9206
9781
 
9207
- case 28:
9208
- minAmountOut = _context8.sent;
9782
+ case 29:
9783
+ minAmountOut = _context9.sent;
9209
9784
  swapTxData = iUniswapV2Router.encodeFunctionData(exports.Transaction.SWAP, [amountIn, minAmountOut, [assetFrom, assetTo], this.address, deadline]);
9210
9785
 
9211
- case 30:
9212
- _context8.next = 32;
9786
+ case 31:
9787
+ _context9.next = 33;
9213
9788
  return this.poolLogic.execTransaction(routerAddress[this.network][dapp], swapTxData, options);
9214
9789
 
9215
- case 32:
9216
- tx = _context8.sent;
9217
- return _context8.abrupt("return", tx);
9790
+ case 33:
9791
+ tx = _context9.sent;
9792
+ return _context9.abrupt("return", tx);
9218
9793
 
9219
- case 34:
9794
+ case 35:
9220
9795
  case "end":
9221
- return _context8.stop();
9796
+ return _context9.stop();
9222
9797
  }
9223
9798
  }
9224
- }, _callee8, this);
9799
+ }, _callee9, this);
9225
9800
  }));
9226
9801
 
9227
- function trade(_x20, _x21, _x22, _x23, _x24, _x25) {
9802
+ function trade(_x24, _x25, _x26, _x27, _x28, _x29) {
9228
9803
  return _trade.apply(this, arguments);
9229
9804
  }
9230
9805
 
@@ -9245,11 +9820,11 @@ var Pool = /*#__PURE__*/function () {
9245
9820
  _proto.addLiquidity =
9246
9821
  /*#__PURE__*/
9247
9822
  function () {
9248
- var _addLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(dapp, assetA, assetB, amountA, amountB, options) {
9823
+ var _addLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(dapp, assetA, assetB, amountA, amountB, options) {
9249
9824
  var iUniswapV2Router, addLiquidityTxData, tx;
9250
- return runtime_1.wrap(function _callee9$(_context9) {
9825
+ return runtime_1.wrap(function _callee10$(_context10) {
9251
9826
  while (1) {
9252
- switch (_context9.prev = _context9.next) {
9827
+ switch (_context10.prev = _context10.next) {
9253
9828
  case 0:
9254
9829
  if (options === void 0) {
9255
9830
  options = null;
@@ -9257,22 +9832,22 @@ var Pool = /*#__PURE__*/function () {
9257
9832
 
9258
9833
  iUniswapV2Router = new ethers.ethers.utils.Interface(IUniswapV2Router.abi);
9259
9834
  addLiquidityTxData = iUniswapV2Router.encodeFunctionData(exports.Transaction.ADD_LIQUIDITY, [assetA, assetB, amountA, amountB, 0, 0, this.address, deadline]);
9260
- _context9.next = 5;
9835
+ _context10.next = 5;
9261
9836
  return this.poolLogic.execTransaction(routerAddress[this.network][dapp], addLiquidityTxData, options);
9262
9837
 
9263
9838
  case 5:
9264
- tx = _context9.sent;
9265
- return _context9.abrupt("return", tx);
9839
+ tx = _context10.sent;
9840
+ return _context10.abrupt("return", tx);
9266
9841
 
9267
9842
  case 7:
9268
9843
  case "end":
9269
- return _context9.stop();
9844
+ return _context10.stop();
9270
9845
  }
9271
9846
  }
9272
- }, _callee9, this);
9847
+ }, _callee10, this);
9273
9848
  }));
9274
9849
 
9275
- function addLiquidity(_x26, _x27, _x28, _x29, _x30, _x31) {
9850
+ function addLiquidity(_x30, _x31, _x32, _x33, _x34, _x35) {
9276
9851
  return _addLiquidity.apply(this, arguments);
9277
9852
  }
9278
9853
 
@@ -9292,11 +9867,11 @@ var Pool = /*#__PURE__*/function () {
9292
9867
  _proto.removeLiquidity =
9293
9868
  /*#__PURE__*/
9294
9869
  function () {
9295
- var _removeLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(dapp, assetA, assetB, amount, options) {
9870
+ var _removeLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(dapp, assetA, assetB, amount, options) {
9296
9871
  var iUniswapV2Router, removeLiquidityTxData, tx;
9297
- return runtime_1.wrap(function _callee10$(_context10) {
9872
+ return runtime_1.wrap(function _callee11$(_context11) {
9298
9873
  while (1) {
9299
- switch (_context10.prev = _context10.next) {
9874
+ switch (_context11.prev = _context11.next) {
9300
9875
  case 0:
9301
9876
  if (options === void 0) {
9302
9877
  options = null;
@@ -9304,22 +9879,22 @@ var Pool = /*#__PURE__*/function () {
9304
9879
 
9305
9880
  iUniswapV2Router = new ethers.ethers.utils.Interface(IUniswapV2Router.abi);
9306
9881
  removeLiquidityTxData = iUniswapV2Router.encodeFunctionData(exports.Transaction.REMOVE_LIQUIDITY, [assetA, assetB, amount, 0, 0, this.address, deadline]);
9307
- _context10.next = 5;
9882
+ _context11.next = 5;
9308
9883
  return this.poolLogic.execTransaction(routerAddress[this.network][dapp], removeLiquidityTxData, options);
9309
9884
 
9310
9885
  case 5:
9311
- tx = _context10.sent;
9312
- return _context10.abrupt("return", tx);
9886
+ tx = _context11.sent;
9887
+ return _context11.abrupt("return", tx);
9313
9888
 
9314
9889
  case 7:
9315
9890
  case "end":
9316
- return _context10.stop();
9891
+ return _context11.stop();
9317
9892
  }
9318
9893
  }
9319
- }, _callee10, this);
9894
+ }, _callee11, this);
9320
9895
  }));
9321
9896
 
9322
- function removeLiquidity(_x32, _x33, _x34, _x35, _x36) {
9897
+ function removeLiquidity(_x36, _x37, _x38, _x39, _x40) {
9323
9898
  return _removeLiquidity.apply(this, arguments);
9324
9899
  }
9325
9900
 
@@ -9338,44 +9913,89 @@ var Pool = /*#__PURE__*/function () {
9338
9913
  _proto.stake =
9339
9914
  /*#__PURE__*/
9340
9915
  function () {
9341
- var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(dapp, asset, amount, options) {
9916
+ var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(dapp, asset, amount, options) {
9342
9917
  var iMiniChefV2, poolId, stakeTxData, tx;
9343
- return runtime_1.wrap(function _callee11$(_context11) {
9918
+ return runtime_1.wrap(function _callee12$(_context12) {
9344
9919
  while (1) {
9345
- switch (_context11.prev = _context11.next) {
9920
+ switch (_context12.prev = _context12.next) {
9346
9921
  case 0:
9347
9922
  if (options === void 0) {
9348
9923
  options = null;
9349
9924
  }
9350
9925
 
9351
9926
  iMiniChefV2 = new ethers.ethers.utils.Interface(IMiniChefV2.abi);
9352
- _context11.next = 4;
9927
+ _context12.next = 4;
9353
9928
  return this.utils.getLpPoolId(dapp, asset);
9354
9929
 
9355
9930
  case 4:
9356
- poolId = _context11.sent;
9931
+ poolId = _context12.sent;
9357
9932
  stakeTxData = iMiniChefV2.encodeFunctionData(exports.Transaction.DEPOSIT, [poolId, amount, this.address]);
9358
- _context11.next = 8;
9933
+ _context12.next = 8;
9359
9934
  return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], stakeTxData, options);
9360
9935
 
9361
9936
  case 8:
9362
- tx = _context11.sent;
9363
- return _context11.abrupt("return", tx);
9937
+ tx = _context12.sent;
9938
+ return _context12.abrupt("return", tx);
9364
9939
 
9365
9940
  case 10:
9366
9941
  case "end":
9367
- return _context11.stop();
9942
+ return _context12.stop();
9368
9943
  }
9369
9944
  }
9370
- }, _callee11, this);
9945
+ }, _callee12, this);
9371
9946
  }));
9372
9947
 
9373
- function stake(_x37, _x38, _x39, _x40) {
9948
+ function stake(_x41, _x42, _x43, _x44) {
9374
9949
  return _stake.apply(this, arguments);
9375
9950
  }
9376
9951
 
9377
9952
  return stake;
9378
9953
  }()
9954
+ /**
9955
+ * Stake liquidity pool tokens in gauge contract
9956
+ * @param {string} gauge Gauge contract address
9957
+ * @param {BigNumber | string} amount Amount of liquidity pool tokens
9958
+ * @param {any} options Transaction options
9959
+ * @returns {Promise<any>} Transaction
9960
+ */
9961
+ ;
9962
+
9963
+ _proto.stakeInGauge =
9964
+ /*#__PURE__*/
9965
+ function () {
9966
+ var _stakeInGauge = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(gauge, amount, options) {
9967
+ var rewardsGauge, stakeTxData, tx;
9968
+ return runtime_1.wrap(function _callee13$(_context13) {
9969
+ while (1) {
9970
+ switch (_context13.prev = _context13.next) {
9971
+ case 0:
9972
+ if (options === void 0) {
9973
+ options = null;
9974
+ }
9975
+
9976
+ rewardsGauge = new ethers.ethers.utils.Interface(IBalancerRewardsGauge.abi);
9977
+ stakeTxData = rewardsGauge.encodeFunctionData("deposit(uint256)", [amount]);
9978
+ _context13.next = 5;
9979
+ return this.poolLogic.execTransaction(gauge, stakeTxData, options);
9980
+
9981
+ case 5:
9982
+ tx = _context13.sent;
9983
+ return _context13.abrupt("return", tx);
9984
+
9985
+ case 7:
9986
+ case "end":
9987
+ return _context13.stop();
9988
+ }
9989
+ }
9990
+ }, _callee13, this);
9991
+ }));
9992
+
9993
+ function stakeInGauge(_x45, _x46, _x47) {
9994
+ return _stakeInGauge.apply(this, arguments);
9995
+ }
9996
+
9997
+ return stakeInGauge;
9998
+ }()
9379
9999
  /**
9380
10000
  * Unstake liquidity pool tokens from a yield farm
9381
10001
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
@@ -9389,50 +10009,95 @@ var Pool = /*#__PURE__*/function () {
9389
10009
  _proto.unStake =
9390
10010
  /*#__PURE__*/
9391
10011
  function () {
9392
- var _unStake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(dapp, asset, amount, options) {
10012
+ var _unStake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(dapp, asset, amount, options) {
9393
10013
  var iMiniChefV2, poolId, unStakeTxData, tx;
9394
- return runtime_1.wrap(function _callee12$(_context12) {
10014
+ return runtime_1.wrap(function _callee14$(_context14) {
9395
10015
  while (1) {
9396
- switch (_context12.prev = _context12.next) {
10016
+ switch (_context14.prev = _context14.next) {
9397
10017
  case 0:
9398
10018
  if (options === void 0) {
9399
10019
  options = null;
9400
10020
  }
9401
10021
 
9402
10022
  iMiniChefV2 = new ethers.ethers.utils.Interface(IMiniChefV2.abi);
9403
- _context12.next = 4;
10023
+ _context14.next = 4;
9404
10024
  return this.utils.getLpPoolId(dapp, asset);
9405
10025
 
9406
10026
  case 4:
9407
- poolId = _context12.sent;
10027
+ poolId = _context14.sent;
9408
10028
  unStakeTxData = iMiniChefV2.encodeFunctionData(exports.Transaction.WITHDRAW, [poolId, amount, this.address]);
9409
- _context12.next = 8;
10029
+ _context14.next = 8;
9410
10030
  return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], unStakeTxData, options);
9411
10031
 
9412
10032
  case 8:
9413
- tx = _context12.sent;
9414
- return _context12.abrupt("return", tx);
10033
+ tx = _context14.sent;
10034
+ return _context14.abrupt("return", tx);
9415
10035
 
9416
10036
  case 10:
9417
10037
  case "end":
9418
- return _context12.stop();
10038
+ return _context14.stop();
9419
10039
  }
9420
10040
  }
9421
- }, _callee12, this);
10041
+ }, _callee14, this);
9422
10042
  }));
9423
10043
 
9424
- function unStake(_x41, _x42, _x43, _x44) {
10044
+ function unStake(_x48, _x49, _x50, _x51) {
9425
10045
  return _unStake.apply(this, arguments);
9426
10046
  }
9427
10047
 
9428
10048
  return unStake;
9429
10049
  }()
10050
+ /**
10051
+ * Unstake liquidity pool tokens from gauge contract
10052
+ * @param {string} gauge Gauge contract address
10053
+ * @param {BigNumber | string} amount Amount of liquidity pool tokens
10054
+ * @param {any} options Transaction options
10055
+ * @returns {Promise<any>} Transaction
10056
+ */
10057
+ ;
10058
+
10059
+ _proto.unstakeFromGauge =
10060
+ /*#__PURE__*/
10061
+ function () {
10062
+ var _unstakeFromGauge = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(gauge, amount, options) {
10063
+ var rewardsGauge, unstakeTxData, tx;
10064
+ return runtime_1.wrap(function _callee15$(_context15) {
10065
+ while (1) {
10066
+ switch (_context15.prev = _context15.next) {
10067
+ case 0:
10068
+ if (options === void 0) {
10069
+ options = null;
10070
+ }
10071
+
10072
+ rewardsGauge = new ethers.ethers.utils.Interface(IBalancerRewardsGauge.abi);
10073
+ unstakeTxData = rewardsGauge.encodeFunctionData("withdraw(uint256)", [amount]);
10074
+ _context15.next = 5;
10075
+ return this.poolLogic.execTransaction(gauge, unstakeTxData, options);
10076
+
10077
+ case 5:
10078
+ tx = _context15.sent;
10079
+ return _context15.abrupt("return", tx);
10080
+
10081
+ case 7:
10082
+ case "end":
10083
+ return _context15.stop();
10084
+ }
10085
+ }
10086
+ }, _callee15, this);
10087
+ }));
10088
+
10089
+ function unstakeFromGauge(_x52, _x53, _x54) {
10090
+ return _unstakeFromGauge.apply(this, arguments);
10091
+ }
10092
+
10093
+ return unstakeFromGauge;
10094
+ }()
9430
10095
  /**
9431
10096
  * Lend asset to a lending pool
9432
10097
  * @param {Dapp} dapp Platform like Aave
9433
10098
  * @param {string} asset Asset
9434
10099
  * @param {BigNumber | string} amount Amount of asset to lend
9435
- * @param {number} referrralCode Code from Aave referral program
10100
+ * @param {number} referralCode Code from Aave referral program
9436
10101
  * @param {any} options Transaction options
9437
10102
  * @returns {Promise<any>} Transaction
9438
10103
  */
@@ -9441,14 +10106,14 @@ var Pool = /*#__PURE__*/function () {
9441
10106
  _proto.lend =
9442
10107
  /*#__PURE__*/
9443
10108
  function () {
9444
- var _lend = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(dapp, asset, amount, referrralCode, options) {
10109
+ var _lend = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16(dapp, asset, amount, referralCode, options) {
9445
10110
  var iLendingPool, depositTxData, tx;
9446
- return runtime_1.wrap(function _callee13$(_context13) {
10111
+ return runtime_1.wrap(function _callee16$(_context16) {
9447
10112
  while (1) {
9448
- switch (_context13.prev = _context13.next) {
10113
+ switch (_context16.prev = _context16.next) {
9449
10114
  case 0:
9450
- if (referrralCode === void 0) {
9451
- referrralCode = 0;
10115
+ if (referralCode === void 0) {
10116
+ referralCode = 0;
9452
10117
  }
9453
10118
 
9454
10119
  if (options === void 0) {
@@ -9456,23 +10121,23 @@ var Pool = /*#__PURE__*/function () {
9456
10121
  }
9457
10122
 
9458
10123
  iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
9459
- depositTxData = iLendingPool.encodeFunctionData(exports.Transaction.DEPOSIT, [asset, amount, this.address, referrralCode]);
9460
- _context13.next = 6;
10124
+ depositTxData = iLendingPool.encodeFunctionData(exports.Transaction.DEPOSIT, [asset, amount, this.address, referralCode]);
10125
+ _context16.next = 6;
9461
10126
  return this.poolLogic.execTransaction(routerAddress[this.network][dapp], depositTxData, options);
9462
10127
 
9463
10128
  case 6:
9464
- tx = _context13.sent;
9465
- return _context13.abrupt("return", tx);
10129
+ tx = _context16.sent;
10130
+ return _context16.abrupt("return", tx);
9466
10131
 
9467
10132
  case 8:
9468
10133
  case "end":
9469
- return _context13.stop();
10134
+ return _context16.stop();
9470
10135
  }
9471
10136
  }
9472
- }, _callee13, this);
10137
+ }, _callee16, this);
9473
10138
  }));
9474
10139
 
9475
- function lend(_x45, _x46, _x47, _x48, _x49) {
10140
+ function lend(_x55, _x56, _x57, _x58, _x59) {
9476
10141
  return _lend.apply(this, arguments);
9477
10142
  }
9478
10143
 
@@ -9491,11 +10156,11 @@ var Pool = /*#__PURE__*/function () {
9491
10156
  _proto.withdrawDeposit =
9492
10157
  /*#__PURE__*/
9493
10158
  function () {
9494
- var _withdrawDeposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(dapp, asset, amount, options) {
10159
+ var _withdrawDeposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17(dapp, asset, amount, options) {
9495
10160
  var iLendingPool, withdrawTxData, tx;
9496
- return runtime_1.wrap(function _callee14$(_context14) {
10161
+ return runtime_1.wrap(function _callee17$(_context17) {
9497
10162
  while (1) {
9498
- switch (_context14.prev = _context14.next) {
10163
+ switch (_context17.prev = _context17.next) {
9499
10164
  case 0:
9500
10165
  if (options === void 0) {
9501
10166
  options = null;
@@ -9503,22 +10168,22 @@ var Pool = /*#__PURE__*/function () {
9503
10168
 
9504
10169
  iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
9505
10170
  withdrawTxData = iLendingPool.encodeFunctionData(exports.Transaction.WITHDRAW, [asset, amount, this.address]);
9506
- _context14.next = 5;
10171
+ _context17.next = 5;
9507
10172
  return this.poolLogic.execTransaction(routerAddress[this.network][dapp], withdrawTxData, options);
9508
10173
 
9509
10174
  case 5:
9510
- tx = _context14.sent;
9511
- return _context14.abrupt("return", tx);
10175
+ tx = _context17.sent;
10176
+ return _context17.abrupt("return", tx);
9512
10177
 
9513
10178
  case 7:
9514
10179
  case "end":
9515
- return _context14.stop();
10180
+ return _context17.stop();
9516
10181
  }
9517
10182
  }
9518
- }, _callee14, this);
10183
+ }, _callee17, this);
9519
10184
  }));
9520
10185
 
9521
- function withdrawDeposit(_x50, _x51, _x52, _x53) {
10186
+ function withdrawDeposit(_x60, _x61, _x62, _x63) {
9522
10187
  return _withdrawDeposit.apply(this, arguments);
9523
10188
  }
9524
10189
 
@@ -9529,7 +10194,7 @@ var Pool = /*#__PURE__*/function () {
9529
10194
  * @param {Dapp} dapp Platform like Aave
9530
10195
  * @param {string} asset Asset
9531
10196
  * @param {BigNumber | string} amount Amount of asset to lend
9532
- * @param {number} referrralCode Code from Aave referral program
10197
+ * @param {number} referralCode Code from Aave referral program
9533
10198
  * @param {any} options Transaction options
9534
10199
  * @returns {Promise<any>} Transaction
9535
10200
  */
@@ -9538,14 +10203,14 @@ var Pool = /*#__PURE__*/function () {
9538
10203
  _proto.borrow =
9539
10204
  /*#__PURE__*/
9540
10205
  function () {
9541
- var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(dapp, asset, amount, referrralCode, options) {
10206
+ var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee18(dapp, asset, amount, referralCode, options) {
9542
10207
  var iLendingPool, borrowTxData, tx;
9543
- return runtime_1.wrap(function _callee15$(_context15) {
10208
+ return runtime_1.wrap(function _callee18$(_context18) {
9544
10209
  while (1) {
9545
- switch (_context15.prev = _context15.next) {
10210
+ switch (_context18.prev = _context18.next) {
9546
10211
  case 0:
9547
- if (referrralCode === void 0) {
9548
- referrralCode = 0;
10212
+ if (referralCode === void 0) {
10213
+ referralCode = 0;
9549
10214
  }
9550
10215
 
9551
10216
  if (options === void 0) {
@@ -9553,23 +10218,23 @@ var Pool = /*#__PURE__*/function () {
9553
10218
  }
9554
10219
 
9555
10220
  iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
9556
- borrowTxData = iLendingPool.encodeFunctionData(exports.Transaction.BORROW, [asset, amount, 2, referrralCode, this.address]);
9557
- _context15.next = 6;
10221
+ borrowTxData = iLendingPool.encodeFunctionData(exports.Transaction.BORROW, [asset, amount, 2, referralCode, this.address]);
10222
+ _context18.next = 6;
9558
10223
  return this.poolLogic.execTransaction(routerAddress[this.network][dapp], borrowTxData, options);
9559
10224
 
9560
- case 6:
9561
- tx = _context15.sent;
9562
- return _context15.abrupt("return", tx);
10225
+ case 6:
10226
+ tx = _context18.sent;
10227
+ return _context18.abrupt("return", tx);
9563
10228
 
9564
10229
  case 8:
9565
10230
  case "end":
9566
- return _context15.stop();
10231
+ return _context18.stop();
9567
10232
  }
9568
10233
  }
9569
- }, _callee15, this);
10234
+ }, _callee18, this);
9570
10235
  }));
9571
10236
 
9572
- function borrow(_x54, _x55, _x56, _x57, _x58) {
10237
+ function borrow(_x64, _x65, _x66, _x67, _x68) {
9573
10238
  return _borrow.apply(this, arguments);
9574
10239
  }
9575
10240
 
@@ -9588,11 +10253,11 @@ var Pool = /*#__PURE__*/function () {
9588
10253
  _proto.repay =
9589
10254
  /*#__PURE__*/
9590
10255
  function () {
9591
- var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16(dapp, asset, amount, options) {
10256
+ var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19(dapp, asset, amount, options) {
9592
10257
  var iLendingPool, repayTxData, tx;
9593
- return runtime_1.wrap(function _callee16$(_context16) {
10258
+ return runtime_1.wrap(function _callee19$(_context19) {
9594
10259
  while (1) {
9595
- switch (_context16.prev = _context16.next) {
10260
+ switch (_context19.prev = _context19.next) {
9596
10261
  case 0:
9597
10262
  if (options === void 0) {
9598
10263
  options = null;
@@ -9600,22 +10265,22 @@ var Pool = /*#__PURE__*/function () {
9600
10265
 
9601
10266
  iLendingPool = new ethers.ethers.utils.Interface(ILendingPool.abi);
9602
10267
  repayTxData = iLendingPool.encodeFunctionData(exports.Transaction.REPAY, [asset, amount, 2, this.address]);
9603
- _context16.next = 5;
10268
+ _context19.next = 5;
9604
10269
  return this.poolLogic.execTransaction(routerAddress[this.network][dapp], repayTxData, options);
9605
10270
 
9606
10271
  case 5:
9607
- tx = _context16.sent;
9608
- return _context16.abrupt("return", tx);
10272
+ tx = _context19.sent;
10273
+ return _context19.abrupt("return", tx);
9609
10274
 
9610
10275
  case 7:
9611
10276
  case "end":
9612
- return _context16.stop();
10277
+ return _context19.stop();
9613
10278
  }
9614
10279
  }
9615
- }, _callee16, this);
10280
+ }, _callee19, this);
9616
10281
  }));
9617
10282
 
9618
- function repay(_x59, _x60, _x61, _x62) {
10283
+ function repay(_x69, _x70, _x71, _x72) {
9619
10284
  return _repay.apply(this, arguments);
9620
10285
  }
9621
10286
 
@@ -9633,39 +10298,39 @@ var Pool = /*#__PURE__*/function () {
9633
10298
  _proto.harvestRewards =
9634
10299
  /*#__PURE__*/
9635
10300
  function () {
9636
- var _harvestRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17(dapp, asset, options) {
10301
+ var _harvestRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee20(dapp, asset, options) {
9637
10302
  var iMiniChefV2, poolId, harvestTxData, tx;
9638
- return runtime_1.wrap(function _callee17$(_context17) {
10303
+ return runtime_1.wrap(function _callee20$(_context20) {
9639
10304
  while (1) {
9640
- switch (_context17.prev = _context17.next) {
10305
+ switch (_context20.prev = _context20.next) {
9641
10306
  case 0:
9642
10307
  if (options === void 0) {
9643
10308
  options = null;
9644
10309
  }
9645
10310
 
9646
10311
  iMiniChefV2 = new ethers.ethers.utils.Interface(IMiniChefV2.abi);
9647
- _context17.next = 4;
10312
+ _context20.next = 4;
9648
10313
  return this.utils.getLpPoolId(dapp, asset);
9649
10314
 
9650
10315
  case 4:
9651
- poolId = _context17.sent;
10316
+ poolId = _context20.sent;
9652
10317
  harvestTxData = iMiniChefV2.encodeFunctionData(exports.Transaction.HARVEST, [poolId, this.address]);
9653
- _context17.next = 8;
10318
+ _context20.next = 8;
9654
10319
  return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], harvestTxData, options);
9655
10320
 
9656
10321
  case 8:
9657
- tx = _context17.sent;
9658
- return _context17.abrupt("return", tx);
10322
+ tx = _context20.sent;
10323
+ return _context20.abrupt("return", tx);
9659
10324
 
9660
10325
  case 10:
9661
10326
  case "end":
9662
- return _context17.stop();
10327
+ return _context20.stop();
9663
10328
  }
9664
10329
  }
9665
- }, _callee17, this);
10330
+ }, _callee20, this);
9666
10331
  }));
9667
10332
 
9668
- function harvestRewards(_x63, _x64, _x65) {
10333
+ function harvestRewards(_x73, _x74, _x75) {
9669
10334
  return _harvestRewards.apply(this, arguments);
9670
10335
  }
9671
10336
 
@@ -9682,21 +10347,21 @@ var Pool = /*#__PURE__*/function () {
9682
10347
  _proto.changeAssets =
9683
10348
  /*#__PURE__*/
9684
10349
  function () {
9685
- var _changeAssets = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee18(assets, options) {
10350
+ var _changeAssets = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee21(assets, options) {
9686
10351
  var currentAssetsEnabled, currentAssets, newAssets, removedAssets, changedAssets, tx;
9687
- return runtime_1.wrap(function _callee18$(_context18) {
10352
+ return runtime_1.wrap(function _callee21$(_context21) {
9688
10353
  while (1) {
9689
- switch (_context18.prev = _context18.next) {
10354
+ switch (_context21.prev = _context21.next) {
9690
10355
  case 0:
9691
10356
  if (options === void 0) {
9692
10357
  options = null;
9693
10358
  }
9694
10359
 
9695
- _context18.next = 3;
10360
+ _context21.next = 3;
9696
10361
  return this.getComposition();
9697
10362
 
9698
10363
  case 3:
9699
- currentAssetsEnabled = _context18.sent;
10364
+ currentAssetsEnabled = _context21.sent;
9700
10365
  currentAssets = currentAssetsEnabled.map(function (e) {
9701
10366
  return e.asset.toLocaleLowerCase();
9702
10367
  });
@@ -9709,22 +10374,22 @@ var Pool = /*#__PURE__*/function () {
9709
10374
  changedAssets = assets.map(function (e) {
9710
10375
  return [e.asset, e.isDeposit];
9711
10376
  });
9712
- _context18.next = 10;
10377
+ _context21.next = 10;
9713
10378
  return this.managerLogic.changeAssets(changedAssets, removedAssets, options);
9714
10379
 
9715
10380
  case 10:
9716
- tx = _context18.sent;
9717
- return _context18.abrupt("return", tx);
10381
+ tx = _context21.sent;
10382
+ return _context21.abrupt("return", tx);
9718
10383
 
9719
10384
  case 12:
9720
10385
  case "end":
9721
- return _context18.stop();
10386
+ return _context21.stop();
9722
10387
  }
9723
10388
  }
9724
- }, _callee18, this);
10389
+ }, _callee21, this);
9725
10390
  }));
9726
10391
 
9727
- function changeAssets(_x66, _x67) {
10392
+ function changeAssets(_x76, _x77) {
9728
10393
  return _changeAssets.apply(this, arguments);
9729
10394
  }
9730
10395
 
@@ -9741,32 +10406,32 @@ var Pool = /*#__PURE__*/function () {
9741
10406
  _proto.setTrader =
9742
10407
  /*#__PURE__*/
9743
10408
  function () {
9744
- var _setTrader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19(trader, options) {
10409
+ var _setTrader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee22(trader, options) {
9745
10410
  var tx;
9746
- return runtime_1.wrap(function _callee19$(_context19) {
10411
+ return runtime_1.wrap(function _callee22$(_context22) {
9747
10412
  while (1) {
9748
- switch (_context19.prev = _context19.next) {
10413
+ switch (_context22.prev = _context22.next) {
9749
10414
  case 0:
9750
10415
  if (options === void 0) {
9751
10416
  options = null;
9752
10417
  }
9753
10418
 
9754
- _context19.next = 3;
10419
+ _context22.next = 3;
9755
10420
  return this.managerLogic.setTrader(trader, options);
9756
10421
 
9757
10422
  case 3:
9758
- tx = _context19.sent;
9759
- return _context19.abrupt("return", tx);
10423
+ tx = _context22.sent;
10424
+ return _context22.abrupt("return", tx);
9760
10425
 
9761
10426
  case 5:
9762
10427
  case "end":
9763
- return _context19.stop();
10428
+ return _context22.stop();
9764
10429
  }
9765
10430
  }
9766
- }, _callee19, this);
10431
+ }, _callee22, this);
9767
10432
  }));
9768
10433
 
9769
- function setTrader(_x68, _x69) {
10434
+ function setTrader(_x78, _x79) {
9770
10435
  return _setTrader.apply(this, arguments);
9771
10436
  }
9772
10437
 
@@ -9785,33 +10450,33 @@ var Pool = /*#__PURE__*/function () {
9785
10450
  _proto.joinBalancerPool =
9786
10451
  /*#__PURE__*/
9787
10452
  function () {
9788
- var _joinBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee20(poolId, assets, amountsIn, options) {
10453
+ var _joinBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee23(poolId, assets, amountsIn, options) {
9789
10454
  var joinPoolTxData, tx;
9790
- return runtime_1.wrap(function _callee20$(_context20) {
10455
+ return runtime_1.wrap(function _callee23$(_context23) {
9791
10456
  while (1) {
9792
- switch (_context20.prev = _context20.next) {
10457
+ switch (_context23.prev = _context23.next) {
9793
10458
  case 0:
9794
10459
  if (options === void 0) {
9795
10460
  options = null;
9796
10461
  }
9797
10462
 
9798
10463
  joinPoolTxData = this.utils.getBalancerJoinPoolTx(this, poolId, assets, amountsIn);
9799
- _context20.next = 4;
10464
+ _context23.next = 4;
9800
10465
  return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.BALANCER], joinPoolTxData, options);
9801
10466
 
9802
10467
  case 4:
9803
- tx = _context20.sent;
9804
- return _context20.abrupt("return", tx);
10468
+ tx = _context23.sent;
10469
+ return _context23.abrupt("return", tx);
9805
10470
 
9806
10471
  case 6:
9807
10472
  case "end":
9808
- return _context20.stop();
10473
+ return _context23.stop();
9809
10474
  }
9810
10475
  }
9811
- }, _callee20, this);
10476
+ }, _callee23, this);
9812
10477
  }));
9813
10478
 
9814
- function joinBalancerPool(_x70, _x71, _x72, _x73) {
10479
+ function joinBalancerPool(_x80, _x81, _x82, _x83) {
9815
10480
  return _joinBalancerPool.apply(this, arguments);
9816
10481
  }
9817
10482
 
@@ -9822,6 +10487,7 @@ var Pool = /*#__PURE__*/function () {
9822
10487
  * @param {string} poolId Balancer pool id
9823
10488
  * @param {string[] | } assets Array of balancer pool assets
9824
10489
  * @param {BigNumber | string } amount Amount of pool tokens to withdraw
10490
+ * @param { null | number } singleExitAssetIndex Index of asset to withdraw to
9825
10491
  * @param {any} options Transaction options
9826
10492
  * @returns {Promise<any>} Transaction
9827
10493
  */
@@ -9830,33 +10496,37 @@ var Pool = /*#__PURE__*/function () {
9830
10496
  _proto.exitBalancerPool =
9831
10497
  /*#__PURE__*/
9832
10498
  function () {
9833
- var _exitBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee21(poolId, assets, amount, options) {
10499
+ var _exitBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee24(poolId, assets, amount, singleExitAssetIndex, options) {
9834
10500
  var exitPoolTxData, tx;
9835
- return runtime_1.wrap(function _callee21$(_context21) {
10501
+ return runtime_1.wrap(function _callee24$(_context24) {
9836
10502
  while (1) {
9837
- switch (_context21.prev = _context21.next) {
10503
+ switch (_context24.prev = _context24.next) {
9838
10504
  case 0:
10505
+ if (singleExitAssetIndex === void 0) {
10506
+ singleExitAssetIndex = null;
10507
+ }
10508
+
9839
10509
  if (options === void 0) {
9840
10510
  options = null;
9841
10511
  }
9842
10512
 
9843
- exitPoolTxData = this.utils.getBalancerExitPoolTx(this, poolId, assets, amount);
9844
- _context21.next = 4;
10513
+ exitPoolTxData = this.utils.getBalancerExitPoolTx(this, poolId, assets, singleExitAssetIndex, amount);
10514
+ _context24.next = 5;
9845
10515
  return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.BALANCER], exitPoolTxData, options);
9846
10516
 
9847
- case 4:
9848
- tx = _context21.sent;
9849
- return _context21.abrupt("return", tx);
10517
+ case 5:
10518
+ tx = _context24.sent;
10519
+ return _context24.abrupt("return", tx);
9850
10520
 
9851
- case 6:
10521
+ case 7:
9852
10522
  case "end":
9853
- return _context21.stop();
10523
+ return _context24.stop();
9854
10524
  }
9855
10525
  }
9856
- }, _callee21, this);
10526
+ }, _callee24, this);
9857
10527
  }));
9858
10528
 
9859
- function exitBalancerPool(_x74, _x75, _x76, _x77) {
10529
+ function exitBalancerPool(_x84, _x85, _x86, _x87, _x88) {
9860
10530
  return _exitBalancerPool.apply(this, arguments);
9861
10531
  }
9862
10532
 
@@ -9873,48 +10543,48 @@ var Pool = /*#__PURE__*/function () {
9873
10543
  _proto.harvestBalancerRewards =
9874
10544
  /*#__PURE__*/
9875
10545
  function () {
9876
- var _harvestBalancerRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee22(options) {
10546
+ var _harvestBalancerRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee25(options) {
9877
10547
  var claimService, multiTokenPendingClaims, tokens, claims, iBalancerMerkleOrchard, harvestTxData, tx;
9878
- return runtime_1.wrap(function _callee22$(_context22) {
10548
+ return runtime_1.wrap(function _callee25$(_context25) {
9879
10549
  while (1) {
9880
- switch (_context22.prev = _context22.next) {
10550
+ switch (_context25.prev = _context25.next) {
9881
10551
  case 0:
9882
10552
  if (options === void 0) {
9883
10553
  options = null;
9884
10554
  }
9885
10555
 
9886
10556
  claimService = new ClaimService(this.network, this.signer);
9887
- _context22.next = 4;
10557
+ _context25.next = 4;
9888
10558
  return claimService.getMultiTokensPendingClaims(this.address);
9889
10559
 
9890
10560
  case 4:
9891
- multiTokenPendingClaims = _context22.sent;
10561
+ multiTokenPendingClaims = _context25.sent;
9892
10562
  tokens = multiTokenPendingClaims.map(function (tokenPendingClaims) {
9893
10563
  return tokenPendingClaims.tokenClaimInfo.token;
9894
10564
  });
9895
- _context22.next = 8;
10565
+ _context25.next = 8;
9896
10566
  return claimService.multiTokenClaimRewards(this.address, multiTokenPendingClaims);
9897
10567
 
9898
10568
  case 8:
9899
- claims = _context22.sent;
10569
+ claims = _context25.sent;
9900
10570
  iBalancerMerkleOrchard = new ethers.ethers.utils.Interface(IBalancerMerkleOrchard.abi);
9901
10571
  harvestTxData = iBalancerMerkleOrchard.encodeFunctionData(exports.Transaction.CLAIM_DISTRIBIUTIONS, [this.address, claims, tokens]);
9902
- _context22.next = 13;
10572
+ _context25.next = 13;
9903
10573
  return this.poolLogic.execTransaction(stakingAddress[this.network][exports.Dapp.BALANCER], harvestTxData, options);
9904
10574
 
9905
10575
  case 13:
9906
- tx = _context22.sent;
9907
- return _context22.abrupt("return", tx);
10576
+ tx = _context25.sent;
10577
+ return _context25.abrupt("return", tx);
9908
10578
 
9909
10579
  case 15:
9910
10580
  case "end":
9911
- return _context22.stop();
10581
+ return _context25.stop();
9912
10582
  }
9913
10583
  }
9914
- }, _callee22, this);
10584
+ }, _callee25, this);
9915
10585
  }));
9916
10586
 
9917
- function harvestBalancerRewards(_x78) {
10587
+ function harvestBalancerRewards(_x89) {
9918
10588
  return _harvestBalancerRewards.apply(this, arguments);
9919
10589
  }
9920
10590
 
@@ -9931,11 +10601,11 @@ var Pool = /*#__PURE__*/function () {
9931
10601
  _proto.harvestAaveRewards =
9932
10602
  /*#__PURE__*/
9933
10603
  function () {
9934
- var _harvestAaveRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee23(assets, options) {
10604
+ var _harvestAaveRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee26(assets, options) {
9935
10605
  var aaveIncentivesAddress, iAaveIncentivesController, aaveIncentivesController, amount, claimTxData, tx;
9936
- return runtime_1.wrap(function _callee23$(_context23) {
10606
+ return runtime_1.wrap(function _callee26$(_context26) {
9937
10607
  while (1) {
9938
- switch (_context23.prev = _context23.next) {
10608
+ switch (_context26.prev = _context26.next) {
9939
10609
  case 0:
9940
10610
  if (options === void 0) {
9941
10611
  options = null;
@@ -9944,28 +10614,28 @@ var Pool = /*#__PURE__*/function () {
9944
10614
  aaveIncentivesAddress = stakingAddress[this.network][exports.Dapp.AAVE];
9945
10615
  iAaveIncentivesController = new ethers.ethers.utils.Interface(IAaveIncentivesController.abi);
9946
10616
  aaveIncentivesController = new ethers.ethers.Contract(aaveIncentivesAddress, iAaveIncentivesController, this.signer);
9947
- _context23.next = 6;
10617
+ _context26.next = 6;
9948
10618
  return aaveIncentivesController.getUserUnclaimedRewards(this.address);
9949
10619
 
9950
10620
  case 6:
9951
- amount = _context23.sent;
10621
+ amount = _context26.sent;
9952
10622
  claimTxData = iAaveIncentivesController.encodeFunctionData(exports.Transaction.CLAIM_REWARDS, [assets, amount, this.address]);
9953
- _context23.next = 10;
10623
+ _context26.next = 10;
9954
10624
  return this.poolLogic.execTransaction(aaveIncentivesAddress, claimTxData, options);
9955
10625
 
9956
10626
  case 10:
9957
- tx = _context23.sent;
9958
- return _context23.abrupt("return", tx);
10627
+ tx = _context26.sent;
10628
+ return _context26.abrupt("return", tx);
9959
10629
 
9960
10630
  case 12:
9961
10631
  case "end":
9962
- return _context23.stop();
10632
+ return _context26.stop();
9963
10633
  }
9964
10634
  }
9965
- }, _callee23, this);
10635
+ }, _callee26, this);
9966
10636
  }));
9967
10637
 
9968
- function harvestAaveRewards(_x79, _x80) {
10638
+ function harvestAaveRewards(_x90, _x91) {
9969
10639
  return _harvestAaveRewards.apply(this, arguments);
9970
10640
  }
9971
10641
 
@@ -9990,18 +10660,18 @@ var Pool = /*#__PURE__*/function () {
9990
10660
  _proto.addLiquidityUniswapV3 =
9991
10661
  /*#__PURE__*/
9992
10662
  function () {
9993
- var _addLiquidityUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee24(assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount, options) {
10663
+ var _addLiquidityUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee27(assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount, options) {
9994
10664
  var iNonfungiblePositionManager, mintTxParams, mintTxData, tx;
9995
- return runtime_1.wrap(function _callee24$(_context24) {
10665
+ return runtime_1.wrap(function _callee27$(_context27) {
9996
10666
  while (1) {
9997
- switch (_context24.prev = _context24.next) {
10667
+ switch (_context27.prev = _context27.next) {
9998
10668
  case 0:
9999
10669
  if (options === void 0) {
10000
10670
  options = null;
10001
10671
  }
10002
10672
 
10003
10673
  if (!((!minPrice || !maxPrice) && (!minTick || !maxTick))) {
10004
- _context24.next = 3;
10674
+ _context27.next = 3;
10005
10675
  break;
10006
10676
  }
10007
10677
 
@@ -10009,35 +10679,36 @@ var Pool = /*#__PURE__*/function () {
10009
10679
 
10010
10680
  case 3:
10011
10681
  iNonfungiblePositionManager = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
10012
- _context24.next = 6;
10682
+ _context27.next = 6;
10013
10683
  return getUniswapV3MintParams(this, assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount);
10014
10684
 
10015
10685
  case 6:
10016
- mintTxParams = _context24.sent;
10686
+ mintTxParams = _context27.sent;
10017
10687
  mintTxData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.MINT, [mintTxParams]);
10018
- _context24.next = 10;
10688
+ _context27.next = 10;
10019
10689
  return this.poolLogic.execTransaction(nonfungiblePositionManagerAddress[this.network], mintTxData, options);
10020
10690
 
10021
10691
  case 10:
10022
- tx = _context24.sent;
10023
- return _context24.abrupt("return", tx);
10692
+ tx = _context27.sent;
10693
+ return _context27.abrupt("return", tx);
10024
10694
 
10025
10695
  case 12:
10026
10696
  case "end":
10027
- return _context24.stop();
10697
+ return _context27.stop();
10028
10698
  }
10029
10699
  }
10030
- }, _callee24, this);
10700
+ }, _callee27, this);
10031
10701
  }));
10032
10702
 
10033
- function addLiquidityUniswapV3(_x81, _x82, _x83, _x84, _x85, _x86, _x87, _x88, _x89, _x90) {
10703
+ function addLiquidityUniswapV3(_x92, _x93, _x94, _x95, _x96, _x97, _x98, _x99, _x100, _x101) {
10034
10704
  return _addLiquidityUniswapV.apply(this, arguments);
10035
10705
  }
10036
10706
 
10037
10707
  return addLiquidityUniswapV3;
10038
10708
  }()
10039
10709
  /**
10040
- * Remove liquidity from an UniswapV3 liquidity pool
10710
+ * Remove liquidity from an UniswapV3 or Arrakis liquidity pool
10711
+ * @param {Dapp} dapp Platform either UniswapV3 or Arrakis
10041
10712
  * @param {string} tokenId Token Id of UniswapV3 position
10042
10713
  * @param {number} amount Amount in percent of assets to be removed
10043
10714
  * @param {any} options Transaction options
@@ -10045,14 +10716,15 @@ var Pool = /*#__PURE__*/function () {
10045
10716
  */
10046
10717
  ;
10047
10718
 
10048
- _proto.removeLiquidityUniswapV3 =
10719
+ _proto.decreaseLiquidity =
10049
10720
  /*#__PURE__*/
10050
10721
  function () {
10051
- var _removeLiquidityUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee25(tokenId, amount, options) {
10052
- var iNonfungiblePositionManager, liquidity, decreaseLiquidityTxData, collectTxData, multicallParams, burnTxData, multicallTxData, tx;
10053
- return runtime_1.wrap(function _callee25$(_context25) {
10722
+ var _decreaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee28(dapp, tokenId, amount, options) {
10723
+ var txData, dappAddress, abi, liquidity, decreaseLiquidityTxData, collectTxData, multicallParams, burnTxData, _abi, _liquidity, tx;
10724
+
10725
+ return runtime_1.wrap(function _callee28$(_context28) {
10054
10726
  while (1) {
10055
- switch (_context25.prev = _context25.next) {
10727
+ switch (_context28.prev = _context28.next) {
10056
10728
  case 0:
10057
10729
  if (amount === void 0) {
10058
10730
  amount = 100;
@@ -10062,45 +10734,76 @@ var Pool = /*#__PURE__*/function () {
10062
10734
  options = null;
10063
10735
  }
10064
10736
 
10065
- iNonfungiblePositionManager = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
10066
- _context25.next = 5;
10737
+ if (!(dapp === exports.Dapp.UNISWAPV3)) {
10738
+ _context28.next = 15;
10739
+ break;
10740
+ }
10741
+
10742
+ dappAddress = nonfungiblePositionManagerAddress[this.network];
10743
+ abi = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
10744
+ _context28.next = 7;
10067
10745
  return getUniswapV3Liquidity(tokenId, this);
10068
10746
 
10069
- case 5:
10070
- liquidity = _context25.sent.mul(amount).div(100);
10071
- decreaseLiquidityTxData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.DECREASE_LIQUIDITY, [[tokenId, liquidity, 0, 0, deadline]]);
10072
- collectTxData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
10747
+ case 7:
10748
+ liquidity = _context28.sent.mul(amount).div(100);
10749
+ decreaseLiquidityTxData = abi.encodeFunctionData(exports.Transaction.DECREASE_LIQUIDITY, [[tokenId, liquidity, 0, 0, deadline]]);
10750
+ collectTxData = abi.encodeFunctionData(exports.Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
10073
10751
  multicallParams = [decreaseLiquidityTxData, collectTxData];
10074
10752
 
10075
10753
  if (amount === 100) {
10076
- burnTxData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.BURN, [tokenId]);
10754
+ burnTxData = abi.encodeFunctionData(exports.Transaction.BURN, [tokenId]);
10077
10755
  multicallParams.push(burnTxData);
10078
10756
  }
10079
10757
 
10080
- multicallTxData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.MULTI_CALL, [multicallParams]);
10081
- _context25.next = 13;
10082
- return this.poolLogic.execTransaction(nonfungiblePositionManagerAddress[this.network], multicallTxData, options);
10083
-
10084
- case 13:
10085
- tx = _context25.sent;
10086
- return _context25.abrupt("return", tx);
10758
+ txData = abi.encodeFunctionData(exports.Transaction.MULTI_CALL, [multicallParams]);
10759
+ _context28.next = 25;
10760
+ break;
10087
10761
 
10088
10762
  case 15:
10763
+ if (!(dapp === exports.Dapp.ARRAKIS)) {
10764
+ _context28.next = 24;
10765
+ break;
10766
+ }
10767
+
10768
+ dappAddress = routerAddress[this.network][dapp];
10769
+ _abi = new ethers.ethers.utils.Interface(IArrakisV1RouterStaking.abi);
10770
+ _context28.next = 20;
10771
+ return this.utils.getBalance(tokenId, this.address);
10772
+
10773
+ case 20:
10774
+ _liquidity = _context28.sent.mul(amount).div(100);
10775
+ txData = _abi.encodeFunctionData(exports.Transaction.REMOVE_LIQUIDITY_UNSTAKE, [tokenId, _liquidity, 0, 0, this.address]);
10776
+ _context28.next = 25;
10777
+ break;
10778
+
10779
+ case 24:
10780
+ throw new Error("dapp not supported");
10781
+
10782
+ case 25:
10783
+ _context28.next = 27;
10784
+ return this.poolLogic.execTransaction(dappAddress, txData, options);
10785
+
10786
+ case 27:
10787
+ tx = _context28.sent;
10788
+ return _context28.abrupt("return", tx);
10789
+
10790
+ case 29:
10089
10791
  case "end":
10090
- return _context25.stop();
10792
+ return _context28.stop();
10091
10793
  }
10092
10794
  }
10093
- }, _callee25, this);
10795
+ }, _callee28, this);
10094
10796
  }));
10095
10797
 
10096
- function removeLiquidityUniswapV3(_x91, _x92, _x93) {
10097
- return _removeLiquidityUniswapV.apply(this, arguments);
10798
+ function decreaseLiquidity(_x102, _x103, _x104, _x105) {
10799
+ return _decreaseLiquidity.apply(this, arguments);
10098
10800
  }
10099
10801
 
10100
- return removeLiquidityUniswapV3;
10802
+ return decreaseLiquidity;
10101
10803
  }()
10102
10804
  /**
10103
- * Increase liquidity of an UniswapV3 liquidity pool
10805
+ * Increase liquidity of an UniswapV3 or Arrakis liquidity pool
10806
+ * @param {Dapp} dapp Platform either UniswapV3 or Arrakis
10104
10807
  * @param {string} tokenId Token Id of UniswapV3 position
10105
10808
  * @param {BigNumber | string} amountA Amount first asset
10106
10809
  * @param {BigNumber | string} amountB Amount second asset
@@ -10109,85 +10812,137 @@ var Pool = /*#__PURE__*/function () {
10109
10812
  */
10110
10813
  ;
10111
10814
 
10112
- _proto.increaseLiquidityUniswapV3 =
10815
+ _proto.increaseLiquidity =
10113
10816
  /*#__PURE__*/
10114
10817
  function () {
10115
- var _increaseLiquidityUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee26(tokenId, amountA, amountB, options) {
10116
- var iNonfungiblePositionManager, increaseLiquidityTxData, tx;
10117
- return runtime_1.wrap(function _callee26$(_context26) {
10818
+ var _increaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee29(dapp, tokenId, amountA, amountB, options) {
10819
+ var txData, dappAddress, abi, _abi2, tx;
10820
+
10821
+ return runtime_1.wrap(function _callee29$(_context29) {
10118
10822
  while (1) {
10119
- switch (_context26.prev = _context26.next) {
10823
+ switch (_context29.prev = _context29.next) {
10120
10824
  case 0:
10121
10825
  if (options === void 0) {
10122
10826
  options = null;
10123
10827
  }
10124
10828
 
10125
- iNonfungiblePositionManager = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
10126
- increaseLiquidityTxData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.INCREASE_LIQUIDITY, [[tokenId, amountA, amountB, 0, 0, deadline]]);
10127
- _context26.next = 5;
10128
- return this.poolLogic.execTransaction(nonfungiblePositionManagerAddress[this.network], increaseLiquidityTxData, options);
10829
+ if (!(dapp === exports.Dapp.UNISWAPV3)) {
10830
+ _context29.next = 7;
10831
+ break;
10832
+ }
10129
10833
 
10130
- case 5:
10131
- tx = _context26.sent;
10132
- return _context26.abrupt("return", tx);
10834
+ dappAddress = nonfungiblePositionManagerAddress[this.network];
10835
+ abi = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
10836
+ txData = abi.encodeFunctionData(exports.Transaction.INCREASE_LIQUIDITY, [[tokenId, amountA, amountB, 0, 0, deadline]]);
10837
+ _context29.next = 14;
10838
+ break;
10133
10839
 
10134
10840
  case 7:
10841
+ if (!(dapp === exports.Dapp.ARRAKIS)) {
10842
+ _context29.next = 13;
10843
+ break;
10844
+ }
10845
+
10846
+ dappAddress = routerAddress[this.network][dapp];
10847
+ _abi2 = new ethers.ethers.utils.Interface(IArrakisV1RouterStaking.abi);
10848
+ txData = _abi2.encodeFunctionData(exports.Transaction.ADD_LIQUIDITY_STAKE, [tokenId, amountA, amountB, 0, 0, this.address]);
10849
+ _context29.next = 14;
10850
+ break;
10851
+
10852
+ case 13:
10853
+ throw new Error("dapp not supported");
10854
+
10855
+ case 14:
10856
+ _context29.next = 16;
10857
+ return this.poolLogic.execTransaction(dappAddress, txData, options);
10858
+
10859
+ case 16:
10860
+ tx = _context29.sent;
10861
+ return _context29.abrupt("return", tx);
10862
+
10863
+ case 18:
10135
10864
  case "end":
10136
- return _context26.stop();
10865
+ return _context29.stop();
10137
10866
  }
10138
10867
  }
10139
- }, _callee26, this);
10868
+ }, _callee29, this);
10140
10869
  }));
10141
10870
 
10142
- function increaseLiquidityUniswapV3(_x94, _x95, _x96, _x97) {
10143
- return _increaseLiquidityUniswapV.apply(this, arguments);
10871
+ function increaseLiquidity(_x106, _x107, _x108, _x109, _x110) {
10872
+ return _increaseLiquidity.apply(this, arguments);
10144
10873
  }
10145
10874
 
10146
- return increaseLiquidityUniswapV3;
10875
+ return increaseLiquidity;
10147
10876
  }()
10148
10877
  /**
10149
- * Claim fees of an UniswapV3 liquidity pool
10150
- * @param {string} tokenId Token Id of UniswapV3 position
10151
- * @param {any} options Transaction options
10878
+ * Claim fees of an UniswapV3 liquidity or Arrakis pool
10879
+ * @param {Dapp} dapp Platform either UniswapV3 or Arrakis
10880
+ * @param {string} tokenId Token Id of UniswapV3 or Gauge address
10881
+ * @param {any} options Transaction option
10152
10882
  * @returns {Promise<any>} Transaction
10153
10883
  */
10154
10884
  ;
10155
10885
 
10156
- _proto.claimFeesUniswapV3 =
10886
+ _proto.claimFees =
10157
10887
  /*#__PURE__*/
10158
10888
  function () {
10159
- var _claimFeesUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee27(tokenId, options) {
10160
- var iNonfungiblePositionManager, collectTxData, tx;
10161
- return runtime_1.wrap(function _callee27$(_context27) {
10889
+ var _claimFees = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee30(dapp, tokenId, options) {
10890
+ var txData, contractAddress, iNonfungiblePositionManager, abi, tx;
10891
+ return runtime_1.wrap(function _callee30$(_context30) {
10162
10892
  while (1) {
10163
- switch (_context27.prev = _context27.next) {
10893
+ switch (_context30.prev = _context30.next) {
10164
10894
  case 0:
10165
10895
  if (options === void 0) {
10166
10896
  options = null;
10167
10897
  }
10168
10898
 
10169
- iNonfungiblePositionManager = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
10170
- collectTxData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
10171
- _context27.next = 5;
10172
- return this.poolLogic.execTransaction(nonfungiblePositionManagerAddress[this.network], collectTxData, options);
10899
+ if (!(dapp === exports.Dapp.UNISWAPV3)) {
10900
+ _context30.next = 7;
10901
+ break;
10902
+ }
10173
10903
 
10174
- case 5:
10175
- tx = _context27.sent;
10176
- return _context27.abrupt("return", tx);
10904
+ contractAddress = nonfungiblePositionManagerAddress[this.network];
10905
+ iNonfungiblePositionManager = new ethers.ethers.utils.Interface(INonfungiblePositionManager.abi);
10906
+ txData = iNonfungiblePositionManager.encodeFunctionData(exports.Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
10907
+ _context30.next = 14;
10908
+ break;
10177
10909
 
10178
10910
  case 7:
10911
+ if (!(dapp === exports.Dapp.ARRAKIS || dapp === exports.Dapp.BALANCER)) {
10912
+ _context30.next = 13;
10913
+ break;
10914
+ }
10915
+
10916
+ contractAddress = tokenId;
10917
+ abi = new ethers.ethers.utils.Interface(ILiquidityGaugeV4.abi);
10918
+ txData = abi.encodeFunctionData("claim_rewards()", []);
10919
+ _context30.next = 14;
10920
+ break;
10921
+
10922
+ case 13:
10923
+ throw new Error("dapp not supported");
10924
+
10925
+ case 14:
10926
+ _context30.next = 16;
10927
+ return this.poolLogic.execTransaction(contractAddress, txData, options);
10928
+
10929
+ case 16:
10930
+ tx = _context30.sent;
10931
+ return _context30.abrupt("return", tx);
10932
+
10933
+ case 18:
10179
10934
  case "end":
10180
- return _context27.stop();
10935
+ return _context30.stop();
10181
10936
  }
10182
10937
  }
10183
- }, _callee27, this);
10938
+ }, _callee30, this);
10184
10939
  }));
10185
10940
 
10186
- function claimFeesUniswapV3(_x98, _x99) {
10187
- return _claimFeesUniswapV.apply(this, arguments);
10941
+ function claimFees(_x111, _x112, _x113) {
10942
+ return _claimFees.apply(this, arguments);
10188
10943
  }
10189
10944
 
10190
- return claimFeesUniswapV3;
10945
+ return claimFees;
10191
10946
  }()
10192
10947
  /**
10193
10948
  * Trade an asset into another asset
@@ -10205,11 +10960,11 @@ var Pool = /*#__PURE__*/function () {
10205
10960
  _proto.tradeUniswapV3 =
10206
10961
  /*#__PURE__*/
10207
10962
  function () {
10208
- var _tradeUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee28(assetFrom, assetTo, amountIn, feeAmount, slippage, options) {
10963
+ var _tradeUniswapV = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee31(assetFrom, assetTo, amountIn, feeAmount, slippage, options) {
10209
10964
  var swapxData, tx;
10210
- return runtime_1.wrap(function _callee28$(_context28) {
10965
+ return runtime_1.wrap(function _callee31$(_context31) {
10211
10966
  while (1) {
10212
- switch (_context28.prev = _context28.next) {
10967
+ switch (_context31.prev = _context31.next) {
10213
10968
  case 0:
10214
10969
  if (slippage === void 0) {
10215
10970
  slippage = 0.5;
@@ -10219,27 +10974,27 @@ var Pool = /*#__PURE__*/function () {
10219
10974
  options = null;
10220
10975
  }
10221
10976
 
10222
- _context28.next = 4;
10977
+ _context31.next = 4;
10223
10978
  return getUniswapV3SwapTxData(this, assetFrom, assetTo, amountIn, slippage, feeAmount);
10224
10979
 
10225
10980
  case 4:
10226
- swapxData = _context28.sent;
10227
- _context28.next = 7;
10981
+ swapxData = _context31.sent;
10982
+ _context31.next = 7;
10228
10983
  return this.poolLogic.execTransaction(routerAddress[this.network][exports.Dapp.UNISWAPV3], swapxData, options);
10229
10984
 
10230
10985
  case 7:
10231
- tx = _context28.sent;
10232
- return _context28.abrupt("return", tx);
10986
+ tx = _context31.sent;
10987
+ return _context31.abrupt("return", tx);
10233
10988
 
10234
10989
  case 9:
10235
10990
  case "end":
10236
- return _context28.stop();
10991
+ return _context31.stop();
10237
10992
  }
10238
10993
  }
10239
- }, _callee28, this);
10994
+ }, _callee31, this);
10240
10995
  }));
10241
10996
 
10242
- function tradeUniswapV3(_x100, _x101, _x102, _x103, _x104, _x105) {
10997
+ function tradeUniswapV3(_x114, _x115, _x116, _x117, _x118, _x119) {
10243
10998
  return _tradeUniswapV.apply(this, arguments);
10244
10999
  }
10245
11000
 
@@ -10249,7 +11004,7 @@ var Pool = /*#__PURE__*/function () {
10249
11004
  return Pool;
10250
11005
  }();
10251
11006
 
10252
- var abi$d = [
11007
+ var abi$g = [
10253
11008
  {
10254
11009
  inputs: [
10255
11010
  {
@@ -10473,10 +11228,10 @@ var abi$d = [
10473
11228
  }
10474
11229
  ];
10475
11230
  var UniswapV2Factory = {
10476
- abi: abi$d
11231
+ abi: abi$g
10477
11232
  };
10478
11233
 
10479
- var abi$e = [
11234
+ var abi$h = [
10480
11235
  {
10481
11236
  anonymous: false,
10482
11237
  inputs: [
@@ -11220,7 +11975,7 @@ var evm = {
11220
11975
  }
11221
11976
  };
11222
11977
  var UniswapV2Pair = {
11223
- abi: abi$e,
11978
+ abi: abi$h,
11224
11979
  evm: evm,
11225
11980
  "interface": [
11226
11981
  {
@@ -11951,7 +12706,7 @@ var UniswapV2Pair = {
11951
12706
  ]
11952
12707
  };
11953
12708
 
11954
- var abi$f = [
12709
+ var abi$i = [
11955
12710
  {
11956
12711
  inputs: [
11957
12712
  {
@@ -13146,7 +13901,7 @@ var abi$f = [
13146
13901
  }
13147
13902
  ];
13148
13903
  var IBalancerV2Vault = {
13149
- abi: abi$f
13904
+ abi: abi$i
13150
13905
  };
13151
13906
 
13152
13907
  var Utils = /*#__PURE__*/function () {
@@ -13529,20 +14284,21 @@ var Utils = /*#__PURE__*/function () {
13529
14284
  }();
13530
14285
 
13531
14286
  _proto.getBalancerExitPoolTx = /*#__PURE__*/function () {
13532
- var _getBalancerExitPoolTx = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(pool, balancerPoolId, assets, amount // eslint-disable-next-line @typescript-eslint/no-explicit-any
14287
+ var _getBalancerExitPoolTx = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(pool, balancerPoolId, assets, singleExitAssetIndex, amount // eslint-disable-next-line @typescript-eslint/no-explicit-any
13533
14288
  ) {
13534
- var minimumAmountOut, iBalancerV2Vault, txData, exitPoolTx;
14289
+ var minimumAmountOut, iBalancerV2Vault, userTxData, txData, exitPoolTx;
13535
14290
  return runtime_1.wrap(function _callee8$(_context8) {
13536
14291
  while (1) {
13537
14292
  switch (_context8.prev = _context8.next) {
13538
14293
  case 0:
13539
14294
  minimumAmountOut = new Array(assets.length).fill(0);
13540
14295
  iBalancerV2Vault = new ethers.ethers.utils.Interface(IBalancerV2Vault.abi);
13541
- txData = [balancerPoolId, pool.address, pool.address, [assets, minimumAmountOut, ethers.ethers.utils.defaultAbiCoder.encode(["uint256", "uint256"], [1, amount]), false]];
14296
+ userTxData = singleExitAssetIndex === null ? ethers.ethers.utils.defaultAbiCoder.encode(["uint256", "uint256"], [1, amount]) : ethers.ethers.utils.defaultAbiCoder.encode(["uint256", "uint256", "uint256"], [0, amount, singleExitAssetIndex]);
14297
+ txData = [balancerPoolId, pool.address, pool.address, [assets, minimumAmountOut, userTxData, false]];
13542
14298
  exitPoolTx = iBalancerV2Vault.encodeFunctionData("exitPool", txData);
13543
14299
  return _context8.abrupt("return", exitPoolTx);
13544
14300
 
13545
- case 5:
14301
+ case 6:
13546
14302
  case "end":
13547
14303
  return _context8.stop();
13548
14304
  }
@@ -13550,7 +14306,7 @@ var Utils = /*#__PURE__*/function () {
13550
14306
  }, _callee8);
13551
14307
  }));
13552
14308
 
13553
- function getBalancerExitPoolTx(_x23, _x24, _x25, _x26) {
14309
+ function getBalancerExitPoolTx(_x23, _x24, _x25, _x26, _x27) {
13554
14310
  return _getBalancerExitPoolTx.apply(this, arguments);
13555
14311
  }
13556
14312
 
@@ -13661,17 +14417,16 @@ var Dhedge = /*#__PURE__*/function () {
13661
14417
  while (1) {
13662
14418
  switch (_context2.prev = _context2.next) {
13663
14419
  case 0:
13664
- this.validatePool(address);
13665
14420
  poolLogic = new ethers.Contract(address, PoolLogic.abi, this.signer);
13666
- _context2.next = 4;
14421
+ _context2.next = 3;
13667
14422
  return poolLogic.poolManagerLogic();
13668
14423
 
13669
- case 4:
14424
+ case 3:
13670
14425
  managerLogicAddress = _context2.sent;
13671
14426
  managerLogic = new ethers.Contract(managerLogicAddress, ManagerLogic.abi, this.signer);
13672
14427
  return _context2.abrupt("return", new Pool(this.network, this.signer, poolLogic, managerLogic, this.utils, this.factory));
13673
14428
 
13674
- case 7:
14429
+ case 6:
13675
14430
  case "end":
13676
14431
  return _context2.stop();
13677
14432
  }
@@ -13684,49 +14439,6 @@ var Dhedge = /*#__PURE__*/function () {
13684
14439
  }
13685
14440
 
13686
14441
  return loadPool;
13687
- }()
13688
- /**
13689
- * Check if pool address is valid
13690
- * @param {string} address Pool address
13691
- * @returns {boolean} Is valid pool address
13692
- */
13693
- ;
13694
-
13695
- _proto.validatePool =
13696
- /*#__PURE__*/
13697
- function () {
13698
- var _validatePool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(address) {
13699
- var isPool;
13700
- return runtime_1.wrap(function _callee3$(_context3) {
13701
- while (1) {
13702
- switch (_context3.prev = _context3.next) {
13703
- case 0:
13704
- _context3.next = 2;
13705
- return this.factory.isPool(address);
13706
-
13707
- case 2:
13708
- isPool = _context3.sent;
13709
-
13710
- if (isPool) {
13711
- _context3.next = 5;
13712
- break;
13713
- }
13714
-
13715
- throw new Error("Given address not a pool");
13716
-
13717
- case 5:
13718
- case "end":
13719
- return _context3.stop();
13720
- }
13721
- }
13722
- }, _callee3, this);
13723
- }));
13724
-
13725
- function validatePool(_x8) {
13726
- return _validatePool.apply(this, arguments);
13727
- }
13728
-
13729
- return validatePool;
13730
14442
  }();
13731
14443
 
13732
14444
  return Dhedge;