Skip to content

Commit

Permalink
Add more helpful logging
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Nov 6, 2024
1 parent 9c6bec6 commit 14423ed
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions eth_defi/uniswap_v2/swap.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Uniswap v2 swap helper functions."""
import warnings
from typing import Callable, Optional
import logging

from eth_typing import HexAddress
from web3.contract import Contract
Expand All @@ -10,6 +11,9 @@
from eth_defi.uniswap_v2.fees import estimate_buy_price, estimate_sell_price


logger = logging.getLogger(__name__)


def swap_with_slippage_protection(
uniswap_v2_deployment: UniswapV2Deployment,
*,
Expand Down Expand Up @@ -136,6 +140,14 @@ def swap_with_slippage_protection(
if intermediate_token:
path = [quote_token.address, intermediate_token.address, base_token.address]

logger.info(
"swap_with_slippage_protection()\npath: %s\nmax_slippage: %s (BPS)\nfee: %s\ndeadline: %s",
path,
max_slippage,
fee,
deadline,
)

if amount_in:
assert amount_out is None, "amount_in is specified, amount_out has to be None"

Expand Down

0 comments on commit 14423ed

Please sign in to comment.