@curvefi/api 2.65.19 → 2.65.21
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/pools/PoolTemplate.js +57 -3
- package/package.json +1 -1
|
@@ -707,8 +707,26 @@ export class PoolTemplate extends CorePool {
|
|
|
707
707
|
return __awaiter(this, void 0, void 0, function* () {
|
|
708
708
|
const amountsBN = amounts.map(BN);
|
|
709
709
|
let pricesBN = [];
|
|
710
|
+
const multicallContract = curve.contracts[this.address].multicallContract;
|
|
710
711
|
if (this.isCrypto || this.id === 'wsteth') {
|
|
711
|
-
|
|
712
|
+
if (curve.isLiteChain) {
|
|
713
|
+
const prices = this.id.includes('twocrypto')
|
|
714
|
+
? [
|
|
715
|
+
1,
|
|
716
|
+
Number(yield curve.contracts[this.address].contract.price_oracle()) / (Math.pow(10, 18)),
|
|
717
|
+
]
|
|
718
|
+
: [
|
|
719
|
+
1,
|
|
720
|
+
...(yield curve.multicallProvider.all([
|
|
721
|
+
multicallContract.price_oracle(0),
|
|
722
|
+
multicallContract.price_oracle(1),
|
|
723
|
+
])).map((value) => Number(value) / (Math.pow(10, 18))),
|
|
724
|
+
];
|
|
725
|
+
pricesBN = prices.map(BN);
|
|
726
|
+
}
|
|
727
|
+
else {
|
|
728
|
+
pricesBN = (yield this._underlyingPrices()).map(BN);
|
|
729
|
+
}
|
|
712
730
|
}
|
|
713
731
|
else {
|
|
714
732
|
pricesBN = yield this._storedRatesBN(true);
|
|
@@ -1321,8 +1339,26 @@ export class PoolTemplate extends CorePool {
|
|
|
1321
1339
|
withdrawImbalanceBonus(amounts) {
|
|
1322
1340
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1323
1341
|
let pricesBN = [];
|
|
1342
|
+
const multicallContract = curve.contracts[this.address].multicallContract;
|
|
1324
1343
|
if (this.isCrypto || this.id === 'wsteth') {
|
|
1325
|
-
|
|
1344
|
+
if (curve.isLiteChain) {
|
|
1345
|
+
const prices = this.id.includes('twocrypto')
|
|
1346
|
+
? [
|
|
1347
|
+
1,
|
|
1348
|
+
Number(yield curve.contracts[this.address].contract.price_oracle()) / (Math.pow(10, 18)),
|
|
1349
|
+
]
|
|
1350
|
+
: [
|
|
1351
|
+
1,
|
|
1352
|
+
...(yield curve.multicallProvider.all([
|
|
1353
|
+
multicallContract.price_oracle(0),
|
|
1354
|
+
multicallContract.price_oracle(1),
|
|
1355
|
+
])).map((value) => Number(value) / (Math.pow(10, 18))),
|
|
1356
|
+
];
|
|
1357
|
+
pricesBN = prices.map(BN);
|
|
1358
|
+
}
|
|
1359
|
+
else {
|
|
1360
|
+
pricesBN = (yield this._underlyingPrices()).map(BN);
|
|
1361
|
+
}
|
|
1326
1362
|
}
|
|
1327
1363
|
else {
|
|
1328
1364
|
pricesBN = yield this._storedRatesBN(true);
|
|
@@ -1430,8 +1466,26 @@ export class PoolTemplate extends CorePool {
|
|
|
1430
1466
|
withdrawOneCoinBonus(lpTokenAmount, coin) {
|
|
1431
1467
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1432
1468
|
let pricesBN = [];
|
|
1469
|
+
const multicallContract = curve.contracts[this.address].multicallContract;
|
|
1433
1470
|
if (this.isCrypto || this.id === 'wsteth') {
|
|
1434
|
-
|
|
1471
|
+
if (curve.isLiteChain) {
|
|
1472
|
+
const prices = this.id.includes('twocrypto')
|
|
1473
|
+
? [
|
|
1474
|
+
1,
|
|
1475
|
+
Number(yield curve.contracts[this.address].contract.price_oracle()) / (Math.pow(10, 18)),
|
|
1476
|
+
]
|
|
1477
|
+
: [
|
|
1478
|
+
1,
|
|
1479
|
+
...(yield curve.multicallProvider.all([
|
|
1480
|
+
multicallContract.price_oracle(0),
|
|
1481
|
+
multicallContract.price_oracle(1),
|
|
1482
|
+
])).map((value) => Number(value) / (Math.pow(10, 18))),
|
|
1483
|
+
];
|
|
1484
|
+
pricesBN = prices.map(BN);
|
|
1485
|
+
}
|
|
1486
|
+
else {
|
|
1487
|
+
pricesBN = (yield this._underlyingPrices()).map(BN);
|
|
1488
|
+
}
|
|
1435
1489
|
}
|
|
1436
1490
|
else {
|
|
1437
1491
|
pricesBN = yield this._storedRatesBN(true);
|