@net-protocol/score 0.1.9 → 0.1.11
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 +30 -0
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +111 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +111 -37
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +110 -36
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +110 -36
- package/dist/react.mjs.map +1 -1
- package/package.json +2 -2
package/dist/react.mjs
CHANGED
|
@@ -164,27 +164,6 @@ var upvote_app_default = [
|
|
|
164
164
|
|
|
165
165
|
// src/abis/multi-version-uniswap-bulk-pool-finder.json
|
|
166
166
|
var multi_version_uniswap_bulk_pool_finder_default = [
|
|
167
|
-
{
|
|
168
|
-
type: "function",
|
|
169
|
-
name: "V2_FACTORY",
|
|
170
|
-
inputs: [],
|
|
171
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
172
|
-
stateMutability: "view"
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
type: "function",
|
|
176
|
-
name: "V3_FACTORY",
|
|
177
|
-
inputs: [],
|
|
178
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
179
|
-
stateMutability: "view"
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
type: "function",
|
|
183
|
-
name: "V4_POOL_MANAGER",
|
|
184
|
-
inputs: [],
|
|
185
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
186
|
-
stateMutability: "view"
|
|
187
|
-
},
|
|
188
167
|
{
|
|
189
168
|
type: "function",
|
|
190
169
|
name: "_checkV4PoolExternal",
|
|
@@ -204,17 +183,36 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
204
183
|
type: "address",
|
|
205
184
|
internalType: "Currency"
|
|
206
185
|
},
|
|
207
|
-
{
|
|
208
|
-
|
|
186
|
+
{
|
|
187
|
+
name: "fee",
|
|
188
|
+
type: "uint24",
|
|
189
|
+
internalType: "uint24"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: "tickSpacing",
|
|
193
|
+
type: "int24",
|
|
194
|
+
internalType: "int24"
|
|
195
|
+
},
|
|
209
196
|
{
|
|
210
197
|
name: "hooks",
|
|
211
198
|
type: "address",
|
|
212
199
|
internalType: "contract IHooks"
|
|
213
200
|
}
|
|
214
201
|
]
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "poolManager",
|
|
205
|
+
type: "address",
|
|
206
|
+
internalType: "address"
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
outputs: [
|
|
210
|
+
{
|
|
211
|
+
name: "exists",
|
|
212
|
+
type: "bool",
|
|
213
|
+
internalType: "bool"
|
|
215
214
|
}
|
|
216
215
|
],
|
|
217
|
-
outputs: [{ name: "exists", type: "bool", internalType: "bool" }],
|
|
218
216
|
stateMutability: "view"
|
|
219
217
|
},
|
|
220
218
|
{
|
|
@@ -236,7 +234,11 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
236
234
|
type: "address[]",
|
|
237
235
|
internalType: "address[]"
|
|
238
236
|
},
|
|
239
|
-
{
|
|
237
|
+
{
|
|
238
|
+
name: "fees",
|
|
239
|
+
type: "uint24[]",
|
|
240
|
+
internalType: "uint24[]"
|
|
241
|
+
},
|
|
240
242
|
{
|
|
241
243
|
name: "v4TickSpacings",
|
|
242
244
|
type: "int24[]",
|
|
@@ -246,6 +248,21 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
246
248
|
name: "v4Hooks",
|
|
247
249
|
type: "address[]",
|
|
248
250
|
internalType: "address[]"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: "v2Factory",
|
|
254
|
+
type: "address",
|
|
255
|
+
internalType: "address"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
name: "v3Factory",
|
|
259
|
+
type: "address",
|
|
260
|
+
internalType: "address"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: "v4PoolManager",
|
|
264
|
+
type: "address",
|
|
265
|
+
internalType: "address"
|
|
249
266
|
}
|
|
250
267
|
]
|
|
251
268
|
}
|
|
@@ -261,7 +278,11 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
261
278
|
type: "uint256",
|
|
262
279
|
internalType: "uint256"
|
|
263
280
|
},
|
|
264
|
-
{
|
|
281
|
+
{
|
|
282
|
+
name: "version",
|
|
283
|
+
type: "uint8",
|
|
284
|
+
internalType: "uint8"
|
|
285
|
+
},
|
|
265
286
|
{
|
|
266
287
|
name: "poolAddress",
|
|
267
288
|
type: "address",
|
|
@@ -282,7 +303,11 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
282
303
|
type: "address",
|
|
283
304
|
internalType: "Currency"
|
|
284
305
|
},
|
|
285
|
-
{
|
|
306
|
+
{
|
|
307
|
+
name: "fee",
|
|
308
|
+
type: "uint24",
|
|
309
|
+
internalType: "uint24"
|
|
310
|
+
},
|
|
286
311
|
{
|
|
287
312
|
name: "tickSpacing",
|
|
288
313
|
type: "int24",
|
|
@@ -295,12 +320,28 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
295
320
|
}
|
|
296
321
|
]
|
|
297
322
|
},
|
|
298
|
-
{
|
|
299
|
-
|
|
300
|
-
|
|
323
|
+
{
|
|
324
|
+
name: "fee",
|
|
325
|
+
type: "uint24",
|
|
326
|
+
internalType: "uint24"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
name: "tickSpacing",
|
|
330
|
+
type: "int24",
|
|
331
|
+
internalType: "int24"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
name: "hooks",
|
|
335
|
+
type: "address",
|
|
336
|
+
internalType: "address"
|
|
337
|
+
}
|
|
301
338
|
]
|
|
302
339
|
},
|
|
303
|
-
{
|
|
340
|
+
{
|
|
341
|
+
name: "count",
|
|
342
|
+
type: "uint256",
|
|
343
|
+
internalType: "uint256"
|
|
344
|
+
}
|
|
304
345
|
],
|
|
305
346
|
stateMutability: "view"
|
|
306
347
|
}
|
|
@@ -1006,7 +1047,7 @@ var ALL_STRATEGY_ADDRESSES = [
|
|
|
1006
1047
|
DYNAMIC_SPLIT_STRATEGY.address
|
|
1007
1048
|
];
|
|
1008
1049
|
var MULTI_VERSION_UNISWAP_BULK_POOL_FINDER = {
|
|
1009
|
-
address: "
|
|
1050
|
+
address: "0x88A51f8d3B1f222394075E086e33108BC9ceDfB6",
|
|
1010
1051
|
abi: multi_version_uniswap_bulk_pool_finder_default
|
|
1011
1052
|
};
|
|
1012
1053
|
var MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER = {
|
|
@@ -1016,8 +1057,10 @@ var MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER = {
|
|
|
1016
1057
|
var WETH_BY_CHAIN = {
|
|
1017
1058
|
8453: "0x4200000000000000000000000000000000000006",
|
|
1018
1059
|
// Base (L2 predeploy)
|
|
1019
|
-
1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
|
1060
|
+
1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
1020
1061
|
// Ethereum mainnet
|
|
1062
|
+
4663: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"
|
|
1063
|
+
// Robinhood Chain (non-standard WETH; not the OP predeploy)
|
|
1021
1064
|
};
|
|
1022
1065
|
function getWethAddress(chainId) {
|
|
1023
1066
|
const addr = WETH_BY_CHAIN[chainId];
|
|
@@ -1027,6 +1070,33 @@ function getWethAddress(chainId) {
|
|
|
1027
1070
|
return addr;
|
|
1028
1071
|
}
|
|
1029
1072
|
var NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
1073
|
+
var UNISWAP_FACTORIES_BY_CHAIN = {
|
|
1074
|
+
8453: {
|
|
1075
|
+
// Base
|
|
1076
|
+
v2Factory: "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6",
|
|
1077
|
+
v3Factory: "0x33128a8fC17869897dcE68Ed026d694621f6FDfD",
|
|
1078
|
+
v4PoolManager: "0x498581fF718922c3f8e6A244956aF099B2652b2b"
|
|
1079
|
+
},
|
|
1080
|
+
1: {
|
|
1081
|
+
// Ethereum mainnet
|
|
1082
|
+
v2Factory: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
|
|
1083
|
+
v3Factory: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
1084
|
+
v4PoolManager: "0x000000000004444c5dc75cB358380D2e3dE08A90"
|
|
1085
|
+
},
|
|
1086
|
+
4663: {
|
|
1087
|
+
// Robinhood Chain — Uniswap V3 only, at a non-canonical factory address.
|
|
1088
|
+
v2Factory: NULL_ADDRESS,
|
|
1089
|
+
v3Factory: "0x1f7d7550B1b028f7571E69A784071F0205FD2EfA",
|
|
1090
|
+
v4PoolManager: NULL_ADDRESS
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
function getUniswapFactories(chainId) {
|
|
1094
|
+
const factories = UNISWAP_FACTORIES_BY_CHAIN[chainId];
|
|
1095
|
+
if (!factories) {
|
|
1096
|
+
throw new Error(`Score: No Uniswap factories for chain ${chainId}`);
|
|
1097
|
+
}
|
|
1098
|
+
return factories;
|
|
1099
|
+
}
|
|
1030
1100
|
var USER_UPVOTE_CONTRACT = {
|
|
1031
1101
|
address: "0xa4bc2c63dd0157692fd5f409389e5032e37d8895",
|
|
1032
1102
|
abi: user_upvote_default
|
|
@@ -1303,13 +1373,16 @@ function normalizeTokenPairs(pairs, wethAddress) {
|
|
|
1303
1373
|
};
|
|
1304
1374
|
});
|
|
1305
1375
|
}
|
|
1306
|
-
function buildDiscoveryArgs(normalizedPairs) {
|
|
1376
|
+
function buildDiscoveryArgs(normalizedPairs, factories) {
|
|
1307
1377
|
return {
|
|
1308
1378
|
tokenAs: normalizedPairs.map((p) => p.tokenA),
|
|
1309
1379
|
tokenBs: normalizedPairs.map((p) => p.tokenB),
|
|
1310
1380
|
fees: V3_V4_FEE_TIERS,
|
|
1311
1381
|
v4TickSpacings: V4_TICK_SPACINGS,
|
|
1312
|
-
v4Hooks: V4_HOOKS
|
|
1382
|
+
v4Hooks: V4_HOOKS,
|
|
1383
|
+
v2Factory: factories.v2Factory,
|
|
1384
|
+
v3Factory: factories.v3Factory,
|
|
1385
|
+
v4PoolManager: factories.v4PoolManager
|
|
1313
1386
|
};
|
|
1314
1387
|
}
|
|
1315
1388
|
function parsePoolDiscoveries(poolResults, pairs, wethAddress) {
|
|
@@ -1513,8 +1586,9 @@ async function discoverPools({
|
|
|
1513
1586
|
}) {
|
|
1514
1587
|
if (pairs.length === 0) return [];
|
|
1515
1588
|
const wethAddress = getWethAddress(chainId);
|
|
1589
|
+
const factories = getUniswapFactories(chainId);
|
|
1516
1590
|
const normalizedPairs = normalizeTokenPairs(pairs, wethAddress);
|
|
1517
|
-
const discoveryArgs = buildDiscoveryArgs(normalizedPairs);
|
|
1591
|
+
const discoveryArgs = buildDiscoveryArgs(normalizedPairs, factories);
|
|
1518
1592
|
const poolResults = await readContract(publicClient, {
|
|
1519
1593
|
address: MULTI_VERSION_UNISWAP_BULK_POOL_FINDER.address,
|
|
1520
1594
|
abi: MULTI_VERSION_UNISWAP_BULK_POOL_FINDER.abi,
|