5️⃣ Complete List of ALL Your Tokens and their Balances - SafeKeep Countdown #5 | Covalent

## Aug 3, 2020

TLDR; SafeKeep is the only DeFi portfolio tracker that displays all of your DeFi assets in one place. This includes Uniswap trading pairs, TokenSet trading sets, Balancer pools and more.

## Countdown #5: Complete List of ALL Your Tokens and their Balances

In the early days of crypto, times were simpler. There were only a dozen or so crypto assets and for crypto’s early-adopters it was relatively easy to keep track of all the ones they had in their portfolio.

As time went on, Ethereum paved the way for a Cambrian explosion of cryptocurrencies for all different sorts of functionalities. The permissionless and composable nature of blockchains allows an almost infinite number of combinations.

This creates a visibility problem for modern crypto investors, especially the sophisticated DeFi investor trying out new protocols such as Uniswap. How can one possibly keep track of all the assets that they are currently holding, and potential future ones as well?

### SafeKeep allows a full display of all of your ERC20 tokens.

Right now, every major portfolio tracker has a whitelist of assets to track. But there are over 200,000 ERC20 contracts today on the Ethereum blockchain and the pace of growth of new ERC20 tokens is accelerating. The only way to track all of these assets is by indexing the entire blockchain, which is what the underlying Covalent technology behind SafeKeep does.

Take for example, the demo.eth address. There are 63 ERC20-based assets within this account. SafeKeep is the only crypto portfolio tracking app that is able to display all of these to the end user. Scroll down to the bottom of this post to read the technical explanation of why this is the case.

We categorize them as Stablecoins, Cryptocurrency tokens and Dust. Sometimes, it’s not possible to get a price for an ERC20 token because they are not listed on any exchanges and so we hide the “Dust” tokens by default.

### Permisionless asset generation with Uniswap, Balancer and Tokensets

DeFi protocols such as Tokensets, Uniswap, and Balancer are permissionless and therefore anyone can create a brand new Tokenset or Uniswap/Balancer pool. These protocols generate their own ERC20 “IOU” token to keep track of your position in the pool for accounting reasons.

In the case of Uniswap, it’s always a token pair for each exchange. Which means in theory, there can be:

$${n \choose 2} = \frac{n * (n-1)}{2}$$

Uniswap trading pairs, where n is the number of ERC20 tokens. So with 200,000 tokens today, there can be 20 billion possible exchanges (and their associated ERC20 tokens). But it doesn’t stop there – you can create a brand new exchange with the IOU token generated from another Uniswap exchange – simply because it’s another ERC20 token. 🤯

With the Balancer protocol, users are able to create a Balancer pool with up to 8 assets instead of just 2 with Uniswap. The Balancer pool is also an IOU token, which again is a regular ERC20 token. The possible number of IOU tokens that can be generated is left as an exercise for the reader.

This pattern of generating IOU tokens is standard in the world of Ethereum and you can see how quickly having a simple whitelist of ERC20 tokens becomes unmanageable.

### Why This Matters for the Sophisticated DeFi Investor

What does this mean for the DeFi investor? Well, every time a new exchange is created on Uniswap, a corresponding ETH-ERC20 trading pair is created with it. This means that whichever wallet app the DeFi investor is using must be able to automatically update to reflect the new Uniswap trading pair that they are investing in. Unfortunately, most crypto wallets simply have a whitelist of tokens that they support, with new ones needing to be manually inputted or voted in by the community.

However, because SafeKeep uses Covalent’s powerful on-chain data infrastructure, any new trading pairs will automatically be reflected in your SafeKeep account. Here is an example with Uniswap trading pairs below:

This applies to every DeFi protocol, not just Uniswap. Check out the Token Sets protocol below:

And Balancer pools:

SafeKeep is the only place where the sophisticated DeFi investor can have an updated, exhaustive list of all their token assets.

### The Technical Details

Say you have three ERC20 tokens tokenA, tokenB and tokenC. The way the balances are tracked on Ethereum is that there are three places on the blockchain within the contract’s state of tokenA, tokenB and tokenC with the wallet’s balances.

This is unintuitive. You would expect an account-based system like Ethereum to have a global table of balances keyed by your user address, but this is not the case.

So, if you want to know the balances of Wallet1, you will need to exhaustively check every single ERC20 token for a non-zero balance. Because Covalent uses a generalized method for their blockchain data structure, hooking up to our API easily allows all tokens in a wallet to be displayed. This is superior to a piece-meal approach of whitelisting specific ERC20 tokens.

## Try SafeKeep now

Check it out for yourself! Click below to use SafeKeep, the most comprehensive portfolio tracking tool for the sophisticated DeFi investor:

### Ganesh Swami

Co-founder, CEO, Covalent