Skip to content

Commit e043be0

Browse files
Adam BaloghAdam Balogh
authored andcommitted
fix filtering
1 parent 9c3521e commit e043be0

1 file changed

Lines changed: 2 additions & 15 deletions

File tree

defi/pools/protocol.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def get_pools(self, query: PoolQuery) -> List[Pool]:
8585
Get pools that match the query criteria
8686
"""
8787
# Collect all pools from relevant protocols
88-
all_pools = []
88+
all_pools: List[Pool] = []
8989
for protocol_name, pools in self.pools_cache.items():
9090
if query.protocols and protocol_name not in query.protocols:
9191
continue
@@ -99,20 +99,7 @@ def get_pools(self, query: PoolQuery) -> List[Pool]:
9999

100100
# Token filter (match any token by address or symbol)
101101
if query.tokens:
102-
pool_token_addresses = [t.address.lower() for t in pool.tokens]
103-
pool_token_symbols = [t.symbol.lower() for t in pool.tokens]
104-
105-
token_match = False
106-
for token in query.tokens:
107-
token_lower = token.lower()
108-
if (
109-
token_lower in pool_token_addresses
110-
or token_lower in pool_token_symbols
111-
):
112-
token_match = True
113-
break
114-
115-
if not token_match:
102+
if not all([t.address in query.tokens for t in pool.tokens]):
116103
continue
117104

118105
# Stablecoin filter

0 commit comments

Comments
 (0)