Skip to content

Commit

Permalink
fix: adapt to uni v3 quoter v2
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler committed Sep 25, 2023
1 parent b2481ab commit f680e5b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions y/prices/dex/uniswap/v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
Expand Down

0 comments on commit f680e5b

Please sign in to comment.