Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Pancakeswap V3 trades support#376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
JohnDoe424242 wants to merge1 commit intouniswap-python:master
base:master
Choose a base branch
Loading
fromJohnDoe424242:master

Conversation

JohnDoe424242
Copy link

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 theuse_rpc_gas_price option to not sendtype 2 transactions to BSC. But since BSC is not POS blockchain, in Web3 object you have to manually addgeth_poa_middleware.

@codecovCodecov
Copy link

codecovbot commentedJan 20, 2024
edited
Loading

Codecov Report

Attention: Patch coverage is83.33333% with16 lines in your changes missing coverage. Please review.

Project coverage is 83.93%. Comparing base(59fba76) to head(20ae24a).
Report is 4 commits behind head on master.

Files with missing linesPatch %Lines
uniswap/uniswap.py82.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 Sentry.
📢 Have feedback on the report?Share it here.

@Dewald928
Copy link

Dewald928 commentedJan 25, 2024
edited
Loading

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

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

@JohnDoe424242
Copy link
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 uniswapfrom web3 import Web3from web3.middleware import geth_poa_middlewarew3 = Web3(Web3.HTTPProvider('http://node.com', request_kwargs={"timeout": 10}))w3.middleware_onion.inject(geth_poa_middleware, layer=0) # thisuswap = uniswap.Uniswap('0xADDR',                        'private_key',                        web3=w3,                        version=3,                        use_rpc_gas_price=True) # to use legacy type 0 transactionsprice = 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)

@hahage21
Copy link

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

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@JohnDoe424242@Dewald928@hahage21

[8]ページ先頭

©2009-2025 Movatter.jp