From 1673e6ee5a694f33522533330c1819580fe86f63 Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Mon, 25 Sep 2023 16:59:09 -0400 Subject: [PATCH] fix: adapt to uni v3 quoter v2 (#370) --- y/prices/dex/uniswap/v3.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/y/prices/dex/uniswap/v3.py b/y/prices/dex/uniswap/v3.py index 59bec0e24..b478aba1b 100644 --- a/y/prices/dex/uniswap/v3.py +++ b/y/prices/dex/uniswap/v3.py @@ -134,16 +134,14 @@ async def get_price( # TODO make this properly async after extending for brownie ContractTx results = await fetch_multicall( - *[ - [quoter, 'quoteExactInput', self._encode_path(path), amount_in] - for path in paths - ], + *[[quoter, 'quoteExactInput', self._encode_path(path), amount_in] for path in paths], block=block, sync=False ) + # Quoter v2 uses this weird return struct, we must unpack it to get amount out. outputs = [ - amount / self._undo_fees(path) / 1e6 + (amount if isinstance(amount, int) else amount[0]) / self._undo_fees(path) / 1e6 for amount, path in zip(results, paths) if amount ]