Skip to content

Commit

Permalink
Update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Oct 26, 2023
1 parent 178a4bf commit 2de87cd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Current

- Fix: `swap_with_slippage_protection()` interpreted `max_slippage` as percent,
even though the doc string says BPS
- Fix: `swap_with_slippage_protection(max_slippage)` is BPS
- API change: `swap_with_slippage_protection(max_slippage=15)` - change the default Uniswap v3
trade slippage tolerance from (unrealistic) 0.1 BPS to 15 BPS.

Expand Down
14 changes: 12 additions & 2 deletions eth_defi/uniswap_v3/swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def swap_with_slippage_protection(
:param amount_out: How much of the base token we want to receive, this has to be `None` if `amount_in` is specified
:param max_slippage:
Max slippage express in bps, default = 5 bps (0.05%)
Max slippage express in BPS.
The default is 15 BPS (0.15%)
:param deadline: Time limit of the swap transaction, by default = forever (no deadline)
:return: Prepared swap function which can be used directly to build transaction
Expand Down Expand Up @@ -120,7 +122,15 @@ def swap_with_slippage_protection(

# Because slippage tolerance errors are very annoying to diagnose,
# try to capture as much possible diagnostics data to logs
logger.info("exactInput() amount in: %s, estimated_min_amount_out: %s, slippage tolerance: %f BPS, fees: %s, path: %s, block: %d", amount_in, estimated_min_amount_out, max_slippage, pool_fees, path, block_number)
logger.info(
"exactInput() amount in: %s, estimated_min_amount_out: %s, slippage tolerance: %f BPS, fees: %s, path: %s, block: %d",
amount_in,
estimated_min_amount_out,
max_slippage,
pool_fees,
path,
block_number,
)

return router.functions.exactInput(
(
Expand Down

0 comments on commit 2de87cd

Please sign in to comment.