Table of Contents

Crypto: Collecting tokens and pairs from DEX

So lately, I've been working on restoring more of my blockchain management system (with the ultimate goal to get back to some arbitrage experiments 😎), and right now, I have a first version of a “Binance Smart Chain” blockchain, “ERC20” compatible Token and Pair classes, and “PancakeSwap” DEX based on a unified “UniswapBase” exchange representation.

And from the PanscakeSwap DEX (ie. Decentralized exchange) object I can request to collect all the pairs available on the exchange and all the tokens used in those pairs, to store information about them in a database. It's working pretty well already, but I still have a few exceptions from time to time due to very specific errors, and I'm still in the process of collecting the pairs only for PancakeSwap (version 1 I mean 😅): there are about 133K pairs already there!

What I will do here is to provide some improvements/extensions around this concept to try to improve it further, so let's get to work!

Example of strange issue: nul character in symbol

Finding token by address or symbol

Each DEX is already aware of its parent blockchain, so we don't have to specify it on the command line above.

Using multiple provider urls

Error retrieving token names

When we call the same function with a valid contract we get a lot of bytes in the HexBytes() of course.

Consolidating pairs/tokens databases

Conclusion