@curvefi/api 1.15.1 → 1.16.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.
|
@@ -1649,4 +1649,99 @@ exports.POOLS_DATA_ETHEREUM = {
|
|
|
1649
1649
|
],
|
|
1650
1650
|
gauge_abi: gauge_v4_json_1.default,
|
|
1651
1651
|
},
|
|
1652
|
+
xautusd: {
|
|
1653
|
+
reference_asset: 'CRYPTO',
|
|
1654
|
+
N_COINS: 2,
|
|
1655
|
+
underlying_decimals: [6, 18],
|
|
1656
|
+
decimals: [6, 18],
|
|
1657
|
+
tethered: [false, false],
|
|
1658
|
+
use_lending: [false, false],
|
|
1659
|
+
is_plain: [true, true],
|
|
1660
|
+
swap_address: '0xAdCFcf9894335dC340f6Cd182aFA45999F45Fc44',
|
|
1661
|
+
token_address: '0x8484673cA7BfF40F82B041916881aeA15ee84834',
|
|
1662
|
+
gauge_address: '0x1B3E14157ED33F60668f2103bCd5Db39a1573E5B',
|
|
1663
|
+
is_crypto: true,
|
|
1664
|
+
base_pool: '3pool',
|
|
1665
|
+
underlying_coins: ['XAUt', 'DAI', 'USDC', 'USDT'],
|
|
1666
|
+
coins: ['XAUt', '3Crv'],
|
|
1667
|
+
underlying_coin_addresses: [
|
|
1668
|
+
'0x68749665ff8d2d112fa859aa293f07a622782f38',
|
|
1669
|
+
'0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490',
|
|
1670
|
+
],
|
|
1671
|
+
coin_addresses: [
|
|
1672
|
+
'0x68749665ff8d2d112fa859aa293f07a622782f38',
|
|
1673
|
+
'0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490',
|
|
1674
|
+
],
|
|
1675
|
+
swap_abi: swap_json_36.default,
|
|
1676
|
+
deposit_abi: deposit_json_22.default,
|
|
1677
|
+
deposit_address: '0xc5FA220347375ac4f91f9E4A4AAb362F22801504',
|
|
1678
|
+
is_meta: true,
|
|
1679
|
+
meta_N: 5,
|
|
1680
|
+
meta_decimals: [6, 18, 18, 6, 6],
|
|
1681
|
+
meta_coin_decimals: [6, 18, 6, 6],
|
|
1682
|
+
meta_wrapped_decimals: [6, 18],
|
|
1683
|
+
meta_coin_addresses: [
|
|
1684
|
+
'0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
|
1685
|
+
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
1686
|
+
'0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
1687
|
+
],
|
|
1688
|
+
all_coin_addresses: [
|
|
1689
|
+
'0x68749665ff8d2d112fa859aa293f07a622782f38',
|
|
1690
|
+
'0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490',
|
|
1691
|
+
'0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
|
1692
|
+
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
1693
|
+
'0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
1694
|
+
],
|
|
1695
|
+
gauge_abi: gauge_v4_json_1.default,
|
|
1696
|
+
},
|
|
1697
|
+
spelleth: {
|
|
1698
|
+
reference_asset: 'CRYPTO',
|
|
1699
|
+
N_COINS: 2,
|
|
1700
|
+
is_crypto: true,
|
|
1701
|
+
underlying_decimals: [18, 18],
|
|
1702
|
+
decimals: [18, 18],
|
|
1703
|
+
tethered: [false, false],
|
|
1704
|
+
use_lending: [false, false],
|
|
1705
|
+
is_plain: [true, true],
|
|
1706
|
+
swap_address: '0x98638FAcf9a3865cd033F36548713183f6996122',
|
|
1707
|
+
token_address: '0x8282BD15dcA2EA2bDf24163E8f2781B30C43A2ef',
|
|
1708
|
+
gauge_address: '0x08380a4999Be1a958E2abbA07968d703C7A3027C',
|
|
1709
|
+
underlying_coins: ['ETH', 'SPELL'],
|
|
1710
|
+
coins: ['WETH', 'SPELL'],
|
|
1711
|
+
underlying_coin_addresses: [
|
|
1712
|
+
'0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
1713
|
+
'0x090185f2135308bad17527004364ebcc2d37e5f6',
|
|
1714
|
+
],
|
|
1715
|
+
coin_addresses: [
|
|
1716
|
+
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
1717
|
+
'0x090185f2135308bad17527004364ebcc2d37e5f6',
|
|
1718
|
+
],
|
|
1719
|
+
swap_abi: swap_json_37.default,
|
|
1720
|
+
gauge_abi: gauge_v4_json_1.default,
|
|
1721
|
+
},
|
|
1722
|
+
teth: {
|
|
1723
|
+
reference_asset: 'CRYPTO',
|
|
1724
|
+
N_COINS: 2,
|
|
1725
|
+
is_crypto: true,
|
|
1726
|
+
underlying_decimals: [18, 18],
|
|
1727
|
+
decimals: [18, 18],
|
|
1728
|
+
tethered: [false, false],
|
|
1729
|
+
use_lending: [false, false],
|
|
1730
|
+
is_plain: [true, true],
|
|
1731
|
+
swap_address: '0x752eBeb79963cf0732E9c0fec72a49FD1DEfAEAC',
|
|
1732
|
+
token_address: '0xCb08717451aaE9EF950a2524E33B6DCaBA60147B',
|
|
1733
|
+
gauge_address: '0x6070fBD4E608ee5391189E7205d70cc4A274c017',
|
|
1734
|
+
underlying_coins: ['ETH', 'T'],
|
|
1735
|
+
coins: ['WETH', 'T'],
|
|
1736
|
+
underlying_coin_addresses: [
|
|
1737
|
+
'0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
1738
|
+
'0xCdF7028ceAB81fA0C6971208e83fa7872994beE5',
|
|
1739
|
+
],
|
|
1740
|
+
coin_addresses: [
|
|
1741
|
+
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
1742
|
+
'0xCdF7028ceAB81fA0C6971208e83fa7872994beE5',
|
|
1743
|
+
],
|
|
1744
|
+
swap_abi: swap_json_37.default,
|
|
1745
|
+
gauge_abi: gauge_v4_json_1.default,
|
|
1746
|
+
},
|
|
1652
1747
|
};
|
|
@@ -31,7 +31,8 @@ exports.ETH_COINS_ETHEREUM = {
|
|
|
31
31
|
ankreth: "0xE95A203B1a91a908F9B9CE46459d101078c2c3cb",
|
|
32
32
|
seth: "0x5e74c9036fb86bd7ecdcb084a0673efc32ea31cb",
|
|
33
33
|
reth: "0x9559aaa82d9649c7a7b220e7c461d2e74c9a3593",
|
|
34
|
-
weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
34
|
+
weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
35
|
+
xaut: "0x68749665ff8d2d112fa859aa293f07a622782f38", // XAUt TODO move to GOLD
|
|
35
36
|
};
|
|
36
37
|
// @ts-ignore
|
|
37
38
|
exports.ETH_COINS_LOWER_CASE_ETHEREUM = Object.fromEntries(Object.entries(exports.ETH_COINS_ETHEREUM).map(function (entry) { return [entry[0], entry[1].toLowerCase()]; }));
|
|
@@ -95,7 +96,7 @@ exports.USD_COINS_ETHEREUM = {
|
|
|
95
96
|
};
|
|
96
97
|
// @ts-ignore
|
|
97
98
|
exports.USD_COINS_LOWER_CASE_ETHEREUM = Object.fromEntries(Object.entries(exports.USD_COINS_ETHEREUM).map(function (entry) { return [entry[0], entry[1].toLowerCase()]; }));
|
|
98
|
-
exports.COINS_ETHEREUM = __assign(__assign(__assign(__assign(__assign(__assign({}, exports.BTC_COINS_ETHEREUM), exports.ETH_COINS_ETHEREUM), exports.LINK_COINS_ETHEREUM), exports.EUR_COINS_ETHEREUM), exports.USD_COINS_ETHEREUM), { snx: "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f" });
|
|
99
|
+
exports.COINS_ETHEREUM = __assign(__assign(__assign(__assign(__assign(__assign({}, exports.BTC_COINS_ETHEREUM), exports.ETH_COINS_ETHEREUM), exports.LINK_COINS_ETHEREUM), exports.EUR_COINS_ETHEREUM), exports.USD_COINS_ETHEREUM), { snx: "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f", spell: "0x090185f2135308bad17527004364ebcc2d37e5f6", t: "0xCdF7028ceAB81fA0C6971208e83fa7872994beE5" });
|
|
99
100
|
exports.DECIMALS_ETHEREUM = {
|
|
100
101
|
"0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3": 18,
|
|
101
102
|
"0x0316EB71485b0Ab14103307bf65a021042c6d380": 18,
|
|
@@ -160,7 +161,10 @@ exports.DECIMALS_ETHEREUM = {
|
|
|
160
161
|
"0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3": 18,
|
|
161
162
|
"0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490": 18,
|
|
162
163
|
"0xD533a949740bb3306d119CC777fa900bA034cd52": 18,
|
|
163
|
-
"0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b": 18,
|
|
164
|
+
"0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b": 18,
|
|
165
|
+
"0x68749665ff8d2d112fa859aa293f07a622782f38": 6,
|
|
166
|
+
"0x090185f2135308bad17527004364ebcc2d37e5f6": 18,
|
|
167
|
+
"0xCdF7028ceAB81fA0C6971208e83fa7872994beE5": 18, // T
|
|
164
168
|
};
|
|
165
169
|
// @ts-ignore
|
|
166
170
|
exports.DECIMALS_LOWER_CASE_ETHEREUM = Object.fromEntries(Object.entries(exports.DECIMALS_ETHEREUM).map(function (entry) { return [entry[0].toLowerCase(), entry[1]]; }));
|
package/lib/pools.js
CHANGED
|
@@ -81,7 +81,7 @@ var Pool = /** @class */ (function () {
|
|
|
81
81
|
_amounts = amounts.map(function (amount, i) {
|
|
82
82
|
return ethers_1.ethers.utils.parseUnits(amount, _this.underlyingDecimals[i]);
|
|
83
83
|
});
|
|
84
|
-
if (!(['compound', 'usdt', 'y', 'busd', 'pax', 'aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 2];
|
|
84
|
+
if (!(['compound', 'usdt', 'y', 'busd', 'pax', 'aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 2];
|
|
85
85
|
return [4 /*yield*/, this._calcLpTokenAmountWithUnderlying(_amounts, isDeposit)];
|
|
86
86
|
case 1:
|
|
87
87
|
_expected = _a.sent(); // Lending pools
|
|
@@ -192,7 +192,7 @@ var Pool = /** @class */ (function () {
|
|
|
192
192
|
_poolUnderlyingBalances = this.name !== 'atricrypto3' ? __spreadArray(__spreadArray([], _poolUnderlyingBalance, true), _basePoolExpectedAmounts, true) : __spreadArray(__spreadArray([], _basePoolExpectedAmounts, true), _poolUnderlyingBalance, true);
|
|
193
193
|
return [3 /*break*/, 6];
|
|
194
194
|
case 3:
|
|
195
|
-
if (!(['compound', 'usdt', 'y', 'busd', 'pax', 'aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 5];
|
|
195
|
+
if (!(['compound', 'usdt', 'y', 'busd', 'pax', 'aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 5];
|
|
196
196
|
return [4 /*yield*/, this._getRates()];
|
|
197
197
|
case 4:
|
|
198
198
|
_rates_1 = _a.sent();
|
|
@@ -459,7 +459,7 @@ var Pool = /** @class */ (function () {
|
|
|
459
459
|
return [4 /*yield*/, this._addLiquidityZap(_amounts, true)];
|
|
460
460
|
case 3: return [2 /*return*/, _d.sent()];
|
|
461
461
|
case 4:
|
|
462
|
-
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 6];
|
|
462
|
+
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 6];
|
|
463
463
|
return [4 /*yield*/, this._addLiquidity(_amounts, true, true)];
|
|
464
464
|
case 5: return [2 /*return*/, _d.sent()];
|
|
465
465
|
case 6:
|
|
@@ -507,7 +507,7 @@ var Pool = /** @class */ (function () {
|
|
|
507
507
|
return [4 /*yield*/, this._addLiquidityZap(_amounts)];
|
|
508
508
|
case 2: return [2 /*return*/, _a.sent()];
|
|
509
509
|
case 3:
|
|
510
|
-
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 5];
|
|
510
|
+
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 5];
|
|
511
511
|
return [4 /*yield*/, this._addLiquidity(_amounts, true)];
|
|
512
512
|
case 4: return [2 /*return*/, _a.sent()];
|
|
513
513
|
case 5:
|
|
@@ -637,7 +637,7 @@ var Pool = /** @class */ (function () {
|
|
|
637
637
|
_amounts = amounts.map(function (amount, i) {
|
|
638
638
|
return ethers_1.ethers.utils.parseUnits(amount, _this.decimals[i]);
|
|
639
639
|
});
|
|
640
|
-
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 4];
|
|
640
|
+
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 4];
|
|
641
641
|
return [4 /*yield*/, this._addLiquidity(_amounts, false, true)];
|
|
642
642
|
case 3: return [2 /*return*/, _d.sent()];
|
|
643
643
|
case 4: return [4 /*yield*/, this._addLiquiditySwap(_amounts, true)];
|
|
@@ -665,7 +665,7 @@ var Pool = /** @class */ (function () {
|
|
|
665
665
|
return [4 /*yield*/, curve_1.curve.updateFeeData()];
|
|
666
666
|
case 1:
|
|
667
667
|
_a.sent();
|
|
668
|
-
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 3];
|
|
668
|
+
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 3];
|
|
669
669
|
return [4 /*yield*/, this._addLiquidity(_amounts, false)];
|
|
670
670
|
case 2: return [2 /*return*/, _a.sent()];
|
|
671
671
|
case 3: return [4 /*yield*/, this._addLiquiditySwap(_amounts)];
|
|
@@ -682,7 +682,7 @@ var Pool = /** @class */ (function () {
|
|
|
682
682
|
switch (_a.label) {
|
|
683
683
|
case 0:
|
|
684
684
|
_lpTokenAmount = ethers_1.ethers.utils.parseUnits(lpTokenAmount);
|
|
685
|
-
if (!(['compound', 'usdt', 'y', 'busd', 'pax', 'aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 2];
|
|
685
|
+
if (!(['compound', 'usdt', 'y', 'busd', 'pax', 'aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 2];
|
|
686
686
|
return [4 /*yield*/, this._calcExpectedUnderlyingAmounts(_lpTokenAmount)];
|
|
687
687
|
case 1:
|
|
688
688
|
_expected = _a.sent(); // Lending pools
|
|
@@ -759,7 +759,7 @@ var Pool = /** @class */ (function () {
|
|
|
759
759
|
return [4 /*yield*/, this._removeLiquidityZap(_lpTokenAmount, true)];
|
|
760
760
|
case 4: return [2 /*return*/, _c.sent()];
|
|
761
761
|
case 5:
|
|
762
|
-
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 7];
|
|
762
|
+
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 7];
|
|
763
763
|
return [4 /*yield*/, this._removeLiquidity(_lpTokenAmount, true, true)];
|
|
764
764
|
case 6: return [2 /*return*/, _c.sent()];
|
|
765
765
|
case 7:
|
|
@@ -784,7 +784,7 @@ var Pool = /** @class */ (function () {
|
|
|
784
784
|
return [4 /*yield*/, this._removeLiquidityZap(_lpTokenAmount)];
|
|
785
785
|
case 2: return [2 /*return*/, _a.sent()];
|
|
786
786
|
case 3:
|
|
787
|
-
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 5];
|
|
787
|
+
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 5];
|
|
788
788
|
return [4 /*yield*/, this._removeLiquidity(_lpTokenAmount, true)];
|
|
789
789
|
case 4: return [2 /*return*/, _a.sent()];
|
|
790
790
|
case 5:
|
|
@@ -828,7 +828,7 @@ var Pool = /** @class */ (function () {
|
|
|
828
828
|
if (Number(lpTokenBalance) < Number(lpTokenAmount)) {
|
|
829
829
|
throw Error("Not enough LP tokens. Actual: ".concat(lpTokenBalance, ", required: ").concat(lpTokenAmount));
|
|
830
830
|
}
|
|
831
|
-
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 3];
|
|
831
|
+
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 3];
|
|
832
832
|
return [4 /*yield*/, this._removeLiquidity(_lpTokenAmount, false, true)];
|
|
833
833
|
case 2: return [2 /*return*/, _a.sent()];
|
|
834
834
|
case 3: return [4 /*yield*/, this._removeLiquiditySwap(_lpTokenAmount, true)];
|
|
@@ -848,7 +848,7 @@ var Pool = /** @class */ (function () {
|
|
|
848
848
|
return [4 /*yield*/, curve_1.curve.updateFeeData()];
|
|
849
849
|
case 1:
|
|
850
850
|
_a.sent();
|
|
851
|
-
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 3];
|
|
851
|
+
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 3];
|
|
852
852
|
return [4 /*yield*/, this._removeLiquidity(_lpTokenAmount, false)];
|
|
853
853
|
case 2: return [2 /*return*/, _a.sent()];
|
|
854
854
|
case 3: return [4 /*yield*/, this._removeLiquiditySwap(_lpTokenAmount)];
|
|
@@ -1225,7 +1225,7 @@ var Pool = /** @class */ (function () {
|
|
|
1225
1225
|
return [4 /*yield*/, this._removeLiquidityOneCoinZap(_lpTokenAmount, i, true)];
|
|
1226
1226
|
case 4: return [2 /*return*/, _c.sent()];
|
|
1227
1227
|
case 5:
|
|
1228
|
-
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 7];
|
|
1228
|
+
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 7];
|
|
1229
1229
|
return [4 /*yield*/, this._removeLiquidityOneCoin(_lpTokenAmount, i, true, true)];
|
|
1230
1230
|
case 6: return [2 /*return*/, _c.sent()];
|
|
1231
1231
|
case 7: return [4 /*yield*/, this._removeLiquidityOneCoinSwap(_lpTokenAmount, i, true)];
|
|
@@ -1249,7 +1249,7 @@ var Pool = /** @class */ (function () {
|
|
|
1249
1249
|
return [4 /*yield*/, this._removeLiquidityOneCoinZap(_lpTokenAmount, i)];
|
|
1250
1250
|
case 2: return [2 /*return*/, _a.sent()];
|
|
1251
1251
|
case 3:
|
|
1252
|
-
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 5];
|
|
1252
|
+
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 5];
|
|
1253
1253
|
return [4 /*yield*/, this._removeLiquidityOneCoin(_lpTokenAmount, i, true)];
|
|
1254
1254
|
case 4: return [2 /*return*/, _a.sent()];
|
|
1255
1255
|
case 5: return [4 /*yield*/, this._removeLiquidityOneCoinSwap(_lpTokenAmount, i)];
|
|
@@ -1321,7 +1321,7 @@ var Pool = /** @class */ (function () {
|
|
|
1321
1321
|
throw Error("".concat(this.name, " pool doesn't have remove_liquidity_one_coin method for wrapped tokens"));
|
|
1322
1322
|
}
|
|
1323
1323
|
_lpTokenAmount = ethers_1.ethers.utils.parseUnits(lpTokenAmount);
|
|
1324
|
-
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 3];
|
|
1324
|
+
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 3];
|
|
1325
1325
|
return [4 /*yield*/, this._removeLiquidityOneCoin(_lpTokenAmount, i, false, true)];
|
|
1326
1326
|
case 2: return [2 /*return*/, _a.sent()];
|
|
1327
1327
|
case 3: return [4 /*yield*/, this._removeLiquidityOneCoinSwap(_lpTokenAmount, i, true)];
|
|
@@ -1345,7 +1345,7 @@ var Pool = /** @class */ (function () {
|
|
|
1345
1345
|
case 1:
|
|
1346
1346
|
_a.sent();
|
|
1347
1347
|
_lpTokenAmount = ethers_1.ethers.utils.parseUnits(lpTokenAmount);
|
|
1348
|
-
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 3];
|
|
1348
|
+
if (!(['aave', 'saave', 'ib', 'crveth', "cvxeth", "spelleth", "teth"].includes(this.name) || (curve_1.curve.chainId === 137 && this.name === 'ren'))) return [3 /*break*/, 3];
|
|
1349
1349
|
return [4 /*yield*/, this._removeLiquidityOneCoin(_lpTokenAmount, i, false)];
|
|
1350
1350
|
case 2: return [2 /*return*/, _a.sent()];
|
|
1351
1351
|
case 3: return [4 /*yield*/, this._removeLiquidityOneCoinSwap(_lpTokenAmount, i)];
|
|
@@ -1383,13 +1383,13 @@ var Pool = /** @class */ (function () {
|
|
|
1383
1383
|
switch (_a.label) {
|
|
1384
1384
|
case 0:
|
|
1385
1385
|
_lpTokenAmount = ethers_1.ethers.utils.parseUnits(lpTokenAmount);
|
|
1386
|
-
return [4 /*yield*/, curve_1.curve.contracts[this.gauge].contract.estimateGas.deposit(_lpTokenAmount, curve_1.curve.
|
|
1386
|
+
return [4 /*yield*/, curve_1.curve.contracts[this.gauge].contract.estimateGas.deposit(_lpTokenAmount, curve_1.curve.constantOptions)];
|
|
1387
1387
|
case 1: return [2 /*return*/, (_a.sent()).toNumber()];
|
|
1388
1388
|
}
|
|
1389
1389
|
});
|
|
1390
1390
|
}); };
|
|
1391
1391
|
this.gaugeDeposit = function (lpTokenAmount) { return __awaiter(_this, void 0, void 0, function () {
|
|
1392
|
-
var _lpTokenAmount;
|
|
1392
|
+
var _lpTokenAmount, gasLimit;
|
|
1393
1393
|
return __generator(this, function (_a) {
|
|
1394
1394
|
switch (_a.label) {
|
|
1395
1395
|
case 0:
|
|
@@ -1397,8 +1397,11 @@ var Pool = /** @class */ (function () {
|
|
|
1397
1397
|
return [4 /*yield*/, (0, utils_1._ensureAllowance)([this.lpToken], [_lpTokenAmount], this.gauge)];
|
|
1398
1398
|
case 1:
|
|
1399
1399
|
_a.sent();
|
|
1400
|
-
return [4 /*yield*/, curve_1.curve.contracts[this.gauge].contract.deposit(_lpTokenAmount, curve_1.curve.
|
|
1401
|
-
case 2:
|
|
1400
|
+
return [4 /*yield*/, curve_1.curve.contracts[this.gauge].contract.estimateGas.deposit(_lpTokenAmount, curve_1.curve.constantOptions)];
|
|
1401
|
+
case 2:
|
|
1402
|
+
gasLimit = (_a.sent()).mul(150).div(100);
|
|
1403
|
+
return [4 /*yield*/, curve_1.curve.contracts[this.gauge].contract.deposit(_lpTokenAmount, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
|
|
1404
|
+
case 3: return [2 /*return*/, (_a.sent()).hash];
|
|
1402
1405
|
}
|
|
1403
1406
|
});
|
|
1404
1407
|
}); };
|
|
@@ -1408,19 +1411,22 @@ var Pool = /** @class */ (function () {
|
|
|
1408
1411
|
switch (_a.label) {
|
|
1409
1412
|
case 0:
|
|
1410
1413
|
_lpTokenAmount = ethers_1.ethers.utils.parseUnits(lpTokenAmount);
|
|
1411
|
-
return [4 /*yield*/, curve_1.curve.contracts[this.gauge].contract.estimateGas.withdraw(_lpTokenAmount, curve_1.curve.
|
|
1414
|
+
return [4 /*yield*/, curve_1.curve.contracts[this.gauge].contract.estimateGas.withdraw(_lpTokenAmount, curve_1.curve.constantOptions)];
|
|
1412
1415
|
case 1: return [2 /*return*/, (_a.sent()).toNumber()];
|
|
1413
1416
|
}
|
|
1414
1417
|
});
|
|
1415
1418
|
}); };
|
|
1416
1419
|
this.gaugeWithdraw = function (lpTokenAmount) { return __awaiter(_this, void 0, void 0, function () {
|
|
1417
|
-
var _lpTokenAmount;
|
|
1420
|
+
var _lpTokenAmount, gasLimit;
|
|
1418
1421
|
return __generator(this, function (_a) {
|
|
1419
1422
|
switch (_a.label) {
|
|
1420
1423
|
case 0:
|
|
1421
1424
|
_lpTokenAmount = ethers_1.ethers.utils.parseUnits(lpTokenAmount);
|
|
1422
|
-
return [4 /*yield*/, curve_1.curve.contracts[this.gauge].contract.withdraw(_lpTokenAmount, curve_1.curve.
|
|
1423
|
-
case 1:
|
|
1425
|
+
return [4 /*yield*/, curve_1.curve.contracts[this.gauge].contract.estimateGas.withdraw(_lpTokenAmount, curve_1.curve.constantOptions)];
|
|
1426
|
+
case 1:
|
|
1427
|
+
gasLimit = (_a.sent()).mul(180).div(100);
|
|
1428
|
+
return [4 /*yield*/, curve_1.curve.contracts[this.gauge].contract.withdraw(_lpTokenAmount, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
|
|
1429
|
+
case 2: return [2 /*return*/, (_a.sent()).hash];
|
|
1424
1430
|
}
|
|
1425
1431
|
});
|
|
1426
1432
|
}); };
|
|
@@ -1631,7 +1637,7 @@ var Pool = /** @class */ (function () {
|
|
|
1631
1637
|
return __generator(this, function (_a) {
|
|
1632
1638
|
switch (_a.label) {
|
|
1633
1639
|
case 0:
|
|
1634
|
-
contractAddress = ["eurtusd", "atricrypto3"].includes(this.name) ? this.zap : this.swap;
|
|
1640
|
+
contractAddress = ["eurtusd", "xautusd", "atricrypto3"].includes(this.name) ? this.zap : this.swap;
|
|
1635
1641
|
i = this._getCoinIdx(inputCoin);
|
|
1636
1642
|
return [4 /*yield*/, (0, utils_1.hasAllowance)([this.underlyingCoinAddresses[i]], [amount], curve_1.curve.signerAddress, contractAddress)];
|
|
1637
1643
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1643,7 +1649,7 @@ var Pool = /** @class */ (function () {
|
|
|
1643
1649
|
return __generator(this, function (_a) {
|
|
1644
1650
|
switch (_a.label) {
|
|
1645
1651
|
case 0:
|
|
1646
|
-
contractAddress = ["eurtusd", "atricrypto3"].includes(this.name) ? this.zap : this.swap;
|
|
1652
|
+
contractAddress = ["eurtusd", "xautusd", "atricrypto3"].includes(this.name) ? this.zap : this.swap;
|
|
1647
1653
|
i = this._getCoinIdx(inputCoin);
|
|
1648
1654
|
return [4 /*yield*/, (0, utils_1.ensureAllowanceEstimateGas)([this.underlyingCoinAddresses[i]], [amount], contractAddress)];
|
|
1649
1655
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1655,7 +1661,7 @@ var Pool = /** @class */ (function () {
|
|
|
1655
1661
|
return __generator(this, function (_a) {
|
|
1656
1662
|
switch (_a.label) {
|
|
1657
1663
|
case 0:
|
|
1658
|
-
contractAddress = ["eurtusd", "atricrypto3"].includes(this.name) ? this.zap : this.swap;
|
|
1664
|
+
contractAddress = ["eurtusd", "xautusd", "atricrypto3"].includes(this.name) ? this.zap : this.swap;
|
|
1659
1665
|
i = this._getCoinIdx(inputCoin);
|
|
1660
1666
|
return [4 /*yield*/, (0, utils_1.ensureAllowance)([this.underlyingCoinAddresses[i]], [amount], contractAddress)];
|
|
1661
1667
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1669,7 +1675,7 @@ var Pool = /** @class */ (function () {
|
|
|
1669
1675
|
return __generator(this, function (_d) {
|
|
1670
1676
|
switch (_d.label) {
|
|
1671
1677
|
case 0:
|
|
1672
|
-
contractAddress = ["eurtusd", "atricrypto3"].includes(this.name) ? this.zap : this.swap;
|
|
1678
|
+
contractAddress = ["eurtusd", "xautusd", "atricrypto3"].includes(this.name) ? this.zap : this.swap;
|
|
1673
1679
|
i = this._getCoinIdx(inputCoin);
|
|
1674
1680
|
j = this._getCoinIdx(outputCoin);
|
|
1675
1681
|
_c = (_a = Object).values;
|
|
@@ -1710,7 +1716,7 @@ var Pool = /** @class */ (function () {
|
|
|
1710
1716
|
return __generator(this, function (_a) {
|
|
1711
1717
|
switch (_a.label) {
|
|
1712
1718
|
case 0:
|
|
1713
|
-
contractAddress = ["eurtusd", "atricrypto3"].includes(this.name) ? this.zap : this.swap;
|
|
1719
|
+
contractAddress = ["eurtusd", "xautusd", "atricrypto3"].includes(this.name) ? this.zap : this.swap;
|
|
1714
1720
|
i = this._getCoinIdx(inputCoin);
|
|
1715
1721
|
j = this._getCoinIdx(outputCoin);
|
|
1716
1722
|
_amount = ethers_1.ethers.utils.parseUnits(amount, this.underlyingDecimals[i]);
|
|
@@ -2215,7 +2221,7 @@ var Pool = /** @class */ (function () {
|
|
|
2215
2221
|
switch (_a.label) {
|
|
2216
2222
|
case 0:
|
|
2217
2223
|
contract = curve_1.curve.contracts[this.swap].contract;
|
|
2218
|
-
if (!["eurtusd", "crveth", "cvxeth"].includes(this.name)) return [3 /*break*/, 2];
|
|
2224
|
+
if (!["eurtusd", "xautusd", "crveth", "cvxeth", "spelleth", "teth"].includes(this.name)) return [3 /*break*/, 2];
|
|
2219
2225
|
return [4 /*yield*/, contract.calc_token_amount(_amounts, curve_1.curve.constantOptions)];
|
|
2220
2226
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2221
2227
|
case 2: return [4 /*yield*/, contract.calc_token_amount(_amounts, isDeposit, curve_1.curve.constantOptions)];
|
|
@@ -2236,7 +2242,7 @@ var Pool = /** @class */ (function () {
|
|
|
2236
2242
|
return [4 /*yield*/, contract.calc_token_amount(this.swap, _amounts, isDeposit, curve_1.curve.constantOptions)];
|
|
2237
2243
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2238
2244
|
case 2:
|
|
2239
|
-
if (!(this.name
|
|
2245
|
+
if (!["eurtusd", "xautusd"].includes(this.name)) return [3 /*break*/, 4];
|
|
2240
2246
|
return [4 /*yield*/, contract.calc_token_amount(_amounts, curve_1.curve.constantOptions)];
|
|
2241
2247
|
case 3: return [2 /*return*/, _a.sent()];
|
|
2242
2248
|
case 4: return [4 /*yield*/, contract.calc_token_amount(_amounts, isDeposit, curve_1.curve.constantOptions)];
|
|
@@ -2896,7 +2902,7 @@ var Pool = /** @class */ (function () {
|
|
|
2896
2902
|
return __generator(this, function (_a) {
|
|
2897
2903
|
switch (_a.label) {
|
|
2898
2904
|
case 0:
|
|
2899
|
-
contractAddress = ["eurtusd", "atricrypto3"].includes(this.name) ? this.zap : this.swap;
|
|
2905
|
+
contractAddress = ["eurtusd", "xautusd", "atricrypto3"].includes(this.name) ? this.zap : this.swap;
|
|
2900
2906
|
contract = curve_1.curve.contracts[contractAddress].contract;
|
|
2901
2907
|
if (!Object.prototype.hasOwnProperty.call(contract, 'get_dy_underlying')) return [3 /*break*/, 2];
|
|
2902
2908
|
return [4 /*yield*/, contract.get_dy_underlying(i, j, _amount, curve_1.curve.constantOptions)];
|
|
@@ -3047,10 +3053,10 @@ var _getBestPoolAndOutput = function (inputCoinAddress, outputCoinAddress, amoun
|
|
|
3047
3053
|
else if (inputCoinIndexes[1] >= 0 && outputCoinIndexes[1] >= 0) {
|
|
3048
3054
|
return { poolAddress: pool[1].swap_address, _output: ethers_1.ethers.BigNumber.from(0), outputUsd: 0, txCostUsd: 0 };
|
|
3049
3055
|
}
|
|
3050
|
-
else if (inputCoinIndexes[0] === 0 && outputCoinIndexes[2] >= 0 && pool[0]
|
|
3056
|
+
else if (inputCoinIndexes[0] === 0 && outputCoinIndexes[2] >= 0 && !['eurtusd', "xautusd"].includes(pool[0])) {
|
|
3051
3057
|
return { poolAddress: pool[1].swap_address, _output: ethers_1.ethers.BigNumber.from(0), outputUsd: 0, txCostUsd: 0 };
|
|
3052
3058
|
}
|
|
3053
|
-
else if (inputCoinIndexes[2] >= 0 && outputCoinIndexes[0] === 0 && pool[0]
|
|
3059
|
+
else if (inputCoinIndexes[2] >= 0 && outputCoinIndexes[0] === 0 && !['eurtusd', "xautusd"].includes(pool[0])) {
|
|
3054
3060
|
return { poolAddress: pool[1].swap_address, _output: ethers_1.ethers.BigNumber.from(0), outputUsd: 0, txCostUsd: 0 };
|
|
3055
3061
|
}
|
|
3056
3062
|
else {
|