Git Product home page Git Product logo

many_abis's Introduction

Many Abis

Version Pypi

GitHub Org's stars GitHub forks


Get different DEX abis easily for blockchain developers.


Now we support dex:



Installation

  • Download
pip install many-abis

# pypi
pip install -i https://pypi.org/simple many-abis

# update
pip install -U many-abis
# or
pip install -U -i https://pypi.org/simple many-abis

Usage

  • Get dex and eth from default settings.
import many_abis as ma

# ===================================
# chain, use upper str to access
chain = ma.get('BSC')

# for now, we collect this chains
support_chains = ma.SUPPORT_CHAIN
print(support_chains)
# ['BSC', 'ETH', 'AVAX', 'FANTOM', 'POLYGON', 'HECO', 'KCC', 'OKEX', 'MOONRIVER', 'ARBITRUM', 'BSC_TEST']

# print basic chain information
print(chain)
# Chain Name: Binance Smart Chain, Explorer: https://bscscan.com/, DEX: dict_keys(['pancake_v2', 'mdex_bsc', 'apeswap', 'biswap', 'jul'])

# all chain keys
print(chain.keys())
# dict_keys(['name', 'explorer', 'weth', 'coins', 'charts', 'rpcs', 'chain_id', 'dex'])

# you can use "." to access value
print(chain.coins)
# {'BUSD': '0xe9e7cea3dedca5984780bafc599bd69add087d56', 'USDT': '0x55d398326f99059ff775485246999027b3197955', 'USDC': '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d'}

# you can also use dict like format
print(chain['weth'])
# {'name': 'Wrapped BNB', 'symbol': 'WBNB', 'address': '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', 'abi': xxxx}

# ===================================
# dex, you should use upper str chain name, an lower str dex name
joe = ma.get('AVAX', 'joe')

# print basic dex information
print(joe)
# DEX Name: traderjoexyz, Website: https://traderjoexyz.com/#/home, Router: 0x60ae616a2155ee3d9a68541ba4544862310933d4, Factory: 0x9ad6c38be94206ca50bb0d90783181662f0cfa10

# all dex keys
print(joe.keys())
# dict_keys(['name', 'router_address', 'router_abi', 'factory_address', 'factory_abi', 'lp_abi', 'website'])

# use "." to access value
print(joe.router_address)

# use dict like format
print(joe['factory_address'])
  • Print all supported chains and dexs.
ma.print_all_dex()

# output
----------------------
- BSC:
  - [1] [PancakeSwap v2](https://exchange.pancakeswap.finance/#/swap)
  - [2] [MDEX (BSC)](https://bsc.mdex.co/#/swap/)
  - [3] [ApeSwap Finance](https://app.apeswap.finance/swap)
  - [4] [BiSwap](https://exchange.biswap.org/#/swap)
  - [5] [Just Liquidity](https://dexbeta.julswap.com/)
- ETH:
  - [1] [Uniswap V2](https://app.uniswap.org/)
- AVAX:
  - [1] [traderjoexyz](https://traderjoexyz.com/#/home)
- FANTOM:
  - [1] [SpookySwap](https://spookyswap.finance/)
  - [2] [SpiritSwap](https://www.spiritswap.finance/)
- POLYGON:
  - [1] [QuickSwap](https://quickswap.exchange/)
- CRONOS:
  - [1] [Mad Meerkat Finance](https://mm.finance/swap)
- HECO:
  - [1] [MDEX (HECO)](https://ht.mdex.co/#/swap/)
- KCC:
  - [1] [KoffeeSwap](https://koffeeswap.exchange/)
- OKEX:
  - [1] [CherrySwap](https://www.cherryswap.net/)
  - [2] [JSwap](https://app.jswap.finance/)
  - [3] [PandaSwap](https://app.pandaex.org/)
- MOONRIVER:
  - [1] [Solarbeam](https://app.solarbeam.io/exchange/swap)
- ARBITRUM:
  - [1] [SushiSwap](https://app.sushi.com/en/swap)
- BSC_TEST:
  - [1] [PancakeSwap v2 (TEST)]()
  • If one DEX contract is not in the default settings, we can get abis from the contract address.

  • you need to specify your api_key from the Block Explorer.

  • KCC is not supported!

Here is an example to access open source dex abi from address.

from many_abis.utils.enums.chain_rpc_enum import CHAIN_RPC_API as rpc
from many_abis.utils.enums.contract_api_enum import CHAIN_CONTRACT_API as contract_api
from many_abis.utils.tools import get_factory_from_router, get_abi_from_address, create_dex_router

# get router
pancake = create_dex_router('BSC', 'pancake-v2')
print(pancake)

# get router abi
abi = get_abi_from_address('0x10ED43C718714eb63d5aA57B78B54704E256024E', 'YOUR_API_KEY', chain_api=contract_api.BSC)

# get factory abi
factory_address, factory_abi = get_factory_from_router('0x10ED43C718714eb63d5aA57B78B54704E256024E', 'YOUR_API_KEY',
                                                       chain_api=contract_api.BSC, rpc=rpc.BSC)

many_abis's People

Contributors

ackness avatar soulmachine avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.