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