René's URL Explorer Experiment


Title: Fails when swapping USDT=>WBNB · Issue #363 · uniswap-python/uniswap-python · GitHub

Open Graph Title: Fails when swapping USDT=>WBNB · Issue #363 · uniswap-python/uniswap-python

X Title: Fails when swapping USDT=>WBNB · Issue #363 · uniswap-python/uniswap-python

Description: I was trying to swap from USDT => BNB but had incorrectly set the address of BNB to WBNB address by mistake. I came across an error from pancake swap saying IDENTICAL ADDRESSES and after stepping through the call stack I could see when i...

Open Graph Description: I was trying to swap from USDT => BNB but had incorrectly set the address of BNB to WBNB address by mistake. I came across an error from pancake swap saying IDENTICAL ADDRESSES and after stepping t...

X Description: I was trying to swap from USDT => BNB but had incorrectly set the address of BNB to WBNB address by mistake. I came across an error from pancake swap saying IDENTICAL ADDRESSES and after steppin...

Opengraph URL: https://github.com/uniswap-python/uniswap-python/issues/363

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fails when swapping USDT=\u003eWBNB","articleBody":"I was trying to swap from USDT =\u003e BNB but had incorrectly set the address of BNB to WBNB address by mistake. I came across an error from pancake swap saying IDENTICAL ADDRESSES and after stepping through the call stack I could see when its building the txn the second element is the same as the last 3rd element in the routing list. This doesn't cause problems when swapping from USDT to native BNB, but it does cause problems when swapping USDT =\u003e WBNB.\r\n\r\nIs there a reason weth have to be in the routing chain? Can't it just be a chain input/output?\r\n\r\n```python\r\n#v2 uniswap being used here\r\n        elif self.version == 2:\r\n            min_tokens_bought = int(\r\n                (1 - slippage)\r\n                * self._get_token_token_input_price(\r\n                    input_token, output_token, qty, fee=fee\r\n                )\r\n            )\r\n            if fee_on_transfer:\r\n                func = (\r\n                    self.router.functions.swapExactTokensForTokensSupportingFeeOnTransferTokens\r\n                )\r\n            else:\r\n                func = self.router.functions.swapExactTokensForTokens\r\n\r\n            return self._build_and_send_tx(\r\n                func(\r\n                    qty,\r\n                    min_tokens_bought,\r\n                    [input_token, self.get_weth_address(), output_token],\r\n                    recipient,\r\n                    self._deadline(),\r\n                ),\r\n            )\r\n```\r\n\r\nFull function\r\n```python\r\n    def _token_to_token_swap_input(\r\n        self,\r\n        input_token: AddressLike,\r\n        output_token: AddressLike,\r\n        qty: int,\r\n        recipient: Optional[AddressLike],\r\n        fee: int,\r\n        slippage: float,\r\n        fee_on_transfer: bool = False,\r\n    ) -\u003e HexBytes:\r\n        \"\"\"Convert tokens to tokens given an input amount.\"\"\"\r\n        # Balance check\r\n        input_balance = self.get_token_balance(input_token)\r\n        if qty \u003e input_balance:\r\n            raise InsufficientBalance(input_balance, qty)\r\n\r\n        if recipient is None:\r\n            recipient = self.address\r\n\r\n        if input_token == ETH_ADDRESS:\r\n            raise ValueError\r\n        elif output_token == ETH_ADDRESS:\r\n            raise ValueError\r\n\r\n        if self.version == 1:\r\n            token_funcs = self._exchange_contract(input_token).functions\r\n            # TODO: This might not be correct\r\n            min_tokens_bought, min_eth_bought = self._calculate_max_output_token(\r\n                input_token, qty, output_token\r\n            )\r\n            func_params = [\r\n                qty,\r\n                min_tokens_bought,\r\n                min_eth_bought,\r\n                self._deadline(),\r\n                output_token,\r\n            ]\r\n            if not recipient:\r\n                function = token_funcs.tokenToTokenSwapInput(*func_params)\r\n            else:\r\n                func_params.insert(len(func_params) - 1, recipient)\r\n                function = token_funcs.tokenToTokenTransferInput(*func_params)\r\n            return self._build_and_send_tx(function)\r\n        elif self.version == 2:\r\n            min_tokens_bought = int(\r\n                (1 - slippage)\r\n                * self._get_token_token_input_price(\r\n                    input_token, output_token, qty, fee=fee\r\n                )\r\n            )\r\n            if fee_on_transfer:\r\n                func = (\r\n                    self.router.functions.swapExactTokensForTokensSupportingFeeOnTransferTokens\r\n                )\r\n            else:\r\n                func = self.router.functions.swapExactTokensForTokens\r\n    \r\n            return self._build_and_send_tx(\r\n                func(\r\n                    qty,\r\n                    min_tokens_bought,\r\n                    [input_token, self.get_weth_address(), output_token],\r\n                    recipient,\r\n                    self._deadline(),\r\n                ),\r\n            )\r\n        elif self.version == 3:\r\n            if fee_on_transfer:\r\n                raise Exception(\"fee on transfer not supported by Uniswap v3\")\r\n\r\n            min_tokens_bought = int(\r\n                (1 - slippage)\r\n                * self._get_token_token_input_price(\r\n                    input_token, output_token, qty, fee=fee\r\n                )\r\n            )\r\n            sqrtPriceLimitX96 = 0\r\n\r\n            return self._build_and_send_tx(\r\n                self.router.functions.exactInputSingle(\r\n                    {\r\n                        \"tokenIn\": input_token,\r\n                        \"tokenOut\": output_token,\r\n                        \"fee\": fee,\r\n                        \"recipient\": recipient,\r\n                        \"deadline\": self._deadline(),\r\n                        \"amountIn\": qty,\r\n                        \"amountOutMinimum\": min_tokens_bought,\r\n                        \"sqrtPriceLimitX96\": sqrtPriceLimitX96,\r\n                    }\r\n                ),\r\n                self._get_tx_params(),\r\n            )\r\n        else:\r\n            raise ValueError  # pragma: no cover\r\n```","author":{"url":"https://github.com/RoscoeTheDog","@type":"Person","name":"RoscoeTheDog"},"datePublished":"2023-12-24T07:53:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/363/uniswap-python/issues/363"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:128586e6-c415-b802-7ac7-55745eb47aad
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB9F2:2C3E22:376C430:485E1EC:696B9BDE
html-safe-nonce461a680b380b0e038c20e96e89c3c7ffee32be35e6b22d4e790c2a62db61ce3d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOUYyOjJDM0UyMjozNzZDNDMwOjQ4NUUxRUM6Njk2QjlCREUiLCJ2aXNpdG9yX2lkIjoiODcwMjExMTc1NjQ5MTM5ODExMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac7d6d0c6c0abadb1647715c9a7f47617f072230dd60d158699d1eee8bfa619994
hovercard-subject-tagissue:2055018106
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/uniswap-python/uniswap-python/363/issue_layout
twitter:imagehttps://opengraph.githubassets.com/181166ba6288c51b095d29e503dde3591957b640231939f4c4762d428352adef/uniswap-python/uniswap-python/issues/363
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/181166ba6288c51b095d29e503dde3591957b640231939f4c4762d428352adef/uniswap-python/uniswap-python/issues/363
og:image:altI was trying to swap from USDT => BNB but had incorrectly set the address of BNB to WBNB address by mistake. I came across an error from pancake swap saying IDENTICAL ADDRESSES and after stepping t...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameRoscoeTheDog
hostnamegithub.com
expected-hostnamegithub.com
None5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d
turbo-cache-controlno-preview
go-importgithub.com/uniswap-python/uniswap-python git https://github.com/uniswap-python/uniswap-python.git
octolytics-dimension-user_id84646677
octolytics-dimension-user_loginuniswap-python
octolytics-dimension-repository_id163547548
octolytics-dimension-repository_nwouniswap-python/uniswap-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id163547548
octolytics-dimension-repository_network_root_nwouniswap-python/uniswap-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release82560a55c6b2054555076f46e683151ee28a19bc
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/issues/363#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Funiswap-python%2Funiswap-python%2Fissues%2F363
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Funiswap-python%2Funiswap-python%2Fissues%2F363
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=uniswap-python%2Funiswap-python
Reloadhttps://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/issues/363
Reloadhttps://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/issues/363
Reloadhttps://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/issues/363
uniswap-python https://patch-diff.githubusercontent.com/uniswap-python
uniswap-pythonhttps://patch-diff.githubusercontent.com/uniswap-python/uniswap-python
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Funiswap-python%2Funiswap-python
Fork 383 https://patch-diff.githubusercontent.com/login?return_to=%2Funiswap-python%2Funiswap-python
Star 1k https://patch-diff.githubusercontent.com/login?return_to=%2Funiswap-python%2Funiswap-python
Code https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python
Issues 57 https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/issues
Pull requests 16 https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/pulls
Discussions https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/discussions
Actions https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/actions
Projects 0 https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/projects
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/security
Please reload this pagehttps://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/issues/363
Insights https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/pulse
Code https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python
Issues https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/issues
Pull requests https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/pulls
Discussions https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/discussions
Actions https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/actions
Projects https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/projects
Security https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/security
Insights https://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/uniswap-python/uniswap-python/issues/363
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/uniswap-python/uniswap-python/issues/363
Fails when swapping USDT=>WBNBhttps://patch-diff.githubusercontent.com/uniswap-python/uniswap-python/issues/363#top
bugSomething isn't workinghttps://github.com/uniswap-python/uniswap-python/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/RoscoeTheDog
https://github.com/RoscoeTheDog
RoscoeTheDoghttps://github.com/RoscoeTheDog
on Dec 24, 2023https://github.com/uniswap-python/uniswap-python/issues/363#issue-2055018106
bugSomething isn't workinghttps://github.com/uniswap-python/uniswap-python/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.