@curvefi/api 2.51.3 → 2.52.1

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 CHANGED
@@ -1590,6 +1590,65 @@ import curve from "@curvefi/api";
1590
1590
  })()
1591
1591
  ```
1592
1592
 
1593
+ ### Deploy stable-ng plain pool
1594
+
1595
+ ```ts
1596
+ import curve from "@curvefi/api";
1597
+
1598
+ (async () => {
1599
+ await curve.init('JsonRpc', {}, { gasPrice: 0 });
1600
+
1601
+ const coins = [
1602
+ "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", // stETH
1603
+ "0xac3e018457b222d93114458476f3e3416abbe38f", // sfrxETH
1604
+ ];
1605
+
1606
+ //0 = Standard, 1 = Oracle, 2 = Rebasing, 3 = ERC4626
1607
+ const assetTypes = [2, 1] as Array<0 | 1 | 2 | 3>;
1608
+
1609
+ const oracleAddresses = [
1610
+ '0x0000000000000000000000000000000000000000',
1611
+ '0xac3e018457b222d93114458476f3e3416abbe38f',
1612
+ ];
1613
+
1614
+ const methodNames = [
1615
+ '',
1616
+ 'pricePerShare',
1617
+ ];
1618
+ // OR
1619
+ //const methodNames = [
1620
+ // '0x00000000',
1621
+ // 'pricePerShare',
1622
+ //];
1623
+
1624
+
1625
+ // Deploy pool
1626
+
1627
+ const deployPoolTx = await curve.stableNgFactory.deployPlainPool('Test pool', 'test', coins, 5, 0.05, 5, assetTypes, 0, 600, oracleAddresses, methodNames);
1628
+ // {
1629
+ // accessList:null
1630
+ // blockHash: "0x981c86a28d1e4a675dae3e14868d62683c02c7906082ba78f5304a45cfd55c38"
1631
+ // blockNumber: 18628729
1632
+ // chainId: 1n
1633
+ // data: "0x5bcd3d83000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000004c4b40000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000002580000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000095465737420706f6f6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000474657374000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84000000000000000000000000ac3e018457b222d93114458476f3e3416abbe38f00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d8a452bc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ac3e018457b222d93114458476f3e3416abbe38f"
1634
+ // from: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
1635
+ // gasLimit: 7046085n
1636
+ // gasPrice: 0n
1637
+ // hash: "0xcbd866d6c4c6294b33d5797bdbf5666aad99a4f7fd461f472aeb95121929242b"
1638
+ // index: undefined
1639
+ // maxFeePerGas: null
1640
+ // maxPriorityFeePerGas: null
1641
+ // nonce: 565
1642
+ // to: "0x6A8cbed756804B16E05E741eDaBd5cB544AE21bf"
1643
+ // type: 0
1644
+ // value: 0n
1645
+ // }
1646
+
1647
+ const poolAddress = await curve.stableNgFactory.getDeployedPlainPoolAddress(deployPoolTx);
1648
+ // 0x0816bc9ced716008c88bb8940c297e9c9167755e
1649
+ })()
1650
+ ```
1651
+
1593
1652
  ### Deploy stable meta pool
1594
1653
 
1595
1654
  ```ts
@@ -1650,6 +1709,45 @@ import curve from "@curvefi/api";
1650
1709
  })()
1651
1710
  ```
1652
1711
 
1712
+ ### Deploy stable-ng meta pool
1713
+
1714
+ ```ts
1715
+ import curve from "@curvefi/api";
1716
+
1717
+ (async () => {
1718
+ await curve.init('JsonRpc', {}, { gasPrice: 0 });
1719
+
1720
+ const basePool = "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7"; // 3pool address
1721
+ const coin = "0xac3e018457b222d93114458476f3e3416abbe38f"; // sfrxETH
1722
+ const oracleAddress = '0xac3e018457b222d93114458476f3e3416abbe38f';
1723
+ const methodName = 'pricePerShare';
1724
+
1725
+ // Deploy pool
1726
+
1727
+ const deployPoolTx = curve.stableNgFactory.deployMetaPool(basePool, 'Test pool', 'test', coin, 5, 0.05, 5, 600, 1, 0, methodName, oracleAddress);
1728
+ // OR const deployPoolTx = curve.stableNgFactory.deployMetaPool(basePool, 'Test pool', 'test',coin, 5, 0.05, 5, 600, 1);
1729
+ // {
1730
+ // accessList: null
1731
+ // blockHash: "0xff6f39ee2dae6940d8a061925bd67d9e1e85947f85a7d65c1eef81abdbba023d"
1732
+ // blockNumber: 18628730
1733
+ // chainId: 1n
1734
+ // data: "0xdf8c5d73000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c7000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000ac3e018457b222d93114458476f3e3416abbe38f000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000004c4b400000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000025800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d8a452bc00000000000000000000000000000000000000000000000000000000000000000000000000000000ac3e018457b222d93114458476f3e3416abbe38f00000000000000000000000000000000000000000000000000000000000000095465737420706f6f6c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000047465737400000000000000000000000000000000000000000000000000000000"
1735
+ // from: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
1736
+ // gasLimit: 7215295n
1737
+ // gasPrice: 0n
1738
+ // hash: "0xdada197e9264ea5697216e68eaae8304f45d490a10e230023bbb32568df622f5"
1739
+ // index: undefined
1740
+ // maxFeePerGas: null
1741
+ // maxPriorityFeePerGas: null
1742
+ // nonce: 566
1743
+ // to: "0x6A8cbed756804B16E05E741eDaBd5cB544AE21bf"
1744
+ // type: 0
1745
+ // value: 0n
1746
+ // }
1747
+ const poolAddress = await curve.factory.getDeployedMetaPoolAddress(deployPoolTx);
1748
+ // 0xd3797c5da2cf2db453b995fb8f7a9199f4106ad9
1749
+ ```
1750
+
1653
1751
  ### Deploy crypto pool
1654
1752
 
1655
1753
  ```ts
package/lib/curve.d.ts CHANGED
@@ -86,9 +86,11 @@ declare class Curve implements ICurve {
86
86
  fetchTricryptoFactoryPools: (useApi?: boolean) => Promise<void>;
87
87
  fetchStableNgFactoryPools: (useApi?: boolean) => Promise<void>;
88
88
  fetchNewFactoryPools: () => Promise<string[]>;
89
+ fetchNewStableNgFactoryPools: () => Promise<string[]>;
89
90
  fetchNewCryptoFactoryPools: () => Promise<string[]>;
90
91
  fetchNewTricryptoFactoryPools: () => Promise<string[]>;
91
92
  fetchRecentlyDeployedFactoryPool: (poolAddress: string) => Promise<string>;
93
+ fetchRecentlyDeployedStableNgFactoryPool: (poolAddress: string) => Promise<string>;
92
94
  fetchRecentlyDeployedCryptoFactoryPool: (poolAddress: string) => Promise<string>;
93
95
  fetchRecentlyDeployedTricryptoFactoryPool: (poolAddress: string) => Promise<string>;
94
96
  getMainPoolList: () => string[];
package/lib/curve.js CHANGED
@@ -630,6 +630,23 @@ var Curve = /** @class */ (function () {
630
630
  }
631
631
  });
632
632
  }); };
633
+ this.fetchNewStableNgFactoryPools = function () { return __awaiter(_this, void 0, void 0, function () {
634
+ var currentPoolIds, lastPoolIdx, poolData, _a;
635
+ return __generator(this, function (_b) {
636
+ switch (_b.label) {
637
+ case 0:
638
+ currentPoolIds = Object.keys(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
639
+ lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
640
+ _a = lowerCasePoolDataAddresses;
641
+ return [4 /*yield*/, getFactoryPoolData.call(this, lastPoolIdx + 1)];
642
+ case 1:
643
+ poolData = _a.apply(void 0, [_b.sent()]);
644
+ this.constants.STABLE_NG_FACTORY_POOLS_DATA = __assign(__assign({}, this.constants.FACTORY_POOLS_DATA), poolData);
645
+ this._updateDecimalsAndGauges(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
646
+ return [2 /*return*/, Object.keys(poolData)];
647
+ }
648
+ });
649
+ }); };
633
650
  this.fetchNewCryptoFactoryPools = function () { return __awaiter(_this, void 0, void 0, function () {
634
651
  var currentPoolIds, lastPoolIdx, poolData, _a;
635
652
  return __generator(this, function (_b) {
@@ -685,6 +702,23 @@ var Curve = /** @class */ (function () {
685
702
  }
686
703
  });
687
704
  }); };
705
+ this.fetchRecentlyDeployedStableNgFactoryPool = function (poolAddress) { return __awaiter(_this, void 0, void 0, function () {
706
+ var poolData, _a;
707
+ return __generator(this, function (_b) {
708
+ switch (_b.label) {
709
+ case 0:
710
+ if (this.chainId === 1313161554)
711
+ return [2 /*return*/, ''];
712
+ _a = lowerCasePoolDataAddresses;
713
+ return [4 /*yield*/, getFactoryPoolData.call(this, 0, poolAddress, this.constants.ALIASES.stable_ng_factory)];
714
+ case 1:
715
+ poolData = _a.apply(void 0, [_b.sent()]);
716
+ this.constants.STABLE_NG_FACTORY_POOLS_DATA = __assign(__assign({}, this.constants.STABLE_NG_FACTORY_POOLS_DATA), poolData);
717
+ this._updateDecimalsAndGauges(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
718
+ return [2 /*return*/, Object.keys(poolData)[0]]; // id
719
+ }
720
+ });
721
+ }); };
688
722
  this.fetchRecentlyDeployedCryptoFactoryPool = function (poolAddress) { return __awaiter(_this, void 0, void 0, function () {
689
723
  var poolData, _a;
690
724
  return __generator(this, function (_b) {
@@ -1,12 +1,16 @@
1
1
  import { ethers } from "ethers";
2
2
  export declare const deployStablePlainPoolEstimateGas: (name: string, symbol: string, coins: string[], A: number | string, fee: number | string, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3 | 4 | 5, emaTime?: number, oracleAddress?: string, methodName?: string) => Promise<number>;
3
3
  export declare const deployStablePlainPool: (name: string, symbol: string, coins: string[], A: number | string, fee: number | string, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3 | 4 | 5, emaTime?: number, oracleAddress?: string, methodName?: string) => Promise<ethers.ContractTransactionResponse>;
4
+ export declare const deployStableNgPlainPoolEstimateGas: (name: string, symbol: string, coins: string[], A: number | string, fee: number | string, offpegFeeMultiplier: number | string, assetTypes: Array<0 | 1 | 2 | 3>, implementationIdx: 0, emaTime: number, oracleAddresses: string[], methodNames: string[]) => Promise<number>;
5
+ export declare const deployStableNgPlainPool: (name: string, symbol: string, coins: string[], A: number | string, fee: number | string, offpegFeeMultiplier: number | string, assetTypes: Array<0 | 1 | 2 | 3>, implementationIdx: 0, emaTime: number, oracleAddresses: string[], methodNames: string[]) => Promise<ethers.ContractTransactionResponse>;
4
6
  export declare const getDeployedStablePlainPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
5
7
  export declare const _setOracle: (poolAddress: string, oracleAddress: string, methodName: string, estimateGas: boolean) => Promise<ethers.ContractTransactionResponse | number>;
6
8
  export declare const setOracleEstimateGas: (poolAddress: string, oracleAddress?: string, methodName?: string) => Promise<number>;
7
9
  export declare const setOracle: (poolAddress: string, oracleAddress?: string, methodName?: string) => Promise<ethers.ContractTransactionResponse>;
8
10
  export declare const deployStableMetaPoolEstimateGas: (basePool: string, name: string, symbol: string, coin: string, A: number | string, fee: number | string, implementationIdx: 0 | 1) => Promise<number>;
9
11
  export declare const deployStableMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: number | string, fee: number | string, implementationIdx: 0 | 1) => Promise<ethers.ContractTransactionResponse>;
12
+ export declare const deployStableNgMetaPoolEstimateGas: (basePool: string, name: string, symbol: string, coin: string, A: number | string, fee: number | string, offpegFeeMultiplier: number | string, assetType: 0 | 1 | 2 | 3, emaTime: number, implementationIdx: 0, methodName: string, oracleAddress: string) => Promise<number>;
13
+ export declare const deployStableNgMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: number | string, fee: number | string, offpegFeeMultiplier: number | string, emaTime: number, implementationIdx: 0, assetType: 0 | 1 | 2 | 3, methodName: string, oracleAddress: string) => Promise<ethers.ContractTransactionResponse>;
10
14
  export declare const getDeployedStableMetaPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
11
15
  export declare const deployCryptoPoolEstimateGas: (name: string, symbol: string, coins: string[], A: number | string, gamma: number | string, midFee: number | string, outFee: number | string, allowedExtraProfit: number | string, feeGamma: number | string, adjustmentStep: number | string, maHalfTime: number, initialPrice: number | string) => Promise<number>;
12
16
  export declare const deployCryptoPool: (name: string, symbol: string, coins: string[], A: number | string, gamma: number | string, midFee: number | string, outFee: number | string, allowedExtraProfit: number | string, feeGamma: number | string, adjustmentStep: number | string, maHalfTime: number, initialPrice: number | string) => Promise<ethers.ContractTransactionResponse>;
@@ -155,6 +155,106 @@ oracleAddress, methodName) {
155
155
  });
156
156
  });
157
157
  };
158
+ var _deployStableNgPlainPool = function (name, symbol, coins, A, fee, // %
159
+ offpegFeeMultiplier, assetTypes, // 0 = Standard, 1 = Oracle, 2 = Rebasing, 3 = ERC4626
160
+ implementationIdx, emaTime, // seconds
161
+ oracleAddresses, methodNames, estimateGas) {
162
+ if (emaTime === void 0) { emaTime = 600; }
163
+ return __awaiter(void 0, void 0, void 0, function () {
164
+ var _oracleAddresses, _methodNames, _A, _fee, _coins, contractAddress, contract, methodIds, args, gas, gasLimit;
165
+ var _a;
166
+ return __generator(this, function (_b) {
167
+ switch (_b.label) {
168
+ case 0:
169
+ if (name.length > 32)
170
+ throw Error("Max name length = 32");
171
+ if (symbol.length > 10)
172
+ throw Error("Max symbol length = 10");
173
+ if (coins.length < 1)
174
+ throw Error("Invalid number of coins. Must be more than 1");
175
+ if (coins.length > 9)
176
+ throw Error("Invalid number of coins. Must be less than 9");
177
+ if (BN(fee).gt(1))
178
+ throw Error("fee must be <= 1%. Passed fee = ".concat(fee));
179
+ if (oracleAddresses.length === 0) {
180
+ _oracleAddresses = new Array(coins.length).fill(curve.constants.ZERO_ADDRESS);
181
+ }
182
+ else {
183
+ _oracleAddresses = oracleAddresses;
184
+ }
185
+ if (methodNames.length === 0) {
186
+ _methodNames = new Array(coins.length).fill("0x00000000");
187
+ }
188
+ else {
189
+ _methodNames = methodNames;
190
+ }
191
+ if (coins.length !== assetTypes.length)
192
+ throw Error("Invalid length of assetTypes. Must be same coins length");
193
+ if (coins.length !== _oracleAddresses.length)
194
+ throw Error("Invalid length of oracleAddresses. Must be same coins length");
195
+ if (coins.length !== _methodNames.length)
196
+ throw Error("Invalid length of methodNames. Must be same coins length");
197
+ assetTypes.forEach(function (item, index) {
198
+ if (![0, 1, 2, 3].includes(item))
199
+ throw Error("Invalid assetType. Must be one of: 0 = Standard, 1 = Oracle, 2 = Rebasing, 3 = ERC4626 for assetTypes[".concat(index, "]"));
200
+ });
201
+ if (![0].includes(implementationIdx))
202
+ throw Error("Invalid implementationIdx. Must be 0");
203
+ if (emaTime <= 0)
204
+ throw Error("emaTime must be > 0. Passed emaTime = ".concat(emaTime));
205
+ _A = parseUnits(A, 0);
206
+ _fee = parseUnits(fee, 8);
207
+ _coins = coins;
208
+ contractAddress = curve.constants.ALIASES.stable_ng_factory;
209
+ contract = curve.contracts[contractAddress].contract;
210
+ methodIds = [];
211
+ _methodNames.forEach(function (item) {
212
+ if (item === '0x00000000' || item === '') {
213
+ methodIds.push('0x00000000');
214
+ }
215
+ else {
216
+ methodIds.push(ethers.id(item).substring(0, 10));
217
+ }
218
+ });
219
+ args = [name, symbol, _coins, _A, _fee, offpegFeeMultiplier, emaTime, implementationIdx, assetTypes, methodIds, _oracleAddresses];
220
+ console.log(args);
221
+ return [4 /*yield*/, (_a = contract.deploy_plain_pool).estimateGas.apply(_a, __spreadArray(__spreadArray([], args, false), [curve.constantOptions], false))];
222
+ case 1:
223
+ gas = _b.sent();
224
+ if (estimateGas)
225
+ return [2 /*return*/, smartNumber(gas)];
226
+ gasLimit = mulBy1_3(DIGas(gas));
227
+ return [4 /*yield*/, curve.updateFeeData()];
228
+ case 2:
229
+ _b.sent();
230
+ return [4 /*yield*/, contract.deploy_plain_pool.apply(contract, __spreadArray(__spreadArray([], args, false), [__assign(__assign({}, curve.options), { gasLimit: gasLimit })], false))];
231
+ case 3: return [2 /*return*/, _b.sent()];
232
+ }
233
+ });
234
+ });
235
+ };
236
+ export var deployStableNgPlainPoolEstimateGas = function (name, symbol, coins, A, fee, // %
237
+ offpegFeeMultiplier, assetTypes, // 0 = Standard, 1 = Oracle, 2 = Rebasing, 3 = ERC4626
238
+ implementationIdx, emaTime, // seconds
239
+ oracleAddresses, methodNames) { return __awaiter(void 0, void 0, void 0, function () {
240
+ return __generator(this, function (_a) {
241
+ switch (_a.label) {
242
+ case 0: return [4 /*yield*/, _deployStableNgPlainPool(name, symbol, coins, A, fee, offpegFeeMultiplier, assetTypes, implementationIdx, emaTime, oracleAddresses, methodNames, true)];
243
+ case 1: return [2 /*return*/, _a.sent()];
244
+ }
245
+ });
246
+ }); };
247
+ export var deployStableNgPlainPool = function (name, symbol, coins, A, fee, // %
248
+ offpegFeeMultiplier, assetTypes, // 0 = Standard, 1 = Oracle, 2 = Rebasing, 3 = ERC4626
249
+ implementationIdx, emaTime, // seconds
250
+ oracleAddresses, methodNames) { return __awaiter(void 0, void 0, void 0, function () {
251
+ return __generator(this, function (_a) {
252
+ switch (_a.label) {
253
+ case 0: return [4 /*yield*/, _deployStableNgPlainPool(name, symbol, coins, A, fee, offpegFeeMultiplier, assetTypes, implementationIdx, emaTime, oracleAddresses, methodNames, false)];
254
+ case 1: return [2 /*return*/, _a.sent()];
255
+ }
256
+ });
257
+ }); };
158
258
  export var getDeployedStablePlainPoolAddress = function (tx) { return __awaiter(void 0, void 0, void 0, function () {
159
259
  var txInfo;
160
260
  return __generator(this, function (_a) {
@@ -266,6 +366,70 @@ implementationIdx) { return __awaiter(void 0, void 0, void 0, function () {
266
366
  }
267
367
  });
268
368
  }); };
369
+ var _deployStableNgMetaPool = function (basePool, name, symbol, coin, A, fee, // %
370
+ offpegFeeMultiplier, assetType, // 0 = Standard, 1 = Oracle, 2 = Rebasing, 3 = ERC4626
371
+ emaTime, // seconds
372
+ implementationIdx, methodName, oracleAddress, estimateGas) {
373
+ if (emaTime === void 0) { emaTime = 600; }
374
+ if (implementationIdx === void 0) { implementationIdx = 0; }
375
+ if (methodName === void 0) { methodName = "0x00000000"; }
376
+ if (oracleAddress === void 0) { oracleAddress = curve.constants.ZERO_ADDRESS; }
377
+ return __awaiter(void 0, void 0, void 0, function () {
378
+ var _A, _fee, methodId, contract, gas, gasLimit;
379
+ return __generator(this, function (_a) {
380
+ switch (_a.label) {
381
+ case 0:
382
+ if (name.length > 32)
383
+ throw Error("Max name length = 32");
384
+ if (symbol.length > 10)
385
+ throw Error("Max symbol length = 10");
386
+ if (BN(fee).lt(0.04))
387
+ throw Error("fee must be >= 0.04%. Passed fee = ".concat(fee));
388
+ if (BN(fee).gt(1))
389
+ throw Error("fee must be <= 1%. Passed fee = ".concat(fee));
390
+ if (![0, 1].includes(implementationIdx))
391
+ throw Error("Invalid implementationIdx. Must be one 0 or 1");
392
+ _A = parseUnits(A, 0);
393
+ _fee = parseUnits(fee, 8);
394
+ methodId = methodName === "0x00000000" ? "0x00000000" : ethers.id(methodName).substring(0, 10);
395
+ contract = curve.contracts[curve.constants.ALIASES.stable_ng_factory].contract;
396
+ return [4 /*yield*/, contract.deploy_metapool.estimateGas(basePool, name, symbol, coin, _A, _fee, offpegFeeMultiplier, emaTime, implementationIdx, assetType, methodId, oracleAddress, curve.constantOptions)];
397
+ case 1:
398
+ gas = _a.sent();
399
+ if (estimateGas)
400
+ return [2 /*return*/, smartNumber(gas)];
401
+ gasLimit = mulBy1_3(DIGas(gas));
402
+ return [4 /*yield*/, curve.updateFeeData()];
403
+ case 2:
404
+ _a.sent();
405
+ return [4 /*yield*/, contract.deploy_metapool(basePool, name, symbol, coin, _A, _fee, offpegFeeMultiplier, emaTime, implementationIdx, assetType, methodId, oracleAddress, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
406
+ case 3: return [2 /*return*/, _a.sent()];
407
+ }
408
+ });
409
+ });
410
+ };
411
+ export var deployStableNgMetaPoolEstimateGas = function (basePool, name, symbol, coin, A, fee, // %
412
+ offpegFeeMultiplier, assetType, // 0 = Standard, 1 = Oracle, 2 = Rebasing, 3 = ERC4626
413
+ emaTime, // seconds
414
+ implementationIdx, methodName, oracleAddress) { return __awaiter(void 0, void 0, void 0, function () {
415
+ return __generator(this, function (_a) {
416
+ switch (_a.label) {
417
+ case 0: return [4 /*yield*/, _deployStableNgMetaPool(basePool, name, symbol, coin, A, fee, offpegFeeMultiplier, assetType, emaTime, implementationIdx, methodName, oracleAddress, true)];
418
+ case 1: return [2 /*return*/, _a.sent()];
419
+ }
420
+ });
421
+ }); };
422
+ export var deployStableNgMetaPool = function (basePool, name, symbol, coin, A, fee, // %
423
+ offpegFeeMultiplier, emaTime, // seconds
424
+ implementationIdx, assetType, // 0 = Standard, 1 = Oracle, 2 = Rebasing, 3 = ERC4626
425
+ methodName, oracleAddress) { return __awaiter(void 0, void 0, void 0, function () {
426
+ return __generator(this, function (_a) {
427
+ switch (_a.label) {
428
+ case 0: return [4 /*yield*/, _deployStableNgMetaPool(basePool, name, symbol, coin, A, fee, offpegFeeMultiplier, assetType, emaTime, implementationIdx, methodName, oracleAddress, false)];
429
+ case 1: return [2 /*return*/, _a.sent()];
430
+ }
431
+ });
432
+ }); };
269
433
  export var getDeployedStableMetaPoolAddress = function (tx) { return __awaiter(void 0, void 0, void 0, function () {
270
434
  var txInfo, i, basePoolId, basePool;
271
435
  return __generator(this, function (_a) {
@@ -106,13 +106,14 @@ export function getBasePoolIds(factoryAddress, rawSwapAddresses, tmpPools) {
106
106
  });
107
107
  });
108
108
  }
109
- function getRecentlyCreatedPoolId(swapAddress) {
109
+ function getRecentlyCreatedPoolId(swapAddress, factoryAddress) {
110
110
  return __awaiter(this, void 0, void 0, function () {
111
- var factoryContract, poolCount, _a, _b, _c, i, address;
111
+ var factoryContract, prefix, poolCount, _a, _b, _c, i, address;
112
112
  return __generator(this, function (_e) {
113
113
  switch (_e.label) {
114
114
  case 0:
115
- factoryContract = this.contracts[this.constants.ALIASES.factory].contract;
115
+ factoryContract = this.contracts[factoryAddress].contract;
116
+ prefix = factoryAddress === this.constants.ALIASES.factory ? 'factory-v2' : 'factory-stable-ng';
116
117
  _a = Number;
117
118
  _c = (_b = curve).formatUnits;
118
119
  return [4 /*yield*/, factoryContract.pool_count(this.constantOptions)];
@@ -126,7 +127,7 @@ function getRecentlyCreatedPoolId(swapAddress) {
126
127
  case 3:
127
128
  address = _e.sent();
128
129
  if (address.toLowerCase() === swapAddress.toLowerCase())
129
- return [2 /*return*/, "factory-v2-".concat(poolCount - i)];
130
+ return [2 /*return*/, "".concat(prefix, "-").concat(poolCount - i)];
130
131
  _e.label = 4;
131
132
  case 4:
132
133
  i++;
@@ -335,7 +336,7 @@ export function getFactoryPoolData(fromIdx, swapAddress, factoryAddress) {
335
336
  switch (_f.label) {
336
337
  case 0:
337
338
  if (!swapAddress) return [3 /*break*/, 2];
338
- return [4 /*yield*/, getRecentlyCreatedPoolId.call(this, swapAddress)];
339
+ return [4 /*yield*/, getRecentlyCreatedPoolId.call(this, swapAddress, factoryAddress)];
339
340
  case 1:
340
341
  _b = [[_f.sent()], [swapAddress.toLowerCase()]];
341
342
  return [3 /*break*/, 4];
package/lib/index.d.ts CHANGED
@@ -95,7 +95,17 @@ declare const curve: {
95
95
  };
96
96
  stableNgFactory: {
97
97
  fetchPools: (useApi?: boolean) => Promise<void>;
98
+ fetchNewPools: () => Promise<string[]>;
98
99
  getPoolList: () => string[];
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
+ 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
+ getDeployedPlainPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
103
+ getDeployedMetaPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
104
+ fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
105
+ estimateGas: {
106
+ 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>;
107
+ deployMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: string | number, fee: string | number, offpegFeeMultiplier: string | number, assetType: 0 | 1 | 2 | 3, emaTime: number, implementationIdx: 0, methodName: string, oracleAddress: string) => Promise<number>;
108
+ };
99
109
  };
100
110
  cryptoFactory: {
101
111
  fetchPools: (useApi?: boolean) => Promise<void>;
package/lib/index.js CHANGED
@@ -40,7 +40,7 @@ import { getBestRouteAndOutput, getArgs, swapExpected, swapRequired, swapPriceIm
40
40
  import { curve as _curve } from "./curve.js";
41
41
  import { getCrv, getLockedAmountAndUnlockTime, getVeCrv, getVeCrvPct, calcUnlockTime, createLockEstimateGas, createLock, isApproved, approveEstimateGas, approve, increaseAmountEstimateGas, increaseAmount, increaseUnlockTimeEstimateGas, increaseUnlockTime, withdrawLockedCrvEstimateGas, withdrawLockedCrv, claimableFees, claimFeesEstimateGas, claimFees, lastEthBlock, getAnycallBalance, topUpAnycall, topUpAnycallEstimateGas, lastBlockSent, blockToSend, sendBlockhash, sendBlockhashEstimateGas, submitProof, submitProofEstimateGas, } from "./boosting.js";
42
42
  import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getGasPriceFromL1, getGasPriceFromL2, getTVL, getCoinsData, getVolume, hasDepositAndStake, hasRouter, } from "./utils.js";
43
- import { deployStablePlainPool, deployStablePlainPoolEstimateGas, getDeployedStablePlainPoolAddress, setOracle, setOracleEstimateGas, deployStableMetaPool, deployStableMetaPoolEstimateGas, getDeployedStableMetaPoolAddress, deployCryptoPool, deployCryptoPoolEstimateGas, getDeployedCryptoPoolAddress, deployTricryptoPool, deployTricryptoPoolEstimateGas, getDeployedTricryptoPoolAddress, deployGauge, deployGaugeEstimateGas, getDeployedGaugeAddress, deployGaugeSidechain, deployGaugeSidechainEstimateGas, deployGaugeMirror, deployGaugeMirrorEstimateGas, getDeployedGaugeMirrorAddress, getDeployedGaugeMirrorAddressByTx, } from './factory/deploy.js';
43
+ import { deployStablePlainPool, deployStablePlainPoolEstimateGas, getDeployedStablePlainPoolAddress, setOracle, setOracleEstimateGas, deployStableMetaPool, deployStableMetaPoolEstimateGas, getDeployedStableMetaPoolAddress, deployCryptoPool, deployCryptoPoolEstimateGas, getDeployedCryptoPoolAddress, deployTricryptoPool, deployTricryptoPoolEstimateGas, getDeployedTricryptoPoolAddress, deployGauge, deployGaugeEstimateGas, getDeployedGaugeAddress, deployGaugeSidechain, deployGaugeSidechainEstimateGas, deployGaugeMirror, deployGaugeMirrorEstimateGas, getDeployedGaugeMirrorAddress, getDeployedGaugeMirrorAddressByTx, deployStableNgPlainPool, deployStableNgPlainPoolEstimateGas, deployStableNgMetaPool, deployStableNgMetaPoolEstimateGas, } from './factory/deploy.js';
44
44
  function init(providerType, providerSettings, options) {
45
45
  if (options === void 0) { options = {}; }
46
46
  return __awaiter(this, void 0, void 0, function () {
@@ -135,7 +135,17 @@ var curve = {
135
135
  },
136
136
  stableNgFactory: {
137
137
  fetchPools: _curve.fetchStableNgFactoryPools,
138
+ fetchNewPools: _curve.fetchNewStableNgFactoryPools,
138
139
  getPoolList: _curve.getStableNgFactoryPoolList,
140
+ deployPlainPool: deployStableNgPlainPool,
141
+ deployMetaPool: deployStableNgMetaPool,
142
+ getDeployedPlainPoolAddress: getDeployedStablePlainPoolAddress,
143
+ getDeployedMetaPoolAddress: getDeployedStableMetaPoolAddress,
144
+ fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedStableNgFactoryPool,
145
+ estimateGas: {
146
+ deployPlainPool: deployStableNgPlainPoolEstimateGas,
147
+ deployMetaPool: deployStableNgMetaPoolEstimateGas,
148
+ },
139
149
  },
140
150
  cryptoFactory: {
141
151
  fetchPools: _curve.fetchCryptoFactoryPools,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.51.3",
3
+ "version": "2.52.1",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",