@curvefi/api 2.54.8 → 2.55.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.
@@ -0,0 +1,331 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
38
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
39
+ if (ar || !(i in from)) {
40
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
41
+ ar[i] = from[i];
42
+ }
43
+ }
44
+ return to.concat(ar || Array.prototype.slice.call(from));
45
+ };
46
+ import { curve } from "../curve.js";
47
+ import ERC20ABI from "../constants/abis/ERC20.json" assert { type: 'json' };
48
+ import twocryptoFactorySwapABI from "../constants/abis/factory-twocrypto/factory-twocrypto-pool.json" assert { type: 'json' };
49
+ import factoryGaugeABI from "../constants/abis/gauge_factory.json" assert { type: 'json' };
50
+ import gaugeChildABI from "../constants/abis/gauge_child.json" assert { type: 'json' };
51
+ var deepFlatten = function (arr) { return [].concat.apply([], arr.map(function (v) { return (Array.isArray(v) ? deepFlatten(v) : v); })); };
52
+ function getRecentlyCreatedCryptoPoolId(swapAddress) {
53
+ return __awaiter(this, void 0, void 0, function () {
54
+ var factoryContract, poolCount, _a, _b, _c, i, address;
55
+ return __generator(this, function (_e) {
56
+ switch (_e.label) {
57
+ case 0:
58
+ factoryContract = this.contracts[this.constants.ALIASES.twocrypto_factory].contract;
59
+ _a = Number;
60
+ _c = (_b = curve).formatUnits;
61
+ return [4 /*yield*/, factoryContract.pool_count(this.constantOptions)];
62
+ case 1:
63
+ poolCount = _a.apply(void 0, [_c.apply(_b, [_e.sent(), 0])]);
64
+ i = 1;
65
+ _e.label = 2;
66
+ case 2:
67
+ if (!(i <= poolCount)) return [3 /*break*/, 5];
68
+ return [4 /*yield*/, factoryContract.pool_list(poolCount - i)];
69
+ case 3:
70
+ address = _e.sent();
71
+ if (address.toLowerCase() === swapAddress.toLowerCase())
72
+ return [2 /*return*/, "factory-twocrypto-".concat(poolCount - i)];
73
+ _e.label = 4;
74
+ case 4:
75
+ i++;
76
+ return [3 /*break*/, 2];
77
+ case 5: throw Error("Unknown pool");
78
+ }
79
+ });
80
+ });
81
+ }
82
+ function getTwocryptoFactoryIdsAndSwapAddresses(fromIdx) {
83
+ if (fromIdx === void 0) { fromIdx = 0; }
84
+ return __awaiter(this, void 0, void 0, function () {
85
+ var factoryContract, factoryMulticallContract, poolCount, _a, _b, _c, calls, i, factories, swapAddresses;
86
+ return __generator(this, function (_e) {
87
+ switch (_e.label) {
88
+ case 0:
89
+ factoryContract = this.contracts[this.constants.ALIASES.twocrypto_factory].contract;
90
+ factoryMulticallContract = this.contracts[this.constants.ALIASES.twocrypto_factory].multicallContract;
91
+ _a = Number;
92
+ _c = (_b = curve).formatUnits;
93
+ return [4 /*yield*/, factoryContract.pool_count(this.constantOptions)];
94
+ case 1:
95
+ poolCount = _a.apply(void 0, [_c.apply(_b, [_e.sent(), 0])]);
96
+ calls = [];
97
+ for (i = fromIdx; i < poolCount; i++) {
98
+ calls.push(factoryMulticallContract.pool_list(i));
99
+ }
100
+ if (calls.length === 0)
101
+ return [2 /*return*/, [[], []]];
102
+ return [4 /*yield*/, this.multicallProvider.all(calls)];
103
+ case 2:
104
+ factories = (_e.sent()).map(function (addr, i) { return ({ id: "factory-twocrypto-".concat(fromIdx + i), address: addr.toLowerCase() }); });
105
+ swapAddresses = Object.values(this.constants.POOLS_DATA).map(function (pool) { return pool.swap_address.toLowerCase(); });
106
+ factories = factories.filter(function (f) { return !swapAddresses.includes(f.address); });
107
+ return [2 /*return*/, [factories.map(function (f) { return f.id; }), factories.map(function (f) { return f.address; })]];
108
+ }
109
+ });
110
+ });
111
+ }
112
+ function _handleCoinAddresses(coinAddresses) {
113
+ var _this = this;
114
+ return coinAddresses.map(function (addresses) { return addresses.map(function (addr) { return _this.chainId === 137 && addr === "0x0000000000000000000000000000000000001010" ? _this.constants.NATIVE_TOKEN.wrappedAddress : addr.toLowerCase(); }); });
115
+ }
116
+ function getPoolsData(factorySwapAddresses) {
117
+ return __awaiter(this, void 0, void 0, function () {
118
+ var factoryMulticallContract, calls, _i, factorySwapAddresses_1, addr, res, gaugeAddresses, coinAddresses, factoryMulticallContract, isFactoryGaugeNull, factoryMulticallGaugeContract, calls, _a, factorySwapAddresses_2, addr, res, gaugeAddresses, coinAddresses, coinAddresses, gaugeAddresses;
119
+ return __generator(this, function (_b) {
120
+ switch (_b.label) {
121
+ case 0:
122
+ if (!(this.chainId === 1)) return [3 /*break*/, 2];
123
+ factoryMulticallContract = this.contracts[this.constants.ALIASES.twocrypto_factory].multicallContract;
124
+ calls = [];
125
+ for (_i = 0, factorySwapAddresses_1 = factorySwapAddresses; _i < factorySwapAddresses_1.length; _i++) {
126
+ addr = factorySwapAddresses_1[_i];
127
+ calls.push(factoryMulticallContract.get_gauge(addr));
128
+ calls.push(factoryMulticallContract.get_coins(addr));
129
+ }
130
+ return [4 /*yield*/, this.multicallProvider.all(calls)];
131
+ case 1:
132
+ res = _b.sent();
133
+ gaugeAddresses = res.filter(function (a, i) { return i % 2 == 0; }).map(function (a) { return a.toLowerCase(); });
134
+ coinAddresses = _handleCoinAddresses.call(this, res.filter(function (a, i) { return i % 2 == 1; }));
135
+ return [2 /*return*/, [gaugeAddresses, coinAddresses]];
136
+ case 2:
137
+ factoryMulticallContract = this.contracts[this.constants.ALIASES.twocrypto_factory].multicallContract;
138
+ isFactoryGaugeNull = this.constants.ALIASES.gauge_factory === '0x0000000000000000000000000000000000000000';
139
+ factoryMulticallGaugeContract = this.contracts[this.constants.ALIASES.gauge_factory].multicallContract;
140
+ calls = [];
141
+ for (_a = 0, factorySwapAddresses_2 = factorySwapAddresses; _a < factorySwapAddresses_2.length; _a++) {
142
+ addr = factorySwapAddresses_2[_a];
143
+ if (!isFactoryGaugeNull) {
144
+ calls.push(factoryMulticallGaugeContract.get_gauge_from_lp_token(addr));
145
+ }
146
+ calls.push(factoryMulticallContract.get_coins(addr));
147
+ }
148
+ return [4 /*yield*/, this.multicallProvider.all(calls)];
149
+ case 3:
150
+ res = _b.sent();
151
+ if (!isFactoryGaugeNull) {
152
+ gaugeAddresses = res.filter(function (a, i) { return i % 2 == 0; }).map(function (a) { return a.toLowerCase(); });
153
+ coinAddresses = _handleCoinAddresses.call(this, res.filter(function (a, i) { return i % 2 == 1; }));
154
+ return [2 /*return*/, [gaugeAddresses, coinAddresses]];
155
+ }
156
+ else {
157
+ coinAddresses = _handleCoinAddresses.call(this, res.filter(function (a, i) { return i % 2 == 0; }));
158
+ gaugeAddresses = Array.from(Array(factorySwapAddresses.length)).map(function () { return '0x0000000000000000000000000000000000000000'; });
159
+ return [2 /*return*/, [gaugeAddresses, coinAddresses]];
160
+ }
161
+ _b.label = 4;
162
+ case 4: return [2 /*return*/];
163
+ }
164
+ });
165
+ });
166
+ }
167
+ function setTwocryptoFactorySwapContracts(factorySwapAddresses) {
168
+ var _this = this;
169
+ factorySwapAddresses.forEach(function (addr) {
170
+ _this.setContract(addr, twocryptoFactorySwapABI);
171
+ });
172
+ }
173
+ function setTwocryptoFactoryTokenContracts(factoryTokenAddresses) {
174
+ var _this = this;
175
+ factoryTokenAddresses.forEach(function (addr) {
176
+ _this.setContract(addr, ERC20ABI);
177
+ });
178
+ }
179
+ function setTwocryptoFactoryGaugeContracts(factoryGaugeAddresses) {
180
+ var _this = this;
181
+ factoryGaugeAddresses.filter(function (addr) { return addr !== curve.constants.ZERO_ADDRESS; }).forEach(function (addr, i) {
182
+ _this.setContract(addr, _this.chainId === 1 ? factoryGaugeABI : gaugeChildABI);
183
+ });
184
+ }
185
+ function setTwocryptoFactoryCoinsContracts(coinAddresses) {
186
+ var flattenedCoinAddresses = Array.from(new Set(deepFlatten(coinAddresses)));
187
+ for (var _i = 0, flattenedCoinAddresses_1 = flattenedCoinAddresses; _i < flattenedCoinAddresses_1.length; _i++) {
188
+ var addr = flattenedCoinAddresses_1[_i];
189
+ if (addr in this.contracts)
190
+ continue;
191
+ this.setContract(addr, ERC20ABI);
192
+ }
193
+ }
194
+ function getTwocryptoFactoryUnderlyingCoinAddresses(coinAddresses) {
195
+ var _this = this;
196
+ return __spreadArray([], coinAddresses.map(function (coins) { return coins.map(function (c) { return c === _this.constants.NATIVE_TOKEN.wrappedAddress ? _this.constants.NATIVE_TOKEN.address : c; }); }), true);
197
+ }
198
+ function getExistingCoinAddressNameDict() {
199
+ var dict = {};
200
+ var _loop_1 = function (poolData) {
201
+ poolData.wrapped_coin_addresses.forEach(function (addr, i) {
202
+ if (!(addr.toLowerCase() in dict)) {
203
+ dict[addr.toLowerCase()] = poolData.wrapped_coins[i];
204
+ }
205
+ });
206
+ poolData.underlying_coin_addresses.forEach(function (addr, i) {
207
+ if (!(addr.toLowerCase() in dict)) {
208
+ dict[addr.toLowerCase()] = poolData.underlying_coins[i];
209
+ }
210
+ });
211
+ };
212
+ for (var _i = 0, _a = Object.values(this.constants.POOLS_DATA); _i < _a.length; _i++) {
213
+ var poolData = _a[_i];
214
+ _loop_1(poolData);
215
+ }
216
+ dict[this.constants.NATIVE_TOKEN.address] = this.constants.NATIVE_TOKEN.symbol;
217
+ return dict;
218
+ }
219
+ function getCoinsData(tokenAddresses, coinAddresses, existingCoinAddrNameDict, existingCoinAddrDecimalsDict) {
220
+ return __awaiter(this, void 0, void 0, function () {
221
+ var flattenedCoinAddresses, newCoinAddresses, coinAddrNamesDict, coinAddrDecimalsDict, _i, flattenedCoinAddresses_2, addr, calls, _a, tokenAddresses_1, addr, _b, newCoinAddresses_1, addr, res, res1, tokenSymbols, tokenNames, res2, symbols, decimals;
222
+ return __generator(this, function (_c) {
223
+ switch (_c.label) {
224
+ case 0:
225
+ flattenedCoinAddresses = Array.from(new Set(deepFlatten(coinAddresses)));
226
+ newCoinAddresses = [];
227
+ coinAddrNamesDict = {};
228
+ coinAddrDecimalsDict = {};
229
+ for (_i = 0, flattenedCoinAddresses_2 = flattenedCoinAddresses; _i < flattenedCoinAddresses_2.length; _i++) {
230
+ addr = flattenedCoinAddresses_2[_i];
231
+ if (addr in existingCoinAddrNameDict) {
232
+ coinAddrNamesDict[addr] = existingCoinAddrNameDict[addr];
233
+ coinAddrDecimalsDict[addr] = existingCoinAddrDecimalsDict[addr];
234
+ }
235
+ else if (addr === "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2") {
236
+ coinAddrNamesDict[addr] = "MKR";
237
+ }
238
+ else {
239
+ newCoinAddresses.push(addr);
240
+ }
241
+ }
242
+ calls = [];
243
+ for (_a = 0, tokenAddresses_1 = tokenAddresses; _a < tokenAddresses_1.length; _a++) {
244
+ addr = tokenAddresses_1[_a];
245
+ calls.push(this.contracts[addr].multicallContract.symbol());
246
+ calls.push(this.contracts[addr].multicallContract.name());
247
+ }
248
+ for (_b = 0, newCoinAddresses_1 = newCoinAddresses; _b < newCoinAddresses_1.length; _b++) {
249
+ addr = newCoinAddresses_1[_b];
250
+ calls.push(this.contracts[addr].multicallContract.symbol());
251
+ calls.push(this.contracts[addr].multicallContract.decimals());
252
+ }
253
+ return [4 /*yield*/, this.multicallProvider.all(calls)];
254
+ case 1:
255
+ res = _c.sent();
256
+ res1 = res.slice(0, tokenAddresses.length * 2);
257
+ tokenSymbols = res1.filter(function (a, i) { return i % 2 == 0; });
258
+ tokenNames = res1.filter(function (a, i) { return i % 2 == 1; });
259
+ res2 = res.slice(tokenAddresses.length * 2);
260
+ symbols = res2.filter(function (a, i) { return i % 2 == 0; });
261
+ decimals = res2.filter(function (a, i) { return i % 2 == 1; }).map(function (_d) { return Number(curve.formatUnits(_d, 0)); });
262
+ newCoinAddresses.forEach(function (addr, i) {
263
+ coinAddrNamesDict[addr] = symbols[i];
264
+ coinAddrDecimalsDict[addr] = decimals[i];
265
+ });
266
+ coinAddrNamesDict[this.constants.NATIVE_TOKEN.address] = this.constants.NATIVE_TOKEN.symbol;
267
+ coinAddrDecimalsDict[this.constants.NATIVE_TOKEN.address] = 18;
268
+ return [2 /*return*/, [tokenSymbols, tokenNames, coinAddrNamesDict, coinAddrDecimalsDict]];
269
+ }
270
+ });
271
+ });
272
+ }
273
+ export function getTwocryptoFactoryPoolData(fromIdx, swapAddress) {
274
+ if (fromIdx === void 0) { fromIdx = 0; }
275
+ return __awaiter(this, void 0, void 0, function () {
276
+ var _a, poolIds, swapAddresses, _b, _c, gaugeAddresses, coinAddresses, underlyingCoinAddresses, existingCoinAddressNameDict, _e, poolSymbols, poolNames, coinAddressNameDict, coinAddressDecimalsDict, TWOCRYPTO_FACTORY_POOLS_DATA, i;
277
+ return __generator(this, function (_f) {
278
+ switch (_f.label) {
279
+ case 0:
280
+ if (!swapAddress) return [3 /*break*/, 2];
281
+ return [4 /*yield*/, getRecentlyCreatedCryptoPoolId.call(this, swapAddress)];
282
+ case 1:
283
+ _b = [[_f.sent()], [swapAddress.toLowerCase()]];
284
+ return [3 /*break*/, 4];
285
+ case 2: return [4 /*yield*/, getTwocryptoFactoryIdsAndSwapAddresses.call(this, fromIdx)];
286
+ case 3:
287
+ _b = _f.sent();
288
+ _f.label = 4;
289
+ case 4:
290
+ _a = _b, poolIds = _a[0], swapAddresses = _a[1];
291
+ if (poolIds.length === 0)
292
+ return [2 /*return*/, {}];
293
+ return [4 /*yield*/, getPoolsData.call(this, swapAddresses)];
294
+ case 5:
295
+ _c = _f.sent(), gaugeAddresses = _c[0], coinAddresses = _c[1];
296
+ setTwocryptoFactorySwapContracts.call(this, swapAddresses);
297
+ setTwocryptoFactoryGaugeContracts.call(this, gaugeAddresses);
298
+ setTwocryptoFactoryCoinsContracts.call(this, coinAddresses);
299
+ underlyingCoinAddresses = getTwocryptoFactoryUnderlyingCoinAddresses.call(this, coinAddresses);
300
+ existingCoinAddressNameDict = getExistingCoinAddressNameDict.call(this);
301
+ return [4 /*yield*/, getCoinsData.call(this, swapAddresses, coinAddresses, existingCoinAddressNameDict, this.constants.DECIMALS)];
302
+ case 6:
303
+ _e = _f.sent(), poolSymbols = _e[0], poolNames = _e[1], coinAddressNameDict = _e[2], coinAddressDecimalsDict = _e[3];
304
+ TWOCRYPTO_FACTORY_POOLS_DATA = {};
305
+ for (i = 0; i < poolIds.length; i++) {
306
+ TWOCRYPTO_FACTORY_POOLS_DATA[poolIds[i]] = {
307
+ name: poolNames[i],
308
+ full_name: poolNames[i],
309
+ symbol: poolSymbols[i],
310
+ reference_asset: "CRYPTO",
311
+ swap_address: swapAddresses[i],
312
+ token_address: swapAddresses[i],
313
+ gauge_address: gaugeAddresses[i],
314
+ is_crypto: true,
315
+ is_plain: underlyingCoinAddresses[i].toString() === coinAddresses[i].toString(),
316
+ is_factory: true,
317
+ underlying_coins: __spreadArray([], underlyingCoinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }), true),
318
+ wrapped_coins: __spreadArray([], coinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }), true),
319
+ underlying_coin_addresses: underlyingCoinAddresses[i],
320
+ wrapped_coin_addresses: coinAddresses[i],
321
+ underlying_decimals: __spreadArray([], underlyingCoinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }), true),
322
+ wrapped_decimals: __spreadArray([], coinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }), true),
323
+ swap_abi: twocryptoFactorySwapABI,
324
+ gauge_abi: this.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
325
+ };
326
+ }
327
+ return [2 /*return*/, TWOCRYPTO_FACTORY_POOLS_DATA];
328
+ }
329
+ });
330
+ });
331
+ }
package/lib/index.d.ts CHANGED
@@ -134,6 +134,27 @@ declare const curve: {
134
134
  deployGaugeMirror: (chainId: number, salt: string) => Promise<number>;
135
135
  };
136
136
  };
137
+ twocryptoFactory: {
138
+ fetchPools: (useApi?: boolean) => Promise<void>;
139
+ fetchNewPools: () => Promise<string[]>;
140
+ getPoolList: () => string[];
141
+ deployPool: (name: string, symbol: string, coins: string[], A: string | number, gamma: string | number, midFee: string | number, outFee: string | number, allowedExtraProfit: string | number, feeGamma: string | number, adjustmentStep: string | number, maHalfTime: number, initialPrice: string | number) => Promise<ethers.ContractTransactionResponse>;
142
+ deployGauge: (poolAddress: string) => Promise<ethers.ContractTransactionResponse>;
143
+ deployGaugeSidechain: (poolAddress: string, salt: string) => Promise<ethers.ContractTransactionResponse>;
144
+ deployGaugeMirror: (chainId: number, salt: string) => Promise<ethers.ContractTransactionResponse>;
145
+ getDeployedPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
146
+ getDeployedGaugeAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
147
+ getDeployedGaugeMirrorAddress: (chainId: number) => Promise<string>;
148
+ getDeployedGaugeMirrorAddressByTx: (tx: ethers.ContractTransactionResponse) => Promise<string>;
149
+ fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
150
+ gaugeImplementation: () => string;
151
+ estimateGas: {
152
+ deployPool: (name: string, symbol: string, coins: string[], A: string | number, gamma: string | number, midFee: string | number, outFee: string | number, allowedExtraProfit: string | number, feeGamma: string | number, adjustmentStep: string | number, maHalfTime: number, initialPrice: string | number) => Promise<number>;
153
+ deployGauge: (poolAddress: string) => Promise<number>;
154
+ deployGaugeSidechain: (poolAddress: string, salt: string) => Promise<number>;
155
+ deployGaugeMirror: (chainId: number, salt: string) => Promise<number>;
156
+ };
157
+ };
137
158
  tricryptoFactory: {
138
159
  fetchPools: (useApi?: boolean) => Promise<void>;
139
160
  fetchNewPools: () => Promise<string[]>;
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, deployStableNgPlainPool, deployStableNgPlainPoolEstimateGas, deployStableNgMetaPool, deployStableNgMetaPoolEstimateGas, } 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, deployTwocryptoPool, deployTwocryptoPoolEstimateGas, getDeployedTwocryptoPoolAddress, } from './factory/deploy.js';
44
44
  import { crvSupplyStats, userCrv, userVeCrv, crvLockIsApproved, crvLockApproveEstimateGas, crvLockApprove, calcCrvUnlockTime, createCrvLockEstimateGas, createCrvLock, increaseCrvLockedAmountEstimateGas, increaseCrvLockedAmount, increaseCrvUnlockTimeEstimateGas, increaseCrvUnlockTime, withdrawLockedCrvEstimateGas as daoWithdrawLockedCrvEstimateGas, withdrawLockedCrv as daoWithdrawLockedCrv, claimableFees as daoClaimableFees, claimFeesEstimateGas as daoClaimFeesEstimateGas, claimFees as daoClaimFees, getVotingGaugeList, userGaugeVotes, voteForGaugeNextTime, voteForGaugeEstimateGas, voteForGauge, getProposalList, getProposal, userProposalVotes, voteForProposalEstimateGas, voteForProposal, } from "./dao.js";
45
45
  function init(providerType, providerSettings, options) {
46
46
  if (options === void 0) { options = {}; }
@@ -193,6 +193,39 @@ var curve = {
193
193
  }); }); },
194
194
  },
195
195
  },
196
+ twocryptoFactory: {
197
+ fetchPools: _curve.fetchTworyptoFactoryPools,
198
+ fetchNewPools: _curve.fetchNewTwocryptoFactoryPools,
199
+ getPoolList: _curve.getTworyptoFactoryPoolList,
200
+ deployPool: deployTwocryptoPool,
201
+ deployGauge: function (poolAddress) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
202
+ return [2 /*return*/, deployGauge(poolAddress, _curve.constants.ALIASES.twocrypto_factory)];
203
+ }); }); },
204
+ deployGaugeSidechain: function (poolAddress, salt) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
205
+ return [2 /*return*/, deployGaugeSidechain(poolAddress, salt)];
206
+ }); }); },
207
+ deployGaugeMirror: function (chainId, salt) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
208
+ return [2 /*return*/, deployGaugeMirror(chainId, salt)];
209
+ }); }); },
210
+ getDeployedPoolAddress: getDeployedTwocryptoPoolAddress,
211
+ getDeployedGaugeAddress: getDeployedGaugeAddress,
212
+ getDeployedGaugeMirrorAddress: getDeployedGaugeMirrorAddress,
213
+ getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx,
214
+ fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedTwocryptoFactoryPool,
215
+ gaugeImplementation: function () { return _curve.getGaugeImplementation("factory-twocrypto"); },
216
+ estimateGas: {
217
+ deployPool: deployTwocryptoPoolEstimateGas,
218
+ deployGauge: function (poolAddress) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
219
+ return [2 /*return*/, deployGaugeEstimateGas(poolAddress, _curve.constants.ALIASES.twocrypto_factory)];
220
+ }); }); },
221
+ deployGaugeSidechain: function (poolAddress, salt) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
222
+ return [2 /*return*/, deployGaugeSidechainEstimateGas(poolAddress, salt)];
223
+ }); }); },
224
+ deployGaugeMirror: function (chainId, salt) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
225
+ return [2 /*return*/, deployGaugeMirrorEstimateGas(chainId, salt)];
226
+ }); }); },
227
+ },
228
+ },
196
229
  tricryptoFactory: {
197
230
  fetchPools: _curve.fetchTricryptoFactoryPools,
198
231
  fetchNewPools: _curve.fetchNewTricryptoFactoryPools,
@@ -5,7 +5,7 @@ export interface IDict<T> {
5
5
  }
6
6
  export type INetworkName = "ethereum" | "bsc" | "optimism" | "xdai" | "polygon" | "fantom" | "zksync" | "moonbeam" | "kava" | "base" | "arbitrum" | "celo" | "avalanche" | "aurora";
7
7
  export type IChainId = 1 | 10 | 56 | 100 | 137 | 250 | 324 | 1284 | 2222 | 8453 | 42161 | 42220 | 43114 | 1313161554;
8
- export type IFactoryPoolType = "factory" | "factory-crvusd" | "factory-eywa" | "factory-crypto" | "factory-tricrypto" | "factory-stable-ng";
8
+ export type IFactoryPoolType = "factory" | "factory-crvusd" | "factory-eywa" | "factory-crypto" | "factory-twocrypto" | "factory-tricrypto" | "factory-stable-ng";
9
9
  export type IPoolType = "main" | "crypto" | IFactoryPoolType;
10
10
  export type ISwapType = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
11
11
  export type REFERENCE_ASSET = 'USD' | 'EUR' | 'BTC' | 'ETH' | 'LINK' | 'CRYPTO' | 'OTHER';
@@ -2336,7 +2336,7 @@ var PoolTemplate = /** @class */ (function () {
2336
2336
  _minMintAmount = fromBN(minAmountBN);
2337
2337
  ethIndex = getEthIndex(coinAddresses);
2338
2338
  value = _amounts[ethIndex] || curve.parseUnits("0");
2339
- return [4 /*yield*/, contract.deposit_and_stake.estimateGas(depositAddress, this.lpToken, this.gauge, coins.length, coinAddresses, _amounts, _minMintAmount, useUnderlying, this.isStableNg && this.isPlain, this.isMetaFactory && isUnderlying ? this.address : curve.constants.ZERO_ADDRESS, __assign(__assign({}, curve.constantOptions), { value: value }))];
2339
+ return [4 /*yield*/, contract.deposit_and_stake.estimateGas(depositAddress, this.lpToken, this.gauge, coins.length, coinAddresses, _amounts, _minMintAmount, useUnderlying, (this.isStableNg && this.isPlain) || (isUnderlying && this.isMeta && (new PoolTemplate(this.basePool)).isStableNg), this.isMetaFactory && isUnderlying ? this.address : curve.constants.ZERO_ADDRESS, __assign(__assign({}, curve.constantOptions), { value: value }))];
2340
2340
  case 17:
2341
2341
  _gas = (_q.sent());
2342
2342
  if (estimateGas)
@@ -2345,7 +2345,7 @@ var PoolTemplate = /** @class */ (function () {
2345
2345
  case 18:
2346
2346
  _q.sent();
2347
2347
  gasLimit = DIGas(_gas) * curve.parseUnits("200", 0) / curve.parseUnits("100", 0);
2348
- return [4 /*yield*/, contract.deposit_and_stake(depositAddress, this.lpToken, this.gauge, coins.length, coinAddresses, _amounts, _minMintAmount, useUnderlying, this.isStableNg && this.isPlain, this.isMetaFactory && isUnderlying ? this.address : curve.constants.ZERO_ADDRESS, __assign(__assign({}, curve.options), { gasLimit: gasLimit, value: value }))];
2348
+ return [4 /*yield*/, contract.deposit_and_stake(depositAddress, this.lpToken, this.gauge, coins.length, coinAddresses, _amounts, _minMintAmount, useUnderlying, (this.isStableNg && this.isPlain) || (isUnderlying && this.isMeta && (new PoolTemplate(this.basePool)).isStableNg), this.isMetaFactory && isUnderlying ? this.address : curve.constants.ZERO_ADDRESS, __assign(__assign({}, curve.options), { gasLimit: gasLimit, value: value }))];
2349
2349
  case 19: return [2 /*return*/, (_q.sent()).hash];
2350
2350
  }
2351
2351
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.54.8",
3
+ "version": "2.55.0",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",