@dhedge/v2-sdk 1.4.0 → 1.4.3
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 +33 -7
- package/dist/entities/utils.d.ts +1 -1
- package/dist/test/constants.d.ts +4 -1
- package/dist/test/txOptions.d.ts +2 -1
- package/dist/v2-sdk.cjs.development.js +677 -327
- 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 +675 -325
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/IBalancerRewardsGauge.json +239 -0
- package/src/entities/dhedge.ts +0 -11
- package/src/entities/pool.ts +92 -13
- package/src/entities/utils.ts +13 -9
- package/src/test/1inch.test.ts +54 -0
- package/src/test/arrakis.test.ts +2 -2
- package/src/test/balancer.test.ts +115 -10
- package/src/test/constants.ts +5 -1
- package/src/test/txOptions.ts +16 -10
package/dist/v2-sdk.esm.js
CHANGED
|
@@ -7812,6 +7812,258 @@ var ILiquidityGaugeV4 = {
|
|
|
7812
7812
|
abi: abi$c
|
|
7813
7813
|
};
|
|
7814
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
|
+
|
|
7815
8067
|
function multicall(_x5, _x6, _x7, _x8, _x9, _x10) {
|
|
7816
8068
|
return _multicall.apply(this, arguments);
|
|
7817
8069
|
}
|
|
@@ -8615,7 +8867,7 @@ function _getUniswapV3Liquidity() {
|
|
|
8615
8867
|
return _getUniswapV3Liquidity.apply(this, arguments);
|
|
8616
8868
|
}
|
|
8617
8869
|
|
|
8618
|
-
var abi$
|
|
8870
|
+
var abi$e = [
|
|
8619
8871
|
{
|
|
8620
8872
|
inputs: [
|
|
8621
8873
|
{
|
|
@@ -8836,10 +9088,10 @@ var abi$d = [
|
|
|
8836
9088
|
}
|
|
8837
9089
|
];
|
|
8838
9090
|
var IUniswapV3Router = {
|
|
8839
|
-
abi: abi$
|
|
9091
|
+
abi: abi$e
|
|
8840
9092
|
};
|
|
8841
9093
|
|
|
8842
|
-
var abi$
|
|
9094
|
+
var abi$f = [
|
|
8843
9095
|
{
|
|
8844
9096
|
inputs: [
|
|
8845
9097
|
{
|
|
@@ -9036,7 +9288,7 @@ var abi$e = [
|
|
|
9036
9288
|
}
|
|
9037
9289
|
];
|
|
9038
9290
|
var IUniswapV3Quoter = {
|
|
9039
|
-
abi: abi$
|
|
9291
|
+
abi: abi$f
|
|
9040
9292
|
};
|
|
9041
9293
|
|
|
9042
9294
|
function getUniswapV3SwapTxData(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
@@ -9399,6 +9651,52 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9399
9651
|
|
|
9400
9652
|
return approveUniswapV3Liquidity;
|
|
9401
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
|
+
}()
|
|
9402
9700
|
/**
|
|
9403
9701
|
* Trade an asset into another asset
|
|
9404
9702
|
* @param {Dapp} dapp Platform like Sushiswap or Uniswap
|
|
@@ -9414,11 +9712,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9414
9712
|
_proto.trade =
|
|
9415
9713
|
/*#__PURE__*/
|
|
9416
9714
|
function () {
|
|
9417
|
-
var _trade = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
9715
|
+
var _trade = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(dapp, assetFrom, assetTo, amountIn, slippage, options) {
|
|
9418
9716
|
var swapTxData, chainId, apiUrl, response, iSynthetix, assets, daoAddress, iUniswapV2Router, minAmountOut, tx;
|
|
9419
|
-
return runtime_1.wrap(function
|
|
9717
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
9420
9718
|
while (1) {
|
|
9421
|
-
switch (
|
|
9719
|
+
switch (_context9.prev = _context9.next) {
|
|
9422
9720
|
case 0:
|
|
9423
9721
|
if (slippage === void 0) {
|
|
9424
9722
|
slippage = 0.5;
|
|
@@ -9429,38 +9727,38 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9429
9727
|
}
|
|
9430
9728
|
|
|
9431
9729
|
if (!(dapp === Dapp.ONEINCH)) {
|
|
9432
|
-
|
|
9730
|
+
_context9.next = 11;
|
|
9433
9731
|
break;
|
|
9434
9732
|
}
|
|
9435
9733
|
|
|
9436
9734
|
chainId = networkChainIdMap[this.network];
|
|
9437
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";
|
|
9438
|
-
|
|
9736
|
+
_context9.next = 7;
|
|
9439
9737
|
return axios.get(apiUrl);
|
|
9440
9738
|
|
|
9441
9739
|
case 7:
|
|
9442
|
-
response =
|
|
9740
|
+
response = _context9.sent;
|
|
9443
9741
|
swapTxData = response.data.tx.data;
|
|
9444
|
-
|
|
9742
|
+
_context9.next = 31;
|
|
9445
9743
|
break;
|
|
9446
9744
|
|
|
9447
9745
|
case 11:
|
|
9448
9746
|
if (!(dapp === Dapp.BALANCER)) {
|
|
9449
|
-
|
|
9747
|
+
_context9.next = 17;
|
|
9450
9748
|
break;
|
|
9451
9749
|
}
|
|
9452
9750
|
|
|
9453
|
-
|
|
9751
|
+
_context9.next = 14;
|
|
9454
9752
|
return this.utils.getBalancerSwapTx(this, assetFrom, assetTo, amountIn, slippage);
|
|
9455
9753
|
|
|
9456
9754
|
case 14:
|
|
9457
|
-
swapTxData =
|
|
9458
|
-
|
|
9755
|
+
swapTxData = _context9.sent;
|
|
9756
|
+
_context9.next = 31;
|
|
9459
9757
|
break;
|
|
9460
9758
|
|
|
9461
9759
|
case 17:
|
|
9462
9760
|
if (!(dapp === Dapp.SYNTHETIX)) {
|
|
9463
|
-
|
|
9761
|
+
_context9.next = 26;
|
|
9464
9762
|
break;
|
|
9465
9763
|
}
|
|
9466
9764
|
|
|
@@ -9468,41 +9766,41 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9468
9766
|
assets = [assetFrom, assetTo].map(function (asset) {
|
|
9469
9767
|
return ethers.utils.formatBytes32String(asset);
|
|
9470
9768
|
});
|
|
9471
|
-
|
|
9769
|
+
_context9.next = 22;
|
|
9472
9770
|
return this.factory.owner();
|
|
9473
9771
|
|
|
9474
9772
|
case 22:
|
|
9475
|
-
daoAddress =
|
|
9773
|
+
daoAddress = _context9.sent;
|
|
9476
9774
|
swapTxData = iSynthetix.encodeFunctionData(Transaction.SWAP_SYNTHS, [assets[0], amountIn, assets[1], daoAddress, SYNTHETIX_TRACKING_CODE]);
|
|
9477
|
-
|
|
9775
|
+
_context9.next = 31;
|
|
9478
9776
|
break;
|
|
9479
9777
|
|
|
9480
9778
|
case 26:
|
|
9481
9779
|
iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
|
|
9482
|
-
|
|
9780
|
+
_context9.next = 29;
|
|
9483
9781
|
return this.utils.getMinAmountOut(dapp, assetFrom, assetTo, amountIn, slippage);
|
|
9484
9782
|
|
|
9485
9783
|
case 29:
|
|
9486
|
-
minAmountOut =
|
|
9784
|
+
minAmountOut = _context9.sent;
|
|
9487
9785
|
swapTxData = iUniswapV2Router.encodeFunctionData(Transaction.SWAP, [amountIn, minAmountOut, [assetFrom, assetTo], this.address, deadline]);
|
|
9488
9786
|
|
|
9489
9787
|
case 31:
|
|
9490
|
-
|
|
9788
|
+
_context9.next = 33;
|
|
9491
9789
|
return this.poolLogic.execTransaction(routerAddress[this.network][dapp], swapTxData, options);
|
|
9492
9790
|
|
|
9493
9791
|
case 33:
|
|
9494
|
-
tx =
|
|
9495
|
-
return
|
|
9792
|
+
tx = _context9.sent;
|
|
9793
|
+
return _context9.abrupt("return", tx);
|
|
9496
9794
|
|
|
9497
9795
|
case 35:
|
|
9498
9796
|
case "end":
|
|
9499
|
-
return
|
|
9797
|
+
return _context9.stop();
|
|
9500
9798
|
}
|
|
9501
9799
|
}
|
|
9502
|
-
},
|
|
9800
|
+
}, _callee9, this);
|
|
9503
9801
|
}));
|
|
9504
9802
|
|
|
9505
|
-
function trade(
|
|
9803
|
+
function trade(_x24, _x25, _x26, _x27, _x28, _x29) {
|
|
9506
9804
|
return _trade.apply(this, arguments);
|
|
9507
9805
|
}
|
|
9508
9806
|
|
|
@@ -9523,11 +9821,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9523
9821
|
_proto.addLiquidity =
|
|
9524
9822
|
/*#__PURE__*/
|
|
9525
9823
|
function () {
|
|
9526
|
-
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) {
|
|
9527
9825
|
var iUniswapV2Router, addLiquidityTxData, tx;
|
|
9528
|
-
return runtime_1.wrap(function
|
|
9826
|
+
return runtime_1.wrap(function _callee10$(_context10) {
|
|
9529
9827
|
while (1) {
|
|
9530
|
-
switch (
|
|
9828
|
+
switch (_context10.prev = _context10.next) {
|
|
9531
9829
|
case 0:
|
|
9532
9830
|
if (options === void 0) {
|
|
9533
9831
|
options = null;
|
|
@@ -9535,22 +9833,22 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9535
9833
|
|
|
9536
9834
|
iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
|
|
9537
9835
|
addLiquidityTxData = iUniswapV2Router.encodeFunctionData(Transaction.ADD_LIQUIDITY, [assetA, assetB, amountA, amountB, 0, 0, this.address, deadline]);
|
|
9538
|
-
|
|
9836
|
+
_context10.next = 5;
|
|
9539
9837
|
return this.poolLogic.execTransaction(routerAddress[this.network][dapp], addLiquidityTxData, options);
|
|
9540
9838
|
|
|
9541
9839
|
case 5:
|
|
9542
|
-
tx =
|
|
9543
|
-
return
|
|
9840
|
+
tx = _context10.sent;
|
|
9841
|
+
return _context10.abrupt("return", tx);
|
|
9544
9842
|
|
|
9545
9843
|
case 7:
|
|
9546
9844
|
case "end":
|
|
9547
|
-
return
|
|
9845
|
+
return _context10.stop();
|
|
9548
9846
|
}
|
|
9549
9847
|
}
|
|
9550
|
-
},
|
|
9848
|
+
}, _callee10, this);
|
|
9551
9849
|
}));
|
|
9552
9850
|
|
|
9553
|
-
function addLiquidity(
|
|
9851
|
+
function addLiquidity(_x30, _x31, _x32, _x33, _x34, _x35) {
|
|
9554
9852
|
return _addLiquidity.apply(this, arguments);
|
|
9555
9853
|
}
|
|
9556
9854
|
|
|
@@ -9570,11 +9868,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9570
9868
|
_proto.removeLiquidity =
|
|
9571
9869
|
/*#__PURE__*/
|
|
9572
9870
|
function () {
|
|
9573
|
-
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) {
|
|
9574
9872
|
var iUniswapV2Router, removeLiquidityTxData, tx;
|
|
9575
|
-
return runtime_1.wrap(function
|
|
9873
|
+
return runtime_1.wrap(function _callee11$(_context11) {
|
|
9576
9874
|
while (1) {
|
|
9577
|
-
switch (
|
|
9875
|
+
switch (_context11.prev = _context11.next) {
|
|
9578
9876
|
case 0:
|
|
9579
9877
|
if (options === void 0) {
|
|
9580
9878
|
options = null;
|
|
@@ -9582,22 +9880,22 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9582
9880
|
|
|
9583
9881
|
iUniswapV2Router = new ethers.utils.Interface(IUniswapV2Router.abi);
|
|
9584
9882
|
removeLiquidityTxData = iUniswapV2Router.encodeFunctionData(Transaction.REMOVE_LIQUIDITY, [assetA, assetB, amount, 0, 0, this.address, deadline]);
|
|
9585
|
-
|
|
9883
|
+
_context11.next = 5;
|
|
9586
9884
|
return this.poolLogic.execTransaction(routerAddress[this.network][dapp], removeLiquidityTxData, options);
|
|
9587
9885
|
|
|
9588
9886
|
case 5:
|
|
9589
|
-
tx =
|
|
9590
|
-
return
|
|
9887
|
+
tx = _context11.sent;
|
|
9888
|
+
return _context11.abrupt("return", tx);
|
|
9591
9889
|
|
|
9592
9890
|
case 7:
|
|
9593
9891
|
case "end":
|
|
9594
|
-
return
|
|
9892
|
+
return _context11.stop();
|
|
9595
9893
|
}
|
|
9596
9894
|
}
|
|
9597
|
-
},
|
|
9895
|
+
}, _callee11, this);
|
|
9598
9896
|
}));
|
|
9599
9897
|
|
|
9600
|
-
function removeLiquidity(
|
|
9898
|
+
function removeLiquidity(_x36, _x37, _x38, _x39, _x40) {
|
|
9601
9899
|
return _removeLiquidity.apply(this, arguments);
|
|
9602
9900
|
}
|
|
9603
9901
|
|
|
@@ -9616,44 +9914,89 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9616
9914
|
_proto.stake =
|
|
9617
9915
|
/*#__PURE__*/
|
|
9618
9916
|
function () {
|
|
9619
|
-
var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
9917
|
+
var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(dapp, asset, amount, options) {
|
|
9620
9918
|
var iMiniChefV2, poolId, stakeTxData, tx;
|
|
9621
|
-
return runtime_1.wrap(function
|
|
9919
|
+
return runtime_1.wrap(function _callee12$(_context12) {
|
|
9622
9920
|
while (1) {
|
|
9623
|
-
switch (
|
|
9921
|
+
switch (_context12.prev = _context12.next) {
|
|
9624
9922
|
case 0:
|
|
9625
9923
|
if (options === void 0) {
|
|
9626
9924
|
options = null;
|
|
9627
9925
|
}
|
|
9628
9926
|
|
|
9629
9927
|
iMiniChefV2 = new ethers.utils.Interface(IMiniChefV2.abi);
|
|
9630
|
-
|
|
9928
|
+
_context12.next = 4;
|
|
9631
9929
|
return this.utils.getLpPoolId(dapp, asset);
|
|
9632
9930
|
|
|
9633
9931
|
case 4:
|
|
9634
|
-
poolId =
|
|
9932
|
+
poolId = _context12.sent;
|
|
9635
9933
|
stakeTxData = iMiniChefV2.encodeFunctionData(Transaction.DEPOSIT, [poolId, amount, this.address]);
|
|
9636
|
-
|
|
9934
|
+
_context12.next = 8;
|
|
9637
9935
|
return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], stakeTxData, options);
|
|
9638
9936
|
|
|
9639
9937
|
case 8:
|
|
9640
|
-
tx =
|
|
9641
|
-
return
|
|
9938
|
+
tx = _context12.sent;
|
|
9939
|
+
return _context12.abrupt("return", tx);
|
|
9642
9940
|
|
|
9643
9941
|
case 10:
|
|
9644
9942
|
case "end":
|
|
9645
|
-
return
|
|
9943
|
+
return _context12.stop();
|
|
9646
9944
|
}
|
|
9647
9945
|
}
|
|
9648
|
-
},
|
|
9946
|
+
}, _callee12, this);
|
|
9649
9947
|
}));
|
|
9650
9948
|
|
|
9651
|
-
function stake(
|
|
9949
|
+
function stake(_x41, _x42, _x43, _x44) {
|
|
9652
9950
|
return _stake.apply(this, arguments);
|
|
9653
9951
|
}
|
|
9654
9952
|
|
|
9655
9953
|
return stake;
|
|
9656
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
|
+
}()
|
|
9657
10000
|
/**
|
|
9658
10001
|
* Unstake liquidity pool tokens from a yield farm
|
|
9659
10002
|
* @param {Dapp} dapp Platform like Sushiswap or Uniswap
|
|
@@ -9667,50 +10010,95 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9667
10010
|
_proto.unStake =
|
|
9668
10011
|
/*#__PURE__*/
|
|
9669
10012
|
function () {
|
|
9670
|
-
var _unStake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
9671
|
-
var iMiniChefV2, poolId, unStakeTxData, tx;
|
|
9672
|
-
return runtime_1.wrap(function
|
|
10013
|
+
var _unStake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(dapp, asset, amount, options) {
|
|
10014
|
+
var iMiniChefV2, poolId, unStakeTxData, tx;
|
|
10015
|
+
return runtime_1.wrap(function _callee14$(_context14) {
|
|
10016
|
+
while (1) {
|
|
10017
|
+
switch (_context14.prev = _context14.next) {
|
|
10018
|
+
case 0:
|
|
10019
|
+
if (options === void 0) {
|
|
10020
|
+
options = null;
|
|
10021
|
+
}
|
|
10022
|
+
|
|
10023
|
+
iMiniChefV2 = new ethers.utils.Interface(IMiniChefV2.abi);
|
|
10024
|
+
_context14.next = 4;
|
|
10025
|
+
return this.utils.getLpPoolId(dapp, asset);
|
|
10026
|
+
|
|
10027
|
+
case 4:
|
|
10028
|
+
poolId = _context14.sent;
|
|
10029
|
+
unStakeTxData = iMiniChefV2.encodeFunctionData(Transaction.WITHDRAW, [poolId, amount, this.address]);
|
|
10030
|
+
_context14.next = 8;
|
|
10031
|
+
return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], unStakeTxData, options);
|
|
10032
|
+
|
|
10033
|
+
case 8:
|
|
10034
|
+
tx = _context14.sent;
|
|
10035
|
+
return _context14.abrupt("return", tx);
|
|
10036
|
+
|
|
10037
|
+
case 10:
|
|
10038
|
+
case "end":
|
|
10039
|
+
return _context14.stop();
|
|
10040
|
+
}
|
|
10041
|
+
}
|
|
10042
|
+
}, _callee14, this);
|
|
10043
|
+
}));
|
|
10044
|
+
|
|
10045
|
+
function unStake(_x48, _x49, _x50, _x51) {
|
|
10046
|
+
return _unStake.apply(this, arguments);
|
|
10047
|
+
}
|
|
10048
|
+
|
|
10049
|
+
return unStake;
|
|
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) {
|
|
9673
10066
|
while (1) {
|
|
9674
|
-
switch (
|
|
10067
|
+
switch (_context15.prev = _context15.next) {
|
|
9675
10068
|
case 0:
|
|
9676
10069
|
if (options === void 0) {
|
|
9677
10070
|
options = null;
|
|
9678
10071
|
}
|
|
9679
10072
|
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
case 4:
|
|
9685
|
-
poolId = _context12.sent;
|
|
9686
|
-
unStakeTxData = iMiniChefV2.encodeFunctionData(Transaction.WITHDRAW, [poolId, amount, this.address]);
|
|
9687
|
-
_context12.next = 8;
|
|
9688
|
-
return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], unStakeTxData, options);
|
|
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);
|
|
9689
10077
|
|
|
9690
|
-
case
|
|
9691
|
-
tx =
|
|
9692
|
-
return
|
|
10078
|
+
case 5:
|
|
10079
|
+
tx = _context15.sent;
|
|
10080
|
+
return _context15.abrupt("return", tx);
|
|
9693
10081
|
|
|
9694
|
-
case
|
|
10082
|
+
case 7:
|
|
9695
10083
|
case "end":
|
|
9696
|
-
return
|
|
10084
|
+
return _context15.stop();
|
|
9697
10085
|
}
|
|
9698
10086
|
}
|
|
9699
|
-
},
|
|
10087
|
+
}, _callee15, this);
|
|
9700
10088
|
}));
|
|
9701
10089
|
|
|
9702
|
-
function
|
|
9703
|
-
return
|
|
10090
|
+
function unstakeFromGauge(_x52, _x53, _x54) {
|
|
10091
|
+
return _unstakeFromGauge.apply(this, arguments);
|
|
9704
10092
|
}
|
|
9705
10093
|
|
|
9706
|
-
return
|
|
10094
|
+
return unstakeFromGauge;
|
|
9707
10095
|
}()
|
|
9708
10096
|
/**
|
|
9709
10097
|
* Lend asset to a lending pool
|
|
9710
10098
|
* @param {Dapp} dapp Platform like Aave
|
|
9711
10099
|
* @param {string} asset Asset
|
|
9712
10100
|
* @param {BigNumber | string} amount Amount of asset to lend
|
|
9713
|
-
* @param {number}
|
|
10101
|
+
* @param {number} referralCode Code from Aave referral program
|
|
9714
10102
|
* @param {any} options Transaction options
|
|
9715
10103
|
* @returns {Promise<any>} Transaction
|
|
9716
10104
|
*/
|
|
@@ -9719,14 +10107,14 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9719
10107
|
_proto.lend =
|
|
9720
10108
|
/*#__PURE__*/
|
|
9721
10109
|
function () {
|
|
9722
|
-
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) {
|
|
9723
10111
|
var iLendingPool, depositTxData, tx;
|
|
9724
|
-
return runtime_1.wrap(function
|
|
10112
|
+
return runtime_1.wrap(function _callee16$(_context16) {
|
|
9725
10113
|
while (1) {
|
|
9726
|
-
switch (
|
|
10114
|
+
switch (_context16.prev = _context16.next) {
|
|
9727
10115
|
case 0:
|
|
9728
|
-
if (
|
|
9729
|
-
|
|
10116
|
+
if (referralCode === void 0) {
|
|
10117
|
+
referralCode = 0;
|
|
9730
10118
|
}
|
|
9731
10119
|
|
|
9732
10120
|
if (options === void 0) {
|
|
@@ -9734,23 +10122,23 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9734
10122
|
}
|
|
9735
10123
|
|
|
9736
10124
|
iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
|
|
9737
|
-
depositTxData = iLendingPool.encodeFunctionData(Transaction.DEPOSIT, [asset, amount, this.address,
|
|
9738
|
-
|
|
10125
|
+
depositTxData = iLendingPool.encodeFunctionData(Transaction.DEPOSIT, [asset, amount, this.address, referralCode]);
|
|
10126
|
+
_context16.next = 6;
|
|
9739
10127
|
return this.poolLogic.execTransaction(routerAddress[this.network][dapp], depositTxData, options);
|
|
9740
10128
|
|
|
9741
10129
|
case 6:
|
|
9742
|
-
tx =
|
|
9743
|
-
return
|
|
10130
|
+
tx = _context16.sent;
|
|
10131
|
+
return _context16.abrupt("return", tx);
|
|
9744
10132
|
|
|
9745
10133
|
case 8:
|
|
9746
10134
|
case "end":
|
|
9747
|
-
return
|
|
10135
|
+
return _context16.stop();
|
|
9748
10136
|
}
|
|
9749
10137
|
}
|
|
9750
|
-
},
|
|
10138
|
+
}, _callee16, this);
|
|
9751
10139
|
}));
|
|
9752
10140
|
|
|
9753
|
-
function lend(
|
|
10141
|
+
function lend(_x55, _x56, _x57, _x58, _x59) {
|
|
9754
10142
|
return _lend.apply(this, arguments);
|
|
9755
10143
|
}
|
|
9756
10144
|
|
|
@@ -9769,11 +10157,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9769
10157
|
_proto.withdrawDeposit =
|
|
9770
10158
|
/*#__PURE__*/
|
|
9771
10159
|
function () {
|
|
9772
|
-
var _withdrawDeposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
10160
|
+
var _withdrawDeposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17(dapp, asset, amount, options) {
|
|
9773
10161
|
var iLendingPool, withdrawTxData, tx;
|
|
9774
|
-
return runtime_1.wrap(function
|
|
10162
|
+
return runtime_1.wrap(function _callee17$(_context17) {
|
|
9775
10163
|
while (1) {
|
|
9776
|
-
switch (
|
|
10164
|
+
switch (_context17.prev = _context17.next) {
|
|
9777
10165
|
case 0:
|
|
9778
10166
|
if (options === void 0) {
|
|
9779
10167
|
options = null;
|
|
@@ -9781,22 +10169,22 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9781
10169
|
|
|
9782
10170
|
iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
|
|
9783
10171
|
withdrawTxData = iLendingPool.encodeFunctionData(Transaction.WITHDRAW, [asset, amount, this.address]);
|
|
9784
|
-
|
|
10172
|
+
_context17.next = 5;
|
|
9785
10173
|
return this.poolLogic.execTransaction(routerAddress[this.network][dapp], withdrawTxData, options);
|
|
9786
10174
|
|
|
9787
10175
|
case 5:
|
|
9788
|
-
tx =
|
|
9789
|
-
return
|
|
10176
|
+
tx = _context17.sent;
|
|
10177
|
+
return _context17.abrupt("return", tx);
|
|
9790
10178
|
|
|
9791
10179
|
case 7:
|
|
9792
10180
|
case "end":
|
|
9793
|
-
return
|
|
10181
|
+
return _context17.stop();
|
|
9794
10182
|
}
|
|
9795
10183
|
}
|
|
9796
|
-
},
|
|
10184
|
+
}, _callee17, this);
|
|
9797
10185
|
}));
|
|
9798
10186
|
|
|
9799
|
-
function withdrawDeposit(
|
|
10187
|
+
function withdrawDeposit(_x60, _x61, _x62, _x63) {
|
|
9800
10188
|
return _withdrawDeposit.apply(this, arguments);
|
|
9801
10189
|
}
|
|
9802
10190
|
|
|
@@ -9807,7 +10195,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9807
10195
|
* @param {Dapp} dapp Platform like Aave
|
|
9808
10196
|
* @param {string} asset Asset
|
|
9809
10197
|
* @param {BigNumber | string} amount Amount of asset to lend
|
|
9810
|
-
* @param {number}
|
|
10198
|
+
* @param {number} referralCode Code from Aave referral program
|
|
9811
10199
|
* @param {any} options Transaction options
|
|
9812
10200
|
* @returns {Promise<any>} Transaction
|
|
9813
10201
|
*/
|
|
@@ -9816,14 +10204,14 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9816
10204
|
_proto.borrow =
|
|
9817
10205
|
/*#__PURE__*/
|
|
9818
10206
|
function () {
|
|
9819
|
-
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) {
|
|
9820
10208
|
var iLendingPool, borrowTxData, tx;
|
|
9821
|
-
return runtime_1.wrap(function
|
|
10209
|
+
return runtime_1.wrap(function _callee18$(_context18) {
|
|
9822
10210
|
while (1) {
|
|
9823
|
-
switch (
|
|
10211
|
+
switch (_context18.prev = _context18.next) {
|
|
9824
10212
|
case 0:
|
|
9825
|
-
if (
|
|
9826
|
-
|
|
10213
|
+
if (referralCode === void 0) {
|
|
10214
|
+
referralCode = 0;
|
|
9827
10215
|
}
|
|
9828
10216
|
|
|
9829
10217
|
if (options === void 0) {
|
|
@@ -9831,23 +10219,23 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9831
10219
|
}
|
|
9832
10220
|
|
|
9833
10221
|
iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
|
|
9834
|
-
borrowTxData = iLendingPool.encodeFunctionData(Transaction.BORROW, [asset, amount, 2,
|
|
9835
|
-
|
|
10222
|
+
borrowTxData = iLendingPool.encodeFunctionData(Transaction.BORROW, [asset, amount, 2, referralCode, this.address]);
|
|
10223
|
+
_context18.next = 6;
|
|
9836
10224
|
return this.poolLogic.execTransaction(routerAddress[this.network][dapp], borrowTxData, options);
|
|
9837
10225
|
|
|
9838
10226
|
case 6:
|
|
9839
|
-
tx =
|
|
9840
|
-
return
|
|
10227
|
+
tx = _context18.sent;
|
|
10228
|
+
return _context18.abrupt("return", tx);
|
|
9841
10229
|
|
|
9842
10230
|
case 8:
|
|
9843
10231
|
case "end":
|
|
9844
|
-
return
|
|
10232
|
+
return _context18.stop();
|
|
9845
10233
|
}
|
|
9846
10234
|
}
|
|
9847
|
-
},
|
|
10235
|
+
}, _callee18, this);
|
|
9848
10236
|
}));
|
|
9849
10237
|
|
|
9850
|
-
function borrow(
|
|
10238
|
+
function borrow(_x64, _x65, _x66, _x67, _x68) {
|
|
9851
10239
|
return _borrow.apply(this, arguments);
|
|
9852
10240
|
}
|
|
9853
10241
|
|
|
@@ -9866,11 +10254,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9866
10254
|
_proto.repay =
|
|
9867
10255
|
/*#__PURE__*/
|
|
9868
10256
|
function () {
|
|
9869
|
-
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
10257
|
+
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19(dapp, asset, amount, options) {
|
|
9870
10258
|
var iLendingPool, repayTxData, tx;
|
|
9871
|
-
return runtime_1.wrap(function
|
|
10259
|
+
return runtime_1.wrap(function _callee19$(_context19) {
|
|
9872
10260
|
while (1) {
|
|
9873
|
-
switch (
|
|
10261
|
+
switch (_context19.prev = _context19.next) {
|
|
9874
10262
|
case 0:
|
|
9875
10263
|
if (options === void 0) {
|
|
9876
10264
|
options = null;
|
|
@@ -9878,22 +10266,22 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9878
10266
|
|
|
9879
10267
|
iLendingPool = new ethers.utils.Interface(ILendingPool.abi);
|
|
9880
10268
|
repayTxData = iLendingPool.encodeFunctionData(Transaction.REPAY, [asset, amount, 2, this.address]);
|
|
9881
|
-
|
|
10269
|
+
_context19.next = 5;
|
|
9882
10270
|
return this.poolLogic.execTransaction(routerAddress[this.network][dapp], repayTxData, options);
|
|
9883
10271
|
|
|
9884
10272
|
case 5:
|
|
9885
|
-
tx =
|
|
9886
|
-
return
|
|
10273
|
+
tx = _context19.sent;
|
|
10274
|
+
return _context19.abrupt("return", tx);
|
|
9887
10275
|
|
|
9888
10276
|
case 7:
|
|
9889
10277
|
case "end":
|
|
9890
|
-
return
|
|
10278
|
+
return _context19.stop();
|
|
9891
10279
|
}
|
|
9892
10280
|
}
|
|
9893
|
-
},
|
|
10281
|
+
}, _callee19, this);
|
|
9894
10282
|
}));
|
|
9895
10283
|
|
|
9896
|
-
function repay(
|
|
10284
|
+
function repay(_x69, _x70, _x71, _x72) {
|
|
9897
10285
|
return _repay.apply(this, arguments);
|
|
9898
10286
|
}
|
|
9899
10287
|
|
|
@@ -9911,39 +10299,39 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9911
10299
|
_proto.harvestRewards =
|
|
9912
10300
|
/*#__PURE__*/
|
|
9913
10301
|
function () {
|
|
9914
|
-
var _harvestRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
10302
|
+
var _harvestRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee20(dapp, asset, options) {
|
|
9915
10303
|
var iMiniChefV2, poolId, harvestTxData, tx;
|
|
9916
|
-
return runtime_1.wrap(function
|
|
10304
|
+
return runtime_1.wrap(function _callee20$(_context20) {
|
|
9917
10305
|
while (1) {
|
|
9918
|
-
switch (
|
|
10306
|
+
switch (_context20.prev = _context20.next) {
|
|
9919
10307
|
case 0:
|
|
9920
10308
|
if (options === void 0) {
|
|
9921
10309
|
options = null;
|
|
9922
10310
|
}
|
|
9923
10311
|
|
|
9924
10312
|
iMiniChefV2 = new ethers.utils.Interface(IMiniChefV2.abi);
|
|
9925
|
-
|
|
10313
|
+
_context20.next = 4;
|
|
9926
10314
|
return this.utils.getLpPoolId(dapp, asset);
|
|
9927
10315
|
|
|
9928
10316
|
case 4:
|
|
9929
|
-
poolId =
|
|
10317
|
+
poolId = _context20.sent;
|
|
9930
10318
|
harvestTxData = iMiniChefV2.encodeFunctionData(Transaction.HARVEST, [poolId, this.address]);
|
|
9931
|
-
|
|
10319
|
+
_context20.next = 8;
|
|
9932
10320
|
return this.poolLogic.execTransaction(stakingAddress[this.network][dapp], harvestTxData, options);
|
|
9933
10321
|
|
|
9934
10322
|
case 8:
|
|
9935
|
-
tx =
|
|
9936
|
-
return
|
|
10323
|
+
tx = _context20.sent;
|
|
10324
|
+
return _context20.abrupt("return", tx);
|
|
9937
10325
|
|
|
9938
10326
|
case 10:
|
|
9939
10327
|
case "end":
|
|
9940
|
-
return
|
|
10328
|
+
return _context20.stop();
|
|
9941
10329
|
}
|
|
9942
10330
|
}
|
|
9943
|
-
},
|
|
10331
|
+
}, _callee20, this);
|
|
9944
10332
|
}));
|
|
9945
10333
|
|
|
9946
|
-
function harvestRewards(
|
|
10334
|
+
function harvestRewards(_x73, _x74, _x75) {
|
|
9947
10335
|
return _harvestRewards.apply(this, arguments);
|
|
9948
10336
|
}
|
|
9949
10337
|
|
|
@@ -9960,21 +10348,21 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9960
10348
|
_proto.changeAssets =
|
|
9961
10349
|
/*#__PURE__*/
|
|
9962
10350
|
function () {
|
|
9963
|
-
var _changeAssets = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
10351
|
+
var _changeAssets = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee21(assets, options) {
|
|
9964
10352
|
var currentAssetsEnabled, currentAssets, newAssets, removedAssets, changedAssets, tx;
|
|
9965
|
-
return runtime_1.wrap(function
|
|
10353
|
+
return runtime_1.wrap(function _callee21$(_context21) {
|
|
9966
10354
|
while (1) {
|
|
9967
|
-
switch (
|
|
10355
|
+
switch (_context21.prev = _context21.next) {
|
|
9968
10356
|
case 0:
|
|
9969
10357
|
if (options === void 0) {
|
|
9970
10358
|
options = null;
|
|
9971
10359
|
}
|
|
9972
10360
|
|
|
9973
|
-
|
|
10361
|
+
_context21.next = 3;
|
|
9974
10362
|
return this.getComposition();
|
|
9975
10363
|
|
|
9976
10364
|
case 3:
|
|
9977
|
-
currentAssetsEnabled =
|
|
10365
|
+
currentAssetsEnabled = _context21.sent;
|
|
9978
10366
|
currentAssets = currentAssetsEnabled.map(function (e) {
|
|
9979
10367
|
return e.asset.toLocaleLowerCase();
|
|
9980
10368
|
});
|
|
@@ -9987,22 +10375,22 @@ var Pool = /*#__PURE__*/function () {
|
|
|
9987
10375
|
changedAssets = assets.map(function (e) {
|
|
9988
10376
|
return [e.asset, e.isDeposit];
|
|
9989
10377
|
});
|
|
9990
|
-
|
|
10378
|
+
_context21.next = 10;
|
|
9991
10379
|
return this.managerLogic.changeAssets(changedAssets, removedAssets, options);
|
|
9992
10380
|
|
|
9993
10381
|
case 10:
|
|
9994
|
-
tx =
|
|
9995
|
-
return
|
|
10382
|
+
tx = _context21.sent;
|
|
10383
|
+
return _context21.abrupt("return", tx);
|
|
9996
10384
|
|
|
9997
10385
|
case 12:
|
|
9998
10386
|
case "end":
|
|
9999
|
-
return
|
|
10387
|
+
return _context21.stop();
|
|
10000
10388
|
}
|
|
10001
10389
|
}
|
|
10002
|
-
},
|
|
10390
|
+
}, _callee21, this);
|
|
10003
10391
|
}));
|
|
10004
10392
|
|
|
10005
|
-
function changeAssets(
|
|
10393
|
+
function changeAssets(_x76, _x77) {
|
|
10006
10394
|
return _changeAssets.apply(this, arguments);
|
|
10007
10395
|
}
|
|
10008
10396
|
|
|
@@ -10019,32 +10407,32 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10019
10407
|
_proto.setTrader =
|
|
10020
10408
|
/*#__PURE__*/
|
|
10021
10409
|
function () {
|
|
10022
|
-
var _setTrader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
10410
|
+
var _setTrader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee22(trader, options) {
|
|
10023
10411
|
var tx;
|
|
10024
|
-
return runtime_1.wrap(function
|
|
10412
|
+
return runtime_1.wrap(function _callee22$(_context22) {
|
|
10025
10413
|
while (1) {
|
|
10026
|
-
switch (
|
|
10414
|
+
switch (_context22.prev = _context22.next) {
|
|
10027
10415
|
case 0:
|
|
10028
10416
|
if (options === void 0) {
|
|
10029
10417
|
options = null;
|
|
10030
10418
|
}
|
|
10031
10419
|
|
|
10032
|
-
|
|
10420
|
+
_context22.next = 3;
|
|
10033
10421
|
return this.managerLogic.setTrader(trader, options);
|
|
10034
10422
|
|
|
10035
10423
|
case 3:
|
|
10036
|
-
tx =
|
|
10037
|
-
return
|
|
10424
|
+
tx = _context22.sent;
|
|
10425
|
+
return _context22.abrupt("return", tx);
|
|
10038
10426
|
|
|
10039
10427
|
case 5:
|
|
10040
10428
|
case "end":
|
|
10041
|
-
return
|
|
10429
|
+
return _context22.stop();
|
|
10042
10430
|
}
|
|
10043
10431
|
}
|
|
10044
|
-
},
|
|
10432
|
+
}, _callee22, this);
|
|
10045
10433
|
}));
|
|
10046
10434
|
|
|
10047
|
-
function setTrader(
|
|
10435
|
+
function setTrader(_x78, _x79) {
|
|
10048
10436
|
return _setTrader.apply(this, arguments);
|
|
10049
10437
|
}
|
|
10050
10438
|
|
|
@@ -10063,33 +10451,33 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10063
10451
|
_proto.joinBalancerPool =
|
|
10064
10452
|
/*#__PURE__*/
|
|
10065
10453
|
function () {
|
|
10066
|
-
var _joinBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
10454
|
+
var _joinBalancerPool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee23(poolId, assets, amountsIn, options) {
|
|
10067
10455
|
var joinPoolTxData, tx;
|
|
10068
|
-
return runtime_1.wrap(function
|
|
10456
|
+
return runtime_1.wrap(function _callee23$(_context23) {
|
|
10069
10457
|
while (1) {
|
|
10070
|
-
switch (
|
|
10458
|
+
switch (_context23.prev = _context23.next) {
|
|
10071
10459
|
case 0:
|
|
10072
10460
|
if (options === void 0) {
|
|
10073
10461
|
options = null;
|
|
10074
10462
|
}
|
|
10075
10463
|
|
|
10076
10464
|
joinPoolTxData = this.utils.getBalancerJoinPoolTx(this, poolId, assets, amountsIn);
|
|
10077
|
-
|
|
10465
|
+
_context23.next = 4;
|
|
10078
10466
|
return this.poolLogic.execTransaction(routerAddress[this.network][Dapp.BALANCER], joinPoolTxData, options);
|
|
10079
10467
|
|
|
10080
10468
|
case 4:
|
|
10081
|
-
tx =
|
|
10082
|
-
return
|
|
10469
|
+
tx = _context23.sent;
|
|
10470
|
+
return _context23.abrupt("return", tx);
|
|
10083
10471
|
|
|
10084
10472
|
case 6:
|
|
10085
10473
|
case "end":
|
|
10086
|
-
return
|
|
10474
|
+
return _context23.stop();
|
|
10087
10475
|
}
|
|
10088
10476
|
}
|
|
10089
|
-
},
|
|
10477
|
+
}, _callee23, this);
|
|
10090
10478
|
}));
|
|
10091
10479
|
|
|
10092
|
-
function joinBalancerPool(
|
|
10480
|
+
function joinBalancerPool(_x80, _x81, _x82, _x83) {
|
|
10093
10481
|
return _joinBalancerPool.apply(this, arguments);
|
|
10094
10482
|
}
|
|
10095
10483
|
|
|
@@ -10100,6 +10488,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10100
10488
|
* @param {string} poolId Balancer pool id
|
|
10101
10489
|
* @param {string[] | } assets Array of balancer pool assets
|
|
10102
10490
|
* @param {BigNumber | string } amount Amount of pool tokens to withdraw
|
|
10491
|
+
* @param { null | number } singleExitAssetIndex Index of asset to withdraw to
|
|
10103
10492
|
* @param {any} options Transaction options
|
|
10104
10493
|
* @returns {Promise<any>} Transaction
|
|
10105
10494
|
*/
|
|
@@ -10108,33 +10497,37 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10108
10497
|
_proto.exitBalancerPool =
|
|
10109
10498
|
/*#__PURE__*/
|
|
10110
10499
|
function () {
|
|
10111
|
-
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) {
|
|
10112
10501
|
var exitPoolTxData, tx;
|
|
10113
|
-
return runtime_1.wrap(function
|
|
10502
|
+
return runtime_1.wrap(function _callee24$(_context24) {
|
|
10114
10503
|
while (1) {
|
|
10115
|
-
switch (
|
|
10504
|
+
switch (_context24.prev = _context24.next) {
|
|
10116
10505
|
case 0:
|
|
10506
|
+
if (singleExitAssetIndex === void 0) {
|
|
10507
|
+
singleExitAssetIndex = null;
|
|
10508
|
+
}
|
|
10509
|
+
|
|
10117
10510
|
if (options === void 0) {
|
|
10118
10511
|
options = null;
|
|
10119
10512
|
}
|
|
10120
10513
|
|
|
10121
|
-
exitPoolTxData = this.utils.getBalancerExitPoolTx(this, poolId, assets, amount);
|
|
10122
|
-
|
|
10514
|
+
exitPoolTxData = this.utils.getBalancerExitPoolTx(this, poolId, assets, singleExitAssetIndex, amount);
|
|
10515
|
+
_context24.next = 5;
|
|
10123
10516
|
return this.poolLogic.execTransaction(routerAddress[this.network][Dapp.BALANCER], exitPoolTxData, options);
|
|
10124
10517
|
|
|
10125
|
-
case
|
|
10126
|
-
tx =
|
|
10127
|
-
return
|
|
10518
|
+
case 5:
|
|
10519
|
+
tx = _context24.sent;
|
|
10520
|
+
return _context24.abrupt("return", tx);
|
|
10128
10521
|
|
|
10129
|
-
case
|
|
10522
|
+
case 7:
|
|
10130
10523
|
case "end":
|
|
10131
|
-
return
|
|
10524
|
+
return _context24.stop();
|
|
10132
10525
|
}
|
|
10133
10526
|
}
|
|
10134
|
-
},
|
|
10527
|
+
}, _callee24, this);
|
|
10135
10528
|
}));
|
|
10136
10529
|
|
|
10137
|
-
function exitBalancerPool(
|
|
10530
|
+
function exitBalancerPool(_x84, _x85, _x86, _x87, _x88) {
|
|
10138
10531
|
return _exitBalancerPool.apply(this, arguments);
|
|
10139
10532
|
}
|
|
10140
10533
|
|
|
@@ -10151,48 +10544,48 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10151
10544
|
_proto.harvestBalancerRewards =
|
|
10152
10545
|
/*#__PURE__*/
|
|
10153
10546
|
function () {
|
|
10154
|
-
var _harvestBalancerRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
10547
|
+
var _harvestBalancerRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee25(options) {
|
|
10155
10548
|
var claimService, multiTokenPendingClaims, tokens, claims, iBalancerMerkleOrchard, harvestTxData, tx;
|
|
10156
|
-
return runtime_1.wrap(function
|
|
10549
|
+
return runtime_1.wrap(function _callee25$(_context25) {
|
|
10157
10550
|
while (1) {
|
|
10158
|
-
switch (
|
|
10551
|
+
switch (_context25.prev = _context25.next) {
|
|
10159
10552
|
case 0:
|
|
10160
10553
|
if (options === void 0) {
|
|
10161
10554
|
options = null;
|
|
10162
10555
|
}
|
|
10163
10556
|
|
|
10164
10557
|
claimService = new ClaimService(this.network, this.signer);
|
|
10165
|
-
|
|
10558
|
+
_context25.next = 4;
|
|
10166
10559
|
return claimService.getMultiTokensPendingClaims(this.address);
|
|
10167
10560
|
|
|
10168
10561
|
case 4:
|
|
10169
|
-
multiTokenPendingClaims =
|
|
10562
|
+
multiTokenPendingClaims = _context25.sent;
|
|
10170
10563
|
tokens = multiTokenPendingClaims.map(function (tokenPendingClaims) {
|
|
10171
10564
|
return tokenPendingClaims.tokenClaimInfo.token;
|
|
10172
10565
|
});
|
|
10173
|
-
|
|
10566
|
+
_context25.next = 8;
|
|
10174
10567
|
return claimService.multiTokenClaimRewards(this.address, multiTokenPendingClaims);
|
|
10175
10568
|
|
|
10176
10569
|
case 8:
|
|
10177
|
-
claims =
|
|
10570
|
+
claims = _context25.sent;
|
|
10178
10571
|
iBalancerMerkleOrchard = new ethers.utils.Interface(IBalancerMerkleOrchard.abi);
|
|
10179
10572
|
harvestTxData = iBalancerMerkleOrchard.encodeFunctionData(Transaction.CLAIM_DISTRIBIUTIONS, [this.address, claims, tokens]);
|
|
10180
|
-
|
|
10573
|
+
_context25.next = 13;
|
|
10181
10574
|
return this.poolLogic.execTransaction(stakingAddress[this.network][Dapp.BALANCER], harvestTxData, options);
|
|
10182
10575
|
|
|
10183
10576
|
case 13:
|
|
10184
|
-
tx =
|
|
10185
|
-
return
|
|
10577
|
+
tx = _context25.sent;
|
|
10578
|
+
return _context25.abrupt("return", tx);
|
|
10186
10579
|
|
|
10187
10580
|
case 15:
|
|
10188
10581
|
case "end":
|
|
10189
|
-
return
|
|
10582
|
+
return _context25.stop();
|
|
10190
10583
|
}
|
|
10191
10584
|
}
|
|
10192
|
-
},
|
|
10585
|
+
}, _callee25, this);
|
|
10193
10586
|
}));
|
|
10194
10587
|
|
|
10195
|
-
function harvestBalancerRewards(
|
|
10588
|
+
function harvestBalancerRewards(_x89) {
|
|
10196
10589
|
return _harvestBalancerRewards.apply(this, arguments);
|
|
10197
10590
|
}
|
|
10198
10591
|
|
|
@@ -10209,11 +10602,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10209
10602
|
_proto.harvestAaveRewards =
|
|
10210
10603
|
/*#__PURE__*/
|
|
10211
10604
|
function () {
|
|
10212
|
-
var _harvestAaveRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
10605
|
+
var _harvestAaveRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee26(assets, options) {
|
|
10213
10606
|
var aaveIncentivesAddress, iAaveIncentivesController, aaveIncentivesController, amount, claimTxData, tx;
|
|
10214
|
-
return runtime_1.wrap(function
|
|
10607
|
+
return runtime_1.wrap(function _callee26$(_context26) {
|
|
10215
10608
|
while (1) {
|
|
10216
|
-
switch (
|
|
10609
|
+
switch (_context26.prev = _context26.next) {
|
|
10217
10610
|
case 0:
|
|
10218
10611
|
if (options === void 0) {
|
|
10219
10612
|
options = null;
|
|
@@ -10222,28 +10615,28 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10222
10615
|
aaveIncentivesAddress = stakingAddress[this.network][Dapp.AAVE];
|
|
10223
10616
|
iAaveIncentivesController = new ethers.utils.Interface(IAaveIncentivesController.abi);
|
|
10224
10617
|
aaveIncentivesController = new ethers.Contract(aaveIncentivesAddress, iAaveIncentivesController, this.signer);
|
|
10225
|
-
|
|
10618
|
+
_context26.next = 6;
|
|
10226
10619
|
return aaveIncentivesController.getUserUnclaimedRewards(this.address);
|
|
10227
10620
|
|
|
10228
10621
|
case 6:
|
|
10229
|
-
amount =
|
|
10622
|
+
amount = _context26.sent;
|
|
10230
10623
|
claimTxData = iAaveIncentivesController.encodeFunctionData(Transaction.CLAIM_REWARDS, [assets, amount, this.address]);
|
|
10231
|
-
|
|
10624
|
+
_context26.next = 10;
|
|
10232
10625
|
return this.poolLogic.execTransaction(aaveIncentivesAddress, claimTxData, options);
|
|
10233
10626
|
|
|
10234
10627
|
case 10:
|
|
10235
|
-
tx =
|
|
10236
|
-
return
|
|
10628
|
+
tx = _context26.sent;
|
|
10629
|
+
return _context26.abrupt("return", tx);
|
|
10237
10630
|
|
|
10238
10631
|
case 12:
|
|
10239
10632
|
case "end":
|
|
10240
|
-
return
|
|
10633
|
+
return _context26.stop();
|
|
10241
10634
|
}
|
|
10242
10635
|
}
|
|
10243
|
-
},
|
|
10636
|
+
}, _callee26, this);
|
|
10244
10637
|
}));
|
|
10245
10638
|
|
|
10246
|
-
function harvestAaveRewards(
|
|
10639
|
+
function harvestAaveRewards(_x90, _x91) {
|
|
10247
10640
|
return _harvestAaveRewards.apply(this, arguments);
|
|
10248
10641
|
}
|
|
10249
10642
|
|
|
@@ -10268,18 +10661,18 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10268
10661
|
_proto.addLiquidityUniswapV3 =
|
|
10269
10662
|
/*#__PURE__*/
|
|
10270
10663
|
function () {
|
|
10271
|
-
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) {
|
|
10272
10665
|
var iNonfungiblePositionManager, mintTxParams, mintTxData, tx;
|
|
10273
|
-
return runtime_1.wrap(function
|
|
10666
|
+
return runtime_1.wrap(function _callee27$(_context27) {
|
|
10274
10667
|
while (1) {
|
|
10275
|
-
switch (
|
|
10668
|
+
switch (_context27.prev = _context27.next) {
|
|
10276
10669
|
case 0:
|
|
10277
10670
|
if (options === void 0) {
|
|
10278
10671
|
options = null;
|
|
10279
10672
|
}
|
|
10280
10673
|
|
|
10281
10674
|
if (!((!minPrice || !maxPrice) && (!minTick || !maxTick))) {
|
|
10282
|
-
|
|
10675
|
+
_context27.next = 3;
|
|
10283
10676
|
break;
|
|
10284
10677
|
}
|
|
10285
10678
|
|
|
@@ -10287,28 +10680,28 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10287
10680
|
|
|
10288
10681
|
case 3:
|
|
10289
10682
|
iNonfungiblePositionManager = new ethers.utils.Interface(INonfungiblePositionManager.abi);
|
|
10290
|
-
|
|
10683
|
+
_context27.next = 6;
|
|
10291
10684
|
return getUniswapV3MintParams(this, assetA, assetB, amountA, amountB, minPrice, maxPrice, minTick, maxTick, feeAmount);
|
|
10292
10685
|
|
|
10293
10686
|
case 6:
|
|
10294
|
-
mintTxParams =
|
|
10687
|
+
mintTxParams = _context27.sent;
|
|
10295
10688
|
mintTxData = iNonfungiblePositionManager.encodeFunctionData(Transaction.MINT, [mintTxParams]);
|
|
10296
|
-
|
|
10689
|
+
_context27.next = 10;
|
|
10297
10690
|
return this.poolLogic.execTransaction(nonfungiblePositionManagerAddress[this.network], mintTxData, options);
|
|
10298
10691
|
|
|
10299
10692
|
case 10:
|
|
10300
|
-
tx =
|
|
10301
|
-
return
|
|
10693
|
+
tx = _context27.sent;
|
|
10694
|
+
return _context27.abrupt("return", tx);
|
|
10302
10695
|
|
|
10303
10696
|
case 12:
|
|
10304
10697
|
case "end":
|
|
10305
|
-
return
|
|
10698
|
+
return _context27.stop();
|
|
10306
10699
|
}
|
|
10307
10700
|
}
|
|
10308
|
-
},
|
|
10701
|
+
}, _callee27, this);
|
|
10309
10702
|
}));
|
|
10310
10703
|
|
|
10311
|
-
function addLiquidityUniswapV3(
|
|
10704
|
+
function addLiquidityUniswapV3(_x92, _x93, _x94, _x95, _x96, _x97, _x98, _x99, _x100, _x101) {
|
|
10312
10705
|
return _addLiquidityUniswapV.apply(this, arguments);
|
|
10313
10706
|
}
|
|
10314
10707
|
|
|
@@ -10327,12 +10720,12 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10327
10720
|
_proto.decreaseLiquidity =
|
|
10328
10721
|
/*#__PURE__*/
|
|
10329
10722
|
function () {
|
|
10330
|
-
var _decreaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
10723
|
+
var _decreaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee28(dapp, tokenId, amount, options) {
|
|
10331
10724
|
var txData, dappAddress, abi, liquidity, decreaseLiquidityTxData, collectTxData, multicallParams, burnTxData, _abi, _liquidity, tx;
|
|
10332
10725
|
|
|
10333
|
-
return runtime_1.wrap(function
|
|
10726
|
+
return runtime_1.wrap(function _callee28$(_context28) {
|
|
10334
10727
|
while (1) {
|
|
10335
|
-
switch (
|
|
10728
|
+
switch (_context28.prev = _context28.next) {
|
|
10336
10729
|
case 0:
|
|
10337
10730
|
if (amount === void 0) {
|
|
10338
10731
|
amount = 100;
|
|
@@ -10343,17 +10736,17 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10343
10736
|
}
|
|
10344
10737
|
|
|
10345
10738
|
if (!(dapp === Dapp.UNISWAPV3)) {
|
|
10346
|
-
|
|
10739
|
+
_context28.next = 15;
|
|
10347
10740
|
break;
|
|
10348
10741
|
}
|
|
10349
10742
|
|
|
10350
10743
|
dappAddress = nonfungiblePositionManagerAddress[this.network];
|
|
10351
10744
|
abi = new ethers.utils.Interface(INonfungiblePositionManager.abi);
|
|
10352
|
-
|
|
10745
|
+
_context28.next = 7;
|
|
10353
10746
|
return getUniswapV3Liquidity(tokenId, this);
|
|
10354
10747
|
|
|
10355
10748
|
case 7:
|
|
10356
|
-
liquidity =
|
|
10749
|
+
liquidity = _context28.sent.mul(Math.round(amount * 1e4)).div(1e6);
|
|
10357
10750
|
decreaseLiquidityTxData = abi.encodeFunctionData(Transaction.DECREASE_LIQUIDITY, [[tokenId, liquidity, 0, 0, deadline]]);
|
|
10358
10751
|
collectTxData = abi.encodeFunctionData(Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
|
|
10359
10752
|
multicallParams = [decreaseLiquidityTxData, collectTxData];
|
|
@@ -10364,46 +10757,46 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10364
10757
|
}
|
|
10365
10758
|
|
|
10366
10759
|
txData = abi.encodeFunctionData(Transaction.MULTI_CALL, [multicallParams]);
|
|
10367
|
-
|
|
10760
|
+
_context28.next = 25;
|
|
10368
10761
|
break;
|
|
10369
10762
|
|
|
10370
10763
|
case 15:
|
|
10371
10764
|
if (!(dapp === Dapp.ARRAKIS)) {
|
|
10372
|
-
|
|
10765
|
+
_context28.next = 24;
|
|
10373
10766
|
break;
|
|
10374
10767
|
}
|
|
10375
10768
|
|
|
10376
10769
|
dappAddress = routerAddress[this.network][dapp];
|
|
10377
10770
|
_abi = new ethers.utils.Interface(IArrakisV1RouterStaking.abi);
|
|
10378
|
-
|
|
10771
|
+
_context28.next = 20;
|
|
10379
10772
|
return this.utils.getBalance(tokenId, this.address);
|
|
10380
10773
|
|
|
10381
10774
|
case 20:
|
|
10382
|
-
_liquidity =
|
|
10775
|
+
_liquidity = _context28.sent.mul(Math.round(amount * 1e4)).div(1e6);
|
|
10383
10776
|
txData = _abi.encodeFunctionData(Transaction.REMOVE_LIQUIDITY_UNSTAKE, [tokenId, _liquidity, 0, 0, this.address]);
|
|
10384
|
-
|
|
10777
|
+
_context28.next = 25;
|
|
10385
10778
|
break;
|
|
10386
10779
|
|
|
10387
10780
|
case 24:
|
|
10388
10781
|
throw new Error("dapp not supported");
|
|
10389
10782
|
|
|
10390
10783
|
case 25:
|
|
10391
|
-
|
|
10784
|
+
_context28.next = 27;
|
|
10392
10785
|
return this.poolLogic.execTransaction(dappAddress, txData, options);
|
|
10393
10786
|
|
|
10394
10787
|
case 27:
|
|
10395
|
-
tx =
|
|
10396
|
-
return
|
|
10788
|
+
tx = _context28.sent;
|
|
10789
|
+
return _context28.abrupt("return", tx);
|
|
10397
10790
|
|
|
10398
10791
|
case 29:
|
|
10399
10792
|
case "end":
|
|
10400
|
-
return
|
|
10793
|
+
return _context28.stop();
|
|
10401
10794
|
}
|
|
10402
10795
|
}
|
|
10403
|
-
},
|
|
10796
|
+
}, _callee28, this);
|
|
10404
10797
|
}));
|
|
10405
10798
|
|
|
10406
|
-
function decreaseLiquidity(
|
|
10799
|
+
function decreaseLiquidity(_x102, _x103, _x104, _x105) {
|
|
10407
10800
|
return _decreaseLiquidity.apply(this, arguments);
|
|
10408
10801
|
}
|
|
10409
10802
|
|
|
@@ -10423,60 +10816,60 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10423
10816
|
_proto.increaseLiquidity =
|
|
10424
10817
|
/*#__PURE__*/
|
|
10425
10818
|
function () {
|
|
10426
|
-
var _increaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
10819
|
+
var _increaseLiquidity = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee29(dapp, tokenId, amountA, amountB, options) {
|
|
10427
10820
|
var txData, dappAddress, abi, _abi2, tx;
|
|
10428
10821
|
|
|
10429
|
-
return runtime_1.wrap(function
|
|
10822
|
+
return runtime_1.wrap(function _callee29$(_context29) {
|
|
10430
10823
|
while (1) {
|
|
10431
|
-
switch (
|
|
10824
|
+
switch (_context29.prev = _context29.next) {
|
|
10432
10825
|
case 0:
|
|
10433
10826
|
if (options === void 0) {
|
|
10434
10827
|
options = null;
|
|
10435
10828
|
}
|
|
10436
10829
|
|
|
10437
10830
|
if (!(dapp === Dapp.UNISWAPV3)) {
|
|
10438
|
-
|
|
10831
|
+
_context29.next = 7;
|
|
10439
10832
|
break;
|
|
10440
10833
|
}
|
|
10441
10834
|
|
|
10442
10835
|
dappAddress = nonfungiblePositionManagerAddress[this.network];
|
|
10443
10836
|
abi = new ethers.utils.Interface(INonfungiblePositionManager.abi);
|
|
10444
10837
|
txData = abi.encodeFunctionData(Transaction.INCREASE_LIQUIDITY, [[tokenId, amountA, amountB, 0, 0, deadline]]);
|
|
10445
|
-
|
|
10838
|
+
_context29.next = 14;
|
|
10446
10839
|
break;
|
|
10447
10840
|
|
|
10448
10841
|
case 7:
|
|
10449
10842
|
if (!(dapp === Dapp.ARRAKIS)) {
|
|
10450
|
-
|
|
10843
|
+
_context29.next = 13;
|
|
10451
10844
|
break;
|
|
10452
10845
|
}
|
|
10453
10846
|
|
|
10454
10847
|
dappAddress = routerAddress[this.network][dapp];
|
|
10455
10848
|
_abi2 = new ethers.utils.Interface(IArrakisV1RouterStaking.abi);
|
|
10456
10849
|
txData = _abi2.encodeFunctionData(Transaction.ADD_LIQUIDITY_STAKE, [tokenId, amountA, amountB, 0, 0, this.address]);
|
|
10457
|
-
|
|
10850
|
+
_context29.next = 14;
|
|
10458
10851
|
break;
|
|
10459
10852
|
|
|
10460
10853
|
case 13:
|
|
10461
10854
|
throw new Error("dapp not supported");
|
|
10462
10855
|
|
|
10463
10856
|
case 14:
|
|
10464
|
-
|
|
10857
|
+
_context29.next = 16;
|
|
10465
10858
|
return this.poolLogic.execTransaction(dappAddress, txData, options);
|
|
10466
10859
|
|
|
10467
10860
|
case 16:
|
|
10468
|
-
tx =
|
|
10469
|
-
return
|
|
10861
|
+
tx = _context29.sent;
|
|
10862
|
+
return _context29.abrupt("return", tx);
|
|
10470
10863
|
|
|
10471
10864
|
case 18:
|
|
10472
10865
|
case "end":
|
|
10473
|
-
return
|
|
10866
|
+
return _context29.stop();
|
|
10474
10867
|
}
|
|
10475
10868
|
}
|
|
10476
|
-
},
|
|
10869
|
+
}, _callee29, this);
|
|
10477
10870
|
}));
|
|
10478
10871
|
|
|
10479
|
-
function increaseLiquidity(
|
|
10872
|
+
function increaseLiquidity(_x106, _x107, _x108, _x109, _x110) {
|
|
10480
10873
|
return _increaseLiquidity.apply(this, arguments);
|
|
10481
10874
|
}
|
|
10482
10875
|
|
|
@@ -10485,8 +10878,8 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10485
10878
|
/**
|
|
10486
10879
|
* Claim fees of an UniswapV3 liquidity or Arrakis pool
|
|
10487
10880
|
* @param {Dapp} dapp Platform either UniswapV3 or Arrakis
|
|
10488
|
-
* @param {string} tokenId Token Id of UniswapV3 or
|
|
10489
|
-
* @param {any} options Transaction
|
|
10881
|
+
* @param {string} tokenId Token Id of UniswapV3 or Gauge address
|
|
10882
|
+
* @param {any} options Transaction option
|
|
10490
10883
|
* @returns {Promise<any>} Transaction
|
|
10491
10884
|
*/
|
|
10492
10885
|
;
|
|
@@ -10494,59 +10887,59 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10494
10887
|
_proto.claimFees =
|
|
10495
10888
|
/*#__PURE__*/
|
|
10496
10889
|
function () {
|
|
10497
|
-
var _claimFees = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
10890
|
+
var _claimFees = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee30(dapp, tokenId, options) {
|
|
10498
10891
|
var txData, contractAddress, iNonfungiblePositionManager, abi, tx;
|
|
10499
|
-
return runtime_1.wrap(function
|
|
10892
|
+
return runtime_1.wrap(function _callee30$(_context30) {
|
|
10500
10893
|
while (1) {
|
|
10501
|
-
switch (
|
|
10894
|
+
switch (_context30.prev = _context30.next) {
|
|
10502
10895
|
case 0:
|
|
10503
10896
|
if (options === void 0) {
|
|
10504
10897
|
options = null;
|
|
10505
10898
|
}
|
|
10506
10899
|
|
|
10507
10900
|
if (!(dapp === Dapp.UNISWAPV3)) {
|
|
10508
|
-
|
|
10901
|
+
_context30.next = 7;
|
|
10509
10902
|
break;
|
|
10510
10903
|
}
|
|
10511
10904
|
|
|
10512
10905
|
contractAddress = nonfungiblePositionManagerAddress[this.network];
|
|
10513
10906
|
iNonfungiblePositionManager = new ethers.utils.Interface(INonfungiblePositionManager.abi);
|
|
10514
10907
|
txData = iNonfungiblePositionManager.encodeFunctionData(Transaction.COLLECT, [[tokenId, this.address, MaxUint128, MaxUint128]]);
|
|
10515
|
-
|
|
10908
|
+
_context30.next = 14;
|
|
10516
10909
|
break;
|
|
10517
10910
|
|
|
10518
10911
|
case 7:
|
|
10519
|
-
if (!(dapp === Dapp.ARRAKIS)) {
|
|
10520
|
-
|
|
10912
|
+
if (!(dapp === Dapp.ARRAKIS || dapp === Dapp.BALANCER)) {
|
|
10913
|
+
_context30.next = 13;
|
|
10521
10914
|
break;
|
|
10522
10915
|
}
|
|
10523
10916
|
|
|
10524
10917
|
contractAddress = tokenId;
|
|
10525
10918
|
abi = new ethers.utils.Interface(ILiquidityGaugeV4.abi);
|
|
10526
10919
|
txData = abi.encodeFunctionData("claim_rewards()", []);
|
|
10527
|
-
|
|
10920
|
+
_context30.next = 14;
|
|
10528
10921
|
break;
|
|
10529
10922
|
|
|
10530
10923
|
case 13:
|
|
10531
10924
|
throw new Error("dapp not supported");
|
|
10532
10925
|
|
|
10533
10926
|
case 14:
|
|
10534
|
-
|
|
10927
|
+
_context30.next = 16;
|
|
10535
10928
|
return this.poolLogic.execTransaction(contractAddress, txData, options);
|
|
10536
10929
|
|
|
10537
10930
|
case 16:
|
|
10538
|
-
tx =
|
|
10539
|
-
return
|
|
10931
|
+
tx = _context30.sent;
|
|
10932
|
+
return _context30.abrupt("return", tx);
|
|
10540
10933
|
|
|
10541
10934
|
case 18:
|
|
10542
10935
|
case "end":
|
|
10543
|
-
return
|
|
10936
|
+
return _context30.stop();
|
|
10544
10937
|
}
|
|
10545
10938
|
}
|
|
10546
|
-
},
|
|
10939
|
+
}, _callee30, this);
|
|
10547
10940
|
}));
|
|
10548
10941
|
|
|
10549
|
-
function claimFees(
|
|
10942
|
+
function claimFees(_x111, _x112, _x113) {
|
|
10550
10943
|
return _claimFees.apply(this, arguments);
|
|
10551
10944
|
}
|
|
10552
10945
|
|
|
@@ -10568,11 +10961,11 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10568
10961
|
_proto.tradeUniswapV3 =
|
|
10569
10962
|
/*#__PURE__*/
|
|
10570
10963
|
function () {
|
|
10571
|
-
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) {
|
|
10572
10965
|
var swapxData, tx;
|
|
10573
|
-
return runtime_1.wrap(function
|
|
10966
|
+
return runtime_1.wrap(function _callee31$(_context31) {
|
|
10574
10967
|
while (1) {
|
|
10575
|
-
switch (
|
|
10968
|
+
switch (_context31.prev = _context31.next) {
|
|
10576
10969
|
case 0:
|
|
10577
10970
|
if (slippage === void 0) {
|
|
10578
10971
|
slippage = 0.5;
|
|
@@ -10582,27 +10975,27 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10582
10975
|
options = null;
|
|
10583
10976
|
}
|
|
10584
10977
|
|
|
10585
|
-
|
|
10978
|
+
_context31.next = 4;
|
|
10586
10979
|
return getUniswapV3SwapTxData(this, assetFrom, assetTo, amountIn, slippage, feeAmount);
|
|
10587
10980
|
|
|
10588
10981
|
case 4:
|
|
10589
|
-
swapxData =
|
|
10590
|
-
|
|
10982
|
+
swapxData = _context31.sent;
|
|
10983
|
+
_context31.next = 7;
|
|
10591
10984
|
return this.poolLogic.execTransaction(routerAddress[this.network][Dapp.UNISWAPV3], swapxData, options);
|
|
10592
10985
|
|
|
10593
10986
|
case 7:
|
|
10594
|
-
tx =
|
|
10595
|
-
return
|
|
10987
|
+
tx = _context31.sent;
|
|
10988
|
+
return _context31.abrupt("return", tx);
|
|
10596
10989
|
|
|
10597
10990
|
case 9:
|
|
10598
10991
|
case "end":
|
|
10599
|
-
return
|
|
10992
|
+
return _context31.stop();
|
|
10600
10993
|
}
|
|
10601
10994
|
}
|
|
10602
|
-
},
|
|
10995
|
+
}, _callee31, this);
|
|
10603
10996
|
}));
|
|
10604
10997
|
|
|
10605
|
-
function tradeUniswapV3(
|
|
10998
|
+
function tradeUniswapV3(_x114, _x115, _x116, _x117, _x118, _x119) {
|
|
10606
10999
|
return _tradeUniswapV.apply(this, arguments);
|
|
10607
11000
|
}
|
|
10608
11001
|
|
|
@@ -10612,7 +11005,7 @@ var Pool = /*#__PURE__*/function () {
|
|
|
10612
11005
|
return Pool;
|
|
10613
11006
|
}();
|
|
10614
11007
|
|
|
10615
|
-
var abi$
|
|
11008
|
+
var abi$g = [
|
|
10616
11009
|
{
|
|
10617
11010
|
inputs: [
|
|
10618
11011
|
{
|
|
@@ -10836,10 +11229,10 @@ var abi$f = [
|
|
|
10836
11229
|
}
|
|
10837
11230
|
];
|
|
10838
11231
|
var UniswapV2Factory = {
|
|
10839
|
-
abi: abi$
|
|
11232
|
+
abi: abi$g
|
|
10840
11233
|
};
|
|
10841
11234
|
|
|
10842
|
-
var abi$
|
|
11235
|
+
var abi$h = [
|
|
10843
11236
|
{
|
|
10844
11237
|
anonymous: false,
|
|
10845
11238
|
inputs: [
|
|
@@ -11583,7 +11976,7 @@ var evm = {
|
|
|
11583
11976
|
}
|
|
11584
11977
|
};
|
|
11585
11978
|
var UniswapV2Pair = {
|
|
11586
|
-
abi: abi$
|
|
11979
|
+
abi: abi$h,
|
|
11587
11980
|
evm: evm,
|
|
11588
11981
|
"interface": [
|
|
11589
11982
|
{
|
|
@@ -12314,7 +12707,7 @@ var UniswapV2Pair = {
|
|
|
12314
12707
|
]
|
|
12315
12708
|
};
|
|
12316
12709
|
|
|
12317
|
-
var abi$
|
|
12710
|
+
var abi$i = [
|
|
12318
12711
|
{
|
|
12319
12712
|
inputs: [
|
|
12320
12713
|
{
|
|
@@ -13509,7 +13902,7 @@ var abi$h = [
|
|
|
13509
13902
|
}
|
|
13510
13903
|
];
|
|
13511
13904
|
var IBalancerV2Vault = {
|
|
13512
|
-
abi: abi$
|
|
13905
|
+
abi: abi$i
|
|
13513
13906
|
};
|
|
13514
13907
|
|
|
13515
13908
|
var Utils = /*#__PURE__*/function () {
|
|
@@ -13892,20 +14285,21 @@ var Utils = /*#__PURE__*/function () {
|
|
|
13892
14285
|
}();
|
|
13893
14286
|
|
|
13894
14287
|
_proto.getBalancerExitPoolTx = /*#__PURE__*/function () {
|
|
13895
|
-
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
|
|
13896
14289
|
) {
|
|
13897
|
-
var minimumAmountOut, iBalancerV2Vault, txData, exitPoolTx;
|
|
14290
|
+
var minimumAmountOut, iBalancerV2Vault, userTxData, txData, exitPoolTx;
|
|
13898
14291
|
return runtime_1.wrap(function _callee8$(_context8) {
|
|
13899
14292
|
while (1) {
|
|
13900
14293
|
switch (_context8.prev = _context8.next) {
|
|
13901
14294
|
case 0:
|
|
13902
14295
|
minimumAmountOut = new Array(assets.length).fill(0);
|
|
13903
14296
|
iBalancerV2Vault = new ethers.utils.Interface(IBalancerV2Vault.abi);
|
|
13904
|
-
|
|
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]];
|
|
13905
14299
|
exitPoolTx = iBalancerV2Vault.encodeFunctionData("exitPool", txData);
|
|
13906
14300
|
return _context8.abrupt("return", exitPoolTx);
|
|
13907
14301
|
|
|
13908
|
-
case
|
|
14302
|
+
case 6:
|
|
13909
14303
|
case "end":
|
|
13910
14304
|
return _context8.stop();
|
|
13911
14305
|
}
|
|
@@ -13913,7 +14307,7 @@ var Utils = /*#__PURE__*/function () {
|
|
|
13913
14307
|
}, _callee8);
|
|
13914
14308
|
}));
|
|
13915
14309
|
|
|
13916
|
-
function getBalancerExitPoolTx(_x23, _x24, _x25, _x26) {
|
|
14310
|
+
function getBalancerExitPoolTx(_x23, _x24, _x25, _x26, _x27) {
|
|
13917
14311
|
return _getBalancerExitPoolTx.apply(this, arguments);
|
|
13918
14312
|
}
|
|
13919
14313
|
|
|
@@ -14024,17 +14418,16 @@ var Dhedge = /*#__PURE__*/function () {
|
|
|
14024
14418
|
while (1) {
|
|
14025
14419
|
switch (_context2.prev = _context2.next) {
|
|
14026
14420
|
case 0:
|
|
14027
|
-
this.validatePool(address);
|
|
14028
14421
|
poolLogic = new Contract(address, PoolLogic.abi, this.signer);
|
|
14029
|
-
_context2.next =
|
|
14422
|
+
_context2.next = 3;
|
|
14030
14423
|
return poolLogic.poolManagerLogic();
|
|
14031
14424
|
|
|
14032
|
-
case
|
|
14425
|
+
case 3:
|
|
14033
14426
|
managerLogicAddress = _context2.sent;
|
|
14034
14427
|
managerLogic = new Contract(managerLogicAddress, ManagerLogic.abi, this.signer);
|
|
14035
14428
|
return _context2.abrupt("return", new Pool(this.network, this.signer, poolLogic, managerLogic, this.utils, this.factory));
|
|
14036
14429
|
|
|
14037
|
-
case
|
|
14430
|
+
case 6:
|
|
14038
14431
|
case "end":
|
|
14039
14432
|
return _context2.stop();
|
|
14040
14433
|
}
|
|
@@ -14047,49 +14440,6 @@ var Dhedge = /*#__PURE__*/function () {
|
|
|
14047
14440
|
}
|
|
14048
14441
|
|
|
14049
14442
|
return loadPool;
|
|
14050
|
-
}()
|
|
14051
|
-
/**
|
|
14052
|
-
* Check if pool address is valid
|
|
14053
|
-
* @param {string} address Pool address
|
|
14054
|
-
* @returns {boolean} Is valid pool address
|
|
14055
|
-
*/
|
|
14056
|
-
;
|
|
14057
|
-
|
|
14058
|
-
_proto.validatePool =
|
|
14059
|
-
/*#__PURE__*/
|
|
14060
|
-
function () {
|
|
14061
|
-
var _validatePool = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(address) {
|
|
14062
|
-
var isPool;
|
|
14063
|
-
return runtime_1.wrap(function _callee3$(_context3) {
|
|
14064
|
-
while (1) {
|
|
14065
|
-
switch (_context3.prev = _context3.next) {
|
|
14066
|
-
case 0:
|
|
14067
|
-
_context3.next = 2;
|
|
14068
|
-
return this.factory.isPool(address);
|
|
14069
|
-
|
|
14070
|
-
case 2:
|
|
14071
|
-
isPool = _context3.sent;
|
|
14072
|
-
|
|
14073
|
-
if (isPool) {
|
|
14074
|
-
_context3.next = 5;
|
|
14075
|
-
break;
|
|
14076
|
-
}
|
|
14077
|
-
|
|
14078
|
-
throw new Error("Given address not a pool");
|
|
14079
|
-
|
|
14080
|
-
case 5:
|
|
14081
|
-
case "end":
|
|
14082
|
-
return _context3.stop();
|
|
14083
|
-
}
|
|
14084
|
-
}
|
|
14085
|
-
}, _callee3, this);
|
|
14086
|
-
}));
|
|
14087
|
-
|
|
14088
|
-
function validatePool(_x8) {
|
|
14089
|
-
return _validatePool.apply(this, arguments);
|
|
14090
|
-
}
|
|
14091
|
-
|
|
14092
|
-
return validatePool;
|
|
14093
14443
|
}();
|
|
14094
14444
|
|
|
14095
14445
|
return Dhedge;
|