diff --git a/conf/finaldata/metadata-finaldata.json b/conf/finaldata/metadata-finaldata.json new file mode 100644 index 0000000..51342e7 --- /dev/null +++ b/conf/finaldata/metadata-finaldata.json @@ -0,0 +1 @@ +{"421614":{"t":[{"a":"0xC285286254318d1dFC9D58F55C3910d8E28e19B4","n":"Wrapped Ether","s":"WETH","d":18,"x":{"mock":true}},{"a":"0x1feCc53911C2fFeC5B12b805C5b49bE60bB544fF","n":"USD Coin","s":"USDC","d":6,"x":{"mock":true}}],"p":[{"a":"0xe6022A376189734F3Cd6Cd63872b7649A00294d8","b":"0x1feCc53911C2fFeC5B12b805C5b49bE60bB544fF","q":"0xC285286254318d1dFC9D58F55C3910d8E28e19B4","f":500,"e":1,"d":-12,"x":{"data":{"uri":"https://beta.dexorder.trade/ohlc/","chain":42161,"symbol":"0xC6962004f452bE9203591991D15f6b388e09E8D0","inverted":true}}}]}} \ No newline at end of file diff --git a/src/dexorder/bin/backfill_ohlc.py b/src/dexorder/bin/backfill_ohlc.py index 6ad23ed..f20def7 100644 --- a/src/dexorder/bin/backfill_ohlc.py +++ b/src/dexorder/bin/backfill_ohlc.py @@ -25,7 +25,7 @@ log = logging.getLogger('dexorder.backfill') async def finalize_callback(fork: Fork, diffs: Reversible[Union[DiffItem, DiffEntryItem]]): ohlc_save(fork, diffs) - ts = await get_block_timestamp(fork.head, fork.height) + ts = await get_block_timestamp(fork.head) log.info(f'backfill completed through block {fork.height} {from_timestamp(ts):%Y-%m-%d %H:%M:%S}') diff --git a/src/dexorder/bin/finaldata.py b/src/dexorder/bin/finaldata.py index abf809b..5ce7034 100644 --- a/src/dexorder/bin/finaldata.py +++ b/src/dexorder/bin/finaldata.py @@ -29,9 +29,9 @@ ohlcs = FinalOHLCRepository() async def handle_backfill_uniswap_swaps(swaps: list[EventData]): # asynchronously prefetch the block timestamps we'll need - block_ids = set((swap['blockHash'], swap['blockNumber']) for swap in swaps) + block_ids = set(swap['blockHash'] for swap in swaps) for batch in itertools.batched(block_ids, 4): - await asyncio.gather(*[get_block_timestamp(h,n) for h, n in batch]) + await asyncio.gather(*[get_block_timestamp(h) for h in batch]) # now execute the swaps synchronously for swap in swaps: diff --git a/src/dexorder/event_handler.py b/src/dexorder/event_handler.py index 2b835b5..8363f0e 100644 --- a/src/dexorder/event_handler.py +++ b/src/dexorder/event_handler.py @@ -135,9 +135,9 @@ async def handle_transfer(transfer: EventData): async def handle_uniswap_swaps(swaps: list[EventData]): # asynchronously prefetch the block timestamps we'll need - block_ids = set((swap['blockHash'], swap['blockNumber']) for swap in swaps) + block_ids = set(swap['blockHash'] for swap in swaps) for batch in itertools.batched(block_ids, 4): - await asyncio.gather(*[get_block_timestamp(h,n) for h, n in batch]) + await asyncio.gather(*[get_block_timestamp(h) for h in batch]) # now execute the swaps synchronously for swap in swaps: diff --git a/src/dexorder/ohlc.py b/src/dexorder/ohlc.py index 3cff509..5a940e7 100644 --- a/src/dexorder/ohlc.py +++ b/src/dexorder/ohlc.py @@ -377,7 +377,7 @@ class OHLCRepository: root_branch = current_blockstate.get().root_branch root_hash = root_branch.head if root_hash is not None: - root_timestamp = await get_block_timestamp(root_hash, root_branch.height) + root_timestamp = await get_block_timestamp(root_hash) oldest_needed = from_timestamp(root_timestamp) - period # noinspection PyTypeChecker trim = (oldest_needed - historical[0].start) // period diff --git a/src/dexorder/pools.py b/src/dexorder/pools.py index 5e1df21..7339c96 100644 --- a/src/dexorder/pools.py +++ b/src/dexorder/pools.py @@ -118,6 +118,6 @@ async def get_uniswap_data(swap: EventData) -> Optional[tuple[OldPoolDict, datet if pool['exchange'] != Exchange.UniswapV3.value: return None price: dec = await uniswap_price(pool, sqrt_price) - timestamp = await get_block_timestamp(swap['blockHash'], swap['blockNumber']) + timestamp = await get_block_timestamp(swap['blockHash']) dt = from_timestamp(timestamp) return pool, dt, price