What is an
AppToken object is an investment positions that are represented by a token
ERC20. These are transferrable and fungible positions that maybe
considered as a receipt for an investment transaction with a Web3 app. These
receipts may be used to represent:
- Liquidity pool positions in a decentralized exchange like Uniswap, SushiSwap, or Curve
- Autocompounding "vaults" like in a yield aggregator like Pickle or Yearn
- Supply and borrow positions in a lending app like Aave
- Or even more obscure primitives like options in Opyn or prize savings accounts in PoolTogether
What is a
In the Zapper API, a
TokenFetcher class dynamically lists a single group of
AppToken typed objects. Groups of tokens share common properties, such as APYs
for Pickle vault tokens, or fees for Uniswap pool tokens. As such, we
declare unique strategy classes for each token group that we want to index in
What are the properties of an app token?
The following table describes the properties on the
|Used to discriminate types, do not change.|
|Address of the token|
|Network of the token|
|See below||Optional. A unique key that represents this token, used for aggregation purposes in Zapper.|
|The token belongs to this app|
|The token belongs to this app group.|
|The ERC20 symbol of this token|
|The ERC20 decimals of this token|
|The display value of the ERC20 supply of this token|
|The underlying token(s). For example, to mint |
|The price of one unit of this token. In the case of |
|The ratio between the price of the token and the price of the underlying token. Since |
|See below.||Additional data props that might be useful to be passed in other areas of the application. For example, the |
|See below.||Properties used by Zapper Web and Zapper Mobile to render meaningful information to Zapper users.|
What are data props?
dataProps field on an
AppTokenPosition object is used for augmenting the
token object with additional data properties. These properties can be used in
other places in the application.
Example: In Aave V2, the supply tokens like
"receipt" tokens for deposits. We can augment the
dataProps with a
property that represents the total amount in USD for that given deposit token.
Another part of the Zapper API aggregates the
liquidity data property to
calculate the total TVL of Aave V2.
What are display props?
displayProps field on an
AppTokenPosition object is used by Zapper Web
and Zapper Mobile to render meaningful information to Zapper users about this
|The primary label for this token. Token symbols generally aren't very human readable, so optimize for understanability.|
|The secondary label for this token. Often, its useful to put the token price here. Use your best judgement here; for example, Uniswap V2 token prices are not very human readable, so its instead useful to put the reserve percentages here instead for those cases.|
|The tertiary label for this token. Most of the time, you don't need to use this field, but it could be useful to surface additional information to the user like an APY for a vault or lending token.|
|An array of |
pricePerShare? Why is it useful?
pricePerShare field is the ratio between the token price and the prices of
the underlying tokens. This property is useful for using the balance of the
token to determine the exposure to the underlying tokens.
Example 1: In the case of Aave V2 supply tokens like
aDAI, these are
minted 1:1 with the deposited token,
DAI. As such, the
the same as the price of
DAI (about $1 USD), and so the
Example 2: In the case of Yearn vault tokens like
yDAI, Yearn strategies
yield gains by accumulating more of the underlying vault token. The
pricePerShare increases over time as the strategies successfully farm yield.
At the time of writing, the
yDAI is about
Example 3: In the case of Uniswap V2 pool tokens, the
be an array of ratios, representing how much of each of the underlying token
corresponds to each pool token. We can use the pool reserves and the pool token
supply to calculate this as
[reserve0 / supply, reserve1 / supply].
key? Why is it useful?
key is a unique identifier on the token object that is used to aggregate
token balances across multiple addresses.
Usually, you can ignore setting the
key and Zapper API will set the default as
md5(<app_id>:<network>:<address>). However, in some circumstances, this is
not a unique identifier, in which case, you can override the
key property in
your token fetcher.
Example 1: In Lyra, the protocol uses an ERC1155 contract for tokens
representing call and put options. The ERC1155 standard allows multiple token
fungible tokens through a single contract address. In this case, each option
token has an
id field as an identifier, so we can use this in the key as