Skip to content

Commit d603b2e

Browse files
Merge branch 'main' into whitelist-buy-hook-bsc
2 parents 6aaa420 + 1c5bee7 commit d603b2e

File tree

2 files changed

+76
-16
lines changed

2 files changed

+76
-16
lines changed

lib/cron/cache-config.ts

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ import {
1919
ZORA_POST_HOOK_ON_BASE_v2_2,
2020
ZORA_POST_HOOK_ON_BASE_v2_2_1,
2121
ZORA_POST_HOOK_ON_BASE_v2_3_0,
22+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_BASE,
23+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_BASE,
24+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_BASE_v2,
25+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_BASE_v2,
26+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_ARBITRUM,
27+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_ARBITRUM,
28+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_UNICHAIN,
29+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_UNICHAIN,
30+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_MAINNET,
31+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_MONAD,
2232
} from '../util/hooksAddressesAllowlist'
2333

2434
// during local cdk stack update, the env vars are not populated
@@ -100,6 +110,26 @@ export const ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING = new Set([
100110
ZORA_POST_HOOK_ON_BASE_v2_3_0,
101111
])
102112

113+
// Clanker hooks addresses for V4 filtering - MUST be lowercase
114+
export const CLANKER_HOOKS_FOR_V4_SUBGRAPH_FILTERING = new Set([
115+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_BASE,
116+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_BASE,
117+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_BASE_v2,
118+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_BASE_v2,
119+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_ARBITRUM,
120+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_ARBITRUM,
121+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_UNICHAIN,
122+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_UNICHAIN,
123+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_MAINNET,
124+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_MONAD,
125+
])
126+
127+
// Combined hooks set for V4SubgraphProvider low-TVL filtering (uses trackedZoraEthThreshold = 0.001)
128+
export const HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING = new Set([
129+
...ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
130+
...CLANKER_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
131+
])
132+
103133
export const v4SubgraphUrlOverride = (chainId: ChainId) => {
104134
switch (chainId) {
105135
case ChainId.SEPOLIA:
@@ -215,7 +245,7 @@ export const v2SubgraphUrlOverride = (chainId: ChainId) => {
215245

216246
const v4TrackedEthThreshold = 0.01 // Pools need at least 0.01 of trackedEth to be selected
217247
const v4BaseTrackedEthThreshold = 0.1 // Pools on Base need at least 0.1 of trackedEth to be selected
218-
const v4BaseZoraTrackedEthThreshold = 0.001 // Pools on Zora need at least 0.1 of trackedEth to be selected
248+
const v4BaseZoraTrackedEthThreshold = 0.001 // Pools on Zora/Clanker need at least 0.001 of trackedEth to be selected
219249
const v4UntrackedUsdThreshold = 0 // v4 subgraph totalValueLockedUSDUntracked returns 0, even with the pools that have appropriate liqudities and correct pool pricing
220250

221251
export const v3TrackedEthThreshold = 0.01 // Pools need at least 0.01 of trackedEth to be selected
@@ -674,7 +704,7 @@ export const chainProtocols = [
674704
true,
675705
v4TrackedEthThreshold,
676706
v4BaseZoraTrackedEthThreshold,
677-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
707+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
678708
v4UntrackedUsdThreshold,
679709
v4SubgraphUrlOverride(ChainId.SEPOLIA)
680710
),
@@ -690,7 +720,7 @@ export const chainProtocols = [
690720
true,
691721
v4TrackedEthThreshold,
692722
v4BaseZoraTrackedEthThreshold,
693-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
723+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
694724
v4UntrackedUsdThreshold,
695725
v4SubgraphUrlOverride(ChainId.ARBITRUM_ONE)
696726
),
@@ -706,7 +736,7 @@ export const chainProtocols = [
706736
true,
707737
v4BaseTrackedEthThreshold,
708738
v4BaseZoraTrackedEthThreshold,
709-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
739+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
710740
v4UntrackedUsdThreshold,
711741
v4SubgraphUrlOverride(ChainId.BASE),
712742
process.env.GRAPH_BEARER_TOKEN
@@ -723,7 +753,7 @@ export const chainProtocols = [
723753
true,
724754
v4TrackedEthThreshold,
725755
v4BaseZoraTrackedEthThreshold,
726-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
756+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
727757
v4UntrackedUsdThreshold,
728758
v4SubgraphUrlOverride(ChainId.POLYGON)
729759
),
@@ -739,7 +769,7 @@ export const chainProtocols = [
739769
true,
740770
v4TrackedEthThreshold,
741771
v4BaseZoraTrackedEthThreshold,
742-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
772+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
743773
v4UntrackedUsdThreshold,
744774
v4SubgraphUrlOverride(ChainId.WORLDCHAIN)
745775
),
@@ -755,7 +785,7 @@ export const chainProtocols = [
755785
true,
756786
v4TrackedEthThreshold,
757787
v4BaseZoraTrackedEthThreshold,
758-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
788+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
759789
v4UntrackedUsdThreshold,
760790
v4SubgraphUrlOverride(ChainId.ZORA)
761791
),
@@ -771,7 +801,7 @@ export const chainProtocols = [
771801
true,
772802
v4TrackedEthThreshold,
773803
v4BaseZoraTrackedEthThreshold,
774-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
804+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
775805
v4UntrackedUsdThreshold,
776806
v4SubgraphUrlOverride(ChainId.UNICHAIN)
777807
),
@@ -794,7 +824,7 @@ export const chainProtocols = [
794824
true,
795825
v4TrackedEthThreshold,
796826
v4BaseZoraTrackedEthThreshold,
797-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
827+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
798828
v4UntrackedUsdThreshold,
799829
v4SubgraphUrlOverride(ChainId.BLAST)
800830
),
@@ -810,7 +840,7 @@ export const chainProtocols = [
810840
true,
811841
v4TrackedEthThreshold,
812842
v4BaseZoraTrackedEthThreshold,
813-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
843+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
814844
v4UntrackedUsdThreshold,
815845
v4SubgraphUrlOverride(ChainId.MAINNET)
816846
),
@@ -833,7 +863,7 @@ export const chainProtocols = [
833863
true,
834864
v4TrackedEthThreshold,
835865
v4BaseZoraTrackedEthThreshold,
836-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
866+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
837867
v4UntrackedUsdThreshold,
838868
v4SubgraphUrlOverride(ChainId.SONEIUM)
839869
),
@@ -849,7 +879,7 @@ export const chainProtocols = [
849879
true,
850880
v4TrackedEthThreshold,
851881
v4BaseZoraTrackedEthThreshold,
852-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
882+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
853883
v4UntrackedUsdThreshold,
854884
v4SubgraphUrlOverride(ChainId.OPTIMISM)
855885
),
@@ -865,7 +895,7 @@ export const chainProtocols = [
865895
true,
866896
v4TrackedEthThreshold,
867897
v4BaseZoraTrackedEthThreshold,
868-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
898+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
869899
v4UntrackedUsdThreshold,
870900
v4SubgraphUrlOverride(ChainId.BNB)
871901
),
@@ -881,7 +911,7 @@ export const chainProtocols = [
881911
true,
882912
v4TrackedEthThreshold,
883913
v4BaseZoraTrackedEthThreshold,
884-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
914+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
885915
v4UntrackedUsdThreshold,
886916
v4SubgraphUrlOverride(ChainId.MONAD),
887917
process.env.GOLD_SKY_BEARER_TOKEN
@@ -898,7 +928,7 @@ export const chainProtocols = [
898928
true,
899929
v4TrackedEthThreshold,
900930
v4BaseZoraTrackedEthThreshold,
901-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
931+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
902932
v4UntrackedUsdThreshold,
903933
v4SubgraphUrlOverride(ChainId.XLAYER),
904934
process.env.GRAPH_BEARER_TOKEN
@@ -915,7 +945,7 @@ export const chainProtocols = [
915945
true,
916946
v4TrackedEthThreshold,
917947
v4BaseZoraTrackedEthThreshold,
918-
ZORA_HOOKS_FOR_V4_SUBGRAPH_FILTERING,
948+
HOOKS_FOR_V4_SUBGRAPH_LOW_TVL_FILTERING,
919949
v4UntrackedUsdThreshold,
920950
v4SubgraphUrlOverride(ChainId.AVALANCHE)
921951
),

lib/util/v4HooksPoolsFiltering.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,34 @@ import {
2626
ZORA_POST_HOOK_ON_BASE_v2_2_1,
2727
ZORA_POST_HOOK_ON_BASE_v2_3_0,
2828
ZORA_POST_HOOK_ON_BASE_v2_4_0,
29+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_BASE,
30+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_BASE,
31+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_BASE_v2,
32+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_BASE_v2,
33+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_ARBITRUM,
34+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_ARBITRUM,
35+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_UNICHAIN,
36+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_UNICHAIN,
37+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_MAINNET,
38+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_MONAD,
2939
} from './hooksAddressesAllowlist'
3040
import { ChainId, Currency, Token } from '@uniswap/sdk-core'
3141
import { PriorityQueue } from '@datastructures-js/priority-queue'
3242
import { ADDRESS_ZERO } from '@uniswap/router-sdk'
3343

44+
const CLANKER_HOOKS = new Set([
45+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_BASE,
46+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_BASE,
47+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_BASE_v2,
48+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_BASE_v2,
49+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_ARBITRUM,
50+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_ARBITRUM,
51+
CLANKER_DYNAMIC_FEE_HOOKS_ADDRESS_ON_UNICHAIN,
52+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_UNICHAIN,
53+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_MAINNET,
54+
CLANKER_STATIC_FEE_HOOKS_ADDRESS_ON_MONAD,
55+
])
56+
3457
type V4PoolGroupingKey = string
3558
const TOP_GROUPED_V4_POOLS = 10
3659

@@ -198,6 +221,13 @@ export function v4HooksPoolsFiltering(chainId: ChainId, pools: Array<V4SubgraphP
198221
}
199222
}
200223

224+
const isClankerPool = CLANKER_HOOKS.has(pool.hooks.toLowerCase())
225+
if (isClankerPool) {
226+
if (pool.tvlETH <= 0.001) {
227+
shouldNotAddV4Pool = true
228+
}
229+
}
230+
201231
if (!shouldNotAddV4Pool) {
202232
v4Pools.push(pool)
203233
}

0 commit comments

Comments
 (0)