Package Logo
uniswap_v3
839
User Avatar streamingfastgithub streamingfast/substreams-uniswap-v3
Published 4 months ago
mainnet
uniswap_v3
uniswap-v3@v0.2.10
README

Official StreamingFast implementation of Uniswap v3 Substreams. Underlying Substreams modules allow for composability. This Substreams contains 22 modules. Mappers are used to extract key structures which are either passed down to other modules or used to emit entity changes. Stores are used as temporary storage to hold/pass down key data to mappers, such as ETH price in USD. These substreams modules compose all the things to build up the Uniswap v3 Substreams. See individual modules docs for more information.

)
Documentation
Modules
Maps icon
Maps

map
graph_out

055e485627bcc1f8fb4cd8093de54665c8cedc33

EntityChanges emitted out for all the entities defined in the schema.graphql for the Uniswap v3 Subgraph.

substreams gui uniswap-v3@v0.2.10 graph_out

map
uni_v0_2_9:map_pools_created

3a5e4d92aeccd801140b7a330e3a1c0407bae58d
map uni_v0_2_9:map_pools_created (
)  -> uniswap.types.v1.Pools

This module will loop over block transactions and detect pools created events. Once the pool created events have been detected, Pools structs will be emitted out of the module.

Try with

substreams gui substreams.yaml map_pools_created -t +1000
substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:map_pools_created

map
uni_v0_2_9:map_tokens_whitelist_pools

daa31f7b3485db18a6aa0830d206e70d79561861

This modules loops over the pools created and emits ERC20Tokens structs out of the module. Tokens part of the pair of a pool are checked against the WHITELIST_TOKENS constant to see if they are part of the list. If so push the address of the pool in the field whitelist_pools of the token.

Try with

substreams gui substreams.yaml map_tokens_whitelist_pools -t +1000
substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:map_tokens_whitelist_pools

map
uni_v0_2_9:map_extract_data_types

9daec64c4ffe5d1cb38272f14d656b87928d2e28

Chunky module which emits multiple types of Events. Looping over every transaction to filter out Events. For some events, we have to loop over StorageChanges to be able to fetch certain changes such as liquidity increases and decreases. For more information on what the Event contains, check proto/uniswap/v1/uniswap.proto.

Try with

substreams gui substreams.yaml map_extract_data_types -t +1000
substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:map_extract_data_types

map
uni_v0_2_9:graph_out

30450454a276a437655a9b9df725a3d3028e091f

EntityChanges emitted out for all the entities defined in the schema.graphql for the Uniswap v3 Subgraph.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:graph_out
Stores icon
Stores

store
uni_v0_2_9:store_pools_created

3ec75d75eea4b8dfd8b515e09dca992a14f059ed

This module stores the Pools emitted by the map_pools_created module. Dynamic data sources pattern for Uniswap v3 pools.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_pools_created

store
uni_v0_2_9:store_tokens

b923c5e5c45311054543e2e8328844a75d723850
store <add,int64> uni_v0_2_9:store_tokens (
)

Int64 store accumulator for each time a token is used for any combination for a pool.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_tokens

store
uni_v0_2_9:store_pool_count

7f75c6218624ad287c5fbc13b071e9b9d1b846cd
store <add,bigint> uni_v0_2_9:store_pool_count (
)

BigInt store accumulator for each time a pool is created.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_pool_count

store
uni_v0_2_9:store_tokens_whitelist_pools

0debcb28f49177ffc637609dc39ab0d933e9837c
store <append,string> uni_v0_2_9:store_tokens_whitelist_pools (
)

String appender store which stores the whitelist_pools field of a token.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_tokens_whitelist_pools

store
uni_v0_2_9:store_pool_sqrt_price

d3700ec063b8fcbecf8a6b5f1bc24f298d7f5b8b

Store setter for PoolSqrtPrice emitted out of the map_extract_data_types.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_pool_sqrt_price

store
uni_v0_2_9:store_prices

a9d80512c571bf9972296cb41327f270e157a128

BigDecimal store setter for storing the price of token0 <> token1 and vice versa. Also store the Daily and Hourly prices.

For example: Pool: TOKEN0 <> TOKEN1 - pool:{pool_address}:{token0_addr}:token0 -> 100 - pool:{pool_address}:{token1_addr}:token1 -> 1 This means that the price of TOKEN0 is 100 for 1 TOKEN1

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_prices

store
uni_v0_2_9:store_pool_liquidities

e67819126193a5e9228d66364b9e9d8e7a67d646
store <set,bigint> uni_v0_2_9:store_pool_liquidities (
)

BigInt store setter for storing pool liquidites which were extracted from map_extract_data_types.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_pool_liquidities

store
uni_v0_2_9:store_total_tx_counts

152ad1c1ae26349022fffac633bc79adaf312b93
store <add,bigint> uni_v0_2_9:store_total_tx_counts (
)

BigInt accumulator store for the total transaction counts for pools, tokens, factory, daily factory, daily and hourly for token and pool data.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_total_tx_counts

store
uni_v0_2_9:store_swaps_volume

9b252ffa69adfe37c30065022f83ff5a55235e37

BigDecimal accumulator store for the swap volume of various entries such as amount0_abs, amount1_abs, volume_usd, volume_usd_untracked, volume_eth, fee_usd and fee_eth. The _0 and _1 entries are the value of one token for another token.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_swaps_volume

store
uni_v0_2_9:store_native_amounts

7861465b294ea72c6aba1695259e2f3773eae8af
store <set,bigdecimal> uni_v0_2_9:store_native_amounts (
)

BigDecimal setter store for the native amounts out of any Event type: Mint, Swap and Burn amounts (amount0 and amount1).

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_native_amounts

store
uni_v0_2_9:store_eth_prices

044de00f3391d6e015f0ce4c206e9fc787b1da55

BigDecimal setter store for the eth_price. This module uses a multiple stores and map_extract_data_types to find the eth_price of any given token. If a pool contains a token which has a pair with a well-known token, the eth_price is easily found. Stores the USD price of ETH.

For example: - Pool: DAI <> WBTC -> we check if there is a pool with DAI <> ETH and easily derive the price - Pool: ANYTOKEN0 <> DAI -> we can derive the price by finding the pool DAI <> ETH - Pool: ANYTOKEN0 <> ANYTOKEN1 -> more complicated case where we have to check on either side of the pool and try to find a path to reach a whitelisted_token which has a pool with ETH to be able to derive the price

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_eth_prices

store
uni_v0_2_9:store_token_tvl

b9f9f762a3208537800be561a99787542f0bd174
store <add,bigdecimal> uni_v0_2_9:store_token_tvl (
)

BigDecimal accumulator store for the total_value_locked for tokens.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_token_tvl

store
uni_v0_2_9:store_derived_tvl

f147428b3b28d099e443cb367785686276722132

BigDecimal accumulator store for the derived total_value_locked in USD, ETH, USDUntracked and ETHUntracked for pools and tokens.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_derived_tvl

store
uni_v0_2_9:store_derived_factory_tvl

b2ae05cfd40cd12e770f00d03800a93dde35122b
store <add,bigdecimal> uni_v0_2_9:store_derived_factory_tvl (
uni_v0_2_9:store_derived_tvlDELTAS<set,bigdecimal>
)

BigDecimal accumulator store for the derived total_value_locked in USD, ETH, USDUntracked and ETHUntracked for the factory.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_derived_factory_tvl

store
uni_v0_2_9:store_ticks_liquidities

6072e47b87506f490dd94b53192c1c9cd2f6747a
store <add,bigint> uni_v0_2_9:store_ticks_liquidities (
)

BigInt accumulator store for the liquidities of the pools. Tracking liquidityGross and liquidityNet for pool values at all times, daily and hourly for Mint and Burn events.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_ticks_liquidities

store
uni_v0_2_9:store_positions

3088b703c57269f50b0509f2ae2f3da75ff35cd2

PositionEvent setter store for Position Events emitted out of map_extract_data_types. CreatedPosition, IncreaseLiquidityPosition, DecreaseLiquidityPosition, CollectPosition and TransferPosition are stored.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_positions

store
uni_v0_2_9:store_min_windows

26b8b8e895450df9edba33b099c315eea0826ac0
store <min,bigdecimal> uni_v0_2_9:store_min_windows (
uni_v0_2_9:store_pricesDELTAS<set,bigdecimal>
uni_v0_2_9:store_eth_pricesDELTAS<set,bigdecimal>
)

BigDecimal minimum store for the price of eth and token prices for open and low for daily and hourly.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_min_windows

store
uni_v0_2_9:store_max_windows

26fac92b06d35f6bc0c507d04352541d461c2a98
store <max,bigdecimal> uni_v0_2_9:store_max_windows (
uni_v0_2_9:store_pricesDELTAS<set,bigdecimal>
uni_v0_2_9:store_eth_pricesDELTAS<set,bigdecimal>
)

BigDecimal maximum store for the price of eth and token prices for open and low for daily and hourly.

substreams gui uniswap-v3@v0.2.10 uni_v0_2_9:store_max_windows
Protobuf

Protobuf Docs Explorer

uniswap.types.v1