@curvefi/api 2.69.10 → 2.69.12
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/lib/constants/coins/ethereum.js +2 -0
- package/lib/pools/PoolTemplate.d.ts +1 -0
- package/lib/pools/PoolTemplate.js +17 -1
- package/lib/pools/mixins/swapWrappedMixins.js +2 -0
- package/lib/pools/mixins/withdrawExpectedMixins.js +8 -0
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +4 -0
- package/lib/route-graph.worker.js +31 -0
- package/package.json +1 -1
|
@@ -11,6 +11,8 @@ export const COINS_ETHEREUM = lowerCaseValues({
|
|
|
11
11
|
susds: "0xa3931d71877c0e7a3148cb7eb4463524fec27fbd",
|
|
12
12
|
reusd: "0x5086bf358635B81D8C47C66d1C8b9E567Db70c72",
|
|
13
13
|
sreusd: "0x557AB1e003951A73c12D16F0fEA8490E39C33C35",
|
|
14
|
+
dola: "0x865377367054516e17014CcdED1e7d814EDC9ce4",
|
|
15
|
+
sdola: "0xb45ad160634c528Cc3D2926d9807104FA3157305",
|
|
14
16
|
ycdai: "0x99d1Fa417f94dcD62BfE781a1213c092a47041Bc", // pax/yDAI
|
|
15
17
|
ycusdc: "0x9777d7E2b60bB01759D0E2f8be2095df444cb07E", // pax/yUSDC
|
|
16
18
|
ycusdt: "0x1bE5d71F2dA660BFdee8012dDc58D024448A0A59", // pax/yUSDT
|
|
@@ -56,6 +56,7 @@ export declare class PoolTemplate extends CorePool {
|
|
|
56
56
|
private calcLpTokenAmountBigInt;
|
|
57
57
|
private calcLpTokenAmountWrapped;
|
|
58
58
|
private calcLpTokenAmountWrappedBigInt;
|
|
59
|
+
_isPoolFiltered(): Promise<boolean>;
|
|
59
60
|
getSeedAmounts(amount1: number | string, useUnderlying?: boolean): Promise<string[]>;
|
|
60
61
|
depositBalancedAmounts(): Promise<string[]>;
|
|
61
62
|
depositExpected(amounts: (number | string)[]): Promise<string>;
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import memoize from "memoizee";
|
|
11
|
-
import { _getAllGaugesFormatted } from '../external-api.js';
|
|
11
|
+
import { _getAllGaugesFormatted, _getPoolFilters } from '../external-api.js';
|
|
12
12
|
import { _cutZeros, _ensureAllowance, _get_price_impact, _get_small_x, _getAddress, _getCoinAddresses, _getRewardsFromApi, _getUsdRate, _setContracts, BN, checkNumber, DIGas, ensureAllowance, ensureAllowanceEstimateGas, findAbiFunction, fromBN, hasAllowance, mulBy1_3, parseUnits, PERIODS, smartNumber, toBN, toStringFromBN, } from '../utils.js';
|
|
13
13
|
import { OLD_CHAINS } from "../curve.js";
|
|
14
14
|
import ERC20Abi from '../constants/abis/ERC20.json' with { type: 'json' };
|
|
@@ -655,6 +655,14 @@ export class PoolTemplate extends CorePool {
|
|
|
655
655
|
return yield this._calcLpTokenAmount(amounts, isDeposit, false);
|
|
656
656
|
});
|
|
657
657
|
}
|
|
658
|
+
_isPoolFiltered() {
|
|
659
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
660
|
+
var _c;
|
|
661
|
+
const poolFilters = yield _getPoolFilters();
|
|
662
|
+
const filteredAddresses = poolFilters[this.curve.constants.NETWORK_NAME];
|
|
663
|
+
return (_c = filteredAddresses === null || filteredAddresses === void 0 ? void 0 : filteredAddresses.includes(this.address)) !== null && _c !== void 0 ? _c : false;
|
|
664
|
+
});
|
|
665
|
+
}
|
|
658
666
|
// ---------------- DEPOSIT ----------------
|
|
659
667
|
getSeedAmounts(amount1_1) {
|
|
660
668
|
return __awaiter(this, arguments, void 0, function* (amount1, useUnderlying = false) {
|
|
@@ -712,6 +720,8 @@ export class PoolTemplate extends CorePool {
|
|
|
712
720
|
}
|
|
713
721
|
depositExpectedBigInt(amounts) {
|
|
714
722
|
return __awaiter(this, void 0, void 0, function* () {
|
|
723
|
+
if (yield this._isPoolFiltered())
|
|
724
|
+
return BigInt(0);
|
|
715
725
|
return yield this.calcLpTokenAmountBigInt(amounts);
|
|
716
726
|
});
|
|
717
727
|
}
|
|
@@ -824,6 +834,8 @@ export class PoolTemplate extends CorePool {
|
|
|
824
834
|
if (this.isFake) {
|
|
825
835
|
throw Error(`depositWrappedExpectedBigInt method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
826
836
|
}
|
|
837
|
+
if (yield this._isPoolFiltered())
|
|
838
|
+
return BigInt(0);
|
|
827
839
|
return yield this.calcLpTokenAmountWrappedBigInt(amounts);
|
|
828
840
|
});
|
|
829
841
|
}
|
|
@@ -1524,6 +1536,8 @@ export class PoolTemplate extends CorePool {
|
|
|
1524
1536
|
}
|
|
1525
1537
|
withdrawOneCoinExpectedBigInt(lpTokenAmount, coin) {
|
|
1526
1538
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1539
|
+
if (yield this._isPoolFiltered())
|
|
1540
|
+
return BigInt(0);
|
|
1527
1541
|
const i = this._getCoinIdx(coin);
|
|
1528
1542
|
return yield this._withdrawOneCoinExpected(lpTokenAmount, i);
|
|
1529
1543
|
});
|
|
@@ -1765,6 +1779,8 @@ export class PoolTemplate extends CorePool {
|
|
|
1765
1779
|
}
|
|
1766
1780
|
swapExpectedBigInt(inputCoin, outputCoin, amount) {
|
|
1767
1781
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1782
|
+
if (yield this._isPoolFiltered())
|
|
1783
|
+
return BigInt(0);
|
|
1768
1784
|
const i = this._getCoinIdx(inputCoin);
|
|
1769
1785
|
const j = this._getCoinIdx(outputCoin);
|
|
1770
1786
|
const _expected = yield this._swapExpected(i, j, amount);
|
|
@@ -117,6 +117,8 @@ export const swapWrappedExpectedAndApproveMixin = {
|
|
|
117
117
|
},
|
|
118
118
|
swapWrappedExpectedBigInt(inputCoin, outputCoin, amount) {
|
|
119
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
if (yield this._isPoolFiltered())
|
|
121
|
+
return BigInt(0);
|
|
120
122
|
const i = this._getCoinIdx(inputCoin, false);
|
|
121
123
|
const j = this._getCoinIdx(outputCoin, false);
|
|
122
124
|
const _expected = yield this._swapWrappedExpected.call(this, i, j, amount);
|
|
@@ -20,6 +20,8 @@ export const withdrawExpectedMixin = {
|
|
|
20
20
|
},
|
|
21
21
|
withdrawExpectedBigInt(lpTokenAmount) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
if (yield this._isPoolFiltered())
|
|
24
|
+
return this.underlyingCoins.map(() => BigInt(0));
|
|
23
25
|
return yield _calcExpectedAmounts.call(this, lpTokenAmount);
|
|
24
26
|
});
|
|
25
27
|
},
|
|
@@ -36,6 +38,8 @@ export const withdrawExpectedLendingOrCryptoMixin = {
|
|
|
36
38
|
},
|
|
37
39
|
withdrawExpectedBigInt(lpTokenAmount) {
|
|
38
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
if (yield this._isPoolFiltered())
|
|
42
|
+
return this.underlyingCoins.map(() => BigInt(0));
|
|
39
43
|
const _expectedAmounts = yield _calcExpectedAmounts.call(this, lpTokenAmount);
|
|
40
44
|
const _rates = yield this._getRates();
|
|
41
45
|
return _expectedAmounts.map((_amount, i) => _amount * _rates[i] / parseUnits(String(Math.pow(10, 18)), 0));
|
|
@@ -52,6 +56,8 @@ export const withdrawExpectedMetaMixin = {
|
|
|
52
56
|
},
|
|
53
57
|
withdrawExpectedBigInt(lpTokenAmount) {
|
|
54
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
if (yield this._isPoolFiltered())
|
|
60
|
+
return this.underlyingCoins.map(() => BigInt(0));
|
|
55
61
|
return yield _calcExpectedUnderlyingAmountsMeta.call(this, lpTokenAmount);
|
|
56
62
|
});
|
|
57
63
|
},
|
|
@@ -66,6 +72,8 @@ export const withdrawWrappedExpectedMixin = {
|
|
|
66
72
|
},
|
|
67
73
|
withdrawWrappedExpectedBigInt(lpTokenAmount) {
|
|
68
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
if (yield this._isPoolFiltered())
|
|
76
|
+
return this.wrappedCoins.map(() => BigInt(0));
|
|
69
77
|
return yield _calcExpectedAmounts.call(this, lpTokenAmount);
|
|
70
78
|
});
|
|
71
79
|
},
|
|
@@ -16,6 +16,8 @@ export const withdrawOneCoinWrappedExpected2argsMixin = {
|
|
|
16
16
|
},
|
|
17
17
|
withdrawOneCoinWrappedExpectedBigInt(lpTokenAmount, coin) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
if (yield this._isPoolFiltered())
|
|
20
|
+
return BigInt(0);
|
|
19
21
|
const i = this._getCoinIdx(coin, false);
|
|
20
22
|
return yield this._withdrawOneCoinWrappedExpected(lpTokenAmount, i);
|
|
21
23
|
});
|
|
@@ -30,6 +32,8 @@ export const withdrawOneCoinWrappedExpected3argsMixin = {
|
|
|
30
32
|
},
|
|
31
33
|
withdrawOneCoinWrappedExpectedBigInt(lpTokenAmount, coin) {
|
|
32
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
if (yield this._isPoolFiltered())
|
|
36
|
+
return BigInt(0);
|
|
33
37
|
const i = this._getCoinIdx(coin, false);
|
|
34
38
|
return yield this._withdrawOneCoinWrappedExpected(lpTokenAmount, i);
|
|
35
39
|
});
|
|
@@ -215,6 +215,37 @@ export function routeGraphWorker() {
|
|
|
215
215
|
tvl: Infinity,
|
|
216
216
|
}];
|
|
217
217
|
}
|
|
218
|
+
// sDOLA <-> DOLA (Ethereum only)
|
|
219
|
+
if (chainId === 1) {
|
|
220
|
+
routerGraph[constants.COINS.dola] = {};
|
|
221
|
+
routerGraph[constants.COINS.dola][constants.COINS.sdola] = [{
|
|
222
|
+
poolId: "sDOLA wrapper",
|
|
223
|
+
swapAddress: constants.COINS.sdola,
|
|
224
|
+
inputCoinAddress: constants.COINS.dola,
|
|
225
|
+
outputCoinAddress: constants.COINS.sdola,
|
|
226
|
+
swapParams: [0, 1, 9, 0, 0],
|
|
227
|
+
poolAddress: constants.ZERO_ADDRESS,
|
|
228
|
+
basePool: constants.ZERO_ADDRESS,
|
|
229
|
+
baseToken: constants.ZERO_ADDRESS,
|
|
230
|
+
secondBasePool: constants.ZERO_ADDRESS,
|
|
231
|
+
secondBaseToken: constants.ZERO_ADDRESS,
|
|
232
|
+
tvl: Infinity,
|
|
233
|
+
}];
|
|
234
|
+
routerGraph[constants.COINS.sdola] = {};
|
|
235
|
+
routerGraph[constants.COINS.sdola][constants.COINS.dola] = [{
|
|
236
|
+
poolId: "sDOLA wrapper",
|
|
237
|
+
swapAddress: constants.COINS.sdola,
|
|
238
|
+
inputCoinAddress: constants.COINS.sdola,
|
|
239
|
+
outputCoinAddress: constants.COINS.dola,
|
|
240
|
+
swapParams: [1, 0, 9, 0, 0],
|
|
241
|
+
poolAddress: constants.ZERO_ADDRESS,
|
|
242
|
+
basePool: constants.ZERO_ADDRESS,
|
|
243
|
+
baseToken: constants.ZERO_ADDRESS,
|
|
244
|
+
secondBasePool: constants.ZERO_ADDRESS,
|
|
245
|
+
secondBaseToken: constants.ZERO_ADDRESS,
|
|
246
|
+
tvl: Infinity,
|
|
247
|
+
}];
|
|
248
|
+
}
|
|
218
249
|
// USDe -> sUSDe (Ethereum only)
|
|
219
250
|
if (chainId === 1) {
|
|
220
251
|
routerGraph[constants.COINS.usde] = {};
|