metadata file no longer limits token and pool processing to approved tokens only

This commit is contained in:
tim
2024-08-04 21:50:44 -04:00
parent 96f57ceebd
commit 01553ae342
3 changed files with 9 additions and 5 deletions

View File

@@ -1,4 +1,3 @@
metadata='metadata.json' # mounted from a ConfigMap in the k8s yaml
rpc_url = '${rpc_urls.finaldata}'
ws_url = ''
redis_url = ''

View File

@@ -144,7 +144,7 @@ class OHLCFile:
@staticmethod
def row_bytes(row):
return (','.join(str(c) for c in row)+'\n').encode('ascii')
return (','.join([str(row[0])] + [f'{c:f}' for c in row[1:]])+'\n').encode('ascii')
def flush(self):
# first we write the "final" rows which means rows that have been closed and will get no more data.
@@ -157,9 +157,11 @@ class OHLCFile:
# write the current row
if self._cur is not None:
data = OHLCFile.row_bytes(self._cur)
start_of_current_row = self.file.tell()
self.file.write(data)
# rewind our file cursor to the beginning of the current row
self.file.seek(len(data), os.SEEK_END)
self.file.seek(start_of_current_row)
log.debug(f'flushing {self.filename}')
self.file.flush()
def _load(self, earliest_change):

View File

@@ -44,8 +44,11 @@ async def load_pool(address: str) -> OldPoolDict:
v3 = UniswapV3Pool(address)
t0, t1 = await asyncio.gather(v3.token0(), v3.token1())
token0, token1 = await asyncio.gather(get_token(t0), get_token(t1))
if (token0 is not None and token1 is not None
and (token0['approved'] and token1['approved'] or is_generating_metadata())):
# This is an old conditional that checks for token approval before handling the data. The backend currently
# handles all pools and token regardless of approval.
# if (token0 is not None and token1 is not None
# and (token0['approved'] and token1['approved'] or is_generating_metadata())):
if token0 is not None and token1 is not None:
fee = await v3.fee()
if uniswapV3_pool_address(t0, t1, fee) == address: # VALIDATE don't just trust that it's a Uniswap pool
decimals = token0['decimals'] - token1['decimals']