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 — GitHub - anryko/pairswap: Uniswap Ethereum to token swapping library

BranchesTags
Open more actions menu

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
assets
assets
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pairswap.py
pairswap.py
 
 

Repository files navigation

Pairswap

Example

>>> from pairswap import ETHPair
>>>
>>> TEST_ADDRESS = '0x26fA8aac763B29AFBFEC7F23C85c1da57530781F'
>>> TEST_PRIVATE_KEY = '25954a23ff10562f3d7e34b55faaa920f04cd576380de04a52f187760db28e70'
>>> TEST_PROVIDER = 'wss://kovan.infura.io/ws/v3/ad54ae9fe2a694a99c62e8fb1fba244e'
>>> TEST_BONDLY = '0xde2005691855e2c71864828a531b47c4537659d4'
>>>
>>> pair = ETHPair(
...     address=TEST_ADDRESS,
...     private_key=TEST_PRIVATE_KEY,
...     provider=TEST_PROVIDER,
...     token=TEST_BONDLY,
... )
>>> pair.is_connected
True
>>> pair
<ETHPair(BONDLY)@0x7ff5f320da60>
>>> pair.balance
1.831966236171743
>>> pair.token_balance
119.63256903080517
>>> pair.weth_address
'0x5Ed806391C930321A89c29a1C0dCE237F30012f1'
>>> pair.price
348.0490514924989
>>> pair.token_price
0.001609960895976091
>>> pair.suggest_gas_price()
1800000000
>>> from web3 import Web3
>>> gas_price = Web3.toWei(1, 'gwei')
>>> pair.swap(0.05, gas=200000, gas_price=gas_price)
'0xbd7e8a9c7883ea8c72efa875d0e4466a705f798d81c7b4d2cbeab6461d24f8f4'
>>> pair.wait('0xbd7e8a9c7883ea8c72efa875d0e4466a705f798d81c7b4d2cbeab6461d24f8f4')
AttributeDict({'blockHash'...
>>> pair.balances
(1.781855709171742, 149.55144756540705)
>>> pair.wait(pair.unswap(50, gas=200000, gas_price=gas_price))
AttributeDict({'blockHash'...
>>> pair.balances
(1.862722511685864, 99.55144756540705)

About

Uniswap Ethereum to token swapping library

Resources

Readme
Apache-2.0 license
Activity

Stars

3 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — 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.