@dhedge/v2-sdk 1.3.0 → 1.4.0
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/pool.d.ts +10 -7
- package/dist/test/constants.d.ts +4 -3
- package/dist/types.d.ts +7 -9
- package/dist/v2-sdk.cjs.development.js +443 -81
- 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 +441 -79
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/IArrakisV1RouterStaking.json +107 -0
- package/src/abi/ILiquidityGaugeV4.json +153 -0
- package/src/config.ts +6 -2
- package/src/entities/pool.ts +107 -53
- package/src/test/aave.test.ts +53 -25
- package/src/test/arrakis.test.ts +89 -0
- package/src/test/constants.ts +11 -7
- package/src/test/oneInch.test.ts +13 -20
- package/src/test/pool.test.ts +1 -1
- 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,278 @@ 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
|
+
|
|
7539
7815
|
function multicall(_x5, _x6, _x7, _x8, _x9, _x10) {
|
|
7540
7816
|
return _multicall.apply(this, arguments);
|
|
7541
7817
|
}
|
|
@@ -8339,7 +8615,7 @@ function _getUniswapV3Liquidity() {
|
|
|
8339
8615
|
return _getUniswapV3Liquidity.apply(this, arguments);
|
|
8340
8616
|
}
|
|
8341
8617
|
|
|
8342
|
-
var abi$
|
|
8618
|
+
var abi$d = [
|
|
8343
8619
|
{
|
|
8344
8620
|
inputs: [
|
|
8345
8621
|
{
|
|
@@ -8560,10 +8836,10 @@ var abi$b = [
|
|
|
8560
8836
|
}
|
|
8561
8837
|
];
|
|
8562
8838
|
var IUniswapV3Router = {
|
|
8563
|
-
abi: abi$
|
|
8839
|
+
abi: abi$d
|
|
8564
8840
|
};
|
|
8565
8841
|
|
|
8566
|
-
var abi$
|
|
8842
|
+
var abi$e = [
|
|
8567
8843
|
{
|
|
8568
8844
|
inputs: [
|
|
8569
8845
|
{
|
|
@@ -8760,7 +9036,7 @@ var abi$c = [
|
|
|
8760
9036
|
}
|
|
8761
9037
|
];
|
|
8762
9038
|
var IUniswapV3Quoter = {
|
|
8763
|
-
abi: abi$
|
|
9039
|
+
abi: abi$e
|
|
8764
9040
|
};
|
|
8765
9041
|
|
|
8766
9042
|
function getUniswapV3SwapTxData(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
@@ -9139,7 +9415,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9139
9415
|
/*#__PURE__*/
|
|
9140
9416
|
function () {
|
|
9141
9417
|
var _trade = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(dapp, assetFrom, assetTo, amountIn, slippage, options) {
|
|
9142
|
-
var swapTxData, apiUrl, response, iSynthetix, assets, daoAddress, iUniswapV2Router, minAmountOut, tx;
|
|
9418
|
+
var swapTxData, chainId, apiUrl, response, iSynthetix, assets, daoAddress, iUniswapV2Router, minAmountOut, tx;
|
|
9143
9419
|
return runtime_1.wrap(function _callee8$(_context8) {
|
|
9144
9420
|
while (1) {
|
|
9145
9421
|
switch (_context8.prev = _context8.next) {
|
|
@@ -9153,37 +9429,38 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9153
9429
|
}
|
|
9154
9430
|
|
|
9155
9431
|
if (!(dapp === Dapp.ONEINCH)) {
|
|
9156
|
-
_context8.next =
|
|
9432
|
+
_context8.next = 11;
|
|
9157
9433
|
break;
|
|
9158
9434
|
}
|
|
9159
9435
|
|
|
9160
|
-
|
|
9161
|
-
|
|
9436
|
+
chainId = networkChainIdMap[this.network];
|
|
9437
|
+
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";
|
|
9438
|
+
_context8.next = 7;
|
|
9162
9439
|
return axios.get(apiUrl);
|
|
9163
9440
|
|
|
9164
|
-
case
|
|
9441
|
+
case 7:
|
|
9165
9442
|
response = _context8.sent;
|
|
9166
9443
|
swapTxData = response.data.tx.data;
|
|
9167
|
-
_context8.next =
|
|
9444
|
+
_context8.next = 31;
|
|
9168
9445
|
break;
|
|
9169
9446
|
|
|
9170
|
-
case
|
|
9447
|
+
case 11:
|
|
9171
9448
|
if (!(dapp === Dapp.BALANCER)) {
|
|
9172
|
-
_context8.next =
|
|
9449
|
+
_context8.next = 17;
|
|
9173
9450
|
break;
|
|
9174
9451
|
}
|
|
9175
9452
|
|
|
9176
|
-
_context8.next =
|
|
9453
|
+
_context8.next = 14;
|
|
9177
9454
|
return this.utils.getBalancerSwapTx(this, assetFrom, assetTo, amountIn, slippage);
|
|
9178
9455
|
|
|
9179
|
-
case
|
|
9456
|
+
case 14:
|
|
9180
9457
|
swapTxData = _context8.sent;
|
|
9181
|
-
_context8.next =
|
|
9458
|
+
_context8.next = 31;
|
|
9182
9459
|
break;
|
|
9183
9460
|
|
|
9184
|
-
case
|
|
9461
|
+
case 17:
|
|
9185
9462
|
if (!(dapp === Dapp.SYNTHETIX)) {
|
|
9186
|
-
_context8.next =
|
|
9463
|
+
_context8.next = 26;
|
|
9187
9464
|
break;
|
|
9188
9465
|
}
|
|
9189
9466
|
|
|
@@ -9191,33 +9468,33 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9191
9468
|
assets = [assetFrom, assetTo].map(function (asset) {
|
|
9192
9469
|
return ethers.utils.formatBytes32String(asset);
|
|
9193
9470
|
});
|
|
9194
|
-
_context8.next =
|
|
9471
|
+
_context8.next = 22;
|
|
9195
9472
|
return this.factory.owner();
|
|
9196
9473
|
|
|
9197
|
-
case
|
|
9474
|
+
case 22:
|
|
9198
9475
|
daoAddress = _context8.sent;
|
|
9199
9476
|
swapTxData = iSynthetix.encodeFunctionData(Transaction.SWAP_SYNTHS, [assets[0], amountIn, assets[1], daoAddress, SYNTHETIX_TRACKING_CODE]);
|
|
9200
|
-
_context8.next =
|
|
9477
|
+
_context8.next = 31;
|
|
9201
9478
|
break;
|
|
9202
9479
|
|
|
9203
|
-
case
|
|
9480
|
+
case 26:
|
|
9204
9481
|
iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
|
|
9205
|
-
_context8.next =
|
|
9482
|
+
_context8.next = 29;
|
|
9206
9483
|
return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
|
|
9207
9484
|
|
|
9208
|
-
case
|
|
9485
|
+
case 29:
|
|
9209
9486
|
minAmountOut = _context8.sent;
|
|
9210
9487
|
swapTxData = iUniswapV2Router.encodeFunctionData(Transaction.SWAP, [amountIn, minAmountOut, [assetFrom, assetTo], this.address, deadline]);
|
|
9211
9488
|
|
|
9212
|
-
case
|
|
9213
|
-
_context8.next =
|
|
9489
|
+
case 31:
|
|
9490
|
+
_context8.next = 33;
|
|
9214
9491
|
return this.poolLogic.execTransaction(routerAddress[this.network][dapp], swapTxData, options);
|
|
9215
9492
|
|
|
9216
|
-
case
|
|
9493
|
+
case 33:
|
|
9217
9494
|
tx = _context8.sent;
|
|
9218
9495
|
return _context8.abrupt("return", tx);
|
|
9219
9496
|
|
|
9220
|
-
case
|
|
9497
|
+
case 35:
|
|
9221
9498
|
case "end":
|
|
9222
9499
|
return _context8.stop();
|
|
9223
9500
|
}
|
|
@@ -10038,7 +10315,8 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10038
10315
|
return addLiquidityUniswapV3;
|
|
10039
10316
|
}()
|
|
10040
10317
|
/**
|
|
10041
|
-
* Remove liquidity from an UniswapV3 liquidity pool
|
|
10318
|
+
* Remove liquidity from an UniswapV3 or Arrakis liquidity pool
|
|
10319
|
+
* @param {Dapp} dapp Platform either UniswapV3 or Arrakis
|
|
10042
10320
|
* @param {string} tokenId Token Id of UniswapV3 position
|
|
10043
10321
|
* @param {number} amount Amount in percent of assets to be removed
|
|
10044
10322
|
* @param {any} options Transaction options
|
|
@@ -10046,11 +10324,12 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10046
10324
|
*/
|
|
10047
10325
|
;
|
|
10048
10326
|
|
|
10049
|
-
_proto.
|
|
10327
|
+
_proto.decreaseLiquidity =
|
|
10050
10328
|
/*#__PURE__*/
|
|
10051
10329
|
function () {
|
|
10052
|
-
var
|
|
10053
|
-
var
|
|
10330
|
+
var _decreaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee25(dapp, tokenId, amount, options) {
|
|
10331
|
+
var txData, dappAddress, abi, liquidity, decreaseLiquidityTxData, collectTxData, multicallParams, burnTxData, _abi, _liquidity, tx;
|
|
10332
|
+
|
|
10054
10333
|
return runtime_1.wrap(function _callee25$(_context25) {
|
|
10055
10334
|
while (1) {
|
|
10056
10335
|
switch (_context25.prev = _context25.next) {
|
|
@@ -10063,30 +10342,60 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10063
10342
|
options = null;
|
|
10064
10343
|
}
|
|
10065
10344
|
|
|
10066
|
-
|
|
10067
|
-
|
|
10345
|
+
if (!(dapp === Dapp.UNISWAPV3)) {
|
|
10346
|
+
_context25.next = 15;
|
|
10347
|
+
break;
|
|
10348
|
+
}
|
|
10349
|
+
|
|
10350
|
+
dappAddress = nonfungiblePositionManagerAddress[this.network];
|
|
10351
|
+
abi = new ethers.utils.Interface(INonfungiblePositionManager.abi);
|
|
10352
|
+
_context25.next = 7;
|
|
10068
10353
|
return getUniswapV3Liquidity(tokenId, this);
|
|
10069
10354
|
|
|
10070
|
-
case
|
|
10355
|
+
case 7:
|
|
10071
10356
|
liquidity = _context25.sent.mul(amount).div(100);
|
|
10072
|
-
decreaseLiquidityTxData =
|
|
10073
|
-
collectTxData =
|
|
10357
|
+
decreaseLiquidityTxData = abi.encodeFunctionData(Transaction.DECREASE_LIQUIDITY, [[tokenId, liquidity, 0, 0, deadline]]);
|
|
10358
|
+
collectTxData = abi.encodeFunctionData(Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
|
|
10074
10359
|
multicallParams = [decreaseLiquidityTxData, collectTxData];
|
|
10075
10360
|
|
|
10076
10361
|
if (amount === 100) {
|
|
10077
|
-
burnTxData =
|
|
10362
|
+
burnTxData = abi.encodeFunctionData(Transaction.BURN, [tokenId]);
|
|
10078
10363
|
multicallParams.push(burnTxData);
|
|
10079
10364
|
}
|
|
10080
10365
|
|
|
10081
|
-
|
|
10082
|
-
_context25.next =
|
|
10083
|
-
|
|
10366
|
+
txData = abi.encodeFunctionData(Transaction.MULTI_CALL, [multicallParams]);
|
|
10367
|
+
_context25.next = 25;
|
|
10368
|
+
break;
|
|
10084
10369
|
|
|
10085
|
-
case
|
|
10370
|
+
case 15:
|
|
10371
|
+
if (!(dapp === Dapp.ARRAKIS)) {
|
|
10372
|
+
_context25.next = 24;
|
|
10373
|
+
break;
|
|
10374
|
+
}
|
|
10375
|
+
|
|
10376
|
+
dappAddress = routerAddress[this.network][dapp];
|
|
10377
|
+
_abi = new ethers.utils.Interface(IArrakisV1RouterStaking.abi);
|
|
10378
|
+
_context25.next = 20;
|
|
10379
|
+
return this.utils.getBalance(tokenId, this.address);
|
|
10380
|
+
|
|
10381
|
+
case 20:
|
|
10382
|
+
_liquidity = _context25.sent.mul(amount).div(100);
|
|
10383
|
+
txData = _abi.encodeFunctionData(Transaction.REMOVE_LIQUIDITY_UNSTAKE, [tokenId, _liquidity, 0, 0, this.address]);
|
|
10384
|
+
_context25.next = 25;
|
|
10385
|
+
break;
|
|
10386
|
+
|
|
10387
|
+
case 24:
|
|
10388
|
+
throw new Error("dapp not supported");
|
|
10389
|
+
|
|
10390
|
+
case 25:
|
|
10391
|
+
_context25.next = 27;
|
|
10392
|
+
return this.poolLogic.execTransaction(dappAddress, txData, options);
|
|
10393
|
+
|
|
10394
|
+
case 27:
|
|
10086
10395
|
tx = _context25.sent;
|
|
10087
10396
|
return _context25.abrupt("return", tx);
|
|
10088
10397
|
|
|
10089
|
-
case
|
|
10398
|
+
case 29:
|
|
10090
10399
|
case "end":
|
|
10091
10400
|
return _context25.stop();
|
|
10092
10401
|
}
|
|
@@ -10094,14 +10403,15 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10094
10403
|
}, _callee25, this);
|
|
10095
10404
|
}));
|
|
10096
10405
|
|
|
10097
|
-
function
|
|
10098
|
-
return
|
|
10406
|
+
function decreaseLiquidity(_x91, _x92, _x93, _x94) {
|
|
10407
|
+
return _decreaseLiquidity.apply(this, arguments);
|
|
10099
10408
|
}
|
|
10100
10409
|
|
|
10101
|
-
return
|
|
10410
|
+
return decreaseLiquidity;
|
|
10102
10411
|
}()
|
|
10103
10412
|
/**
|
|
10104
|
-
* Increase liquidity of an UniswapV3 liquidity pool
|
|
10413
|
+
* Increase liquidity of an UniswapV3 or Arrakis liquidity pool
|
|
10414
|
+
* @param {Dapp} dapp Platform either UniswapV3 or Arrakis
|
|
10105
10415
|
* @param {string} tokenId Token Id of UniswapV3 position
|
|
10106
10416
|
* @param {BigNumber | string} amountA Amount first asset
|
|
10107
10417
|
* @param {BigNumber | string} amountB Amount second asset
|
|
@@ -10110,11 +10420,12 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10110
10420
|
*/
|
|
10111
10421
|
;
|
|
10112
10422
|
|
|
10113
|
-
_proto.
|
|
10423
|
+
_proto.increaseLiquidity =
|
|
10114
10424
|
/*#__PURE__*/
|
|
10115
10425
|
function () {
|
|
10116
|
-
var
|
|
10117
|
-
var
|
|
10426
|
+
var _increaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee26(dapp, tokenId, amountA, amountB, options) {
|
|
10427
|
+
var txData, dappAddress, abi, _abi2, tx;
|
|
10428
|
+
|
|
10118
10429
|
return runtime_1.wrap(function _callee26$(_context26) {
|
|
10119
10430
|
while (1) {
|
|
10120
10431
|
switch (_context26.prev = _context26.next) {
|
|
@@ -10123,16 +10434,41 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10123
10434
|
options = null;
|
|
10124
10435
|
}
|
|
10125
10436
|
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10437
|
+
if (!(dapp === Dapp.UNISWAPV3)) {
|
|
10438
|
+
_context26.next = 7;
|
|
10439
|
+
break;
|
|
10440
|
+
}
|
|
10130
10441
|
|
|
10131
|
-
|
|
10442
|
+
dappAddress = nonfungiblePositionManagerAddress[this.network];
|
|
10443
|
+
abi = new ethers.utils.Interface(INonfungiblePositionManager.abi);
|
|
10444
|
+
txData = abi.encodeFunctionData(Transaction.INCREASE_LIQUIDITY, [[tokenId, amountA, amountB, 0, 0, deadline]]);
|
|
10445
|
+
_context26.next = 14;
|
|
10446
|
+
break;
|
|
10447
|
+
|
|
10448
|
+
case 7:
|
|
10449
|
+
if (!(dapp === Dapp.ARRAKIS)) {
|
|
10450
|
+
_context26.next = 13;
|
|
10451
|
+
break;
|
|
10452
|
+
}
|
|
10453
|
+
|
|
10454
|
+
dappAddress = routerAddress[this.network][dapp];
|
|
10455
|
+
_abi2 = new ethers.utils.Interface(IArrakisV1RouterStaking.abi);
|
|
10456
|
+
txData = _abi2.encodeFunctionData(Transaction.ADD_LIQUIDITY_STAKE, [tokenId, amountA, amountB, 0, 0, this.address]);
|
|
10457
|
+
_context26.next = 14;
|
|
10458
|
+
break;
|
|
10459
|
+
|
|
10460
|
+
case 13:
|
|
10461
|
+
throw new Error("dapp not supported");
|
|
10462
|
+
|
|
10463
|
+
case 14:
|
|
10464
|
+
_context26.next = 16;
|
|
10465
|
+
return this.poolLogic.execTransaction(dappAddress, txData, options);
|
|
10466
|
+
|
|
10467
|
+
case 16:
|
|
10132
10468
|
tx = _context26.sent;
|
|
10133
10469
|
return _context26.abrupt("return", tx);
|
|
10134
10470
|
|
|
10135
|
-
case
|
|
10471
|
+
case 18:
|
|
10136
10472
|
case "end":
|
|
10137
10473
|
return _context26.stop();
|
|
10138
10474
|
}
|
|
@@ -10140,25 +10476,26 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10140
10476
|
}, _callee26, this);
|
|
10141
10477
|
}));
|
|
10142
10478
|
|
|
10143
|
-
function
|
|
10144
|
-
return
|
|
10479
|
+
function increaseLiquidity(_x95, _x96, _x97, _x98, _x99) {
|
|
10480
|
+
return _increaseLiquidity.apply(this, arguments);
|
|
10145
10481
|
}
|
|
10146
10482
|
|
|
10147
|
-
return
|
|
10483
|
+
return increaseLiquidity;
|
|
10148
10484
|
}()
|
|
10149
10485
|
/**
|
|
10150
|
-
* Claim fees of an UniswapV3 liquidity pool
|
|
10151
|
-
* @param {
|
|
10486
|
+
* Claim fees of an UniswapV3 liquidity or Arrakis pool
|
|
10487
|
+
* @param {Dapp} dapp Platform either UniswapV3 or Arrakis
|
|
10488
|
+
* @param {string} tokenId Token Id of UniswapV3 or Arrakis position
|
|
10152
10489
|
* @param {any} options Transaction options
|
|
10153
10490
|
* @returns {Promise<any>} Transaction
|
|
10154
10491
|
*/
|
|
10155
10492
|
;
|
|
10156
10493
|
|
|
10157
|
-
_proto.
|
|
10494
|
+
_proto.claimFees =
|
|
10158
10495
|
/*#__PURE__*/
|
|
10159
10496
|
function () {
|
|
10160
|
-
var
|
|
10161
|
-
var iNonfungiblePositionManager,
|
|
10497
|
+
var _claimFees = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee27(dapp, tokenId, options) {
|
|
10498
|
+
var txData, contractAddress, iNonfungiblePositionManager, abi, tx;
|
|
10162
10499
|
return runtime_1.wrap(function _callee27$(_context27) {
|
|
10163
10500
|
while (1) {
|
|
10164
10501
|
switch (_context27.prev = _context27.next) {
|
|
@@ -10167,16 +10504,41 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10167
10504
|
options = null;
|
|
10168
10505
|
}
|
|
10169
10506
|
|
|
10507
|
+
if (!(dapp === Dapp.UNISWAPV3)) {
|
|
10508
|
+
_context27.next = 7;
|
|
10509
|
+
break;
|
|
10510
|
+
}
|
|
10511
|
+
|
|
10512
|
+
contractAddress = nonfungiblePositionManagerAddress[this.network];
|
|
10170
10513
|
iNonfungiblePositionManager = new ethers.utils.Interface(INonfungiblePositionManager.abi);
|
|
10171
|
-
|
|
10172
|
-
_context27.next =
|
|
10173
|
-
|
|
10514
|
+
txData = iNonfungiblePositionManager.encodeFunctionData(Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
|
|
10515
|
+
_context27.next = 14;
|
|
10516
|
+
break;
|
|
10174
10517
|
|
|
10175
|
-
case
|
|
10518
|
+
case 7:
|
|
10519
|
+
if (!(dapp === Dapp.ARRAKIS)) {
|
|
10520
|
+
_context27.next = 13;
|
|
10521
|
+
break;
|
|
10522
|
+
}
|
|
10523
|
+
|
|
10524
|
+
contractAddress = tokenId;
|
|
10525
|
+
abi = new ethers.utils.Interface(ILiquidityGaugeV4.abi);
|
|
10526
|
+
txData = abi.encodeFunctionData("claim_rewards()", []);
|
|
10527
|
+
_context27.next = 14;
|
|
10528
|
+
break;
|
|
10529
|
+
|
|
10530
|
+
case 13:
|
|
10531
|
+
throw new Error("dapp not supported");
|
|
10532
|
+
|
|
10533
|
+
case 14:
|
|
10534
|
+
_context27.next = 16;
|
|
10535
|
+
return this.poolLogic.execTransaction(contractAddress, txData, options);
|
|
10536
|
+
|
|
10537
|
+
case 16:
|
|
10176
10538
|
tx = _context27.sent;
|
|
10177
10539
|
return _context27.abrupt("return", tx);
|
|
10178
10540
|
|
|
10179
|
-
case
|
|
10541
|
+
case 18:
|
|
10180
10542
|
case "end":
|
|
10181
10543
|
return _context27.stop();
|
|
10182
10544
|
}
|
|
@@ -10184,11 +10546,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10184
10546
|
}, _callee27, this);
|
|
10185
10547
|
}));
|
|
10186
10548
|
|
|
10187
|
-
function
|
|
10188
|
-
return
|
|
10549
|
+
function claimFees(_x100, _x101, _x102) {
|
|
10550
|
+
return _claimFees.apply(this, arguments);
|
|
10189
10551
|
}
|
|
10190
10552
|
|
|
10191
|
-
return
|
|
10553
|
+
return claimFees;
|
|
10192
10554
|
}()
|
|
10193
10555
|
/**
|
|
10194
10556
|
* Trade an asset into another asset
|
|
@@ -10240,7 +10602,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10240
10602
|
}, _callee28, this);
|
|
10241
10603
|
}));
|
|
10242
10604
|
|
|
10243
|
-
function tradeUniswapV3(
|
|
10605
|
+
function tradeUniswapV3(_x103, _x104, _x105, _x106, _x107, _x108) {
|
|
10244
10606
|
return _tradeUniswapV.apply(this, arguments);
|
|
10245
10607
|
}
|
|
10246
10608
|
|
|
@@ -10250,7 +10612,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10250
10612
|
return Pool;
|
|
10251
10613
|
}();
|
|
10252
10614
|
|
|
10253
|
-
var abi$
|
|
10615
|
+
var abi$f = [
|
|
10254
10616
|
{
|
|
10255
10617
|
inputs: [
|
|
10256
10618
|
{
|
|
@@ -10474,10 +10836,10 @@ var abi$d = [
|
|
|
10474
10836
|
}
|
|
10475
10837
|
];
|
|
10476
10838
|
var UniswapV2Factory = {
|
|
10477
|
-
abi: abi$
|
|
10839
|
+
abi: abi$f
|
|
10478
10840
|
};
|
|
10479
10841
|
|
|
10480
|
-
var abi$
|
|
10842
|
+
var abi$g = [
|
|
10481
10843
|
{
|
|
10482
10844
|
anonymous: false,
|
|
10483
10845
|
inputs: [
|
|
@@ -11221,7 +11583,7 @@ var evm = {
|
|
|
11221
11583
|
}
|
|
11222
11584
|
};
|
|
11223
11585
|
var UniswapV2Pair = {
|
|
11224
|
-
abi: abi$
|
|
11586
|
+
abi: abi$g,
|
|
11225
11587
|
evm: evm,
|
|
11226
11588
|
"interface": [
|
|
11227
11589
|
{
|
|
@@ -11952,7 +12314,7 @@ var UniswapV2Pair = {
|
|
|
11952
12314
|
]
|
|
11953
12315
|
};
|
|
11954
12316
|
|
|
11955
|
-
var abi$
|
|
12317
|
+
var abi$h = [
|
|
11956
12318
|
{
|
|
11957
12319
|
inputs: [
|
|
11958
12320
|
{
|
|
@@ -13147,7 +13509,7 @@ var abi$f = [
|
|
|
13147
13509
|
}
|
|
13148
13510
|
];
|
|
13149
13511
|
var IBalancerV2Vault = {
|
|
13150
|
-
abi: abi$
|
|
13512
|
+
abi: abi$h
|
|
13151
13513
|
};
|
|
13152
13514
|
|
|
13153
13515
|
var Utils = /*#__PURE__*/function () {
|