@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/README.md
CHANGED
|
@@ -25,6 +25,7 @@ Net Score is a decentralized on-chain scoring system built on Net Protocol. It a
|
|
|
25
25
|
- **Decode upvote messages** from Net protocol (legacy and strategy formats)
|
|
26
26
|
- **Decode strategy metadata** to inspect vote weight details
|
|
27
27
|
- **Select strategies** automatically based on pool key availability
|
|
28
|
+
- **Compute token leaderboards** with `getTokenRankings()` — the same time-decayed ranking that powers the website's `/token/<chain>/trending` page (`trending` / `recent` / `top` sorts)
|
|
28
29
|
|
|
29
30
|
This package provides both React hooks (for UI) and a client class (for non-React code).
|
|
30
31
|
|
|
@@ -128,6 +129,29 @@ const appCounts = await client.getAppKeyScores({
|
|
|
128
129
|
});
|
|
129
130
|
```
|
|
130
131
|
|
|
132
|
+
### Token Rankings
|
|
133
|
+
|
|
134
|
+
`getTokenRankings()` returns the same leaderboard that powers the website's
|
|
135
|
+
`/token/<chain>/trending` page — read live from chain with no off-chain index.
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import { getTokenRankings } from "@net-protocol/score";
|
|
139
|
+
|
|
140
|
+
const tokens = await getTokenRankings({
|
|
141
|
+
chainId: 8453,
|
|
142
|
+
sort: "trending", // "trending" | "recent" | "top"
|
|
143
|
+
maxTokens: 50,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
for (const t of tokens) {
|
|
147
|
+
console.log(t.symbol, t.upvotes, t.fdv, t.priceInUsdc);
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Each call performs ~8 RPC reads. Production callers should cache via HTTP
|
|
152
|
+
`Cache-Control` headers or an edge cache. Only Base (chainId 8453) is
|
|
153
|
+
supported today; other chains throw synchronously.
|
|
154
|
+
|
|
131
155
|
## API Reference
|
|
132
156
|
|
|
133
157
|
### ScoreClient
|
|
@@ -139,6 +163,12 @@ const appCounts = await client.getAppKeyScores({
|
|
|
139
163
|
| `getStrategyKeyScores(opts)` | Get scores for keys from a specific strategy |
|
|
140
164
|
| `getAppKeyScores(opts)` | Get scores for keys from a specific app |
|
|
141
165
|
|
|
166
|
+
### Token Rankings
|
|
167
|
+
|
|
168
|
+
| Function | Description |
|
|
169
|
+
|----------|-------------|
|
|
170
|
+
| `getTokenRankings(opts)` | Compute a token leaderboard ranked by upvote activity (`trending` / `recent` / `top`). Mirrors the website's `/token/<chain>/trending` page. |
|
|
171
|
+
|
|
142
172
|
### React Hooks
|
|
143
173
|
|
|
144
174
|
| Hook | Description |
|
package/dist/index.d.mts
CHANGED
|
@@ -409,6 +409,15 @@ declare const MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER: {
|
|
|
409
409
|
*/
|
|
410
410
|
declare function getWethAddress(chainId: number): Address;
|
|
411
411
|
declare const NULL_ADDRESS: Address;
|
|
412
|
+
type UniswapFactories = {
|
|
413
|
+
v2Factory: Address;
|
|
414
|
+
v3Factory: Address;
|
|
415
|
+
v4PoolManager: Address;
|
|
416
|
+
};
|
|
417
|
+
/**
|
|
418
|
+
* Get the Uniswap factory / pool-manager addresses for a given chain.
|
|
419
|
+
*/
|
|
420
|
+
declare function getUniswapFactories(chainId: number): UniswapFactories;
|
|
412
421
|
declare const UPVOTE_PRICE_ETH = 0.000025;
|
|
413
422
|
declare const USER_UPVOTE_CONTRACT: {
|
|
414
423
|
readonly address: Address;
|
|
@@ -479,4 +488,4 @@ declare function buildUserUpvoteReceived(parsed: ParsedUserUpvoteMessage, upvote
|
|
|
479
488
|
decimals: number;
|
|
480
489
|
}): UserUpvoteReceived;
|
|
481
490
|
|
|
482
|
-
export { ALL_STRATEGY_ADDRESSES, DYNAMIC_SPLIT_STRATEGY, DecodedStrategyMetadata, ERC20_BULK_INFO_HELPER_CONTRACT, GetAppKeyScoresOptions, GetStrategyKeyScoresOptions, type GetTokenRankingsOptions, GetUpvotesForItemsOptions, GetUpvotesOptions, LEGACY_UPVOTE_V1_ADDRESS, LEGACY_UPVOTE_V2_ADDRESS, MULTI_VERSION_UNISWAP_BULK_POOL_FINDER, MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER, NULL_ADDRESS, PURE_ALPHA_STRATEGY, type ParsedUserUpvoteMessage, PoolDiscoveryPair, PoolDiscoveryResult, PoolKey, type RankedToken, type RankingSort, SCORE_CONTRACT, SUPPORTED_SCORE_CHAINS, ScoreClient, ScoreClientOptions, type TokenAddressExtraction, UNIV234_POOLS_STRATEGY, UPVOTE_APP, UPVOTE_PRICE_ETH, UPVOTE_STORAGE_APP, USER_UPVOTE_CONTRACT, type UserUpvote, UserUpvoteClient, type UserUpvoteClientOptions, type UserUpvoteNetMessage, type UserUpvoteReceived, buildUserUpvote, buildUserUpvoteReceived, calculatePriceFromSqrtPriceX96, calculatePriceInUsdc, calculateUpvoteCost, calculateUserTokenBalance, decodeStrategyMetadata, decodeUpvoteMessage, decodeUpvoteStorageBlob, discoverPools, discoverTokenPool, encodePoolKey, encodeUpvoteKey, extractStrategyAddress, extractTokenAddressesFromMessages, getTokenRankings, getWethAddress, isDynamicSplitStrategy, isPureAlphaStrategy, isStrategyMessage, isUniv234PoolsStrategy, isUserUpvoteMessage, parseUserUpvoteMessage, selectStrategy, tokenAddressToUpvoteKeyString, validateUpvoteParams, validateUserUpvoteMessage };
|
|
491
|
+
export { ALL_STRATEGY_ADDRESSES, DYNAMIC_SPLIT_STRATEGY, DecodedStrategyMetadata, ERC20_BULK_INFO_HELPER_CONTRACT, GetAppKeyScoresOptions, GetStrategyKeyScoresOptions, type GetTokenRankingsOptions, GetUpvotesForItemsOptions, GetUpvotesOptions, LEGACY_UPVOTE_V1_ADDRESS, LEGACY_UPVOTE_V2_ADDRESS, MULTI_VERSION_UNISWAP_BULK_POOL_FINDER, MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER, NULL_ADDRESS, PURE_ALPHA_STRATEGY, type ParsedUserUpvoteMessage, PoolDiscoveryPair, PoolDiscoveryResult, PoolKey, type RankedToken, type RankingSort, SCORE_CONTRACT, SUPPORTED_SCORE_CHAINS, ScoreClient, ScoreClientOptions, type TokenAddressExtraction, UNIV234_POOLS_STRATEGY, UPVOTE_APP, UPVOTE_PRICE_ETH, UPVOTE_STORAGE_APP, USER_UPVOTE_CONTRACT, type UserUpvote, UserUpvoteClient, type UserUpvoteClientOptions, type UserUpvoteNetMessage, type UserUpvoteReceived, buildUserUpvote, buildUserUpvoteReceived, calculatePriceFromSqrtPriceX96, calculatePriceInUsdc, calculateUpvoteCost, calculateUserTokenBalance, decodeStrategyMetadata, decodeUpvoteMessage, decodeUpvoteStorageBlob, discoverPools, discoverTokenPool, encodePoolKey, encodeUpvoteKey, extractStrategyAddress, extractTokenAddressesFromMessages, getTokenRankings, getUniswapFactories, getWethAddress, isDynamicSplitStrategy, isPureAlphaStrategy, isStrategyMessage, isUniv234PoolsStrategy, isUserUpvoteMessage, parseUserUpvoteMessage, selectStrategy, tokenAddressToUpvoteKeyString, validateUpvoteParams, validateUserUpvoteMessage };
|
package/dist/index.d.ts
CHANGED
|
@@ -409,6 +409,15 @@ declare const MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER: {
|
|
|
409
409
|
*/
|
|
410
410
|
declare function getWethAddress(chainId: number): Address;
|
|
411
411
|
declare const NULL_ADDRESS: Address;
|
|
412
|
+
type UniswapFactories = {
|
|
413
|
+
v2Factory: Address;
|
|
414
|
+
v3Factory: Address;
|
|
415
|
+
v4PoolManager: Address;
|
|
416
|
+
};
|
|
417
|
+
/**
|
|
418
|
+
* Get the Uniswap factory / pool-manager addresses for a given chain.
|
|
419
|
+
*/
|
|
420
|
+
declare function getUniswapFactories(chainId: number): UniswapFactories;
|
|
412
421
|
declare const UPVOTE_PRICE_ETH = 0.000025;
|
|
413
422
|
declare const USER_UPVOTE_CONTRACT: {
|
|
414
423
|
readonly address: Address;
|
|
@@ -479,4 +488,4 @@ declare function buildUserUpvoteReceived(parsed: ParsedUserUpvoteMessage, upvote
|
|
|
479
488
|
decimals: number;
|
|
480
489
|
}): UserUpvoteReceived;
|
|
481
490
|
|
|
482
|
-
export { ALL_STRATEGY_ADDRESSES, DYNAMIC_SPLIT_STRATEGY, DecodedStrategyMetadata, ERC20_BULK_INFO_HELPER_CONTRACT, GetAppKeyScoresOptions, GetStrategyKeyScoresOptions, type GetTokenRankingsOptions, GetUpvotesForItemsOptions, GetUpvotesOptions, LEGACY_UPVOTE_V1_ADDRESS, LEGACY_UPVOTE_V2_ADDRESS, MULTI_VERSION_UNISWAP_BULK_POOL_FINDER, MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER, NULL_ADDRESS, PURE_ALPHA_STRATEGY, type ParsedUserUpvoteMessage, PoolDiscoveryPair, PoolDiscoveryResult, PoolKey, type RankedToken, type RankingSort, SCORE_CONTRACT, SUPPORTED_SCORE_CHAINS, ScoreClient, ScoreClientOptions, type TokenAddressExtraction, UNIV234_POOLS_STRATEGY, UPVOTE_APP, UPVOTE_PRICE_ETH, UPVOTE_STORAGE_APP, USER_UPVOTE_CONTRACT, type UserUpvote, UserUpvoteClient, type UserUpvoteClientOptions, type UserUpvoteNetMessage, type UserUpvoteReceived, buildUserUpvote, buildUserUpvoteReceived, calculatePriceFromSqrtPriceX96, calculatePriceInUsdc, calculateUpvoteCost, calculateUserTokenBalance, decodeStrategyMetadata, decodeUpvoteMessage, decodeUpvoteStorageBlob, discoverPools, discoverTokenPool, encodePoolKey, encodeUpvoteKey, extractStrategyAddress, extractTokenAddressesFromMessages, getTokenRankings, getWethAddress, isDynamicSplitStrategy, isPureAlphaStrategy, isStrategyMessage, isUniv234PoolsStrategy, isUserUpvoteMessage, parseUserUpvoteMessage, selectStrategy, tokenAddressToUpvoteKeyString, validateUpvoteParams, validateUserUpvoteMessage };
|
|
491
|
+
export { ALL_STRATEGY_ADDRESSES, DYNAMIC_SPLIT_STRATEGY, DecodedStrategyMetadata, ERC20_BULK_INFO_HELPER_CONTRACT, GetAppKeyScoresOptions, GetStrategyKeyScoresOptions, type GetTokenRankingsOptions, GetUpvotesForItemsOptions, GetUpvotesOptions, LEGACY_UPVOTE_V1_ADDRESS, LEGACY_UPVOTE_V2_ADDRESS, MULTI_VERSION_UNISWAP_BULK_POOL_FINDER, MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER, NULL_ADDRESS, PURE_ALPHA_STRATEGY, type ParsedUserUpvoteMessage, PoolDiscoveryPair, PoolDiscoveryResult, PoolKey, type RankedToken, type RankingSort, SCORE_CONTRACT, SUPPORTED_SCORE_CHAINS, ScoreClient, ScoreClientOptions, type TokenAddressExtraction, UNIV234_POOLS_STRATEGY, UPVOTE_APP, UPVOTE_PRICE_ETH, UPVOTE_STORAGE_APP, USER_UPVOTE_CONTRACT, type UserUpvote, UserUpvoteClient, type UserUpvoteClientOptions, type UserUpvoteNetMessage, type UserUpvoteReceived, buildUserUpvote, buildUserUpvoteReceived, calculatePriceFromSqrtPriceX96, calculatePriceInUsdc, calculateUpvoteCost, calculateUserTokenBalance, decodeStrategyMetadata, decodeUpvoteMessage, decodeUpvoteStorageBlob, discoverPools, discoverTokenPool, encodePoolKey, encodeUpvoteKey, extractStrategyAddress, extractTokenAddressesFromMessages, getTokenRankings, getUniswapFactories, getWethAddress, isDynamicSplitStrategy, isPureAlphaStrategy, isStrategyMessage, isUniv234PoolsStrategy, isUserUpvoteMessage, parseUserUpvoteMessage, selectStrategy, tokenAddressToUpvoteKeyString, validateUpvoteParams, validateUserUpvoteMessage };
|
package/dist/index.js
CHANGED
|
@@ -1659,27 +1659,6 @@ var dynamic_split_strategy_default = [
|
|
|
1659
1659
|
|
|
1660
1660
|
// src/abis/multi-version-uniswap-bulk-pool-finder.json
|
|
1661
1661
|
var multi_version_uniswap_bulk_pool_finder_default = [
|
|
1662
|
-
{
|
|
1663
|
-
type: "function",
|
|
1664
|
-
name: "V2_FACTORY",
|
|
1665
|
-
inputs: [],
|
|
1666
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
1667
|
-
stateMutability: "view"
|
|
1668
|
-
},
|
|
1669
|
-
{
|
|
1670
|
-
type: "function",
|
|
1671
|
-
name: "V3_FACTORY",
|
|
1672
|
-
inputs: [],
|
|
1673
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
1674
|
-
stateMutability: "view"
|
|
1675
|
-
},
|
|
1676
|
-
{
|
|
1677
|
-
type: "function",
|
|
1678
|
-
name: "V4_POOL_MANAGER",
|
|
1679
|
-
inputs: [],
|
|
1680
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
1681
|
-
stateMutability: "view"
|
|
1682
|
-
},
|
|
1683
1662
|
{
|
|
1684
1663
|
type: "function",
|
|
1685
1664
|
name: "_checkV4PoolExternal",
|
|
@@ -1699,17 +1678,36 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
1699
1678
|
type: "address",
|
|
1700
1679
|
internalType: "Currency"
|
|
1701
1680
|
},
|
|
1702
|
-
{
|
|
1703
|
-
|
|
1681
|
+
{
|
|
1682
|
+
name: "fee",
|
|
1683
|
+
type: "uint24",
|
|
1684
|
+
internalType: "uint24"
|
|
1685
|
+
},
|
|
1686
|
+
{
|
|
1687
|
+
name: "tickSpacing",
|
|
1688
|
+
type: "int24",
|
|
1689
|
+
internalType: "int24"
|
|
1690
|
+
},
|
|
1704
1691
|
{
|
|
1705
1692
|
name: "hooks",
|
|
1706
1693
|
type: "address",
|
|
1707
1694
|
internalType: "contract IHooks"
|
|
1708
1695
|
}
|
|
1709
1696
|
]
|
|
1697
|
+
},
|
|
1698
|
+
{
|
|
1699
|
+
name: "poolManager",
|
|
1700
|
+
type: "address",
|
|
1701
|
+
internalType: "address"
|
|
1702
|
+
}
|
|
1703
|
+
],
|
|
1704
|
+
outputs: [
|
|
1705
|
+
{
|
|
1706
|
+
name: "exists",
|
|
1707
|
+
type: "bool",
|
|
1708
|
+
internalType: "bool"
|
|
1710
1709
|
}
|
|
1711
1710
|
],
|
|
1712
|
-
outputs: [{ name: "exists", type: "bool", internalType: "bool" }],
|
|
1713
1711
|
stateMutability: "view"
|
|
1714
1712
|
},
|
|
1715
1713
|
{
|
|
@@ -1731,7 +1729,11 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
1731
1729
|
type: "address[]",
|
|
1732
1730
|
internalType: "address[]"
|
|
1733
1731
|
},
|
|
1734
|
-
{
|
|
1732
|
+
{
|
|
1733
|
+
name: "fees",
|
|
1734
|
+
type: "uint24[]",
|
|
1735
|
+
internalType: "uint24[]"
|
|
1736
|
+
},
|
|
1735
1737
|
{
|
|
1736
1738
|
name: "v4TickSpacings",
|
|
1737
1739
|
type: "int24[]",
|
|
@@ -1741,6 +1743,21 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
1741
1743
|
name: "v4Hooks",
|
|
1742
1744
|
type: "address[]",
|
|
1743
1745
|
internalType: "address[]"
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
name: "v2Factory",
|
|
1749
|
+
type: "address",
|
|
1750
|
+
internalType: "address"
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
name: "v3Factory",
|
|
1754
|
+
type: "address",
|
|
1755
|
+
internalType: "address"
|
|
1756
|
+
},
|
|
1757
|
+
{
|
|
1758
|
+
name: "v4PoolManager",
|
|
1759
|
+
type: "address",
|
|
1760
|
+
internalType: "address"
|
|
1744
1761
|
}
|
|
1745
1762
|
]
|
|
1746
1763
|
}
|
|
@@ -1756,7 +1773,11 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
1756
1773
|
type: "uint256",
|
|
1757
1774
|
internalType: "uint256"
|
|
1758
1775
|
},
|
|
1759
|
-
{
|
|
1776
|
+
{
|
|
1777
|
+
name: "version",
|
|
1778
|
+
type: "uint8",
|
|
1779
|
+
internalType: "uint8"
|
|
1780
|
+
},
|
|
1760
1781
|
{
|
|
1761
1782
|
name: "poolAddress",
|
|
1762
1783
|
type: "address",
|
|
@@ -1777,7 +1798,11 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
1777
1798
|
type: "address",
|
|
1778
1799
|
internalType: "Currency"
|
|
1779
1800
|
},
|
|
1780
|
-
{
|
|
1801
|
+
{
|
|
1802
|
+
name: "fee",
|
|
1803
|
+
type: "uint24",
|
|
1804
|
+
internalType: "uint24"
|
|
1805
|
+
},
|
|
1781
1806
|
{
|
|
1782
1807
|
name: "tickSpacing",
|
|
1783
1808
|
type: "int24",
|
|
@@ -1790,12 +1815,28 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
1790
1815
|
}
|
|
1791
1816
|
]
|
|
1792
1817
|
},
|
|
1793
|
-
{
|
|
1794
|
-
|
|
1795
|
-
|
|
1818
|
+
{
|
|
1819
|
+
name: "fee",
|
|
1820
|
+
type: "uint24",
|
|
1821
|
+
internalType: "uint24"
|
|
1822
|
+
},
|
|
1823
|
+
{
|
|
1824
|
+
name: "tickSpacing",
|
|
1825
|
+
type: "int24",
|
|
1826
|
+
internalType: "int24"
|
|
1827
|
+
},
|
|
1828
|
+
{
|
|
1829
|
+
name: "hooks",
|
|
1830
|
+
type: "address",
|
|
1831
|
+
internalType: "address"
|
|
1832
|
+
}
|
|
1796
1833
|
]
|
|
1797
1834
|
},
|
|
1798
|
-
{
|
|
1835
|
+
{
|
|
1836
|
+
name: "count",
|
|
1837
|
+
type: "uint256",
|
|
1838
|
+
internalType: "uint256"
|
|
1839
|
+
}
|
|
1799
1840
|
],
|
|
1800
1841
|
stateMutability: "view"
|
|
1801
1842
|
}
|
|
@@ -2556,7 +2597,7 @@ var LEGACY_UPVOTE_V1_ADDRESS = "0x0ada882dbbdc12388a1f9ca85d2d847088f747df";
|
|
|
2556
2597
|
var LEGACY_UPVOTE_V2_ADDRESS = "0x9027dcad0a3dca5835895e14fbc022a1e5ea909b";
|
|
2557
2598
|
var SUPPORTED_SCORE_CHAINS = [8453];
|
|
2558
2599
|
var MULTI_VERSION_UNISWAP_BULK_POOL_FINDER = {
|
|
2559
|
-
address: "
|
|
2600
|
+
address: "0x88A51f8d3B1f222394075E086e33108BC9ceDfB6",
|
|
2560
2601
|
abi: multi_version_uniswap_bulk_pool_finder_default
|
|
2561
2602
|
};
|
|
2562
2603
|
var MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER = {
|
|
@@ -2566,8 +2607,10 @@ var MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER = {
|
|
|
2566
2607
|
var WETH_BY_CHAIN = {
|
|
2567
2608
|
8453: "0x4200000000000000000000000000000000000006",
|
|
2568
2609
|
// Base (L2 predeploy)
|
|
2569
|
-
1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
|
2610
|
+
1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
2570
2611
|
// Ethereum mainnet
|
|
2612
|
+
4663: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"
|
|
2613
|
+
// Robinhood Chain (non-standard WETH; not the OP predeploy)
|
|
2571
2614
|
};
|
|
2572
2615
|
function getWethAddress(chainId) {
|
|
2573
2616
|
const addr = WETH_BY_CHAIN[chainId];
|
|
@@ -2577,6 +2620,33 @@ function getWethAddress(chainId) {
|
|
|
2577
2620
|
return addr;
|
|
2578
2621
|
}
|
|
2579
2622
|
var NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2623
|
+
var UNISWAP_FACTORIES_BY_CHAIN = {
|
|
2624
|
+
8453: {
|
|
2625
|
+
// Base
|
|
2626
|
+
v2Factory: "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6",
|
|
2627
|
+
v3Factory: "0x33128a8fC17869897dcE68Ed026d694621f6FDfD",
|
|
2628
|
+
v4PoolManager: "0x498581fF718922c3f8e6A244956aF099B2652b2b"
|
|
2629
|
+
},
|
|
2630
|
+
1: {
|
|
2631
|
+
// Ethereum mainnet
|
|
2632
|
+
v2Factory: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
|
|
2633
|
+
v3Factory: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
2634
|
+
v4PoolManager: "0x000000000004444c5dc75cB358380D2e3dE08A90"
|
|
2635
|
+
},
|
|
2636
|
+
4663: {
|
|
2637
|
+
// Robinhood Chain — Uniswap V3 only, at a non-canonical factory address.
|
|
2638
|
+
v2Factory: NULL_ADDRESS,
|
|
2639
|
+
v3Factory: "0x1f7d7550B1b028f7571E69A784071F0205FD2EfA",
|
|
2640
|
+
v4PoolManager: NULL_ADDRESS
|
|
2641
|
+
}
|
|
2642
|
+
};
|
|
2643
|
+
function getUniswapFactories(chainId) {
|
|
2644
|
+
const factories = UNISWAP_FACTORIES_BY_CHAIN[chainId];
|
|
2645
|
+
if (!factories) {
|
|
2646
|
+
throw new Error(`Score: No Uniswap factories for chain ${chainId}`);
|
|
2647
|
+
}
|
|
2648
|
+
return factories;
|
|
2649
|
+
}
|
|
2580
2650
|
var UPVOTE_PRICE_ETH = 25e-6;
|
|
2581
2651
|
var USER_UPVOTE_CONTRACT = {
|
|
2582
2652
|
address: "0xa4bc2c63dd0157692fd5f409389e5032e37d8895",
|
|
@@ -3292,13 +3362,16 @@ function normalizeTokenPairs(pairs, wethAddress) {
|
|
|
3292
3362
|
};
|
|
3293
3363
|
});
|
|
3294
3364
|
}
|
|
3295
|
-
function buildDiscoveryArgs(normalizedPairs) {
|
|
3365
|
+
function buildDiscoveryArgs(normalizedPairs, factories) {
|
|
3296
3366
|
return {
|
|
3297
3367
|
tokenAs: normalizedPairs.map((p) => p.tokenA),
|
|
3298
3368
|
tokenBs: normalizedPairs.map((p) => p.tokenB),
|
|
3299
3369
|
fees: V3_V4_FEE_TIERS,
|
|
3300
3370
|
v4TickSpacings: V4_TICK_SPACINGS,
|
|
3301
|
-
v4Hooks: V4_HOOKS
|
|
3371
|
+
v4Hooks: V4_HOOKS,
|
|
3372
|
+
v2Factory: factories.v2Factory,
|
|
3373
|
+
v3Factory: factories.v3Factory,
|
|
3374
|
+
v4PoolManager: factories.v4PoolManager
|
|
3302
3375
|
};
|
|
3303
3376
|
}
|
|
3304
3377
|
function parsePoolDiscoveries(poolResults, pairs, wethAddress) {
|
|
@@ -3512,8 +3585,9 @@ async function discoverPools({
|
|
|
3512
3585
|
}) {
|
|
3513
3586
|
if (pairs.length === 0) return [];
|
|
3514
3587
|
const wethAddress = getWethAddress(chainId);
|
|
3588
|
+
const factories = getUniswapFactories(chainId);
|
|
3515
3589
|
const normalizedPairs = normalizeTokenPairs(pairs, wethAddress);
|
|
3516
|
-
const discoveryArgs = buildDiscoveryArgs(normalizedPairs);
|
|
3590
|
+
const discoveryArgs = buildDiscoveryArgs(normalizedPairs, factories);
|
|
3517
3591
|
const poolResults = await actions.readContract(publicClient, {
|
|
3518
3592
|
address: MULTI_VERSION_UNISWAP_BULK_POOL_FINDER.address,
|
|
3519
3593
|
abi: MULTI_VERSION_UNISWAP_BULK_POOL_FINDER.abi,
|
|
@@ -4071,6 +4145,7 @@ exports.getStorageScoreKey = getStorageScoreKey;
|
|
|
4071
4145
|
exports.getStorageUpvoteContext = getStorageUpvoteContext;
|
|
4072
4146
|
exports.getTokenRankings = getTokenRankings;
|
|
4073
4147
|
exports.getTokenScoreKey = getTokenScoreKey;
|
|
4148
|
+
exports.getUniswapFactories = getUniswapFactories;
|
|
4074
4149
|
exports.getWethAddress = getWethAddress;
|
|
4075
4150
|
exports.isDynamicSplitStrategy = isDynamicSplitStrategy;
|
|
4076
4151
|
exports.isPureAlphaStrategy = isPureAlphaStrategy;
|