@curvefi/api 2.52.4 → 2.52.5
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/README.md +61 -0
- package/lib/curve.js +1 -1
- package/lib/index.d.ts +6 -0
- package/lib/index.js +12 -0
- package/lib/pools/PoolTemplate.js +19 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1646,6 +1646,36 @@ import curve from "@curvefi/api";
|
|
|
1646
1646
|
|
|
1647
1647
|
const poolAddress = await curve.stableNgFactory.getDeployedPlainPoolAddress(deployPoolTx);
|
|
1648
1648
|
// 0x0816bc9ced716008c88bb8940c297e9c9167755e
|
|
1649
|
+
|
|
1650
|
+
// Deploy gauge
|
|
1651
|
+
|
|
1652
|
+
const deployGaugeTx = await curve.stableNgFactory.deployGauge(poolAddress);
|
|
1653
|
+
// {
|
|
1654
|
+
// hash: '0x8bb0eb63430e6c522c30922a833fee263816ebc0f30367d53ecfe52e17b7c3a0',
|
|
1655
|
+
// type: 0,
|
|
1656
|
+
// accessList: null,
|
|
1657
|
+
// ...
|
|
1658
|
+
// }
|
|
1659
|
+
const gaugeAddress = await curve.stableNgFactory.getDeployedGaugeAddress(deployGaugeTx);
|
|
1660
|
+
// 0x1400e08f1d9f5bc90ae19acd4bf81beabc9e79de
|
|
1661
|
+
|
|
1662
|
+
//For sidechain
|
|
1663
|
+
const salt = '15'
|
|
1664
|
+
//salt - unical random string
|
|
1665
|
+
const deployGaugeSidechain = await curve.stableNgFactory.deployGaugeSidechain(poolAddress, salt);
|
|
1666
|
+
// ContractTransactionResponse {
|
|
1667
|
+
// provider: JsonRpcProvider {},
|
|
1668
|
+
// blockNumber: 17393463,
|
|
1669
|
+
// blockHash: '0x7f393493d7eb30b39aeef3118b51925426946eb83b72b18946f0da8c7bec40a0',
|
|
1670
|
+
// ...
|
|
1671
|
+
// }
|
|
1672
|
+
const gaugeSidechainAddress = await curve.stableNgFactory.getDeployedGaugeAddress(deployGaugeSidechain);
|
|
1673
|
+
// 0x60d3d7ebbc44dc810a743703184f062d00e6db7e
|
|
1674
|
+
//After that should be deployed mirror gauge on mainnet with same salt
|
|
1675
|
+
//const gaugeMirrorTx = await curve.stableNgFactory.deployGaugeMirror(sidechainId, salt);
|
|
1676
|
+
//const deployedGaugeMirrorAddress = await curve.stableNgFactory.getDeployedGaugeMirrorAddressByTx(gaugeMirrorTx);
|
|
1677
|
+
//OR
|
|
1678
|
+
//const deployedGaugeMirrorAddress = await curve.stableNgFactory.getDeployedGaugeMirrorAddress(sidechainId);
|
|
1649
1679
|
})()
|
|
1650
1680
|
```
|
|
1651
1681
|
|
|
@@ -1746,6 +1776,37 @@ import curve from "@curvefi/api";
|
|
|
1746
1776
|
// }
|
|
1747
1777
|
const poolAddress = await curve.factory.getDeployedMetaPoolAddress(deployPoolTx);
|
|
1748
1778
|
// 0xd3797c5da2cf2db453b995fb8f7a9199f4106ad9
|
|
1779
|
+
|
|
1780
|
+
// Deploy gauge
|
|
1781
|
+
|
|
1782
|
+
const deployGaugeTx = await curve.stableNgFactory.deployGauge(poolAddress);
|
|
1783
|
+
// {
|
|
1784
|
+
// hash: '0x37a53a08d6c71095de8c25bcd4a01b39beec35990f77c7b98355bd064511541f',
|
|
1785
|
+
// type: 0,
|
|
1786
|
+
// accessList: null,
|
|
1787
|
+
// ...
|
|
1788
|
+
// }
|
|
1789
|
+
|
|
1790
|
+
const gaugeAddress = await curve.stableNgFactory.getDeployedGaugeAddress(deployGaugeTx);
|
|
1791
|
+
// 0x326290a1b0004eee78fa6ed4f1d8f4b2523ab669
|
|
1792
|
+
|
|
1793
|
+
//For sidechain
|
|
1794
|
+
const salt = '15'
|
|
1795
|
+
//salt - unical random string
|
|
1796
|
+
const deployGaugeSidechain = await curve.stableNgFactory.deployGaugeSidechain(poolAddress, salt);
|
|
1797
|
+
// ContractTransactionResponse {
|
|
1798
|
+
// provider: JsonRpcProvider {},
|
|
1799
|
+
// blockNumber: 17393463,
|
|
1800
|
+
// blockHash: '0x7f393493d7eb30b39aeef3118b51925426946eb83b72b18946f0da8c7bec40a0',
|
|
1801
|
+
// ...
|
|
1802
|
+
// }
|
|
1803
|
+
const gaugeSidechainAddress = await curve.stableNgFactory.getDeployedGaugeAddress(deployGaugeSidechain);
|
|
1804
|
+
// 0x60d3d7ebbc44dc810a743703184f062d00e6db7e
|
|
1805
|
+
//After that should be deployed mirror gauge on mainnet with same salt
|
|
1806
|
+
//const gaugeMirrorTx = await curve.stableNgFactory.deployGaugeMirror(sidechainId, salt);
|
|
1807
|
+
//const deployedGaugeMirrorAddress = await curve.stableNgFactory.getDeployedGaugeMirrorAddressByTx(gaugeMirrorTx);
|
|
1808
|
+
//OR
|
|
1809
|
+
//const deployedGaugeMirrorAddress = await curve.stableNgFactory.getDeployedGaugeMirrorAddress(sidechainId);
|
|
1749
1810
|
```
|
|
1750
1811
|
|
|
1751
1812
|
### Deploy crypto pool
|
package/lib/curve.js
CHANGED
|
@@ -581,7 +581,7 @@ var Curve = /** @class */ (function () {
|
|
|
581
581
|
return __generator(this, function (_f) {
|
|
582
582
|
switch (_f.label) {
|
|
583
583
|
case 0:
|
|
584
|
-
if (
|
|
584
|
+
if (this.chainId === 1313161554)
|
|
585
585
|
return [2 /*return*/];
|
|
586
586
|
if (!useApi) return [3 /*break*/, 2];
|
|
587
587
|
_a = this.constants;
|
package/lib/index.d.ts
CHANGED
|
@@ -99,8 +99,14 @@ declare const curve: {
|
|
|
99
99
|
getPoolList: () => string[];
|
|
100
100
|
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, offpegFeeMultiplier: string | number, assetTypes: (0 | 1 | 2 | 3)[], implementationIdx: 0, emaTime: number, oracleAddresses: string[], methodNames: string[]) => Promise<ethers.ContractTransactionResponse>;
|
|
101
101
|
deployMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: string | number, fee: string | number, offpegFeeMultiplier: string | number, emaTime: number, implementationIdx: 0, assetType: 0 | 1 | 2 | 3, methodName: string, oracleAddress: string) => Promise<ethers.ContractTransactionResponse>;
|
|
102
|
+
deployGauge: (poolAddress: string) => Promise<ethers.ContractTransactionResponse>;
|
|
103
|
+
deployGaugeSidechain: (poolAddress: string, salt: string) => Promise<ethers.ContractTransactionResponse>;
|
|
104
|
+
deployGaugeMirror: (chainId: number, salt: string) => Promise<ethers.ContractTransactionResponse>;
|
|
102
105
|
getDeployedPlainPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
103
106
|
getDeployedMetaPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
107
|
+
getDeployedGaugeAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
108
|
+
getDeployedGaugeMirrorAddress: (chainId: number) => Promise<string>;
|
|
109
|
+
getDeployedGaugeMirrorAddressByTx: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
104
110
|
fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
|
|
105
111
|
estimateGas: {
|
|
106
112
|
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, offpegFeeMultiplier: string | number, assetTypes: (0 | 1 | 2 | 3)[], implementationIdx: 0, emaTime: number, oracleAddresses: string[], methodNames: string[]) => Promise<number>;
|
package/lib/index.js
CHANGED
|
@@ -139,8 +139,20 @@ var curve = {
|
|
|
139
139
|
getPoolList: _curve.getStableNgFactoryPoolList,
|
|
140
140
|
deployPlainPool: deployStableNgPlainPool,
|
|
141
141
|
deployMetaPool: deployStableNgMetaPool,
|
|
142
|
+
deployGauge: function (poolAddress) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
143
|
+
return [2 /*return*/, deployGauge(poolAddress, _curve.constants.ALIASES.stable_ng_factory)];
|
|
144
|
+
}); }); },
|
|
145
|
+
deployGaugeSidechain: function (poolAddress, salt) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
146
|
+
return [2 /*return*/, deployGaugeSidechain(poolAddress, salt)];
|
|
147
|
+
}); }); },
|
|
148
|
+
deployGaugeMirror: function (chainId, salt) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
149
|
+
return [2 /*return*/, deployGaugeMirror(chainId, salt)];
|
|
150
|
+
}); }); },
|
|
142
151
|
getDeployedPlainPoolAddress: getDeployedStablePlainPoolAddress,
|
|
143
152
|
getDeployedMetaPoolAddress: getDeployedStableMetaPoolAddress,
|
|
153
|
+
getDeployedGaugeAddress: getDeployedGaugeAddress,
|
|
154
|
+
getDeployedGaugeMirrorAddress: getDeployedGaugeMirrorAddress,
|
|
155
|
+
getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx,
|
|
144
156
|
fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedStableNgFactoryPool,
|
|
145
157
|
estimateGas: {
|
|
146
158
|
deployPlainPool: deployStableNgPlainPoolEstimateGas,
|
|
@@ -1403,27 +1403,34 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1403
1403
|
};
|
|
1404
1404
|
PoolTemplate.prototype.depositBonus = function (amounts) {
|
|
1405
1405
|
return __awaiter(this, void 0, void 0, function () {
|
|
1406
|
-
var amountsBN, prices, pricesBN, balancesBN, balancedAmounts, expectedBN,
|
|
1407
|
-
return __generator(this, function (
|
|
1408
|
-
switch (
|
|
1406
|
+
var amountsBN, prices, _c, pricesBN, balancesBN, balancedAmounts, expectedBN, _d, balancedExpectedBN, _e;
|
|
1407
|
+
return __generator(this, function (_f) {
|
|
1408
|
+
switch (_f.label) {
|
|
1409
1409
|
case 0:
|
|
1410
1410
|
amountsBN = amounts.map(BN);
|
|
1411
|
+
if (!(this.isCrypto || this.id === 'wsteth' || this.id === 'factory-crvusd-24')) return [3 /*break*/, 2];
|
|
1411
1412
|
return [4 /*yield*/, this._underlyingPrices()];
|
|
1412
1413
|
case 1:
|
|
1413
|
-
|
|
1414
|
+
_c = _f.sent();
|
|
1415
|
+
return [3 /*break*/, 3];
|
|
1416
|
+
case 2:
|
|
1417
|
+
_c = this.underlyingCoins.map(function () { return 1; });
|
|
1418
|
+
_f.label = 3;
|
|
1419
|
+
case 3:
|
|
1420
|
+
prices = _c;
|
|
1414
1421
|
pricesBN = prices.map(BN);
|
|
1415
1422
|
return [4 /*yield*/, this.stats.underlyingBalances()];
|
|
1416
|
-
case
|
|
1417
|
-
balancesBN = (
|
|
1423
|
+
case 4:
|
|
1424
|
+
balancesBN = (_f.sent()).map(BN);
|
|
1418
1425
|
balancedAmounts = this._balancedAmountsWithSameValue(amountsBN, pricesBN, balancesBN);
|
|
1419
|
-
_c = BN;
|
|
1420
|
-
return [4 /*yield*/, this.depositExpected(amounts)];
|
|
1421
|
-
case 3:
|
|
1422
|
-
expectedBN = _c.apply(void 0, [_e.sent()]);
|
|
1423
1426
|
_d = BN;
|
|
1427
|
+
return [4 /*yield*/, this.depositExpected(amounts)];
|
|
1428
|
+
case 5:
|
|
1429
|
+
expectedBN = _d.apply(void 0, [_f.sent()]);
|
|
1430
|
+
_e = BN;
|
|
1424
1431
|
return [4 /*yield*/, this.depositExpected(balancedAmounts)];
|
|
1425
|
-
case
|
|
1426
|
-
balancedExpectedBN =
|
|
1432
|
+
case 6:
|
|
1433
|
+
balancedExpectedBN = _e.apply(void 0, [_f.sent()]);
|
|
1427
1434
|
return [2 /*return*/, String(expectedBN.minus(balancedExpectedBN).div(balancedExpectedBN).times(100))];
|
|
1428
1435
|
}
|
|
1429
1436
|
});
|