metadata file no longer limits token and pool processing to approved tokens only
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
metadata='metadata.json' # mounted from a ConfigMap in the k8s yaml
|
|
||||||
rpc_url = '${rpc_urls.finaldata}'
|
rpc_url = '${rpc_urls.finaldata}'
|
||||||
ws_url = ''
|
ws_url = ''
|
||||||
redis_url = ''
|
redis_url = ''
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ class OHLCFile:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def row_bytes(row):
|
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):
|
def flush(self):
|
||||||
# first we write the "final" rows which means rows that have been closed and will get no more data.
|
# 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
|
# write the current row
|
||||||
if self._cur is not None:
|
if self._cur is not None:
|
||||||
data = OHLCFile.row_bytes(self._cur)
|
data = OHLCFile.row_bytes(self._cur)
|
||||||
|
start_of_current_row = self.file.tell()
|
||||||
self.file.write(data)
|
self.file.write(data)
|
||||||
# rewind our file cursor to the beginning of the current row
|
# 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()
|
self.file.flush()
|
||||||
|
|
||||||
def _load(self, earliest_change):
|
def _load(self, earliest_change):
|
||||||
|
|||||||
@@ -44,8 +44,11 @@ async def load_pool(address: str) -> OldPoolDict:
|
|||||||
v3 = UniswapV3Pool(address)
|
v3 = UniswapV3Pool(address)
|
||||||
t0, t1 = await asyncio.gather(v3.token0(), v3.token1())
|
t0, t1 = await asyncio.gather(v3.token0(), v3.token1())
|
||||||
token0, token1 = await asyncio.gather(get_token(t0), get_token(t1))
|
token0, token1 = await asyncio.gather(get_token(t0), get_token(t1))
|
||||||
if (token0 is not None and token1 is not None
|
# This is an old conditional that checks for token approval before handling the data. The backend currently
|
||||||
and (token0['approved'] and token1['approved'] or is_generating_metadata())):
|
# 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()
|
fee = await v3.fee()
|
||||||
if uniswapV3_pool_address(t0, t1, fee) == address: # VALIDATE don't just trust that it's a Uniswap pool
|
if uniswapV3_pool_address(t0, t1, fee) == address: # VALIDATE don't just trust that it's a Uniswap pool
|
||||||
decimals = token0['decimals'] - token1['decimals']
|
decimals = token0['decimals'] - token1['decimals']
|
||||||
|
|||||||
Reference in New Issue
Block a user