@curvefi/api 2.56.10 → 2.56.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.
|
@@ -71,23 +71,6 @@
|
|
|
71
71
|
"anonymous": false,
|
|
72
72
|
"type": "event"
|
|
73
73
|
},
|
|
74
|
-
{
|
|
75
|
-
"name": "LiquidityGaugeDeployed",
|
|
76
|
-
"inputs": [
|
|
77
|
-
{
|
|
78
|
-
"name": "pool",
|
|
79
|
-
"type": "address",
|
|
80
|
-
"indexed": false
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"name": "gauge",
|
|
84
|
-
"type": "address",
|
|
85
|
-
"indexed": false
|
|
86
|
-
}
|
|
87
|
-
],
|
|
88
|
-
"anonymous": false,
|
|
89
|
-
"type": "event"
|
|
90
|
-
},
|
|
91
74
|
{
|
|
92
75
|
"name": "UpdateFeeReceiver",
|
|
93
76
|
"inputs": [
|
|
@@ -127,23 +110,6 @@
|
|
|
127
110
|
"anonymous": false,
|
|
128
111
|
"type": "event"
|
|
129
112
|
},
|
|
130
|
-
{
|
|
131
|
-
"name": "UpdateGaugeImplementation",
|
|
132
|
-
"inputs": [
|
|
133
|
-
{
|
|
134
|
-
"name": "_old_gauge_implementation",
|
|
135
|
-
"type": "address",
|
|
136
|
-
"indexed": false
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
"name": "_new_gauge_implementation",
|
|
140
|
-
"type": "address",
|
|
141
|
-
"indexed": false
|
|
142
|
-
}
|
|
143
|
-
],
|
|
144
|
-
"anonymous": false,
|
|
145
|
-
"type": "event"
|
|
146
|
-
},
|
|
147
113
|
{
|
|
148
114
|
"name": "UpdateMathImplementation",
|
|
149
115
|
"inputs": [
|
|
@@ -279,23 +245,6 @@
|
|
|
279
245
|
}
|
|
280
246
|
]
|
|
281
247
|
},
|
|
282
|
-
{
|
|
283
|
-
"stateMutability": "nonpayable",
|
|
284
|
-
"type": "function",
|
|
285
|
-
"name": "deploy_gauge",
|
|
286
|
-
"inputs": [
|
|
287
|
-
{
|
|
288
|
-
"name": "_pool",
|
|
289
|
-
"type": "address"
|
|
290
|
-
}
|
|
291
|
-
],
|
|
292
|
-
"outputs": [
|
|
293
|
-
{
|
|
294
|
-
"name": "",
|
|
295
|
-
"type": "address"
|
|
296
|
-
}
|
|
297
|
-
]
|
|
298
|
-
},
|
|
299
248
|
{
|
|
300
249
|
"stateMutability": "nonpayable",
|
|
301
250
|
"type": "function",
|
|
@@ -324,18 +273,6 @@
|
|
|
324
273
|
],
|
|
325
274
|
"outputs": []
|
|
326
275
|
},
|
|
327
|
-
{
|
|
328
|
-
"stateMutability": "nonpayable",
|
|
329
|
-
"type": "function",
|
|
330
|
-
"name": "set_gauge_implementation",
|
|
331
|
-
"inputs": [
|
|
332
|
-
{
|
|
333
|
-
"name": "_gauge_implementation",
|
|
334
|
-
"type": "address"
|
|
335
|
-
}
|
|
336
|
-
],
|
|
337
|
-
"outputs": []
|
|
338
|
-
},
|
|
339
276
|
{
|
|
340
277
|
"stateMutability": "nonpayable",
|
|
341
278
|
"type": "function",
|
|
@@ -379,6 +316,23 @@
|
|
|
379
316
|
"inputs": [],
|
|
380
317
|
"outputs": []
|
|
381
318
|
},
|
|
319
|
+
{
|
|
320
|
+
"stateMutability": "view",
|
|
321
|
+
"type": "function",
|
|
322
|
+
"name": "get_implementation_address",
|
|
323
|
+
"inputs": [
|
|
324
|
+
{
|
|
325
|
+
"name": "_pool",
|
|
326
|
+
"type": "address"
|
|
327
|
+
}
|
|
328
|
+
],
|
|
329
|
+
"outputs": [
|
|
330
|
+
{
|
|
331
|
+
"name": "",
|
|
332
|
+
"type": "address"
|
|
333
|
+
}
|
|
334
|
+
]
|
|
335
|
+
},
|
|
382
336
|
{
|
|
383
337
|
"stateMutability": "view",
|
|
384
338
|
"type": "function",
|
|
@@ -505,23 +459,6 @@
|
|
|
505
459
|
}
|
|
506
460
|
]
|
|
507
461
|
},
|
|
508
|
-
{
|
|
509
|
-
"stateMutability": "view",
|
|
510
|
-
"type": "function",
|
|
511
|
-
"name": "get_gauge",
|
|
512
|
-
"inputs": [
|
|
513
|
-
{
|
|
514
|
-
"name": "_pool",
|
|
515
|
-
"type": "address"
|
|
516
|
-
}
|
|
517
|
-
],
|
|
518
|
-
"outputs": [
|
|
519
|
-
{
|
|
520
|
-
"name": "",
|
|
521
|
-
"type": "address"
|
|
522
|
-
}
|
|
523
|
-
]
|
|
524
|
-
},
|
|
525
462
|
{
|
|
526
463
|
"stateMutability": "view",
|
|
527
464
|
"type": "function",
|
|
@@ -596,18 +533,6 @@
|
|
|
596
533
|
}
|
|
597
534
|
]
|
|
598
535
|
},
|
|
599
|
-
{
|
|
600
|
-
"stateMutability": "view",
|
|
601
|
-
"type": "function",
|
|
602
|
-
"name": "gauge_implementation",
|
|
603
|
-
"inputs": [],
|
|
604
|
-
"outputs": [
|
|
605
|
-
{
|
|
606
|
-
"name": "",
|
|
607
|
-
"type": "address"
|
|
608
|
-
}
|
|
609
|
-
]
|
|
610
|
-
},
|
|
611
536
|
{
|
|
612
537
|
"stateMutability": "view",
|
|
613
538
|
"type": "function",
|
package/lib/constants/aliases.js
CHANGED
|
@@ -120,7 +120,7 @@ export var ALIASES_OPTIMISM = lowerCaseValues({
|
|
|
120
120
|
"eywa_factory": '0x37F22A0B028f2152e6CAcef210e0C4d3b875f367',
|
|
121
121
|
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
122
122
|
"twocrypto_factory": '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F',
|
|
123
|
-
"tricrypto_factory": '
|
|
123
|
+
"tricrypto_factory": '0xc6C09471Ee39C7E30a067952FcC89c8922f9Ab53',
|
|
124
124
|
"stable_ng_factory": '0x5eeE3091f747E60a045a2E715a4c71e600e31F6E',
|
|
125
125
|
"factory_admin": "",
|
|
126
126
|
"gas_oracle": '0xc0d3C0d3C0d3c0D3C0D3C0d3C0d3C0D3C0D3000f',
|
|
@@ -48,6 +48,7 @@ import ERC20ABI from "../constants/abis/ERC20.json" assert { type: 'json' };
|
|
|
48
48
|
import tricryptoFactorySwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool.json" assert { type: 'json' };
|
|
49
49
|
import factoryGaugeABI from "../constants/abis/gauge_factory.json" assert { type: 'json' };
|
|
50
50
|
import gaugeChildABI from "../constants/abis/gauge_child.json" assert { type: 'json' };
|
|
51
|
+
import { tricryptoDeployImplementations } from "../constants/tricryptoDeployImplementations.js";
|
|
51
52
|
var deepFlatten = function (arr) { return [].concat.apply([], arr.map(function (v) { return (Array.isArray(v) ? deepFlatten(v) : v); })); };
|
|
52
53
|
function getRecentlyCreatedCryptoPoolId(swapAddress) {
|
|
53
54
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -115,7 +116,7 @@ function _handleCoinAddresses(coinAddresses) {
|
|
|
115
116
|
}
|
|
116
117
|
function getPoolsData(factorySwapAddresses) {
|
|
117
118
|
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
|
+
var factoryMulticallContract, calls, _i, factorySwapAddresses_1, addr, res, gaugeAddresses, coinAddresses, implementationAddresses, factoryMulticallContract, isFactoryGaugeNull, factoryMulticallGaugeContract, calls, _a, factorySwapAddresses_2, addr, res, gaugeAddresses, coinAddresses, implementationAddresses, coinAddresses, gaugeAddresses, implementationAddresses;
|
|
119
120
|
return __generator(this, function (_b) {
|
|
120
121
|
switch (_b.label) {
|
|
121
122
|
case 0:
|
|
@@ -126,13 +127,15 @@ function getPoolsData(factorySwapAddresses) {
|
|
|
126
127
|
addr = factorySwapAddresses_1[_i];
|
|
127
128
|
calls.push(factoryMulticallContract.get_gauge(addr));
|
|
128
129
|
calls.push(factoryMulticallContract.get_coins(addr));
|
|
130
|
+
calls.push(factoryMulticallContract.get_implementation_address(addr));
|
|
129
131
|
}
|
|
130
132
|
return [4 /*yield*/, this.multicallProvider.all(calls)];
|
|
131
133
|
case 1:
|
|
132
134
|
res = _b.sent();
|
|
133
|
-
gaugeAddresses = res.filter(function (a, i) { return i %
|
|
134
|
-
coinAddresses = _handleCoinAddresses.call(this, res.filter(function (a, i) { return i %
|
|
135
|
-
return
|
|
135
|
+
gaugeAddresses = res.filter(function (a, i) { return i % 3 == 0; }).map(function (a) { return a.toLowerCase(); });
|
|
136
|
+
coinAddresses = _handleCoinAddresses.call(this, res.filter(function (a, i) { return i % 3 == 1; }));
|
|
137
|
+
implementationAddresses = res.filter(function (a, i) { return i % 3 == 2; }).map(function (a) { return a.toLowerCase(); });
|
|
138
|
+
return [2 /*return*/, [gaugeAddresses, coinAddresses, implementationAddresses]];
|
|
136
139
|
case 2:
|
|
137
140
|
factoryMulticallContract = this.contracts[this.constants.ALIASES.tricrypto_factory].multicallContract;
|
|
138
141
|
isFactoryGaugeNull = this.constants.ALIASES.gauge_factory === '0x0000000000000000000000000000000000000000';
|
|
@@ -144,19 +147,22 @@ function getPoolsData(factorySwapAddresses) {
|
|
|
144
147
|
calls.push(factoryMulticallGaugeContract.get_gauge_from_lp_token(addr));
|
|
145
148
|
}
|
|
146
149
|
calls.push(factoryMulticallContract.get_coins(addr));
|
|
150
|
+
calls.push(factoryMulticallContract.get_implementation_address(addr));
|
|
147
151
|
}
|
|
148
152
|
return [4 /*yield*/, this.multicallProvider.all(calls)];
|
|
149
153
|
case 3:
|
|
150
154
|
res = _b.sent();
|
|
151
155
|
if (!isFactoryGaugeNull) {
|
|
152
|
-
gaugeAddresses = res.filter(function (a, i) { return i %
|
|
153
|
-
coinAddresses = _handleCoinAddresses.call(this, res.filter(function (a, i) { return i %
|
|
154
|
-
return
|
|
156
|
+
gaugeAddresses = res.filter(function (a, i) { return i % 3 == 0; }).map(function (a) { return a.toLowerCase(); });
|
|
157
|
+
coinAddresses = _handleCoinAddresses.call(this, res.filter(function (a, i) { return i % 3 == 1; }));
|
|
158
|
+
implementationAddresses = res.filter(function (a, i) { return i % 3 == 2; }).map(function (a) { return a.toLowerCase(); });
|
|
159
|
+
return [2 /*return*/, [gaugeAddresses, coinAddresses, implementationAddresses]];
|
|
155
160
|
}
|
|
156
161
|
else {
|
|
157
162
|
coinAddresses = _handleCoinAddresses.call(this, res.filter(function (a, i) { return i % 2 == 0; }));
|
|
158
163
|
gaugeAddresses = Array.from(Array(factorySwapAddresses.length)).map(function () { return '0x0000000000000000000000000000000000000000'; });
|
|
159
|
-
return
|
|
164
|
+
implementationAddresses = res.filter(function (a, i) { return i % 2 == 1; }).map(function (a) { return a.toLowerCase(); });
|
|
165
|
+
return [2 /*return*/, [gaugeAddresses, coinAddresses, implementationAddresses]];
|
|
160
166
|
}
|
|
161
167
|
_b.label = 4;
|
|
162
168
|
case 4: return [2 /*return*/];
|
|
@@ -191,10 +197,6 @@ function setCryptoFactoryCoinsContracts(coinAddresses) {
|
|
|
191
197
|
this.setContract(addr, ERC20ABI);
|
|
192
198
|
}
|
|
193
199
|
}
|
|
194
|
-
function getCryptoFactoryUnderlyingCoinAddresses(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
200
|
function getExistingCoinAddressNameDict() {
|
|
199
201
|
var dict = {};
|
|
200
202
|
var _loop_1 = function (poolData) {
|
|
@@ -273,7 +275,7 @@ function getCoinsData(tokenAddresses, coinAddresses, existingCoinAddrNameDict, e
|
|
|
273
275
|
export function getTricryptoFactoryPoolData(fromIdx, swapAddress) {
|
|
274
276
|
if (fromIdx === void 0) { fromIdx = 0; }
|
|
275
277
|
return __awaiter(this, void 0, void 0, function () {
|
|
276
|
-
var _a, poolIds, swapAddresses, _b, _c, gaugeAddresses, coinAddresses,
|
|
278
|
+
var _a, poolIds, swapAddresses, _b, _c, gaugeAddresses, coinAddresses, implementationAddresses, existingCoinAddressNameDict, _e, poolSymbols, poolNames, coinAddressNameDict, coinAddressDecimalsDict, TRICRYPTO_FACTORY_POOLS_DATA, nativeToken, _loop_2, this_1, i;
|
|
277
279
|
return __generator(this, function (_f) {
|
|
278
280
|
switch (_f.label) {
|
|
279
281
|
case 0:
|
|
@@ -292,17 +294,26 @@ export function getTricryptoFactoryPoolData(fromIdx, swapAddress) {
|
|
|
292
294
|
return [2 /*return*/, {}];
|
|
293
295
|
return [4 /*yield*/, getPoolsData.call(this, swapAddresses)];
|
|
294
296
|
case 5:
|
|
295
|
-
_c = _f.sent(), gaugeAddresses = _c[0], coinAddresses = _c[1];
|
|
297
|
+
_c = _f.sent(), gaugeAddresses = _c[0], coinAddresses = _c[1], implementationAddresses = _c[2];
|
|
296
298
|
setCryptoFactorySwapContracts.call(this, swapAddresses);
|
|
297
299
|
setCryptoFactoryGaugeContracts.call(this, gaugeAddresses);
|
|
298
300
|
setCryptoFactoryCoinsContracts.call(this, coinAddresses);
|
|
299
|
-
underlyingCoinAddresses = getCryptoFactoryUnderlyingCoinAddresses.call(this, coinAddresses);
|
|
300
301
|
existingCoinAddressNameDict = getExistingCoinAddressNameDict.call(this);
|
|
301
302
|
return [4 /*yield*/, getCoinsData.call(this, swapAddresses, coinAddresses, existingCoinAddressNameDict, this.constants.DECIMALS)];
|
|
302
303
|
case 6:
|
|
303
304
|
_e = _f.sent(), poolSymbols = _e[0], poolNames = _e[1], coinAddressNameDict = _e[2], coinAddressDecimalsDict = _e[3];
|
|
304
305
|
TRICRYPTO_FACTORY_POOLS_DATA = {};
|
|
305
|
-
|
|
306
|
+
nativeToken = this.constants.NATIVE_TOKEN;
|
|
307
|
+
_loop_2 = function (i) {
|
|
308
|
+
var underlyingCoinAddresses = coinAddresses[i].map(function (addr) {
|
|
309
|
+
var isETHEnabled = implementationAddresses[i] === tricryptoDeployImplementations[curve.chainId].amm_native_transfers_enabled;
|
|
310
|
+
if (isETHEnabled) {
|
|
311
|
+
return addr === nativeToken.wrappedAddress ? nativeToken.address : addr;
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
return addr;
|
|
315
|
+
}
|
|
316
|
+
});
|
|
306
317
|
TRICRYPTO_FACTORY_POOLS_DATA[poolIds[i]] = {
|
|
307
318
|
name: poolNames[i],
|
|
308
319
|
full_name: poolNames[i],
|
|
@@ -312,17 +323,21 @@ export function getTricryptoFactoryPoolData(fromIdx, swapAddress) {
|
|
|
312
323
|
token_address: swapAddresses[i],
|
|
313
324
|
gauge_address: gaugeAddresses[i],
|
|
314
325
|
is_crypto: true,
|
|
315
|
-
is_plain: underlyingCoinAddresses
|
|
326
|
+
is_plain: underlyingCoinAddresses.toString() === coinAddresses[i].toString(),
|
|
316
327
|
is_factory: true,
|
|
317
|
-
underlying_coins: __spreadArray([], underlyingCoinAddresses
|
|
328
|
+
underlying_coins: __spreadArray([], underlyingCoinAddresses.map(function (addr) { return coinAddressNameDict[addr]; }), true),
|
|
318
329
|
wrapped_coins: __spreadArray([], coinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }), true),
|
|
319
|
-
underlying_coin_addresses: underlyingCoinAddresses
|
|
330
|
+
underlying_coin_addresses: underlyingCoinAddresses,
|
|
320
331
|
wrapped_coin_addresses: coinAddresses[i],
|
|
321
|
-
underlying_decimals: __spreadArray([], underlyingCoinAddresses
|
|
332
|
+
underlying_decimals: __spreadArray([], underlyingCoinAddresses.map(function (addr) { return coinAddressDecimalsDict[addr]; }), true),
|
|
322
333
|
wrapped_decimals: __spreadArray([], coinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }), true),
|
|
323
334
|
swap_abi: tricryptoFactorySwapABI,
|
|
324
|
-
gauge_abi:
|
|
335
|
+
gauge_abi: this_1.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
|
|
325
336
|
};
|
|
337
|
+
};
|
|
338
|
+
this_1 = this;
|
|
339
|
+
for (i = 0; i < poolIds.length; i++) {
|
|
340
|
+
_loop_2(i);
|
|
326
341
|
}
|
|
327
342
|
return [2 /*return*/, TRICRYPTO_FACTORY_POOLS_DATA];
|
|
328
343
|
}
|