Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adapt to uni v3 quoter v2 #370

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading