Skip to content
Closed
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"makefile.extensionOutputFolder": "./.vscode"
}
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[tool.poetry]
name = "uniswap-python"
version = "0.7.2" # this is automatically set in CI on tagged releases (before pushed to PyPI)
name = "uniswap-python-route"
version = "0.7.2"
description = "An unofficial Python wrapper for the decentralized exchange Uniswap"
repository = "https://github.com/shanefontaine/uniswap-python"
repository = "https://github.com/starascendin/uniswap-python"
readme = "README.md"
keywords = ["uniswap", "ethereum", "exchange", "trading"]
authors = ["Shane Fontaine <[email protected]>", "Erik Bjäreholt <[email protected]>"]
Expand Down
20 changes: 19 additions & 1 deletion uniswap/uniswap.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ def make_trade(
fee: Optional[int] = None,
slippage: Optional[float] = None,
fee_on_transfer: bool = False,
route: Optional[List[AddressLike]] = None,
) -> HexBytes:
"""Make a trade by defining the qty of the input token."""
if not isinstance(qty, int):
Expand Down Expand Up @@ -478,6 +479,7 @@ def make_trade(
fee,
slippage,
fee_on_transfer,
route=route
)

@check_approval
Expand Down Expand Up @@ -695,6 +697,7 @@ def _token_to_token_swap_input(
fee: int,
slippage: float,
fee_on_transfer: bool = False,
route: Optional[List[AddressLike]] = None,
) -> HexBytes:
"""Convert tokens to tokens given an input amount."""
# Balance check
Expand Down Expand Up @@ -733,7 +736,7 @@ def _token_to_token_swap_input(
min_tokens_bought = int(
(1 - slippage)
* self._get_token_token_input_price(
input_token, output_token, qty, fee=fee
input_token, output_token, qty, fee=fee, route=route
)
)
if fee_on_transfer:
Expand All @@ -742,6 +745,21 @@ def _token_to_token_swap_input(
)
else:
func = self.router.functions.swapExactTokensForTokens

camelot_dex_arbitrum_router_addr = "0xc873fEcbd354f5A56E00E710B90EF4201db2448d"
if self.router.address == camelot_dex_arbitrum_router_addr:
logger.info("Using CamelotDex Arbitrum Router....")
return self._build_and_send_tx(
func(
qty,
min_tokens_bought,
[input_token, output_token],
recipient,
'0x0000000000000000000000000000000000000000',
self._deadline(),
),
)

return self._build_and_send_tx(
func(
qty,
Expand Down