From 16fffdb80b59f674d822befc4a0da3a733de3881 Mon Sep 17 00:00:00 2001 From: King Diamond Ape Date: Sat, 5 Mar 2022 11:34:24 -0500 Subject: [PATCH 1/4] BL: adding route support --- .vscode/settings.json | 3 +++ pyproject.toml | 2 +- uniswap/uniswap.py | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..65e1ec0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "makefile.extensionOutputFolder": "./.vscode" +} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 964f7b4..3a1f87b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "uniswap-python" -version = "0.5.5" +version = "0.5.5.a" description = "An unofficial Python wrapper for the decentralized exchange Uniswap" repository = "https://github.com/shanefontaine/uniswap-python" readme = "README.md" diff --git a/uniswap/uniswap.py b/uniswap/uniswap.py index ccc5639..e6948a9 100644 --- a/uniswap/uniswap.py +++ b/uniswap/uniswap.py @@ -401,6 +401,7 @@ def make_trade( fee: int = None, slippage: 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 fee is None: @@ -431,6 +432,7 @@ def make_trade( fee, slippage, fee_on_transfer, + route=route ) @check_approval @@ -652,6 +654,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 @@ -690,7 +693,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: From da2d791816fbe9644112482d2836e197eb7f6684 Mon Sep 17 00:00:00 2001 From: King Diamond Ape Date: Sat, 5 Mar 2022 11:40:13 -0500 Subject: [PATCH 2/4] BL: 0.5.5.5.2 --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3a1f87b..2e3d6ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [tool.poetry] -name = "uniswap-python" -version = "0.5.5.a" +name = "uniswap-python-route" +version = "0.5.5.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 ", "Erik Bjäreholt "] From 0652a2f2c384fd8d01a79dc50ac00a4dd0b0b219 Mon Sep 17 00:00:00 2001 From: King Diamond Ape Date: Sun, 6 Mar 2022 22:37:04 -0500 Subject: [PATCH 3/4] code cleanup --- .vscode/settings.json | 3 --- pyproject.toml | 4 ++-- uniswap/uniswap.py | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 65e1ec0..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "makefile.extensionOutputFolder": "./.vscode" -} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 2e3d6ac..011979d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] -name = "uniswap-python-route" -version = "0.5.5.2" +name = "uniswap-python" +version = "0.5.5" description = "An unofficial Python wrapper for the decentralized exchange Uniswap" repository = "https://github.com/starascendin/uniswap-python" readme = "README.md" diff --git a/uniswap/uniswap.py b/uniswap/uniswap.py index e6948a9..c7d7e56 100644 --- a/uniswap/uniswap.py +++ b/uniswap/uniswap.py @@ -284,6 +284,7 @@ def _get_token_token_input_price( logger.warning(f"No route specified, assuming route: {route}") if self.version == 2: + # BL: This is where route param gets called price: int = self.router.functions.getAmountsOut(qty, route).call()[-1] elif self.version == 3: if route: From e77d98b2bcc7a05363d3a9e0f2094be2f37f7ccb Mon Sep 17 00:00:00 2001 From: King Diamond Ape Date: Sun, 6 Mar 2022 22:38:44 -0500 Subject: [PATCH 4/4] clean up code --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 011979d..964f7b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "uniswap-python" version = "0.5.5" description = "An unofficial Python wrapper for the decentralized exchange Uniswap" -repository = "https://github.com/starascendin/uniswap-python" +repository = "https://github.com/shanefontaine/uniswap-python" readme = "README.md" keywords = ["uniswap", "ethereum", "exchange", "trading"] authors = ["Shane Fontaine ", "Erik Bjäreholt "] pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy