GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add Pancakeswap V3 trades support by JohnDoe424242 · Pull Request #376 · uniswap-python/uniswap-python

Conversation

@JohnDoe424242

@JohnDoe424242 JohnDoe424242 commented Jan 19, 2024

Copy link
Copy Markdown

It's not full support for Pancakeswap V3, but now it's possible to recognize prices and make trades. Pancakeswap V3 is almost the same, but there are some differences, support for which I have added. I also added the use_rpc_gas_price option to not send type 2 transactions to BSC. But since BSC is not POS blockchain, in Web3 object you have to manually add geth_poa_middleware.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
-
Add Pancakeswap V3 trades support
20ae24a
@codecov

codecov Bot commented Jan 20, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.93%. Comparing base (59fba76) to head (20ae24a).
⚠️ Report is 38 commits behind head on master.

Files with missing lines Patch % Lines
uniswap/uniswap.py 82.02% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #376      +/-   ##
==========================================
- Coverage   84.20%   83.93%   -0.27%     
==========================================
  Files          11       11              
  Lines        1057     1139      +82     
==========================================
+ Hits          890      956      +66     
- Misses        167      183      +16     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Dewald928

Dewald928 commented Jan 25, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Care to share an example script of how to call this?

Additionally, things that have to change are the pair contract ABI. To make the get_pool_state work.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JohnDoe424242

JohnDoe424242 commented Jan 25, 2024

Copy link
Copy Markdown
Author

@Dewald928 unfortunately pools management is not implemented in this patch, trading only.

Care to share an example script of how to call this?

Nothing in particular, just like the regular code, except for the POA middleware

import uniswap
from web3 import Web3
from web3.middleware import geth_poa_middleware

w3 = Web3(Web3.HTTPProvider('http://node.com', request_kwargs={"timeout": 10}))
w3.middleware_onion.inject(geth_poa_middleware, layer=0) # this

uswap = uniswap.Uniswap('0xADDR',
                        'private_key',
                        web3=w3,
                        version=3,
                        use_rpc_gas_price=True) # to use legacy type 0 transactions

price = uswap.get_price_output('0xTOKEN_ADDR_1',
                               '0xTOKEN_ADDR_2',
                               1000000000,
                               fee=500)

tx_hash = uswap.make_trade_output('0xTOKEN_ADDR_1',
                                  '0xTOKEN_ADDR_2',
                                  1000000000,
                                  fee=500)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hahage21

hahage21 commented Jan 24, 2025

Copy link
Copy Markdown

I use this code but wrong,i dont know how to use the code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@JohnDoe424242 @Dewald928 @hahage21
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.