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