@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.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
- { name: "fee", type: "uint24", internalType: "uint24" },
210
- { name: "tickSpacing", type: "int24", internalType: "int24" },
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
- { name: "fees", type: "uint24[]", internalType: "uint24[]" },
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
- { name: "version", type: "uint8", internalType: "uint8" },
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
- { name: "fee", type: "uint24", internalType: "uint24" },
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
- { name: "fee", type: "uint24", internalType: "uint24" },
301
- { name: "tickSpacing", type: "int24", internalType: "int24" },
302
- { name: "hooks", type: "address", internalType: "address" }
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
- { name: "count", type: "uint256", internalType: "uint256" }
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: "0xbc237dac4c74c170780fc12f353a258bdd31a8cf",
1052
+ address: "0x88A51f8d3B1f222394075E086e33108BC9ceDfB6",
1012
1053
  abi: multi_version_uniswap_bulk_pool_finder_default
1013
1054
  };
1014
1055
  var MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER = {
@@ -1031,6 +1072,33 @@ function getWethAddress(chainId) {
1031
1072
  return addr;
1032
1073
  }
1033
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
+ }
1034
1102
  var USER_UPVOTE_CONTRACT = {
1035
1103
  address: "0xa4bc2c63dd0157692fd5f409389e5032e37d8895",
1036
1104
  abi: user_upvote_default
@@ -1307,13 +1375,16 @@ function normalizeTokenPairs(pairs, wethAddress) {
1307
1375
  };
1308
1376
  });
1309
1377
  }
1310
- function buildDiscoveryArgs(normalizedPairs) {
1378
+ function buildDiscoveryArgs(normalizedPairs, factories) {
1311
1379
  return {
1312
1380
  tokenAs: normalizedPairs.map((p) => p.tokenA),
1313
1381
  tokenBs: normalizedPairs.map((p) => p.tokenB),
1314
1382
  fees: V3_V4_FEE_TIERS,
1315
1383
  v4TickSpacings: V4_TICK_SPACINGS,
1316
- v4Hooks: V4_HOOKS
1384
+ v4Hooks: V4_HOOKS,
1385
+ v2Factory: factories.v2Factory,
1386
+ v3Factory: factories.v3Factory,
1387
+ v4PoolManager: factories.v4PoolManager
1317
1388
  };
1318
1389
  }
1319
1390
  function parsePoolDiscoveries(poolResults, pairs, wethAddress) {
@@ -1517,8 +1588,9 @@ async function discoverPools({
1517
1588
  }) {
1518
1589
  if (pairs.length === 0) return [];
1519
1590
  const wethAddress = getWethAddress(chainId);
1591
+ const factories = getUniswapFactories(chainId);
1520
1592
  const normalizedPairs = normalizeTokenPairs(pairs, wethAddress);
1521
- const discoveryArgs = buildDiscoveryArgs(normalizedPairs);
1593
+ const discoveryArgs = buildDiscoveryArgs(normalizedPairs, factories);
1522
1594
  const poolResults = await actions.readContract(publicClient, {
1523
1595
  address: MULTI_VERSION_UNISWAP_BULK_POOL_FINDER.address,
1524
1596
  abi: MULTI_VERSION_UNISWAP_BULK_POOL_FINDER.abi,