@net-protocol/score 0.1.10 → 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/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
- { name: "fee", type: "uint24", internalType: "uint24" },
208
- { name: "tickSpacing", type: "int24", internalType: "int24" },
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
- { name: "fees", type: "uint24[]", internalType: "uint24[]" },
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
- { name: "version", type: "uint8", internalType: "uint8" },
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
- { name: "fee", type: "uint24", internalType: "uint24" },
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
- { name: "fee", type: "uint24", internalType: "uint24" },
299
- { name: "tickSpacing", type: "int24", internalType: "int24" },
300
- { name: "hooks", type: "address", internalType: "address" }
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
- { name: "count", type: "uint256", internalType: "uint256" }
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: "0xbc237dac4c74c170780fc12f353a258bdd31a8cf",
1050
+ address: "0x88A51f8d3B1f222394075E086e33108BC9ceDfB6",
1010
1051
  abi: multi_version_uniswap_bulk_pool_finder_default
1011
1052
  };
1012
1053
  var MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER = {
@@ -1029,6 +1070,33 @@ function getWethAddress(chainId) {
1029
1070
  return addr;
1030
1071
  }
1031
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
+ }
1032
1100
  var USER_UPVOTE_CONTRACT = {
1033
1101
  address: "0xa4bc2c63dd0157692fd5f409389e5032e37d8895",
1034
1102
  abi: user_upvote_default
@@ -1305,13 +1373,16 @@ function normalizeTokenPairs(pairs, wethAddress) {
1305
1373
  };
1306
1374
  });
1307
1375
  }
1308
- function buildDiscoveryArgs(normalizedPairs) {
1376
+ function buildDiscoveryArgs(normalizedPairs, factories) {
1309
1377
  return {
1310
1378
  tokenAs: normalizedPairs.map((p) => p.tokenA),
1311
1379
  tokenBs: normalizedPairs.map((p) => p.tokenB),
1312
1380
  fees: V3_V4_FEE_TIERS,
1313
1381
  v4TickSpacings: V4_TICK_SPACINGS,
1314
- v4Hooks: V4_HOOKS
1382
+ v4Hooks: V4_HOOKS,
1383
+ v2Factory: factories.v2Factory,
1384
+ v3Factory: factories.v3Factory,
1385
+ v4PoolManager: factories.v4PoolManager
1315
1386
  };
1316
1387
  }
1317
1388
  function parsePoolDiscoveries(poolResults, pairs, wethAddress) {
@@ -1515,8 +1586,9 @@ async function discoverPools({
1515
1586
  }) {
1516
1587
  if (pairs.length === 0) return [];
1517
1588
  const wethAddress = getWethAddress(chainId);
1589
+ const factories = getUniswapFactories(chainId);
1518
1590
  const normalizedPairs = normalizeTokenPairs(pairs, wethAddress);
1519
- const discoveryArgs = buildDiscoveryArgs(normalizedPairs);
1591
+ const discoveryArgs = buildDiscoveryArgs(normalizedPairs, factories);
1520
1592
  const poolResults = await readContract(publicClient, {
1521
1593
  address: MULTI_VERSION_UNISWAP_BULK_POOL_FINDER.address,
1522
1594
  abi: MULTI_VERSION_UNISWAP_BULK_POOL_FINDER.abi,