@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/index.mjs
CHANGED
|
@@ -1657,27 +1657,6 @@ var dynamic_split_strategy_default = [
|
|
|
1657
1657
|
|
|
1658
1658
|
// src/abis/multi-version-uniswap-bulk-pool-finder.json
|
|
1659
1659
|
var multi_version_uniswap_bulk_pool_finder_default = [
|
|
1660
|
-
{
|
|
1661
|
-
type: "function",
|
|
1662
|
-
name: "V2_FACTORY",
|
|
1663
|
-
inputs: [],
|
|
1664
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
1665
|
-
stateMutability: "view"
|
|
1666
|
-
},
|
|
1667
|
-
{
|
|
1668
|
-
type: "function",
|
|
1669
|
-
name: "V3_FACTORY",
|
|
1670
|
-
inputs: [],
|
|
1671
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
1672
|
-
stateMutability: "view"
|
|
1673
|
-
},
|
|
1674
|
-
{
|
|
1675
|
-
type: "function",
|
|
1676
|
-
name: "V4_POOL_MANAGER",
|
|
1677
|
-
inputs: [],
|
|
1678
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
1679
|
-
stateMutability: "view"
|
|
1680
|
-
},
|
|
1681
1660
|
{
|
|
1682
1661
|
type: "function",
|
|
1683
1662
|
name: "_checkV4PoolExternal",
|
|
@@ -1697,17 +1676,36 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
1697
1676
|
type: "address",
|
|
1698
1677
|
internalType: "Currency"
|
|
1699
1678
|
},
|
|
1700
|
-
{
|
|
1701
|
-
|
|
1679
|
+
{
|
|
1680
|
+
name: "fee",
|
|
1681
|
+
type: "uint24",
|
|
1682
|
+
internalType: "uint24"
|
|
1683
|
+
},
|
|
1684
|
+
{
|
|
1685
|
+
name: "tickSpacing",
|
|
1686
|
+
type: "int24",
|
|
1687
|
+
internalType: "int24"
|
|
1688
|
+
},
|
|
1702
1689
|
{
|
|
1703
1690
|
name: "hooks",
|
|
1704
1691
|
type: "address",
|
|
1705
1692
|
internalType: "contract IHooks"
|
|
1706
1693
|
}
|
|
1707
1694
|
]
|
|
1695
|
+
},
|
|
1696
|
+
{
|
|
1697
|
+
name: "poolManager",
|
|
1698
|
+
type: "address",
|
|
1699
|
+
internalType: "address"
|
|
1700
|
+
}
|
|
1701
|
+
],
|
|
1702
|
+
outputs: [
|
|
1703
|
+
{
|
|
1704
|
+
name: "exists",
|
|
1705
|
+
type: "bool",
|
|
1706
|
+
internalType: "bool"
|
|
1708
1707
|
}
|
|
1709
1708
|
],
|
|
1710
|
-
outputs: [{ name: "exists", type: "bool", internalType: "bool" }],
|
|
1711
1709
|
stateMutability: "view"
|
|
1712
1710
|
},
|
|
1713
1711
|
{
|
|
@@ -1729,7 +1727,11 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
1729
1727
|
type: "address[]",
|
|
1730
1728
|
internalType: "address[]"
|
|
1731
1729
|
},
|
|
1732
|
-
{
|
|
1730
|
+
{
|
|
1731
|
+
name: "fees",
|
|
1732
|
+
type: "uint24[]",
|
|
1733
|
+
internalType: "uint24[]"
|
|
1734
|
+
},
|
|
1733
1735
|
{
|
|
1734
1736
|
name: "v4TickSpacings",
|
|
1735
1737
|
type: "int24[]",
|
|
@@ -1739,6 +1741,21 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
1739
1741
|
name: "v4Hooks",
|
|
1740
1742
|
type: "address[]",
|
|
1741
1743
|
internalType: "address[]"
|
|
1744
|
+
},
|
|
1745
|
+
{
|
|
1746
|
+
name: "v2Factory",
|
|
1747
|
+
type: "address",
|
|
1748
|
+
internalType: "address"
|
|
1749
|
+
},
|
|
1750
|
+
{
|
|
1751
|
+
name: "v3Factory",
|
|
1752
|
+
type: "address",
|
|
1753
|
+
internalType: "address"
|
|
1754
|
+
},
|
|
1755
|
+
{
|
|
1756
|
+
name: "v4PoolManager",
|
|
1757
|
+
type: "address",
|
|
1758
|
+
internalType: "address"
|
|
1742
1759
|
}
|
|
1743
1760
|
]
|
|
1744
1761
|
}
|
|
@@ -1754,7 +1771,11 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
1754
1771
|
type: "uint256",
|
|
1755
1772
|
internalType: "uint256"
|
|
1756
1773
|
},
|
|
1757
|
-
{
|
|
1774
|
+
{
|
|
1775
|
+
name: "version",
|
|
1776
|
+
type: "uint8",
|
|
1777
|
+
internalType: "uint8"
|
|
1778
|
+
},
|
|
1758
1779
|
{
|
|
1759
1780
|
name: "poolAddress",
|
|
1760
1781
|
type: "address",
|
|
@@ -1775,7 +1796,11 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
1775
1796
|
type: "address",
|
|
1776
1797
|
internalType: "Currency"
|
|
1777
1798
|
},
|
|
1778
|
-
{
|
|
1799
|
+
{
|
|
1800
|
+
name: "fee",
|
|
1801
|
+
type: "uint24",
|
|
1802
|
+
internalType: "uint24"
|
|
1803
|
+
},
|
|
1779
1804
|
{
|
|
1780
1805
|
name: "tickSpacing",
|
|
1781
1806
|
type: "int24",
|
|
@@ -1788,12 +1813,28 @@ var multi_version_uniswap_bulk_pool_finder_default = [
|
|
|
1788
1813
|
}
|
|
1789
1814
|
]
|
|
1790
1815
|
},
|
|
1791
|
-
{
|
|
1792
|
-
|
|
1793
|
-
|
|
1816
|
+
{
|
|
1817
|
+
name: "fee",
|
|
1818
|
+
type: "uint24",
|
|
1819
|
+
internalType: "uint24"
|
|
1820
|
+
},
|
|
1821
|
+
{
|
|
1822
|
+
name: "tickSpacing",
|
|
1823
|
+
type: "int24",
|
|
1824
|
+
internalType: "int24"
|
|
1825
|
+
},
|
|
1826
|
+
{
|
|
1827
|
+
name: "hooks",
|
|
1828
|
+
type: "address",
|
|
1829
|
+
internalType: "address"
|
|
1830
|
+
}
|
|
1794
1831
|
]
|
|
1795
1832
|
},
|
|
1796
|
-
{
|
|
1833
|
+
{
|
|
1834
|
+
name: "count",
|
|
1835
|
+
type: "uint256",
|
|
1836
|
+
internalType: "uint256"
|
|
1837
|
+
}
|
|
1797
1838
|
],
|
|
1798
1839
|
stateMutability: "view"
|
|
1799
1840
|
}
|
|
@@ -2554,7 +2595,7 @@ var LEGACY_UPVOTE_V1_ADDRESS = "0x0ada882dbbdc12388a1f9ca85d2d847088f747df";
|
|
|
2554
2595
|
var LEGACY_UPVOTE_V2_ADDRESS = "0x9027dcad0a3dca5835895e14fbc022a1e5ea909b";
|
|
2555
2596
|
var SUPPORTED_SCORE_CHAINS = [8453];
|
|
2556
2597
|
var MULTI_VERSION_UNISWAP_BULK_POOL_FINDER = {
|
|
2557
|
-
address: "
|
|
2598
|
+
address: "0x88A51f8d3B1f222394075E086e33108BC9ceDfB6",
|
|
2558
2599
|
abi: multi_version_uniswap_bulk_pool_finder_default
|
|
2559
2600
|
};
|
|
2560
2601
|
var MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER = {
|
|
@@ -2564,8 +2605,10 @@ var MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER = {
|
|
|
2564
2605
|
var WETH_BY_CHAIN = {
|
|
2565
2606
|
8453: "0x4200000000000000000000000000000000000006",
|
|
2566
2607
|
// Base (L2 predeploy)
|
|
2567
|
-
1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
|
2608
|
+
1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
2568
2609
|
// Ethereum mainnet
|
|
2610
|
+
4663: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"
|
|
2611
|
+
// Robinhood Chain (non-standard WETH; not the OP predeploy)
|
|
2569
2612
|
};
|
|
2570
2613
|
function getWethAddress(chainId) {
|
|
2571
2614
|
const addr = WETH_BY_CHAIN[chainId];
|
|
@@ -2575,6 +2618,33 @@ function getWethAddress(chainId) {
|
|
|
2575
2618
|
return addr;
|
|
2576
2619
|
}
|
|
2577
2620
|
var NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2621
|
+
var UNISWAP_FACTORIES_BY_CHAIN = {
|
|
2622
|
+
8453: {
|
|
2623
|
+
// Base
|
|
2624
|
+
v2Factory: "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6",
|
|
2625
|
+
v3Factory: "0x33128a8fC17869897dcE68Ed026d694621f6FDfD",
|
|
2626
|
+
v4PoolManager: "0x498581fF718922c3f8e6A244956aF099B2652b2b"
|
|
2627
|
+
},
|
|
2628
|
+
1: {
|
|
2629
|
+
// Ethereum mainnet
|
|
2630
|
+
v2Factory: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
|
|
2631
|
+
v3Factory: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
2632
|
+
v4PoolManager: "0x000000000004444c5dc75cB358380D2e3dE08A90"
|
|
2633
|
+
},
|
|
2634
|
+
4663: {
|
|
2635
|
+
// Robinhood Chain — Uniswap V3 only, at a non-canonical factory address.
|
|
2636
|
+
v2Factory: NULL_ADDRESS,
|
|
2637
|
+
v3Factory: "0x1f7d7550B1b028f7571E69A784071F0205FD2EfA",
|
|
2638
|
+
v4PoolManager: NULL_ADDRESS
|
|
2639
|
+
}
|
|
2640
|
+
};
|
|
2641
|
+
function getUniswapFactories(chainId) {
|
|
2642
|
+
const factories = UNISWAP_FACTORIES_BY_CHAIN[chainId];
|
|
2643
|
+
if (!factories) {
|
|
2644
|
+
throw new Error(`Score: No Uniswap factories for chain ${chainId}`);
|
|
2645
|
+
}
|
|
2646
|
+
return factories;
|
|
2647
|
+
}
|
|
2578
2648
|
var UPVOTE_PRICE_ETH = 25e-6;
|
|
2579
2649
|
var USER_UPVOTE_CONTRACT = {
|
|
2580
2650
|
address: "0xa4bc2c63dd0157692fd5f409389e5032e37d8895",
|
|
@@ -3290,13 +3360,16 @@ function normalizeTokenPairs(pairs, wethAddress) {
|
|
|
3290
3360
|
};
|
|
3291
3361
|
});
|
|
3292
3362
|
}
|
|
3293
|
-
function buildDiscoveryArgs(normalizedPairs) {
|
|
3363
|
+
function buildDiscoveryArgs(normalizedPairs, factories) {
|
|
3294
3364
|
return {
|
|
3295
3365
|
tokenAs: normalizedPairs.map((p) => p.tokenA),
|
|
3296
3366
|
tokenBs: normalizedPairs.map((p) => p.tokenB),
|
|
3297
3367
|
fees: V3_V4_FEE_TIERS,
|
|
3298
3368
|
v4TickSpacings: V4_TICK_SPACINGS,
|
|
3299
|
-
v4Hooks: V4_HOOKS
|
|
3369
|
+
v4Hooks: V4_HOOKS,
|
|
3370
|
+
v2Factory: factories.v2Factory,
|
|
3371
|
+
v3Factory: factories.v3Factory,
|
|
3372
|
+
v4PoolManager: factories.v4PoolManager
|
|
3300
3373
|
};
|
|
3301
3374
|
}
|
|
3302
3375
|
function parsePoolDiscoveries(poolResults, pairs, wethAddress) {
|
|
@@ -3510,8 +3583,9 @@ async function discoverPools({
|
|
|
3510
3583
|
}) {
|
|
3511
3584
|
if (pairs.length === 0) return [];
|
|
3512
3585
|
const wethAddress = getWethAddress(chainId);
|
|
3586
|
+
const factories = getUniswapFactories(chainId);
|
|
3513
3587
|
const normalizedPairs = normalizeTokenPairs(pairs, wethAddress);
|
|
3514
|
-
const discoveryArgs = buildDiscoveryArgs(normalizedPairs);
|
|
3588
|
+
const discoveryArgs = buildDiscoveryArgs(normalizedPairs, factories);
|
|
3515
3589
|
const poolResults = await readContract(publicClient, {
|
|
3516
3590
|
address: MULTI_VERSION_UNISWAP_BULK_POOL_FINDER.address,
|
|
3517
3591
|
abi: MULTI_VERSION_UNISWAP_BULK_POOL_FINDER.abi,
|
|
@@ -4029,6 +4103,6 @@ function isValidPoolKey2(poolKey) {
|
|
|
4029
4103
|
return poolKey.fee !== void 0 || poolKey.tickSpacing !== void 0 || poolKey.currency0 !== void 0;
|
|
4030
4104
|
}
|
|
4031
4105
|
|
|
4032
|
-
export { ALL_STRATEGY_ADDRESSES, DYNAMIC_SPLIT_STRATEGY, ERC20_BULK_INFO_HELPER_CONTRACT, 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, SCORE_CONTRACT, SUPPORTED_SCORE_CHAINS, ScoreClient, UNIV234_POOLS_STRATEGY, UPVOTE_APP, UPVOTE_PRICE_ETH, UPVOTE_STORAGE_APP, USER_UPVOTE_CONTRACT, UserUpvoteClient, buildUserUpvote, buildUserUpvoteReceived, calculatePriceFromSqrtPriceX96, calculatePriceInUsdc, calculateUpvoteCost, calculateUserTokenBalance, decodeStrategyMetadata, decodeUpvoteMessage, decodeUpvoteStorageBlob, discoverPools, discoverTokenPool, encodePoolKey, encodeUpvoteKey, extractStrategyAddress, extractTokenAddressFromScoreKey, extractTokenAddressesFromMessages, getFeedContentKey, getScoreKey, getStorageScoreKey, getStorageUpvoteContext, getTokenRankings, getTokenScoreKey, getWethAddress, isDynamicSplitStrategy, isPureAlphaStrategy, isStrategyMessage, isTokenScoreKey, isUniv234PoolsStrategy, isUserUpvoteMessage, parseUserUpvoteMessage, selectStrategy, tokenAddressToUpvoteKeyString, validateUpvoteParams, validateUserUpvoteMessage };
|
|
4106
|
+
export { ALL_STRATEGY_ADDRESSES, DYNAMIC_SPLIT_STRATEGY, ERC20_BULK_INFO_HELPER_CONTRACT, 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, SCORE_CONTRACT, SUPPORTED_SCORE_CHAINS, ScoreClient, UNIV234_POOLS_STRATEGY, UPVOTE_APP, UPVOTE_PRICE_ETH, UPVOTE_STORAGE_APP, USER_UPVOTE_CONTRACT, UserUpvoteClient, buildUserUpvote, buildUserUpvoteReceived, calculatePriceFromSqrtPriceX96, calculatePriceInUsdc, calculateUpvoteCost, calculateUserTokenBalance, decodeStrategyMetadata, decodeUpvoteMessage, decodeUpvoteStorageBlob, discoverPools, discoverTokenPool, encodePoolKey, encodeUpvoteKey, extractStrategyAddress, extractTokenAddressFromScoreKey, extractTokenAddressesFromMessages, getFeedContentKey, getScoreKey, getStorageScoreKey, getStorageUpvoteContext, getTokenRankings, getTokenScoreKey, getUniswapFactories, getWethAddress, isDynamicSplitStrategy, isPureAlphaStrategy, isStrategyMessage, isTokenScoreKey, isUniv234PoolsStrategy, isUserUpvoteMessage, parseUserUpvoteMessage, selectStrategy, tokenAddressToUpvoteKeyString, validateUpvoteParams, validateUserUpvoteMessage };
|
|
4033
4107
|
//# sourceMappingURL=index.mjs.map
|
|
4034
4108
|
//# sourceMappingURL=index.mjs.map
|