# Table of Contents - [Uniswap Docs | Uniswap](#uniswap-docs-uniswap) - [Overview | Uniswap](#overview-uniswap) - [v4 Protocol Query Examples | Uniswap](#v4-protocol-query-examples-uniswap) - [Overview | Uniswap](#overview-uniswap) - [v3 Protocol Query Examples | Uniswap](#v3-protocol-query-examples-uniswap) - [Factory Contract | Uniswap](#factory-contract-uniswap) - [NonFungiblePositionManager Contract | Uniswap](#nonfungiblepositionmanager-contract-uniswap) - [Pool Contract (Templatized) | Uniswap](#pool-contract-templatized-uniswap) - [Pool Mapping | Uniswap](#pool-mapping-uniswap) - [Entity Types | Uniswap](#entity-types-uniswap) - [Events Monitored | Uniswap](#events-monitored-uniswap) - [Introduction | Uniswap](#introduction-uniswap) - [Burn | Uniswap](#burn-uniswap) - [Collect | Uniswap](#collect-uniswap) - [Factory | Uniswap](#factory-uniswap) - [Mint | Uniswap](#mint-uniswap) - [Flash | Uniswap](#flash-uniswap) - [Pool | Uniswap](#pool-uniswap) - [PoolDayData | Uniswap](#pooldaydata-uniswap) - [PoolHourData | Uniswap](#poolhourdata-uniswap) - [PositionSnapshot | Uniswap](#positionsnapshot-uniswap) - [Position | Uniswap](#position-uniswap) - [Swap | Uniswap](#swap-uniswap) - [Tick | Uniswap](#tick-uniswap) - [TickDayData | Uniswap](#tickdaydata-uniswap) - [TickHourData | Uniswap](#tickhourdata-uniswap) - [Resources | Uniswap](#resources-uniswap) - [Bundle | Uniswap](#bundle-uniswap) - [Token | Uniswap](#token-uniswap) - [TokenDayData | Uniswap](#tokendaydata-uniswap) - [Changelog | Uniswap](#changelog-uniswap) - [Subgraph Configuration | Uniswap](#subgraph-configuration-uniswap) - [Glossary | Uniswap](#glossary-uniswap) - [Uniswap Overview | Uniswap](#uniswap-overview-uniswap) - [Adversarial Circumstances | Uniswap](#adversarial-circumstances-uniswap) - [Core Functions | Uniswap](#core-functions-uniswap) - [Contracts | Uniswap](#contracts-uniswap) - [Glossary | Uniswap](#glossary-uniswap) - [Beginners' Guide to Voting | Uniswap](#beginners-guide-to-voting-uniswap) - [Functions | Uniswap](#functions-uniswap) - [Utility Functions | Uniswap](#utility-functions-uniswap) - [Overview | Uniswap](#overview-uniswap) - [Process | Uniswap](#process-uniswap) - [Resources | Uniswap](#resources-uniswap) - [Research | Uniswap](#research-uniswap) - [Concentrated Liquidity | Uniswap](#concentrated-liquidity-uniswap) - [Fees | Uniswap](#fees-uniswap) - [Token Integration Issues | Uniswap](#token-integration-issues-uniswap) - [Range Orders | Uniswap](#range-orders-uniswap) - [Oracle | Uniswap](#oracle-uniswap) - [The Uniswap Protocol | Uniswap](#the-uniswap-protocol-uniswap) - [Hooks | Uniswap](#hooks-uniswap) - [Swaps | Uniswap](#swaps-uniswap) - [Transaction | Uniswap](#transaction-uniswap) - [TokenHourData | Uniswap](#tokenhourdata-uniswap) - [Unknown](#unknown) - [Unknown](#unknown) --- # Uniswap Docs | Uniswap [Skip to main content](https://docs.uniswap.org/#__docusaurus_skipToContent_fallback) BuildwithUniswap ================ Dive into the world of DeFi apps, integrations, and developer tooling built on top of the Uniswap Protocol. [Getting started\ \ ### What is Uniswap?\ \ Learn about the core concepts of the Uniswap Protocol, Swaps, Pools, Liquidity, and more.](https://docs.uniswap.org/concepts/overview) [### Integrate with Uniswap\ \ Learn how to integrate with Uniswap by building a dApp through guided examples.](https://docs.uniswap.org/sdk/v4/overview) [### The Uniswap smart contracts\ \ Learn about the architecture of the Uniswap Protocol smart contracts through guided examples.](https://docs.uniswap.org/contracts/v4/overview) ### Integrate your Smart Contracts [#### Fetch token prices\ \ Fetch the price of tokens in a specific Pool](https://docs.uniswap.org/sdk/v4/guides/swaps/quoting) [#### Create a Trade\ \ Fetch a Quote for a Trade and execute the Trade](https://docs.uniswap.org/sdk/v3/guides/swaps/trading) [#### Route trades\ \ Use Routing to get optimized prices for your Trades](https://docs.uniswap.org/sdk/v3/guides/swaps/routing) [#### Provide liquidity\ \ Contribute to a Pool's liquidity by using tokens to earn fees](https://docs.uniswap.org/sdk/v3/guides/liquidity/minting) [#### UI Component\ \ Integrate with the Swap Widget, a React component that works out of the box](https://docs.uniswap.org/sdk/swap-widget/overview) ### Integrate your dApp [#### Setup your environment\ \ Prepare your local environment by installing the required dependencies](https://docs.uniswap.org/contracts/v4/quickstart/hooks/setup) [#### Implement a Swap\ \ Start swapping from a smart contract in Solidity](https://docs.uniswap.org/contracts/v4/quickstart/swap) [#### Provide Liquidity\ \ Provide liquidity from a smart contract in Solidity](https://docs.uniswap.org/contracts/v4/quickstart/manage-liquidity/setup-liquidity) [#### Implement Flash Swaps\ \ Implement Flash Swaps from a smart contract in Solidity](https://docs.uniswap.org/contracts/v4/guides/flash-accounting) [#### Create a Hook\ \ Create your first hook to customize pool behavior in Solidity](https://docs.uniswap.org/contracts/v4/guides/hooks/your-first-hook) ### Quick Links [Uniswap/v4-core](https://github.com/Uniswap/v4-core/) [Uniswap/v4-periphery](https://github.com/Uniswap/v4-periphery) [Uniswap/v4-sdk](https://github.com/Uniswap/sdks/tree/main/sdks/v4-sdk) [Deployment addresses](https://docs.uniswap.org/contracts/v4/deployments) ### Connect with us ### Join us on Discord to get support [Dev Chat](https://discord.com/invite/uniswap) ### Insights and news from the UF team [Blog](https://www.uniswapfoundation.org/blog) ### Sign up for research and updates from the Uniswap Foundation [Sign up](https://share.hsforms.com/1-5C0iYu9TN2nvz2tz7_5xQsdca9) ### Uniswap Foundation In pursuit of a more open and fair financial system, the Uniswap Foundation supports the growth, decentralization, and sustainability of the Uniswap community. [Learn more](https://unigrants.org/) ![](https://docs.uniswap.org/assets/images/UGP-e61f4b24622c94de7a82c731e488b388.png) --- # Overview | Uniswap [Skip to main content](https://docs.uniswap.org/api/overview#__docusaurus_skipToContent_fallback) On this page Welcome to the Uniswap API documentation. Uniswap provides several APIs and data sources to help developers integrate with and build on top of the Uniswap protocol. Available APIs[​](https://docs.uniswap.org/api/overview#available-apis "Direct link to Available APIs") -------------------------------------------------------------------------------------------------------- ### Subgraph API[​](https://docs.uniswap.org/api/overview#subgraph-api "Direct link to Subgraph API") The Uniswap Subgraph provides a GraphQL API for querying historical and real-time data from the Uniswap protocol. * **[Subgraph Documentation](https://docs.uniswap.org/api/subgraph/overview) ** - Learn how to query Uniswap data using GraphQL * **[Subgraph Examples](https://docs.uniswap.org/api/subgraph/guides/v4-subgraph-example) ** - Practical examples and queries * **[v3 Subgraph Guide](https://docs.uniswap.org/api/subgraph/guides/v3-subgraph-example) ** - Legacy v3 protocol queries ### Routing API[​](https://docs.uniswap.org/api/overview#routing-api "Direct link to Routing API") The Uniswap Routing API provides optimized trade routes and quotes for swaps. * **Smart Order Routing** - Find the best prices across multiple pools * **Gas Optimization** - Routes optimized for gas efficiency * **Multi-hop Support** - Complex routing across token pairs ### Price APIs[​](https://docs.uniswap.org/api/overview#price-apis "Direct link to Price APIs") Get real-time and historical price data for tokens on Uniswap. * **Current Prices** - Real-time token prices * **Historical Data** - Price charts and historical trends * **Pool Information** - Liquidity and volume data Getting Started[​](https://docs.uniswap.org/api/overview#getting-started "Direct link to Getting Started") ----------------------------------------------------------------------------------------------------------- ### For Developers[​](https://docs.uniswap.org/api/overview#for-developers "Direct link to For Developers") If you're building applications that need to: * Query historical trading data → Use the **Subgraph API** * Get optimal swap routes → Use the **Routing API** * Display token prices → Use the **Price APIs** ### For Data Analysis[​](https://docs.uniswap.org/api/overview#for-data-analysis "Direct link to For Data Analysis") The Subgraph API is perfect for: * Analytics dashboards * Trading strategy research * Protocol metrics and insights * DeFi research and analysis Rate Limits and Usage[​](https://docs.uniswap.org/api/overview#rate-limits-and-usage "Direct link to Rate Limits and Usage") ----------------------------------------------------------------------------------------------------------------------------- * **Subgraph API**: Generous rate limits via The Graph * **Routing API**: Production-ready with caching * **Price APIs**: Real-time updates with historical data Support and Resources[​](https://docs.uniswap.org/api/overview#support-and-resources "Direct link to Support and Resources") ----------------------------------------------------------------------------------------------------------------------------- * **Discord**: Join the Uniswap developer community * **GitHub**: Explore code examples and integrations * **Documentation**: Comprehensive guides and references Ready to start building? Choose the API that fits your needs from the navigation menu. On this page * [Available APIs](https://docs.uniswap.org/api/overview#available-apis) * [Subgraph API](https://docs.uniswap.org/api/overview#subgraph-api) * [Routing API](https://docs.uniswap.org/api/overview#routing-api) * [Price APIs](https://docs.uniswap.org/api/overview#price-apis) * [Getting Started](https://docs.uniswap.org/api/overview#getting-started) * [For Developers](https://docs.uniswap.org/api/overview#for-developers) * [For Data Analysis](https://docs.uniswap.org/api/overview#for-data-analysis) * [Rate Limits and Usage](https://docs.uniswap.org/api/overview#rate-limits-and-usage) * [Support and Resources](https://docs.uniswap.org/api/overview#support-and-resources) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/overview.md) --- # v4 Protocol Query Examples | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/guides/v4-examples#__docusaurus_skipToContent_fallback) On this page This doc will teach you how to query Uniswap v4 analytics by writing GraphQL queries on the subgraph. You can fetch data points like: * [position details](https://docs.uniswap.org/api/subgraph/guides/v4-examples#general-position-data) * [current liquidity](https://docs.uniswap.org/api/subgraph/guides/v4-examples#pool-data) of a pool * [volume on a certain day](https://docs.uniswap.org/api/subgraph/guides/v4-examples#historical-global-data) and much more. Below are some example queries. To run a query copy and paste it into the [v4 explorer](https://thegraph.com/explorer/subgraphs/DiYPVdygkfjDWhbxGSqAQxwBKmfKnkWQojqeM2rkLb3G?view=Query&chain=arbitrum-one) to get fresh data. Global Data[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#global-data "Direct link to Global Data") ------------------------------------------------------------------------------------------------------------------ Global data refers to data points about the Uniswap v4 protocol as a whole. Some examples of global data points are: * Total value locked in the protocol, * Total pools deployed, * Total transaction counts. Thus, to query global data you must pass in the PoolManager address `0x000000000004444c5dc75cb358380d2e3de08a90` and select the desired fields. Reference the full [poolManager schema](https://github.com/Uniswap/v4-subgraph/blob/main/schema.graphql#L1) to see all possible fields. PoolManager addresses for all supported chains are listed in the [Deployments](https://docs.uniswap.org/contracts/v4/deployments) section. ### Current Global Data[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#current-global-data "Direct link to Current Global Data") An example querying total pool count, transaction count, and total volume in USD and ETH: { poolManager(id: "0x000000000004444c5dc75cb358380d2e3de08a90") { poolCount txCount totalVolumeUSD totalVolumeETH }} ### Historical Global Data[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#historical-global-data "Direct link to Historical Global Data") You can also query historical data by specifying a block number. { poolManager( id: "0x000000000004444c5dc75cb358380d2e3de08a90", block: { number: 22451931 } ) { poolCount txCount totalVolumeUSD totalVolumeETH }} Pool Data[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#pool-data "Direct link to Pool Data") ------------------------------------------------------------------------------------------------------------ To get data about a certain pool, pass in the pool address. Reference the full [pool schema](https://github.com/Uniswap/v4-subgraph/blob/main/schema.graphql#L76) and adjust the query fields to retrieve the data points you want. ### General Pool Query[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#general-pool-query "Direct link to General Pool Query") The query below returns the feeTier, spot price, and liquidity for the ETH-USDC pool. { pool(id: "0x21c67e77068de97969ba93d4aab21826d33ca12bb9f565d8496e8fda8a82ca27") { tick token0 { symbol id decimals } token1 { symbol id decimals } feeTier sqrtPrice liquidity }} ### All Possible Pools[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#all-possible-pools "Direct link to All Possible Pools") The maximum items you can query at once is 1000. Thus to get all possible pools, you can iterate using the skip variable. To get pools beyond the first 1000 you can also set the skip as shown below. ### Skipping First 1000 Pools[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#skipping-first-1000-pools "Direct link to Skipping First 1000 Pools") This query sets the skip value and returns the first 10 responses after the first 1000. { pools(first: 10, skip: 1000) { id token0 { id symbol } token1 { id symbol } }} ### Creating a Skip Variable[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#creating-a-skip-variable "Direct link to Creating a Skip Variable") This next query sets a skip variable. In your language and environment of choice you can then iterate through a loop, query to get 1000 pools each time, and continually adjust skip by 1000 until all pool responses are returned. Check out [this example](https://github.com/Uniswap/v3-info/blob/770a05dc1a191cf229432ebc43c1f2ceb3666e3b/src/data/pools/chartData.ts#L14) from our interface for poolDayData that does something similar. > **Note** This query will not work in the graph explorer and more resembles the structure of a query you'd pass to some GraphQL middleware like Apollo. query pools($skip: Int!) { pools( first: 1000 skip: $skip orderDirection: asc ) { id sqrtPrice token0 { id } token1 { id } }} ### Most Liquid Pools[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#most-liquid-pools "Direct link to Most Liquid Pools") Retrieve the top 1000 most liquid pools. You can use this similar set up to orderBy other variables like number of swaps or volume. { pools( first: 1000, orderBy: liquidity, orderDirection: desc ) { id }} ### Pool Daily Aggregated[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#pool-daily-aggregated "Direct link to Pool Daily Aggregated") This query returns daily aggregated data for the first 10 days since the given timestamp for the UNI-ETH pool. To calculate `poolId`, refer to [PoolId Library](https://docs.uniswap.org/contracts/v4/reference/core/types/PoolId#toid) . { poolDayDatas( first: 10, orderBy: date, where: { pool: "0x21c67e77068de97969ba93d4aab21826d33ca12bb9f565d8496e8fda8a82ca27", date_gt: 1735689600 } ) { date liquidity sqrtPrice token0Price token1Price volumeToken0 volumeToken1 }} Swap Data[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#swap-data "Direct link to Swap Data") ------------------------------------------------------------------------------------------------------------ ### General Swap Data[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#general-swap-data "Direct link to General Swap Data") To query data about a particular swap, input the transaction hash + "-" + the index in the swaps the transaction array. This is the reference for the full [swap schema](https://github.com/Uniswap/v4-subgraph/blob/main/schema.graphql#L186) . This query fetches data about the sender, amounts, transaction data, timestamp, and tokens for a particular swap. { swap(id: "0x0000329e0d864d8e7c93627b76f6b5b99bd776cb18d9f8829e7da469f563e7d4-212") { sender amount0 amount1 transaction { id blockNumber gasUsed gasPrice } timestamp token0 { id symbol } token1 { id symbol } } } ### Recent Swaps Within a Pool[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#recent-swaps-within-a-pool "Direct link to Recent Swaps Within a Pool") You can set the `where` field to filter swap data by pool address. This example fetches data about multiple swaps for the ETH-USDT pool, ordered by timestamp. { swaps( orderBy: timestamp, orderDirection: desc, where: { pool: "0x21c67e77068de97969ba93d4aab21826d33ca12bb9f565d8496e8fda8a82ca27" } ) { pool { token0 { id symbol } token1 { id symbol } } sender amount0 amount1 }} Token Data[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#token-data "Direct link to Token Data") --------------------------------------------------------------------------------------------------------------- Input the token contract address to fetch token data. Any token that exists in at least one Uniswap v4 pool can be queried. The output will aggregate data across all v4 pools that include the token. ### General Token Data[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#general-token-data "Direct link to General Token Data") This queries the decimals, symbol, name, pool count, and volume in USD for the UNI token. Reference the full [token schema](https://github.com/Uniswap/v4-subgraph/blob/main/schema.graphql#L37) for all possible fields you can query. { token(id:"0x1f9840a85d5af5bf1d1762f925bdaddc4201f984") { symbol name decimals volumeUSD poolCount }} ### Token Daily Aggregated[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#token-daily-aggregated "Direct link to Token Daily Aggregated") You can fetch aggregate data about a specific token over a 24-hour period. This query gets 10-days of the 24-hour volume data for the UNI token ordered from oldest to newest. { tokenDayDatas( first: 10, where: { token: "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984" }, orderBy: date, orderDirection: asc ) { date token { id symbol } volumeUSD }} ### All Tokens[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#all-tokens "Direct link to All Tokens") Similar to retrieving all pools, you can fetch all tokens by using skip. > **Note** This query will not work in the graph explorer and more resembles the structure of a query you'd pass to some GraphQL middleware like Apollo. query tokens($skip: Int!) { tokens(first: 1000, skip: $skip) { id symbol name }} Position Data[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#position-data "Direct link to Position Data") ------------------------------------------------------------------------------------------------------------------------ ### General Position Data[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#general-position-data "Direct link to General Position Data") To get data about a specific position, input the NFT tokenId. This queries the subscriptions, unsubscriptions, and transfers for the position with tokenId 3. Reference the full [position schema](https://github.com/Uniswap/v4-subgraph/blob/main/schema.graphql#416) to see all fields. { position(id:3) { id subscriptions { id } unsubscriptions { id } transfers { id } }} Contribute[​](https://docs.uniswap.org/api/subgraph/guides/v4-examples#contribute "Direct link to Contribute") --------------------------------------------------------------------------------------------------------------- There are many more queries you can do with the Uniswap v4 subgraph including data related to ticks, subscriptions, unsubscriptions, and more. Once again you can reference the full schema [here](https://github.com/Uniswap/v4-subgraph/blob/main/schema.graphql) . If you'd like to suggest more example queries to showcase, feel free to drop some suggestions in [discord](https://discord.com/invite/uniswap) under #dev-chat or [contribute](https://github.com/Uniswap/docs/blob/main/CONTRIBUTING.md) your own queries by submitting a pull request to the docs repo. On this page * [Global Data](https://docs.uniswap.org/api/subgraph/guides/v4-examples#global-data) * [Current Global Data](https://docs.uniswap.org/api/subgraph/guides/v4-examples#current-global-data) * [Historical Global Data](https://docs.uniswap.org/api/subgraph/guides/v4-examples#historical-global-data) * [Pool Data](https://docs.uniswap.org/api/subgraph/guides/v4-examples#pool-data) * [General Pool Query](https://docs.uniswap.org/api/subgraph/guides/v4-examples#general-pool-query) * [All Possible Pools](https://docs.uniswap.org/api/subgraph/guides/v4-examples#all-possible-pools) * [Skipping First 1000 Pools](https://docs.uniswap.org/api/subgraph/guides/v4-examples#skipping-first-1000-pools) * [Creating a Skip Variable](https://docs.uniswap.org/api/subgraph/guides/v4-examples#creating-a-skip-variable) * [Most Liquid Pools](https://docs.uniswap.org/api/subgraph/guides/v4-examples#most-liquid-pools) * [Pool Daily Aggregated](https://docs.uniswap.org/api/subgraph/guides/v4-examples#pool-daily-aggregated) * [Swap Data](https://docs.uniswap.org/api/subgraph/guides/v4-examples#swap-data) * [General Swap Data](https://docs.uniswap.org/api/subgraph/guides/v4-examples#general-swap-data) * [Recent Swaps Within a Pool](https://docs.uniswap.org/api/subgraph/guides/v4-examples#recent-swaps-within-a-pool) * [Token Data](https://docs.uniswap.org/api/subgraph/guides/v4-examples#token-data) * [General Token Data](https://docs.uniswap.org/api/subgraph/guides/v4-examples#general-token-data) * [Token Daily Aggregated](https://docs.uniswap.org/api/subgraph/guides/v4-examples#token-daily-aggregated) * [All Tokens](https://docs.uniswap.org/api/subgraph/guides/v4-examples#all-tokens) * [Position Data](https://docs.uniswap.org/api/subgraph/guides/v4-examples#position-data) * [General Position Data](https://docs.uniswap.org/api/subgraph/guides/v4-examples#general-position-data) * [Contribute](https://docs.uniswap.org/api/subgraph/guides/v4-examples#contribute) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/guides/v4-subgraph-example.md) --- # Overview | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/overview#__docusaurus_skipToContent_fallback) On this page Uniswap uses multiple [subgraphs](https://thegraph.com/docs/about/introduction#what-the-graph-is) for indexing and organizing data from the Uniswap smart contracts. These subgraphs are hosted on The Graph hosted service and can be used to query Uniswap data. Versions and Production Endpoints[​](https://docs.uniswap.org/api/subgraph/overview#versions-and-production-endpoints "Direct link to Versions and Production Endpoints") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Each version of Uniswap has its own dedicated subgraph, and governance contracts have a dedicated subgraph as well. Each subgraph has a dedicated endpoint for querying data, as well as a page on [The Graph explorer](https://thegraph.com/explorer) that exposes the schema and available fields to query. ##### v4 (Mainnet)[​](https://docs.uniswap.org/api/subgraph/overview#v4-mainnet "Direct link to v4 (Mainnet)") * [Subgraph](https://thegraph.com/explorer/subgraphs/DiYPVdygkfjDWhbxGSqAQxwBKmfKnkWQojqeM2rkLb3G?view=About&chain=arbitrum-one) * Graphql Endpoint: `https://gateway.thegraph.com/api//subgraphs/id/DiYPVdygkfjDWhbxGSqAQxwBKmfKnkWQojqeM2rkLb3G` * Code: [https://github.com/Uniswap/v4-subgraph](https://github.com/Uniswap/v4-subgraph) ##### v3 (Mainnet)[​](https://docs.uniswap.org/api/subgraph/overview#v3-mainnet "Direct link to v3 (Mainnet)") * [Subgraph](https://thegraph.com/explorer/subgraphs/5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV?view=Query&chain=arbitrum-one) * Graphql Endpoint: `https://gateway.thegraph.com/api//subgraphs/id/5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV` * Code: [https://github.com/Uniswap/v3-subgraph](https://github.com/Uniswap/v3-subgraph) ##### v2 (Mainnet)[​](https://docs.uniswap.org/api/subgraph/overview#v2-mainnet "Direct link to v2 (Mainnet)") * [Subgraph](https://thegraph.com/explorer/subgraphs/A3Np3RQbaBA6oKJgiwDJeo5T3zrYfGHPWFYayMwtNDum?view=Query&chain=arbitrum-one) * Graphql Endpoint: `https://gateway.thegraph.com/api//subgraphs/id/A3Np3RQbaBA6oKJgiwDJeo5T3zrYfGHPWFYayMwtNDum` * Code: [https://github.com/Uniswap/v2-subgraph](https://github.com/Uniswap/v2-subgraph) On this page * [Versions and Production Endpoints](https://docs.uniswap.org/api/subgraph/overview#versions-and-production-endpoints) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/overview.md) --- # v3 Protocol Query Examples | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/guides/v3-examples#__docusaurus_skipToContent_fallback) On this page This doc will teach you how to query Uniswap v3 analytics by writing GraphQL queries on the subgraph. You can fetch data points like : * [collected fees for a position](https://docs.uniswap.org/api/subgraph/guides/v3-examples#general-position-data) * [current liquidity](https://docs.uniswap.org/api/subgraph/guides/v3-examples#pool-data) of a pool * [volume on a certain day](https://docs.uniswap.org/api/subgraph/guides/v3-examples#historical-global-data) and much more. Below are some example queries. To run a query copy and paste it into the [v3 explorer](https://thegraph.com/explorer/subgraphs/5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV?view=Query&chain=arbitrum-one) to get fresh data. Global Data[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#global-data "Direct link to Global Data") ------------------------------------------------------------------------------------------------------------------ Global data refers to data points about the Uniswap v3 protocol as a whole. Some examples of global data points are: * Total value locked in the protocol, * Total pools deployed, * Total transaction counts. Thus, to query global data you must pass in the Uniswap v3 Factory address `0x1F98431c8aD98523631AE4a59f267346ea31F984` and select the desired fields. Reference the full [factory schema](https://github.com/Uniswap/v3-subgraph/blob/main/src/v3/schema.graphql#L1) to see all possible fields. ### Current Global Data[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#current-global-data "Direct link to Current Global Data") An example querying total pool count, transaction count, and total volume in USD and ETH: { factory(id: "0x1F98431c8aD98523631AE4a59f267346ea31F984" ) { poolCount txCount totalVolumeUSD totalVolumeETH }} ### Historical Global Data[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#historical-global-data "Direct link to Historical Global Data") You can also query historical data by specifying a block number. { factory( id: "0x1F98431c8aD98523631AE4a59f267346ea31F984", block: { number: 13380584 } ) { poolCount txCount totalVolumeUSD totalVolumeETH }} Pool Data[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#pool-data "Direct link to Pool Data") ------------------------------------------------------------------------------------------------------------ To get data about a certain pool, pass in the pool address. Reference the full [pool schema](https://github.com/Uniswap/v3-subgraph/blob/main/src/v3/schema.graphql#L77) and adjust the query fields to retrieve the data points you want. ### General Pool Query[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#general-pool-query "Direct link to General Pool Query") The query below returns the feeTier, spot price, and liquidity for the ETH-USDC pool. { pool(id: "0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8") { tick token0 { symbol id decimals } token1 { symbol id decimals } feeTier sqrtPrice liquidity }} ### All Possible Pools[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#all-possible-pools "Direct link to All Possible Pools") The maximum items you can query at once is 1000. Thus to get all possible pools, you can iterate using the skip variable. To get pools beyond the first 1000 you can also set the skip as shown below. ### Skipping First 1000 Pools[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#skipping-first-1000-pools "Direct link to Skipping First 1000 Pools") This query sets the skip value and returns the first 10 responses after the first 1000. { pools(first:10, skip:1000) { id token0 { id symbol } token1 { id symbol } }} ### Creating a Skip Variable[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#creating-a-skip-variable "Direct link to Creating a Skip Variable") This next query sets a skip variable. In your language and environment of choice you can then iterate through a loop, query to get 1000 pools each time, and continually adjust skip by 1000 until all pool responses are returned. Check out [this example](https://github.com/Uniswap/v3-info/blob/770a05dc1a191cf229432ebc43c1f2ceb3666e3b/src/data/pools/chartData.ts#L14) from our interface for poolDayData that does something similar. > **Note** This query will not work in the graph explorer and more resembles the structure of a query you'd pass to some GraphQL middleware like Apollo. query pools($skip: Int!) { pools( first: 1000, skip: $skip, orderDirection: asc ) { id sqrtPrice token0 { id } token1 { id } }} ### Most Liquid Pools[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#most-liquid-pools "Direct link to Most Liquid Pools") Retrieve the top 1000 most liquid pools. You can use this similar set up to orderBy other variables like number of swaps or volume. { pools( first: 1000, orderBy: liquidity, orderDirection: desc ) { id }} ### Pool Daily Aggregated[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#pool-daily-aggregated "Direct link to Pool Daily Aggregated") This query returns daily aggregated data for the first 10 days since the given timestamp for the UNI-ETH pool. { poolDayDatas( first: 10, orderBy: date, where: { pool: "0x1d42064fc4beb5f8aaf85f4617ae8b3b5b8bd801", date_gt: 1633642435 } ) { date liquidity sqrtPrice token0Price token1Price volumeToken0 volumeToken1 }} Swap Data[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#swap-data "Direct link to Swap Data") ------------------------------------------------------------------------------------------------------------ ### General Swap Data[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#general-swap-data "Direct link to General Swap Data") To query data about a particular swap, input the transaction hash + "#" + the index in the swaps the transaction array. This is the reference for the full [swap schema](https://github.com/Uniswap/v3-subgraph/blob/main/src/v3/schema.graphql#L253) . This query fetches data about the sender, receiver, amounts, transaction data, and timestamp for a particular swap. { swap(id: "0x000007e1111cbd97f74cfc6eea2879a5b02020f26960ac06f4af0f9395372b64#66785") { sender recipient amount0 amount1 transaction { id blockNumber gasUsed gasPrice } timestamp token0 { id symbol } token1 { id symbol } }} ### Recent Swaps Within a Pool[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#recent-swaps-within-a-pool "Direct link to Recent Swaps Within a Pool") You can set the `where` field to filter swap data by pool address. This example fetches data about multiple swaps for the USDC-USDT pool, ordered by timestamp. { swaps( orderBy: timestamp, orderDirection: desc, where: { pool: "0x7858e59e0c01ea06df3af3d20ac7b0003275d4bf" } ) { pool { token0 { id symbol } token1 { id symbol } } sender recipient amount0 amount1 }} Token Data[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#token-data "Direct link to Token Data") --------------------------------------------------------------------------------------------------------------- Input the token contract address to fetch token data. Any token that exists in at least one Uniswap v3 pool can be queried. The output will aggregate data across all v3 pools that include the token. ### General Token Data[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#general-token-data "Direct link to General Token Data") This queries the decimals, symbol, name, pool count, and volume in USD for the UNI token. Reference the full [token schema](https://github.com/Uniswap/v3-subgraph/blob/main/src/v3/schema.graphql#L38) for all possible fields you can query. { token(id:"0x1f9840a85d5af5bf1d1762f925bdaddc4201f984") { symbol name decimals volumeUSD poolCount }} ### Token Daily Aggregated[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#token-daily-aggregated "Direct link to Token Daily Aggregated") You can fetch aggregate data about a specific token over a 24-hour period. This query gets 10-days of the 24-hour volume data for the UNI token ordered from oldest to newest. { tokenDayDatas( first: 10, where: { token: "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984" }, orderBy: date, orderDirection: asc ) { date token { id symbol } volumeUSD }} ### All Tokens[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#all-tokens "Direct link to All Tokens") Similar to retrieving all pools, you can fetch all tokens by using skip. > **Note** This query will not work in the graph explorer and more resembles the structure of a query you'd pass to some GraphQL middleware like Apollo. query tokens($skip: Int!) { tokens(first: 1000, skip: $skip) { id symbol name }} Position Data[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#position-data "Direct link to Position Data") ------------------------------------------------------------------------------------------------------------------------ ### General Position Data[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#general-position-data "Direct link to General Position Data") To get data about a specific position, input the NFT tokenId. This queries the collected fees for token0 and token1 and current liquidity for the position with tokenId 3. Reference the full [position schema](https://github.com/Uniswap/v3-subgraph/blob/main/schema.graphql#L192) to see all fields. { position(id: 3) { id collectedFeesToken0 collectedFeesToken1 liquidity token0 { id symbol } token1 { id symbol } }} Contribute[​](https://docs.uniswap.org/api/subgraph/guides/v3-examples#contribute "Direct link to Contribute") --------------------------------------------------------------------------------------------------------------- There are many more queries you can do with the Uniswap v3 subgraph including data related to ticks, mints, positions, and burns. Once again you can reference the full schema [here](https://github.com/Uniswap/v3-subgraph/blob/main/src/v3/schema.graphql) . If you'd like to suggest more example queries to showcase, feel free to drop some suggestions in [discord](https://discord.com/invite/uniswap) under #dev-chat or [contribute](https://github.com/Uniswap/docs/blob/main/CONTRIBUTING.md) your own queries by submitting a pull request to the docs repo. On this page * [Global Data](https://docs.uniswap.org/api/subgraph/guides/v3-examples#global-data) * [Current Global Data](https://docs.uniswap.org/api/subgraph/guides/v3-examples#current-global-data) * [Historical Global Data](https://docs.uniswap.org/api/subgraph/guides/v3-examples#historical-global-data) * [Pool Data](https://docs.uniswap.org/api/subgraph/guides/v3-examples#pool-data) * [General Pool Query](https://docs.uniswap.org/api/subgraph/guides/v3-examples#general-pool-query) * [All Possible Pools](https://docs.uniswap.org/api/subgraph/guides/v3-examples#all-possible-pools) * [Skipping First 1000 Pools](https://docs.uniswap.org/api/subgraph/guides/v3-examples#skipping-first-1000-pools) * [Creating a Skip Variable](https://docs.uniswap.org/api/subgraph/guides/v3-examples#creating-a-skip-variable) * [Most Liquid Pools](https://docs.uniswap.org/api/subgraph/guides/v3-examples#most-liquid-pools) * [Pool Daily Aggregated](https://docs.uniswap.org/api/subgraph/guides/v3-examples#pool-daily-aggregated) * [Swap Data](https://docs.uniswap.org/api/subgraph/guides/v3-examples#swap-data) * [General Swap Data](https://docs.uniswap.org/api/subgraph/guides/v3-examples#general-swap-data) * [Recent Swaps Within a Pool](https://docs.uniswap.org/api/subgraph/guides/v3-examples#recent-swaps-within-a-pool) * [Token Data](https://docs.uniswap.org/api/subgraph/guides/v3-examples#token-data) * [General Token Data](https://docs.uniswap.org/api/subgraph/guides/v3-examples#general-token-data) * [Token Daily Aggregated](https://docs.uniswap.org/api/subgraph/guides/v3-examples#token-daily-aggregated) * [All Tokens](https://docs.uniswap.org/api/subgraph/guides/v3-examples#all-tokens) * [Position Data](https://docs.uniswap.org/api/subgraph/guides/v3-examples#position-data) * [General Position Data](https://docs.uniswap.org/api/subgraph/guides/v3-examples#general-position-data) * [Contribute](https://docs.uniswap.org/api/subgraph/guides/v3-examples#contribute) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/guides/v3-subgraph-example.md) --- # Factory Contract | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/factory#__docusaurus_skipToContent_fallback) On this page Contract Details[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/factory#contract-details "Direct link to Contract Details") ----------------------------------------------------------------------------------------------------------------------------------------------- | Chain | Address | StartBlock | | --- | --- | --- | | Mainnet | 0x1F98431c8aD98523631AE4a59f267346ea31F984 | 12369621 | | Polygon | 0x1F98431c8aD98523631AE4a59f267346ea31F984 | 22757547 | | Arbitrum-One | 0x1F98431c8aD98523631AE4a59f267346ea31F984 | 175 | | Optimism | 0x1F98431c8aD98523631AE4a59f267346ea31F984 | 0 | Events Tracked[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/factory#events-tracked "Direct link to Events Tracked") ----------------------------------------------------------------------------------------------------------------------------------------- | Event Name | Event handler | | --- | --- | | PoolCreated | [handlePoolCreated()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/factory.ts#handlepoolcreated) | On this page * [Contract Details](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/factory#contract-details) * [Events Tracked](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/factory#events-tracked) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/contracts/factory.md) --- # NonFungiblePositionManager Contract | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/nonfungiblepositionmanager#__docusaurus_skipToContent_fallback) On this page Contract Details[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/nonfungiblepositionmanager#contract-details "Direct link to Contract Details") ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | Chain | Address | StartBlock | | --- | --- | --- | | Mainnet | 0xC36442b4a4522E871399CD717aBDD847Ab11FE88 | 12369651 | | Polygon | 0xC36442b4a4522E871399CD717aBDD847Ab11FE88 | 22760586 | | Arbitrum-One | None | None | | Optimism | 0xC36442b4a4522E871399CD717aBDD847Ab11FE88 | 0 | Events Tracked[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/nonfungiblepositionmanager#events-tracked "Direct link to Events Tracked") ------------------------------------------------------------------------------------------------------------------------------------------------------------ | Event Name | Event handler | | --- | --- | | IncreaseLiquidity | [handleIncreaseLiquidity()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handleincreaseliquidity) | | DecreaseLiquidity | [handleDecreaseLiquidity()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handledecreaseliquidity) | | Collect | [handleCollect()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handlecollect) | | Transfer | [handleTransfer()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handletransfer) | On this page * [Contract Details](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/nonfungiblepositionmanager#contract-details) * [Events Tracked](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/nonfungiblepositionmanager#events-tracked) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/contracts/nonfungiblepositionmanager.md) --- # Pool Contract (Templatized) | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/pool#__docusaurus_skipToContent_fallback) On this page Contract Details[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/pool#contract-details "Direct link to Contract Details") -------------------------------------------------------------------------------------------------------------------------------------------- Pools are deployed dynamically and the addresses cannot be pre-determined. Thus the template feature of graph protocol is used and the Pool contracts to monitor are added when a new pool is deployed using the factory. The [`handlePoolCreated()`](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/factory.ts#handlepoolcreated) event handler adds a new pool contract to monitor. Events Tracked[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/pool#events-tracked "Direct link to Events Tracked") -------------------------------------------------------------------------------------------------------------------------------------- | Event Name | Event handler | | --- | --- | | Initialize | [handleInitialize()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleinitialize) | | Swap | [handleSwap()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleswap) | | Mint | [handleMint()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handlemint) | | Burn | [handleBurn()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleburn) | | Flash | [handleFlash()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleflash) | On this page * [Contract Details](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/pool#contract-details) * [Events Tracked](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/pool#events-tracked) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/contracts/pool.md) --- # Pool Mapping | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/poolMapping.ts#__docusaurus_skipToContent_fallback) On this page Only in Optimism The file is present in Optimism only ### POOL\_MAPPINGS[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/poolMapping.ts#pool_mappings "Direct link to POOL_MAPPINGS") The table captures pool addresses pre-regenesis provided by the Optimism team. This is needed as subgraph indexer has no knowledge for pre-regenesis events. | Old Address | New Address | Token0 Address | Token1 Address | | --- | --- | --- | --- | | 0x8c505fd76eed0945699265c7c7e5bbf756b7e5ad | 0x03af20bdaaffb4cc0a521796a223f7d85e2aac31 | 0x4200000000000000000000000000000000000006 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x8c505fd76eed0945699265c7c7e5bbf756b7e5ad | 0x827f0a2a4376bc26729f398b865f424dc8456841 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0xdd54251a35078ba39e3ad5fb059f9aa243693b9d | 0x73b14a78a0d396c521f954532d43fd5ffe385216 | 0x4200000000000000000000000000000000000006 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | | 0x0ad1af4178e17d7f41dbcdf9d573701bef5eb501 | 0xdd0c6bae8ad5998c358b823df15a2a4181da1b80 | 0x4200000000000000000000000000000000000006 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0xdf42e37f057c61765fe7204642c4d2e5ff929cfe | 0x815ae7bf44dda74ed9274377ed711efc8b567911 | 0x4200000000000000000000000000000000000006 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x6b952bfbfda057a7f288edaa9f611cd446ddbe22 | 0x95d9d28606ee55de7667f0f176ebfc3215cfd9c0 | 0x4200000000000000000000000000000000000006 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x0bec645f0373750fe0256ee0e7b06d63eae5e04d | 0x2df05e4cdbd758cb1a99a34bb0d767e040d6b078 | 0x4200000000000000000000000000000000000006 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0x6afd8618459729da24ee36978567fb04fe5fd1bd | 0x85c31ffa3706d1cce9d525a00f1c7d4a2911754c | 0x4200000000000000000000000000000000000006 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | | 0xa61dea82c7c3e64a6a80550aacb251eed604b46b | 0x37ffd11972128fd624337ebceb167c8c0a5115ff | 0x4200000000000000000000000000000000000006 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | | 0xcf438c19332d507326210da527fb9cf792fd3e18 | 0xc858a329bf053be78d6239c4a4343b8fbd21472b | 0x4200000000000000000000000000000000000006 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0xaddd011cb3b61d0dc4f85c2661cc9bd1bd640067 | 0xb29a022ff4b37bdfb21e5f1daff4af5a22aa9510 | 0x4200000000000000000000000000000000000006 | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | | 0x47516ccba929c607e14dbd02f2ebac1e7960b1f8 | 0x0392b358ce4547601befa962680bede836606ae2 | 0x4200000000000000000000000000000000000006 | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | | 0x13b2d83ec506b5c770f64ee0f564ff9719c74071 | 0xfea834a5c47b923add607cc5b96288d18ffb9c3f | 0x4200000000000000000000000000000000000006 | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | | 0xd20bf925e04933ff79274479009218dedab6657f | 0xac721d2e27ca148f505b5106fc95e594c78ace5b | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0x7678f1e1ed90efec8757af161ab25bf1e8e00238 | 0xa13514b5444e50067f6e48c386016b211773cf9e | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x2816913eda0010af856d323724f521fb702a25a7 | 0xcf2aebb91fec906f51fc11cd57035a09d8b16965 | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x2419a5fee0f8e0192869507ed6a301382ad9edda | 0xea0f33940eb221aaad9360891cab08ef4f1f0703 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x0ccf6bf2df83d250d0f6a636215ef7d19f86dd01 | 0x703eb589321f3dc7408e9dde01b790e64a9fe4e9 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x1135e9ce18373238c77ff602a9b0a579ca86eb8e | 0xc22662b904d98e45f89e030201355c3e372cc819 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x2f5ccaf670e9c5f4336c127a29fdd4932f238069 | 0x1aa9b4d9933ff96b2011fddd764240d4a16b7c07 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x0f641370eb5cb4f0b0d58140d5fb2f97ffcbfce5 | 0x2459023a29d3b07711b8b916d86aa7e8a14747af | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0xa14e5b3ba5dd981b536e0950390b03972b795018 | 0xadb35413ec50e0afe41039eac8b930d313e94fa4 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0xbdb9a8279a525bafe9be7efb9b5df79b18eeb23f | 0x84eb2c5c23999b3ddc87be10f15ccec5d22c7d97 | 0x4200000000000000000000000000000000000006 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | | 0xa194977b416f082f71a0362041b57208c91ee1c1 | 0x2e80d5a7b3c613d854ee43243ff09808108561eb | 0x4200000000000000000000000000000000000006 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | | 0xc3099d7fd3fc7d4feea11911fbe6eadc94c7c07a | 0x3d44cc727fe2f603e4929be164c70edb3b498b5f | 0x4200000000000000000000000000000000000006 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | | 0xfe901e734c8c55645731acd4eb0be963d2a85b94 | 0xa588c9d2884c60b098c5ad028ec2f4a1fab772b5 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | | 0xeaa5ba3ef450887e4d5a627700aef3c1a16d4090 | 0xc53f2be3331926d2f30ee2b10362bb45fdbe7bf6 | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | | 0x263312f667279452ad44cda7971fe93f18b6dad4 | 0x0843e0f56b9e7fdc4fb95fabba22a01ef4088f41 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0x051580636f94b8b6ba69b879958939d324d8f650 | 0x8184f5cf4921558c201923ef6d7d5258a6efa31f | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0xbb8a699cbd6b45f7c31dcd14bd6d965ab4293e2c | 0x8b057f0ccd9fb78f688472574cf3f9d2322f5454 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0x98fd8560e184136f482054c19a63e644240e30f4 | 0x9f08065dfc4817a0a56db7bcab757e86399bc51d | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | | 0xbeafe824395fff8df37c4814e8de9d455e79cdad | 0x7628784d2c5d47fcd5479ba812343b1aabad6484 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | | 0xcfe7288e10994555ca97dfa2d0c50e55a4d4dc39 | 0xceb488e01c8e2e669c40b330bfc1440921c9ebe2 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | | 0x4cff717ff0b0a4a3578e8bbb7a5f06d32574238b | 0x25e412992634b93a025e2a538c53222a8c62e2d6 | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | | 0x072611197970d6a9e57680f97f177ff947f09139 | 0xc0f184c6c4832b3ed861bd5b05722792ffa64abd | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | | 0x380ff418bf1589b46e9660c6b2197b4ce8ae8a12 | 0xf046d8b7365d8abe5a8f8301c669b4b5284fc21d | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0xac8c823548f13874dcfc76029089de01f4adc1d3 | 0x1f2390484dfe2d8900bc91c7111d274b7b2d63a1 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x8cf0a5fdcaed0956a3221e1dd5219bb14f092595 | 0xa0959d2dcd9dd56bf080a10cfe29eeb401344e3d | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0xaf00e47d2fe45befc4540fe02a87cb053e252065 | 0x30be2fff09fcd820a1d472e646bd233dbd812133 | 0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0x00a0e3cd857a7e5676c901bd349ed1d6afb59fb3 | 0x3202c46666e774b44ba463eafaa6da9a968a058f | 0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6 | 0x4200000000000000000000000000000000000006 | | 0x90fc3f5f84fb868b7693b1f2690b91f28c1600d0 | 0x85e8d0fddf559a57aac6404e7695142cd53eb808 | 0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | | 0xc87adb8ac31434e96b429ced522ed84a2ce707a6 | 0x22fc5dc36811d15fafde7cc7900ae73a538e59e0 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0x466fd9d58bdd0e246cbe9112d95d077b81b341af | 0xe7ee03b72a89f87d161425e42548bd5492d06679 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x7b6467b86878b86163bcb3162d84e34ea5c7389b | 0xfe1bd31a79163d6277ab8c2917d7857c225db065 | 0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | | 0xc24383ba6d156706864a48f50fc01e89c0bf11d7 | 0xbf595eb9a512b1c274125264aef84a2847158eb3 | 0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6 | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | | 0x93d9dfb5caf591df911b251db4d76cd95f4644b7 | 0x124657e5bb6afc12a15c439d08fc80070f9a1a1e | 0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x36c95ae265883c2b19e61997760b110cc05e4a60 | 0xd6101cda1a51924e249132cbcae82bfcd0a91fbc | 0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0xd515990647c39c4a0b8c03f811f9b746958a0eec | 0x19ea026886cbb7a900ecb2458636d72b5cae223b | 0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6 | 0x4200000000000000000000000000000000000006 | | 0x3b6479c7748eb5b143a3a52d237c0097734b811b | 0x5aacc66073cb0c3064353f1441c2e04170b4dbbf | 0x4200000000000000000000000000000000000006 | 0xc5Db22719A06418028A40A9B5E9A7c02959D0d08 | | 0x2d073707207098cc69e8e86c6a3fd12644b8a1b2 | 0x4284b21e76d1b3977cab8f0032867e00e6eea382 | 0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6 | 0xc5Db22719A06418028A40A9B5E9A7c02959D0d08 | | 0x015986c7074ec1eeae0387a8baf485fd9d811b7d | 0x2f10a1a3e640ad1615cbedf95a1749a4af88cbc0 | 0xB548f63D4405466B36C0c0aC3318a22fDcec711a | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x4a88e6fa2afad460befd586fc1581f322308c490 | 0x32846ede08688d10a9da59387707a8fbb0790fa7 | 0x4200000000000000000000000000000000000006 | 0xab7bAdEF82E9Fe11f6f33f87BC9bC2AA27F2fCB5 | | 0xccf24898ca659afa8cb6a3bdb8a2e0a2debda12d | 0xbdb6371fffc1753b33b87c68c827eb7978670515 | 0x4200000000000000000000000000000000000006 | 0x6fd9d7AD17242c41f7131d257212c54A0e816691 | | 0x856d50c587824f84de481ea706208b03db38f6f2 | 0x2eee8ed7df992f23d7554b0db8835d483cce901c | 0x298B9B95708152ff6968aafd889c6586e9169f1D | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | | 0xe3d8cfc3a0b43d2288b3da41563b1fe0623209de | 0x65dc095b35679005229896566928f6852948092b | 0x298B9B95708152ff6968aafd889c6586e9169f1D | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | | 0x62196490fcf045437e5e4cb49228bbd778b7196d | 0x2d6497dd08a1620d386ce708edac50aaec332415 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | 0xe405de8f52ba7559f9df3c368500b6e6ae6cee49 | | 0x3b1f6287be238c9b0a4b48d85d2359d58aaa9683 | 0x039ae8860fbfdf61f654b1a5b55cc3aa753f5842 | 0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0x91e50b184ea237b3da1c005ee5d2a17a904a34c6 | 0x24342b5d46f69ba05c09becdd00e5324f9f0f7ca | 0x298B9B95708152ff6968aafd889c6586e9169f1D | 0x4200000000000000000000000000000000000006 | | 0x518767d8ef1acffd978581c16789f8a2803f9bef | 0xf0d0e52da1fdde512af299f3d8ea1c5e3bebb96f | 0x4200000000000000000000000000000000000006 | 0xe3C332a5DcE0e1d9bC2cC72A68437790570C28a4 | | 0xc2c0786e85ac9b0b223966d040ebc641fa44225e | 0xb589969d38ce76d3d7aa319de7133bc9755fd840 | 0x4200000000000000000000000000000000000006 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | | 0xa2389a4ee391b4b04ae8dc664664190f3d28f2fe | 0x8eda97883a1bc02cf68c6b9fb996e06ed8fdb3e5 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | | 0xf9ca53854d1ac7adb43d9447aa87f17fe1454e31 | 0x100bdc1431a9b09c61c0efc5776814285f8fb248 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x4893c5f29301cfd7a6527331f3e06ea82e68a952 | 0xe229ce1cdbea9983362ca29f0f0b2c70bb2dacdf | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0xf2e805fe3b15297e1df03b6036d01b32ab8f7998 | 0xd9b160620447d9a9a6ca90c0450f5490e5219257 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x6663eea65669978481bae55814cbc496acd50352 | 0x1179b19438a622fe36be5f9c073b700420384397 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x7bbc5726e6c2640ed0f0fda1546dc232dc5db89c | 0xf3f3433c3a97f70349c138ada81da4d3554982db | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0x0d4294ae819ff83a4e2a99db8d06cdd025c19218 | 0x85149247691df622eaf1a8bd0cafd40bc45154a9 | 0x4200000000000000000000000000000000000006 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | | 0x9e845c705aba9a2ca6e97c2423797e18a98d34c0 | 0x6fa1ea0ccbbe9b2ad52440c88a47b5d73cd9a731 | 0x298B9B95708152ff6968aafd889c6586e9169f1D | 0x4200000000000000000000000000000000000006 | | 0x00a4dfb447a43a583d8e07eae9d4efbb3656cbcb | 0xad4c666fc170b468b19988959eb931a3676f0e9f | 0x4200000000000000000000000000000000000006 | 0x6fd9d7AD17242c41f7131d257212c54A0e816691 | | 0xdeb1106b510d94df3bcc55e74f51a6f6b231d97e | 0x4983691a26d55eb9e18d2e12e3b770cdd3f76a5f | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0xd2243a43813cd7c4bfb2287f32d3989b0f2f67d5 | 0x8e2eaef2c05ef93f424a8324b94e725eaa362f91 | 0x4200000000000000000000000000000000000006 | 0x6fd9d7AD17242c41f7131d257212c54A0e816691 | | 0x0b3a6896345b68539571aab140134630151ebc68 | 0x8531e48a8611729185be9eaad945acbd6b32e256 | 0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6 | 0x4200000000000000000000000000000000000006 | | 0x99959743247f2fa2e97b33e532337eae616beeda | 0xeb1817b708415f4f78c5f0c99cbbd6a3a899fa6d | 0x6fd9d7AD17242c41f7131d257212c54A0e816691 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0x94ee41af02171d6dc1e05b790de547fa50dbd7cf | 0x26e7fed14a97e0c482a302237971cf1b04f6d3e9 | 0x6fd9d7AD17242c41f7131d257212c54A0e816691 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x7613311fbb6a4580cdd602f9978c317b2a783d5f | 0x3926a81afe5c9c3d05296e4fac4728ba5411ac78 | 0x6fd9d7AD17242c41f7131d257212c54A0e816691 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x89fe55759966831d747669bfbda477ebf09475d6 | 0x7a5ea63fe3430a3b9a06fd80a4a9afaa17c1e878 | 0x4200000000000000000000000000000000000006 | 0xB27E3Eab7526bF721ea8029bFcd3fDc94c4f8b5b | | 0x1c536614fd8ed5faba94528782fbc886c426651a | 0xf5a389030a565c13d6e6bbe9342ac9d31dc7521a | 0x4200000000000000000000000000000000000006 | 0xe405de8f52ba7559f9df3c368500b6e6ae6cee49 | | 0xb0e9a44258cce8ef36c87e8f252aa6bf7cd4b245 | 0x6168ec836d0b1f0c37381ec7ed1891a412872121 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | | 0xcd7b42cee81a3394ee58dab93bbfc87cab03adb5 | 0x2024c394741a5301e89a375b7bf52f865bc166fd | 0x6fd9d7AD17242c41f7131d257212c54A0e816691 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | | 0x88f8cd42570f74ff3ef5acd090419070c6efe37a | 0x91cca461ee9435848ac0da8fc416ad0816272786 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0xd4bbfe5b58381ba4b9ce87146ce9e5a2d1057d3e | 0x865d39d66dee5719e6bee98885ef40b9a36bf56e | 0x6fd9d7AD17242c41f7131d257212c54A0e816691 | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | | 0x9b8ad5085af53eff13f3ddadcafa453549f7a93f | 0x1fff624960ff9d0556420f3647d6aaf06389aab1 | 0x6fd9d7AD17242c41f7131d257212c54A0e816691 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | | 0x188530f0c09e56e6e30dd5ef76a9b3f0dc403763 | 0xc8c07386e29f3f239b91019d5426ae139c5bd17b | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | 0x96db852D93c2feA0F447D6Ec22E146e4e09Caee6 | | 0x704baee64df71741cf3029652dc99101adc846f0 | 0x1b19825a9e32b1039080acb1e1f9271314938b96 | 0x7FB688CCf682d58f86D7e38e03f9D22e7705448B | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0xe4decbe898a6b8bb79ac48e93681cd04d7b1ca1b | 0x602a4d0f9e8d40ad3f620050efd1690da908dc0d | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | 0x7FB688CCf682d58f86D7e38e03f9D22e7705448B | | 0x251144c131413a5f6e54001cb586f9101b447059 | 0x345ddb5743859efce0e6e8293ebd35373d34b6c7 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | 0xe405de8f52ba7559f9df3c368500b6e6ae6cee49 | | 0x4065c249115481baaec5c6a16929592935d29ec1 | 0x94ad9a19126ebb02dda874237e5820fd4943f5de | 0x4200000000000000000000000000000000000006 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | | 0x6c66eb2798bf42455b63cff3fa3e5bcc3d31848f | 0x905707e5c7a10e8351bbd03347be8b5f5de7301a | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0x6fd9d7AD17242c41f7131d257212c54A0e816691 | | 0xa0eed53ea02a174e4ee81d88d3970b5198580b52 | 0x7d1602f342787f80aef458c10e741149a1697447 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0x6fd9d7AD17242c41f7131d257212c54A0e816691 | | 0xb61a5a79a83ff386dbe40a1bc95578856ab2fa5f | 0xa7bb0d95c6ba0ed0aca70c503b34bc7108589a47 | 0x68f180fcCe6836688e9084f035309E29Bf0A2095 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | | 0xc102e1de27d8467589cc65f4b4b18d534f6fdac6 | 0xb0eca217602b031e03956553fb510085c9f2df28 | 0x4200000000000000000000000000000000000006 | 0x8F69Ee043d52161Fd29137AeDf63f5e70cd504D5 | | 0x61057f7f7c2e338c36fd29433d7977b618348cd0 | 0x320616dbe138aa2f3db7a5a46ba79a13032cc5f2 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | | 0x05c1d7c9b9b4f1c38859681bd7b4eebb4c373a8e | 0xba213008fe93b3591e439f3b2aa51b3e4a2bd7c7 | 0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | | 0xbf592a3a4c64c8c28b667d060336e25480fe6c48 | 0x680b4eb8b9b8533d503a545adad4af9f00df5f05 | 0x4200000000000000000000000000000000000006 | 0x7C17611Ed67D562D1F00ce82eebD39Cb7B595472 | | 0xb2ab739b499ff9fa019ff944135b4974942b3a95 | 0x296b88b607ea3a03c821ca4dc34dd9e7e4efa041 | 0x4200000000000000000000000000000000000006 | 0x7FB688CCf682d58f86D7e38e03f9D22e7705448B | | 0x3e9ef76529932226742113984e6a6c7cea7e2452 | 0xa99638e4ac81d4ce32c945c1415f89ab8d86bf2c | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9 | | 0xcb590932a77e02aac00c83bbba4d8014efbebb89 | 0x9bb3267c4c3e69a961479c475f8fcc4c300af5bd | 0x4200000000000000000000000000000000000006 | 0x7FB688CCf682d58f86D7e38e03f9D22e7705448B | | 0x3643c5840fc0ccf4f667a35a151e10302d4d0d23 | 0x65f8a80d8049a77619435f841055fa4c8d785c47 | 0x4200000000000000000000000000000000000006 | 0x96db852D93c2feA0F447D6Ec22E146e4e09Caee6 | | 0x805b9cf595282d807adfe84a89bec85be5d07f53 | 0xd3265ea86af798659b4132a453e7cdb29b877e10 | 0x96db852D93c2feA0F447D6Ec22E146e4e09Caee6 | 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 | | 0x1a718270a5b014209fb77ac2985556ee471b29af | 0x8dfc59e8b119bffa5f552642028e005b1972edc4 | 0x6fd9d7AD17242c41f7131d257212c54A0e816691 | 0x96db852D93c2feA0F447D6Ec22E146e4e09Caee6 | | 0xb91cf01b64c6e6540c45ae356554599cbe92831f | 0xc210aeb4e84e0c3b6ee5816858984d52d04f0219 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | 0x96db852D93c2feA0F447D6Ec22E146e4e09Caee6 | | 0x8956827b23063c82d0c697004f0015b454a2f107 | 0x9aaa481a863e95168c01f23640b357b014dff09a | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 | 0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4 | | 0x86cf7e458ce79afe44924263d58ef1fd57d1b57c | 0x25cc77a38f8de3b9b090fea8f0f5995c4e10a386 | 0x4200000000000000000000000000000000000006 | 0xe0BB0D3DE8c10976511e5030cA403dBf4c25165B | #### References At:[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/poolMapping.ts#references-at "Direct link to References At:") 1. [populateEmptyPools()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/backfill.ts#populateemptypools) On this page * [POOL\_MAPPINGS](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/poolMapping.ts#pool_mappings) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/functions-n-handlers/poolMapping.ts.md) --- # Entity Types | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/all-entities#__docusaurus_skipToContent_fallback) Following Entity Types are defined in the graph [schema file](https://github.com/Uniswap/v3-subgraph/blob/main/schema.graphql) : | | Entity | Description | Schema differs with chain | | --- | --- | --- | --- | | 1. | [Factory](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/factory) | Captures metrics for all the pools deployed by a specific [factory contract](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/factory)
. | ✅ | | 2. | [Bundle](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/bundle) | Stores the current Eth price in USD. | | | 3. | [Token](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token) | Stores the metadata and token level metrics for a token present in any of the pools. | | | 4. | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool) | Stores a pool's metadata, current & lifetime metrics and links to events and hourly/daily metrics and references to it's tick entities. | ✅ | | 5. | [Tick](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick) | Stores the metadata for a tick in a pool, it's lifetime metrics and current liquidity and fee variables. | ✅ | | 6. | [Position](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/position) | Represents a position created through [NonfungiblePositionManager](https://docs.uniswap.org/api/subgraph/contracts/nonfungiblepositionmanager)
. Stores it's metadata, deposited/withdrawn tokens, fee variables and transactions where it participated. | ✅ | | 7 | [PositionSnapshot](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/positionsnapshot) | Saves the state of a position after an action taken on the position. | ✅ | | 8 | [Transaction](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction) | Stores the list of mint, burn, swap, flash and collects events emitted within a transaction. | | | 9 | [Mint](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/mint) | Stores details of a mint event emitted while adding liquidity to a pool | | | 10 | [Burn](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/burn) | Stores details of a burn event emitted while removing liquidity from a pool | | | 11 | [Swap](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/swap) | Stores details of a swap event emitted while swapping one token for the other in a pool | | | 12 | [Collect](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/collect) | Stores details of a collect event emitted while removing tokens from a position | | | 13 | [Flash](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/flash) | Stores details of a flash event emitted while a flash loan was taken from a pool | | | 14 | [UniswapDayData](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/uniswapdaydata) | Daily stats for all of Uniswap. | | | 15 | [PoolDayData](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pooldaydata) | Daily stats for each pool | ✅ | | 16 | [PoolHourData](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/poolhourdata) | Hourly stats for each pool | ✅ | | 17 | [TickHourData](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tickhourdata) | Stats on Liquidity available & Volume of token traded at a tick for a given hour | | | 18 | [TickDayData](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tickdaydata) | Stats on Liquidity available & Volume of token traded at a tick on a given day.
(Note: this entity gets saved only if there is a change during the day) | ✅ | | 19 | [TokenDayData](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tokendaydata) | Daily stats for a token across all of Uniswap. | | | 20 | [TokenHourData](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tokenhourdata) | Hourly stats for a token across all of Uniswap. | | Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/all-entities.md) --- # Events Monitored | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/events#__docusaurus_skipToContent_fallback) | Event Name | Contract Type | Event handler | Description | | --- | --- | --- | --- | | PoolCreated | [Factory](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/factory) | [handlePoolCreated()](https://docs.uniswap.org/api/subgraph/functions-n-handlers/mappings/factory.ts#handlepoolcreated) | Event emitted when a new pool is deployed using the factory contract | | Initialize | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/pool) | [handleInitialize()](https://docs.uniswap.org/api/subgraph/functions-n-handlers/mappings/core.ts#handleinitialize) | Event emitted when a new deployed pool is initialized with current price and is ready for adding liquidity and doing swaps | | Swap | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/pool) | [handleSwap()](https://docs.uniswap.org/api/subgraph/functions-n-handlers/mappings/core.ts#handleswap) | Event emitted when a swap takes place | | Mint | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/pool) | [handleMint()](https://docs.uniswap.org/api/subgraph/functions-n-handlers/mappings/core.ts#handlemint) | Event emitted when liquidity is added to the pool | | Burn | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/pool) | [handleBurn()](https://docs.uniswap.org/api/subgraph/functions-n-handlers/mappings/core.ts#handleburn) | Event emitted when liquidity is removed from the pool | | Flash | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/pool) | [handleFlash()](https://docs.uniswap.org/api/subgraph/functions-n-handlers/mappings/core.ts#handleflash) | Event emitted when a flash loan was taken from the pool | | IncreaseLiquidity | [NonFungiblePositionManager](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/nonfungiblepositionmanager) | [handleIncreaseLiquidity()](https://docs.uniswap.org/api/subgraph/functions-n-handlers/mappings/position-manager.ts#handleincreaseliquidity) | Event emitted when liquidity is added to a new/existing position | | DecreaseLiquidity | [NonFungiblePositionManager](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/nonfungiblepositionmanager) | [handleDecreaseLiquidity()](https://docs.uniswap.org/api/subgraph/functions-n-handlers/mappings/position-manager.ts#handledecreaseliquidity) | Event emitted when liquidity is removed from a position | | Collect | [NonFungiblePositionManager](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/nonfungiblepositionmanager) | [handleCollect()](https://docs.uniswap.org/api/subgraph/functions-n-handlers/mappings/position-manager.ts#handlecollect) | Event emitted when removed liquidity and it's accumulated fee collected by the position owner | | Transfer | [NonFungiblePositionManager](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/nonfungiblepositionmanager) | [handleTransfer()](https://docs.uniswap.org/api/subgraph/functions-n-handlers/mappings/position-manager.ts#handletransfer) | Even emitted whent the NFT representing the position ownership is transferred to a different address | Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/events.md) --- # Introduction | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/intro#__docusaurus_skipToContent_fallback) On this page Welcome to exploring the data of [**Uniswap**](https://uniswap.org/) , the leading EVM DEX. The docs help you understand data structure in the **SubGraphs** deployed for the dex on the [graph protocol](https://thegraph.com/) . If you're completely new to the working of the V3 protocol, would recommend going through the [references](https://docs.uniswap.org/api/subgraph/subgraphs-devs/intro#references) below. Uniswap Foundation[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/intro#uniswap-foundation "Direct link to Uniswap Foundation") ----------------------------------------------------------------------------------------------------------------------------------------- The docs was possible as I recieved a grant from [Uniswap Foundation](https://uniswapfoundation.mirror.xyz/) . The foundation publishes [grant wishlist for RFPs](https://uniswap.notion.site/Uniswap-Foundation-Grants-Wish-List-3be614ba4e504b5caeee7b0159e64a42) regularly if you wish to get involved. ### Get In Touch[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/intro#get-in-touch "Direct link to Get In Touch") For any updates or additions, you can raise a PR to the [docs repo](https://github.com/vintageplayer/uniswap-v3-subgraph-docs) . Feel free to reach out on [Twitter](https://twitter.com/artsofbaniya) to discuss about web3 or any field, or just to keep up with what I'm building. On this page * [Uniswap Foundation](https://docs.uniswap.org/api/subgraph/subgraphs-devs/intro#uniswap-foundation) * [Get In Touch](https://docs.uniswap.org/api/subgraph/subgraphs-devs/intro#get-in-touch) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/intro.md) --- # Burn | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/burn#__docusaurus_skipToContent_fallback) On this page Entity to stores the details of a burn event emitted while removing liquidity from a pool. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/burn#schema "Direct link to Schema") ------------------------------------------------------------------------------------------------------------ | Field | Type | derivedFrom | Description | | --- | --- | --- | --- | | id | ID! | | Burn Entity ID. Format: `#` | | transaction | [Transaction](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
! | | [Transaction Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
in which the burn event was emitted | | pool | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
! | | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
in which the burn event was emitted | | token0 | [Token](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
! | | token0 entity of the pool | | token1 | [Token](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
! | | token1 entity of the pool | | timestamp | BigInt! | | Timestamp of the block in which which the burn event was emitted | | owner | Bytes! | | owner of the position to which the liquidity was burnt | | origin | Bytes! | | The EOA address that initiated the transaction | | amount | BigInt! | | Amount of liquidity burnt | | amount0 | BigDecimal! | | Amount of token0 burnt | | amount1 | BigDecimal! | | Amount of token1 burnt | | amountUSD | BigDecimal | | Burn value derived in USD based on available prices of tokens | | tickLower | BigInt! | | Lower tick of the position | | tickUpper | BigInt! | | Upper tick of the position | | logIndex | BigInt | | Order of the Burn event within the logs of the transaction | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/burn#referencing-functions "Direct link to Referencing Functions") --------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [handleBurn()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleburn) | ✅ | | ✅ | ✅ | On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/burn#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/burn#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/burn.md) --- # Collect | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/collect#__docusaurus_skipToContent_fallback) On this page Entity to store details of a collect event emitted while removing tokens from a position. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/collect#schema "Direct link to Schema") --------------------------------------------------------------------------------------------------------------- | Field | Type | derivedFrom | Description | | --- | --- | --- | --- | | id | ID! | | Collect Entity ID. Format: `#` | | transaction | [Transaction](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
! | | [Transaction Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
in which the collect event was emitted | | timestamp | BigInt! | | Timestamp of the block in which which the collect event was emitted | | pool | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
! | | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
in which the collect event was emitted | | owner | Bytes! | | owner of the position from which the tokens were collected | | amount0 | BigDecimal! | | Amount of token0 collected | | amount1 | BigDecimal! | | Amount of token1 collected | | amountUSD | BigDecimal | | Collect value derived in USD based on available prices of tokens | | tickLower | BigInt! | | Lower tick of the position | | tickUpper | BigInt! | | Upper tick of the position | | logIndex | BigInt | | Order of the Collect Event within the logs of the transaction | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/collect#referencing-functions "Direct link to Referencing Functions") ------------------------------------------------------------------------------------------------------------------------------------------------------------ danger Couldn't find any references to collect schema On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/collect#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/collect#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/collect.md) --- # Factory | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/factory#__docusaurus_skipToContent_fallback) On this page Entity to capture metrics for all the pools deployed by a specific [factory contract](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/factory) . Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/factory#schema "Direct link to Schema") --------------------------------------------------------------------------------------------------------------- | Field | Type | derivedFrom | Description | | --- | --- | --- | --- | | id | ID! | | Factory Contract address | | poolCount | BigInt! | | No. of pools created using the factory | | txCount | BigInt! | | No. of all the transactions through pools mananged by the factory | | totalVolumeUSD | BigDecimal! | | Total Volume all time in derived USD | | totalVolumeETH | BigDecimal! | | Total Volume all time in derived ETH | | totalFeesUSD | BigDecimal! | | Total Swap Fees all time in derived USD | | totalFeesETH | BigDecimal! | | Total Swap Fees all time in derived ETH | | untrackedVolumeUSD | BigDecimal! | | Total Volume all time, including less reliable USD values | | totalValueLockedUSD | BigDecimal! | | TVL derived in USD | | totalValueLockedETH | BigDecimal! | | TVL derived in ETH | | totalValueLockedUSDUntracked | BigDecimal! | | TVL including tokens with unreliable USD prices in USD | | totalValueLockedETHUntracked | BigDecimal! | | TVL including tokens with unreliable USD prices in ETH | | populated | Boolean | | Flag capturing if the new pool is populated | | owner | ID! | | Current Owner of the factory contract | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/factory#referencing-functions "Direct link to Referencing Functions") ------------------------------------------------------------------------------------------------------------------------------------------------------------ | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [handlePoolCreated()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/factory.ts#handlepoolcreated) | ✅ | ✅ | ✅ | ✅ | | [handleMint()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handlemint) | | ✅ | ✅ | ✅ | | [handleBurn()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleburn) | | ✅ | ✅ | ✅ | | [handleSwap()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleswap) | | ✅ | ✅ | ✅ | | [updateUniswapDayData()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalUpdates.ts#updateuniswapdaydata) | | ✅ | | | On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/factory#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/factory#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/factory.md) --- # Mint | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/mint#__docusaurus_skipToContent_fallback) On this page Entity to store details of a mint event emitted while adding liquidity to a pool. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/mint#schema "Direct link to Schema") ------------------------------------------------------------------------------------------------------------ | Field | Type | derivedFrom | Description | | --- | --- | --- | --- | | id | ID! | | Mint Entity ID. Format: `#` | | transaction | [Transaction](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
! | | [Transaction Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
in which the mint event was emitted | | timestamp | BigInt! | | Timestamp of the block in which which the mint event was emitted | | pool | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
! | | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
in which the mint event was emitted | | token0 | [Token](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
! | | token0 entity of the pool | | token1 | [Token](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
! | | token1 entity of the pool | | owner | Bytes! | | owner of the position to which the liquidity was minted | | sender | Bytes | | the address that minted the liquidity | | origin | Bytes! | | The EOA address that initiated the transaction | | amount | BigInt! | | Amount of liquidity minted | | amount0 | BigDecimal! | | Amount of token0 minted | | amount1 | BigDecimal! | | Amount of token1 minted | | amountUSD | BigDecimal | | Mint value derived in USD based on available prices of tokens | | tickLower | BigInt! | | Lower tick of the position | | tickUpper | BigInt! | | Upper tick of the position | | logIndex | BigInt | | Order of the Mint Event within the logs of the transaction | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/mint#referencing-functions "Direct link to Referencing Functions") --------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [handleMint()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handlemint) | ✅ | | ✅ | ✅ | On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/mint#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/mint#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/mint.md) --- # Flash | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/flash#__docusaurus_skipToContent_fallback) On this page Entity to store details of a flash event emitted while a flash loan was taken from a pool. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/flash#schema "Direct link to Schema") ------------------------------------------------------------------------------------------------------------- | Field | Type | derivedFrom | Description | | --- | --- | --- | --- | | id | ID! | | Flash Entity ID. Format: `#` | | transaction | [Transaction](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
! | | [Transaction Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
in which the flash event was emitted | | timestamp | BigInt! | | Timestamp of the block in which which the flash event was emitted | | pool | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
! | | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
in which the flash event was emitted | | sender | Bytes | | the address of the sender that invoked the flash operation | | recipient | Bytes! | | the address of the recipient that received the flash amount | | amount0 | BigDecimal! | | Amount of token0 flashed | | amount1 | BigDecimal! | | Amount of token1 flashed | | amountUSD | BigDecimal | | Flash value derived in USD based on available prices of tokens | | amount0Paid | BigDecimal! | | Amount of token0 paid for the flash operation | | amount1Paid | BigDecimal! | | Amount of token1 paid for the flash operation | | logIndex | BigInt | | Order of the Flash Event within the logs of the transaction | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/flash#referencing-functions "Direct link to Referencing Functions") ---------------------------------------------------------------------------------------------------------------------------------------------------------- danger Couldn't find any references to collect schema On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/flash#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/flash#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/flash.md) --- # Pool | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool#__docusaurus_skipToContent_fallback) On this page Entity to store a pool's metadata, current & lifetime metrics and links to events and hourly/daily metrics and references to it's tick entities. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool#schema "Direct link to Schema") ------------------------------------------------------------------------------------------------------------ | Field | Type | derivedFrom | Description | Field Missing | | --- | --- | --- | --- | --- | | id | ID! | | Pool Contract Address | | | createdAtTimestamp | BigInt! | | BlockTime where the pool was created | | | createdAtBlockNumber | BigInt! | | Block Number where the pool was created | | | token0 | [Token](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
! | | Token entity for token0 | | | token1 | [Token](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
! | | Token entity for token1 | | | feeTier | BigInt! | | The percentage of token taken as fee in terms of basis points | | | liquidity | BigInt! | | Liquidity in the currently active tick range | | | sqrtPrice | BigInt! | | The current token pair price tracked in square root & Q96 format | | | feeGrowthGlobal0X128 | BigInt! | | The total fee in token0 per unit of liquidity collected by the pool | arbitrum-one | | feeGrowthGlobal1X128 | BigInt! | | The total fee in token1 per unit of liquidity collected by the pool | arbitrum-one | | token0Price | BigDecimal! | | Price of token0 in terms of token1 | | | token1Price | BigDecimal! | | Price of token1 in terms of token0 | | | tick | BigInt | | The current active [tick](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick) | | | observationIndex | BigInt! | | The current observation index (used to record historic prices) | | | volumeToken0 | BigDecimal! | | Total volume of token0 swapped in the pool | | | volumeToken1 | BigDecimal! | | Total volume of token1 swapped in the pool | | | volumeUSD | BigDecimal! | | Total volume swapped in the pool in USD value | | | untrackedVolumeUSD | BigDecimal! | | Total volume swapped in the pool (including values for unreliable USD pools) in USD value | | | feesUSD | BigDecimal! | | Total fee collected in USD value | | | txCount | BigInt! | | Total no. of transactions in the pool | | | collectedFeesToken0 | BigDecimal! | | Total amount of token0 fee collected | | | collectedFeesToken1 | BigDecimal! | | Total amount of token1 fee collected | | | collectedFeesUSD | BigDecimal! | | Total amount of fee collected in USD value | | | totalValueLockedToken0 | BigDecimal! | | Total amount of token0 locked across all ticks in the pool | | | totalValueLockedToken1 | BigDecimal! | | Total amount of token1 locked across all ticks in the pool | | | totalValueLockedETH | BigDecimal! | | Total value locked in the pool in ETH value | | | totalValueLockedUSD | BigDecimal! | | Total value locked in the pool in USD value | | | totalValueLockedUSDUntracked | BigDecimal! | | Total value locked in the pool (including tokens with unreliable USD values) in USD value | | | liquidityProviderCount | BigInt! | | Used for detecting new exchanges. (Currently not updated Anywhere) | | | poolHourData | \[[PoolHourData](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/poolhourdata)
!\]! | @derivedFrom(field: "pool") | Hourly Snapshots of Pool's data | | | poolDayData | \[[PoolDayData](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pooldaydata)
!\]! | @derivedFrom(field: "pool") | Daily Snapshots of Pool's data | | | mints | \[[Mint](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/mint)
!\]! | @derivedFrom(field: "pool") | Mint Events emitted from the Pool | | | burns | \[[Burn](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/burn)
!\]! | @derivedFrom(field: "pool") | Burn Events emitted from the Pool | | | swaps | \[[Swap](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/swap)
!\]! | @derivedFrom(field: "pool") | Swap Events emitted from the Pool | | | collects | \[[Collect](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/collect)
!\]! | @derivedFrom(field: "pool") | Collect Events emitted from the Pool | | | ticks | \[[Tick](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick)
!\]! | @derivedFrom(field: "pool") | Tick entities respresenting the Pool liquidity | | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool#referencing-functions "Direct link to Referencing Functions") --------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [handlePoolCreated()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/factory.ts#handlepoolcreated) | ✅ | | ✅ | ✅ | | [updatePoolDayData()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalUpdates.ts#updatepooldaydata) | | ✅ | | | | [updatePoolHourData()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalUpdates.ts#updatepoolhourdata) | | ✅ | | | | [getEthPriceInUSD()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/pricing.ts#getethpriceinusd) | | ✅ | | | | [findEthPerToken()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/pricing.ts#findethpertoken) | | ✅ | | | | [handleInitialize()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleinitialize) | | ✅ | ✅ | ✅\* | | [handleMint()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handlemint) | | ✅ | ✅ | ✅ | | [handleBurn()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleburn) | | ✅ | ✅ | ✅ | | [handleSwap()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleswap) | | ✅ | ✅ | ✅ | | [handleFlash()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleflash) | | | ✅ | ✅ | | [populateEmptyPools()\*](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/backfill.ts#populateemptypools) | ✅ | | ✅ | ✅ | \* -> Different across chains On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/pool.md) --- # PoolDayData | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pooldaydata#__docusaurus_skipToContent_fallback) On this page Entity to store the daily metrics for each pool. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pooldaydata#schema "Direct link to Schema") ------------------------------------------------------------------------------------------------------------------- | Field | Type | derivedFrom | Description | Field Missing | | --- | --- | --- | --- | --- | | id | ID! | | PoolDayData Entity ID. Format: `-` | | | date | Int! | | Timestamp rounded to hour by dividing by 86400 | | | pool | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
! | | [Pool Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
for which the daily metrics are tracked | | | liquidity | BigInt! | | In range Liquidity at the end of the day | | | sqrtPrice | BigInt! | | Pool Price at the end of the day | | | token0Price | BigDecimal! | | Price of token0 in terms of token1 at the end of the day | | | token1Price | BigDecimal! | | Price of token1 in terms of token0 at the end of the day | | | tick | BigInt | | Actice Tick at the end of the day | | | feeGrowthGlobal0X128 | BigInt! | | Global Fee Marker Value for token0 at the end of the day | arbitrum-one | | feeGrowthGlobal1X128 | BigInt! | | Global Fee Marker Value for token1 at the end of the day | arbitrum-one | | tvlUSD | BigDecimal! | | TVL available at the end of the day derived in USD | | | volumeToken0 | BigDecimal! | | Total daily volume in token0 | | | volumeToken1 | BigDecimal! | | Total daily volume in token1 | | | volumeUSD | BigDecimal! | | Total daily volume in USD | | | feesUSD | BigDecimal! | | Total swap fee taken during the day in terms of USD | | | txCount | BigInt! | | No. of transactions in pool executed during the day | | | open | BigDecimal! | | Open Price of token0 | | | high | BigDecimal! | | High Price of token0 | | | low | BigDecimal! | | Low Price of token0 | | | close | BigDecimal! | | Close Price of token0 | | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pooldaydata#referencing-functions "Direct link to Referencing Functions") ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [updatePoolDayData()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalUpdates.ts#updatepooldaydata) | ✅ | ✅ | ✅ | ✅ | | [handleSwap()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleswap) | | ✅ | ✅ | ✅ | On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pooldaydata#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pooldaydata#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/pooldaydata.md) --- # PoolHourData | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/poolhourdata#__docusaurus_skipToContent_fallback) On this page Entity to store the hourly stats for each pool. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/poolhourdata#schema "Direct link to Schema") -------------------------------------------------------------------------------------------------------------------- | Field | Type | derivedFrom | Description | Field Missing | | --- | --- | --- | --- | --- | | id | ID! | | PoolHourData Entity ID. Format: `-` | | | periodStartUnix | Int! | | Timestamp rounded to hour by dividing by 3600 | | | pool | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
! | | [Pool Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
for which the hourly metrics are tracked | | | liquidity | BigInt! | | In range Liquidity at the end of the hour | | | sqrtPrice | BigInt! | | Pool Price at the end of the hour | | | token0Price | BigDecimal! | | Price of token0 in terms of token1 at the end of the hour | | | token1Price | BigDecimal! | | Price of token1 in terms of token0 at the end of the hour | | | tick | BigInt | | Actice Tick at the end of the hour | | | feeGrowthGlobal0X128 | BigInt! | | Global Fee Marker Value for token0 at the end of the hour | arbitrum-one | | feeGrowthGlobal1X128 | BigInt! | | Global Fee Marker Value for token1 at the end of the hour | arbitrum-one | | tvlUSD | BigDecimal! | | TVL available at the end of the hour derived in USD | | | volumeToken0 | BigDecimal! | | Total hourly volume in token0 | | | volumeToken1 | BigDecimal! | | Total hourly volume in token1 | | | volumeUSD | BigDecimal! | | Total hourly volume in USD | | | feesUSD | BigDecimal! | | Total swap fee taken during the hour in terms of USD | | | txCount | BigInt! | | No. of transactions in pool executed during the hour | | | open | BigDecimal! | | Open Price of token0 | | | high | BigDecimal! | | High Price of token0 | | | low | BigDecimal! | | Low Price of token0 | | | close | BigDecimal! | | Close Price of token0 | | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/poolhourdata#referencing-functions "Direct link to Referencing Functions") ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [updatePoolHourData()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalUpdates.ts#updatehourdaydata) | ✅ | ✅ | ✅ | ✅ | | [handleSwap()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleswap) | | ✅ | ✅ | ✅\* | \* -> Different across chains On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/poolhourdata#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/poolhourdata#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/poolhourdata.md) --- # PositionSnapshot | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/positionsnapshot#__docusaurus_skipToContent_fallback) On this page Entity storing the state of a position after an action taken on the position. Entity Not Defined * Currently the entity is not defined for arbitrum-one chain Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/positionsnapshot#schema "Direct link to Schema") ------------------------------------------------------------------------------------------------------------------------ | Field | Type | derivedFrom | Description | | --- | --- | --- | --- | | id | ID! | | Position Snapshot ID. Format: `#` | | owner | Bytes! | | Position NFT's Owner's Address | | pool | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
! | | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
entity to which the position belongs to | | position | [Position](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/position)
! | | [Position](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/position)
entity for which the snapshot is taken | | blockNumber | BigInt! | | BlockNumber in which the snapshot was created | | timestamp | BigInt! | | Timestamp of the block in which the snapshot was created | | liquidity | BigInt! | | Total Liquidity of the position | | depositedToken0 | BigDecimal! | | Total amount of token0 ever deposited to the position | | depositedToken1 | BigDecimal! | | Total amount of token1 ever deposited to the position | | withdrawnToken0 | BigDecimal! | | Total amount of token0 withdrawn from the position (excluding the fee) | | withdrawnToken1 | BigDecimal! | | Total amount of token1 withdrawn from the position (excluding the fee) | | collectedFeesToken0 | BigDecimal! | | Total amount of token0 fee collected | | collectedFeesToken1 | BigDecimal! | | Total amount of token1 fee collected | | transaction | [Transaction](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
! | | [Transaction](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
in which the Snapshot was created. | | feeGrowthInside0LastX128 | BigInt! | | Marker to compute the position's token0 fee in a pool | | feeGrowthInside1LastX128 | BigInt! | | Marker to compute the position's token1 fee in a pool | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/positionsnapshot#referencing-functions "Direct link to Referencing Functions") --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [savePositionSnapshot()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#savepositionsnapshot) | ✅ | | ✅ | ✅ | On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/positionsnapshot#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/positionsnapshot#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/positionsnapshot.md) --- # Position | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/position#__docusaurus_skipToContent_fallback) On this page Entity to store details of a position created through [NonfungiblePositionManager](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/nonfungiblepositionmanager) . Stores it's metadata, deposited/withdrawn tokens, fee variables and transactions where it participated. Entity Not Defined * Currently the entity is not defined for arbitrum-one chain Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/position#schema "Direct link to Schema") ---------------------------------------------------------------------------------------------------------------- | Field | Type | derivedFrom | Description | Field Missing | | --- | --- | --- | --- | --- | | id | ID! | | Position NFT Token ID | | | owner | Bytes! | | Position NFT owner's address | | | pool | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
! | | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
where the position staked the tokens | | | token0 | [Token](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
! | | token0 entity of the pool | | | token1 | [Token](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
! | | token1 entity of the pool | | | tickLower | [Tick](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick)
! | | Lower [Tick Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick)
of the position | | | tickUpper | [Tick](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick)
! | | Upper [Tick Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick)
of the position | | | liquidity | BigInt! | | Total liquidity added by the position | | | depositedToken0 | BigDecimal! | | Total amount token0 ever deposited to the position | | | depositedToken1 | BigDecimal! | | Total amount token1 ever deposited to the position | | | withdrawnToken0 | BigDecimal! | | Total amount token0 withdrawn to the position (excluding fees) | | | withdrawnToken1 | BigDecimal! | | Total amount token1 withdrawn to the position (excluding fees) | | | collectedToken0 | BigDecimal! | | Total amount of token0 collected (inclusive of burn amounts) | mainnet | | collectedToken1 | BigDecimal! | | Total amount of token1 collected (inclusive of burn amounts) | mainnet | | collectedFeesToken0 | BigDecimal! | | Total amount token0 fee collected | | | collectedFeesToken1 | BigDecimal! | | Total amount token1 fee collected | | | amountDepositedUSD | BigDecimal! | | Total amount deposited in terms of USD | mainnet, optimsim | | amountWithdrawnUSD | BigDecimal! | | Total amount withdrawn in terms of USD | mainnet, optimism | | amountCollectedUSD | BigDecimal! | | Total amount collected in terms of USD | mainnet, optimism | | transaction | [Transaction](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
! | | [Transaction entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
in which the position was created | | | feeGrowthInside0LastX128 | BigInt! | | Tracking the amount of token0 fee accumulated by the position | | | feeGrowthInside1LastX128 | BigInt! | | Tracking the amount of token1 fee accumulated by the position | | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/position#referencing-functions "Direct link to Referencing Functions") ------------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [getPosition()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#getposition) | ✅ | | ✅ | | | [updateFeeVars()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#updatefeevars) | | | ✅ | | | [savePositionSnapshot()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#savepositionsnapshot) | | ✅ | | | | [handleIncreaseLiquidity()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handleincreaseliquidity) | | ✅ | ✅ | ✅ | | [handleDecreaseLiquidity()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handledecreaseliquidity) | | ✅ | ✅ | ✅ | | [handleCollect()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handlecollect) | | ✅ | ✅ | ✅ | | [handleTransfer()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handletransfer) | | | ✅ | ✅ | On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/position#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/position#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/position.md) --- # Swap | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/swap#__docusaurus_skipToContent_fallback) On this page Entity to stores details of a swap event emitted while swapping one token for the other in a pool. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/swap#schema "Direct link to Schema") ------------------------------------------------------------------------------------------------------------ | Field | Type | derivedFrom | Description | | --- | --- | --- | --- | | id | ID! | | Swap Entity ID. Format: `#` | | transaction | [Transaction](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
! | | [Transaction Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction)
in which the swap event was emitted | | timestamp | BigInt! | | Timestamp of the block in which which the swap event was emitted | | pool | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
! | | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
in which the swap event was emitted | | token0 | [Token](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
! | | token0 entity of the pool | | token1 | [Token](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
! | | token1 entity of the pool | | sender | Bytes | | the address that triggered the swap | | recipient | Bytes! | | The address that gets their tokens swapped | | origin | Bytes! | | The EOA address that initiated the transaction | | amount0 | BigDecimal! | | Amount of token0 swapped | | amount1 | BigDecimal! | | Amount of token1 swapped | | amountUSD | BigDecimal | | Swapped token value derived in USD based on available prices of tokens | | sqrtPriceX96 | BigInt! | | The sqrt(price) of the pool after the swap, as a Q64.96 | | tick | BigInt! | | The tick after the swap | | logIndex | BigInt | | Order of the swap event within the logs of the transaction | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/swap#referencing-functions "Direct link to Referencing Functions") --------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [handleSwap()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleswap) | ✅ | | ✅ | ✅ | On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/swap#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/swap#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/swap.md) --- # Tick | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick#__docusaurus_skipToContent_fallback) On this page Entity to stores the metadata for a tick in a pool, it's lifetime metrics and current liquidity and fee variables. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick#schema "Direct link to Schema") ------------------------------------------------------------------------------------------------------------ | Field | Type | derivedFrom | Description | Field Missing | | --- | --- | --- | --- | --- | | id | ID! | | Tick ID. Format: `#` | | | poolAddress | String | | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
contract address | | | tickIdx | BigInt! | | [Tick](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick)
Index | | | pool | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
! | | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
Entity | | | liquidityGross | BigInt! | | Total Liquidity the pool has at the tick with it's lower and upper range. | | | liquidityNet | BigInt! | | Liquidity change when the tick is crossed | | | price0 | BigDecimal! | | Price of token0 at this tick (constant) | | | price1 | BigDecimal! | | Price of token1 at this tick (constant) | | | volumeToken0 | BigDecimal! | | Total volume of token0 transacted with tick in active range | | | volumeToken1 | BigDecimal! | | Total volume of token1 transacted with tick in active range | | | volumeUSD | BigDecimal! | | Total transacted value with tick in active range in USD | | | untrackedVolumeUSD | BigDecimal! | | Total transacted value with tick in active range (including tokens with unreliable USD value) in USD | | | feesUSD | BigDecimal! | | Fee collected with the tick in active range in USD | | | collectedFeesToken0 | BigDecimal! | | Total amount of token0 collected as fee when this tick is active | | | collectedFeesToken1 | BigDecimal! | | Total amount of token1 collected as fee when this tick is active | | | collectedFeesUSD | BigDecimal! | | Total value of fee collected when this tick is active is USD | | | createdAtTimestamp | BigInt! | | BlockTime when the tick was initialized | | | createdAtBlockNumber | BigInt! | | BlockNumber when the tick was initialized | | | liquidityProviderCount | BigInt! | | Used for detecting new exchanges. (Not Used currently) | | | feeGrowthOutside0X128 | BigInt! | | Used for calculating token0 fee's accumulated outside a tick whenever it is crossed | arbitrum-one | | feeGrowthOutside1X128 | BigInt! | | Used for calculating token1 fee's accumulated outside a tick whenever it is crossed | arbitrum-one | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick#referencing-functions "Direct link to Referencing Functions") --------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [createTick()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/tick.ts#createtick) | ✅ | | ✅ | | | [updateTickDayData()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalUpdates.ts#updatetickdaydata) | | ✅ | | | | [handleMint()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handlemint) | | | ✅ | | | [handleBurn()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleburn) | | | ✅ | | | [updateTickFeeVarsAndSave()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#updatetickfeevarsandsave) | | | ✅ | ✅ | | [loadTickUpdateFeeVarsAndSave()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#loadtickupdatefeevarsandsave) | | ✅ | | | On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/tick.md) --- # TickDayData | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tickdaydata#__docusaurus_skipToContent_fallback) On this page Entities storing the details of Liquidity available & volume of token traded at a tick on a given day. info An entity is created only if there is a change during the day Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tickdaydata#schema "Direct link to Schema") ------------------------------------------------------------------------------------------------------------------- | Field | Type | derivedFrom | Description | Field Missing | | --- | --- | --- | --- | --- | | id | ID! | | TickDayData Entity ID. Format: `--` | | | date | Int! | | Timestamp rounded to the day by dividing by 86400 | | | pool | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
! | | [Pool Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
for which the daily tick metrics were recorded | | | tick | [Tick](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick)
! | | [Tick Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick)
for which daily metrics were recorded | | | liquidityGross | BigInt! | | Total liquidity around the tick (1-tick range below or above) at end of the day | | | liquidityNet | BigInt! | | Change in liquidity when the tick is crossed at end of the day | | | volumeToken0 | BigDecimal! | | Daily volume of token0 with this tick in active range | | | volumeToken1 | BigDecimal! | | Daily volume of token1 with this tick in active range | | | volumeUSD | BigDecimal! | | Daily swap value with this tick in active range in derived USD | | | feesUSD | BigDecimal! | | Daily swap fee with this tick in active range in derived USD | | | feeGrowthOutside0X128 | BigInt! | | token0 fee accumulated marker outside the tick range at the end of the day | arbitrum-one | | feeGrowthOutside1X128 | BigInt! | | token1 fee accumulated marker outside the tick range at the end of the day | arbitrum-one | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tickdaydata#referencing-functions "Direct link to Referencing Functions") ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [updateTickDayData()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalUpdates.ts#updatetickdaydata) | ✅ | | ✅ | ✅ | On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tickdaydata#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tickdaydata#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/tickdaydata.md) --- # TickHourData | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tickhourdata#__docusaurus_skipToContent_fallback) On this page Entities capturing details of Liquidity available & Volume of token traded at a tick for a given hour. Not Used The Schema is not currently populated in mainnet subgraph Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tickhourdata#schema "Direct link to Schema") -------------------------------------------------------------------------------------------------------------------- | Field | Type | derivedFrom | Description | | --- | --- | --- | --- | | id | ID! | | TickHourData Entity ID. Format: `--` | | periodStartUnix | Int! | | Timestamp rounded to the hour by dividing by 3600 | | pool | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
! | | [Pool Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
for which the hourly tick metrics were recorded | | tick | [Tick](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick)
! | | [Tick Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tick)
for which hourly metrics were recorded | | liquidityGross | BigInt! | | Total liquidity around the tick (1-tick range below or above) at end of the hour | | liquidityNet | BigInt! | | Change in liquidity when the tick is crossed at end of the hour | | volumeToken0 | BigDecimal! | | Hourly volume of token0 with this tick in active range | | volumeToken1 | BigDecimal! | | Hourly volume of token1 with this tick in active range | | volumeUSD | BigDecimal! | | Hourly swap value with this tick in active range in derived USD | | feesUSD | BigDecimal! | | Hourly swap fee with this tick in active range in derived USD | On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tickhourdata#schema) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/tickhourdata.md) --- # Resources | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/links-n-resources#__docusaurus_skipToContent_fallback) On this page ### Repo Links:[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/links-n-resources#repo-links "Direct link to Repo Links:") * [V3 Subgraph Repo](https://github.com/Uniswap/v3-subgraph/tree/main) * [V3 Core Contracts Repo](https://github.com/Uniswap/v3-core) - Mainly for factory and pool contracts * [V3 Periphery Contract Repo](https://github.com/Uniswap/v3-periphery) - Mainly for NonFungiblePositionManager Contract ### References[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/links-n-resources#references "Direct link to References") * [Uniswap V3 Core Whitepaper](https://uniswap.org/whitepaper-v3.pdf) * [Liquidity Math in Uniswap V3](https://atiselsts.github.io/pdfs/uniswap-v3-liquidity-math.pdf) * [Uniswap V3 Development Book](https://uniswapv3book.com/) ### Misc[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/links-n-resources#misc "Direct link to Misc") * [Uniswap Hacker Getting Started Guide](https://uniswap.notion.site/uniswap/Uniswap-Hacker-Getting-Started-Guide-781b008a16c849c8bf4d9920744e77f5) * [Uniswap Docs](https://docs.uniswap.org/) ([Code Repo](https://github.com/Uniswap/docs/tree/main) ) * [Uniswap Info Site](https://info.uniswap.org/#/) to see the pool and token stats using the subgraph * [V3 New Chain Deployment Guide](https://github.com/Uniswap/v3-new-chain-deployments) (Slightly Outdated) On this page * [Repo Links:](https://docs.uniswap.org/api/subgraph/subgraphs-devs/links-n-resources#repo-links) * [References](https://docs.uniswap.org/api/subgraph/subgraphs-devs/links-n-resources#references) * [Misc](https://docs.uniswap.org/api/subgraph/subgraphs-devs/links-n-resources#misc) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/links-n-resources.md) --- # Bundle | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/bundle#__docusaurus_skipToContent_fallback) On this page Entity to store the current Eth price in USD. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/bundle#schema "Direct link to Schema") -------------------------------------------------------------------------------------------------------------- | Field | Type | derivedFrom | Description | | --- | --- | --- | --- | | id | ID! | | ID to fetch a unique entity. (Only ID='1' is used.) | | ethPriceUSD | BigDecimal! | | Price of ETH in USD | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/bundle#referencing-functions "Direct link to Referencing Functions") ----------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [findEthPerToken()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/pricing.ts#findethpertoken) | | ✅ | | | | [getTrackedAmountUSD()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/pricing.ts#gettrackedamountusd) | | ✅ | | | | [handlePoolCreated()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/factory.ts#handlepoolcreated) | ✅ | | ✅ | ✅ | | [handleInitialize()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleinitialize) | | | ✅\* | ✅\* | | [handleMint()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handlemint) | | ✅ | | | | [handleBurn()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleburn) | | ✅ | | | | [handleSwap()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleswap) | | ✅ | ✅ | ✅ | | [handleIncreaseLiquidity()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handleincreaseliquidity) | | ✅\* | | | | [handleDecreaseLiquidity()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handledecreaseliquidity) | | ✅\* | | | | [handleCollect()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handlecollect) | | ✅\* | | | | [updateTokenDayData()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalupdates.ts#updatetokendaydata) | | ✅ | | | | [updateTokenHourData()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalupdates.ts#updatetokenhourdata) | | ✅ | | | \* -> Varies across chains On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/bundle#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/bundle#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/bundle.md) --- # Token | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token#__docusaurus_skipToContent_fallback) On this page Entity to stores the metadata and token level metrics for a token present in any of the pools. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token#schema "Direct link to Schema") ------------------------------------------------------------------------------------------------------------- | Field | Type | derivedFrom | Description | | --- | --- | --- | --- | | id | ID! | | Token Contract Address | | symbol | String! | | Token Symbol | | name | String! | | Token Name | | decimals | BigInt! | | No. of decimals in the token value | | totalSupply | BigInt! | | Total supply of the token | | volume | BigDecimal! | | Total token volume traded in swaps | | volumeUSD | BigDecimal! | | Total token value traded in swaps in USD | | untrackedVolumeUSD | BigDecimal! | | Total token value traded in USD, including pools with unreliable USD values | | feesUSD | BigDecimal! | | Amount of Fees taken from token swaps in derived in USD | | txCount | BigInt! | | No. of transactions across all pools that include this token | | poolCount | BigInt! | | No. of pools containing this token | | totalValueLocked | BigDecimal! | | Liquidity across all pools for the token | | totalValueLockedUSD | BigDecimal! | | Liquidity across all pools for the token in terms of USD value | | totalValueLockedUSDUntracked | BigDecimal! | | Liquidity across all pools (including pools with unreliable USD values) for the token in terms of USD value | | derivedETH | BigDecimal! | | Price of token relative to ETH | | whitelistPools | \[[Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
!\]! | | [Pool](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/pool)
entities which can can be used for reliable USD pricing of the token | | tokenDayData | \[[TokenDayData](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tokendaydata)
!\]! | @derivedFrom(field: "token") | Link to daily stats for the token | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token#referencing-functions "Direct link to Referencing Functions") ---------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [sqrtPriceX96ToTokenPrices()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/pricing.ts#sqrtpricex96totokenprices) | | ✅ | | | | [findEthPerToken()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/pricing.ts#findethpertoken) | | ✅ | | | | [getTrackedAmountUSD()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/pricing.ts#gettrackedamountusd) | | ✅ | | | | [updateTokenDayData()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalUpdates.ts#updatetokendaydata) | | ✅ | | | | [updateTokenHourData()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalUpdates.ts#updatetokenhourdata) | | ✅ | | | | [handleInitialize()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleinitialize) | | ✅\* | ✅ | ✅ | | [handleMint()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handlemint) | | ✅ | ✅ | ✅ | | [handleBurn()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleburn) | | ✅ | ✅ | ✅ | | [handleSwap()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleswap) | | ✅ | ✅ | ✅\* | | [handlePoolCreated()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/factory.ts#handlepoolcreated) | ✅ | ✅ | ✅ | ✅ | | [handleIncreaseLiquidity()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handleincreaseliquidity) | | ✅ | | | | [handleDecreaseLiquidity()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handledecreaseliquidity) | | ✅ | | | | [handleCollect()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#handlecollect) | | ✅ | | | | [populateToken()\*](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/backfill.ts#populatetoken) | ✅ | | ✅ | ✅ | | [populateEmptyPools()\*](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/backfill.ts#populateemptypools) | | ✅ | ✅ | ✅ | \* -> Different across chains On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/token.md) --- # TokenDayData | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tokendaydata#__docusaurus_skipToContent_fallback) On this page Entities capturing the daily stats for a token across all of Uniswap. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tokendaydata#schema "Direct link to Schema") -------------------------------------------------------------------------------------------------------------------- | Field | Type | derivedFrom | Description | | --- | --- | --- | --- | | id | ID! | | TokenDayData Entity ID. Format: `-` | | date | Int! | | Timestamp rounded to the day by dividing by 86400 | | token | [Token](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
! | | [Token Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
for which the daily metric were recorded | | volume | BigDecimal! | | Daily swap volume of the token | | volumeUSD | BigDecimal! | | Daily swap volume of the token in derived USD | | untrackedVolumeUSD | BigDecimal! | | Daily swap volume of the token in derived USD (including in pools with tokens with unreliable USD value) | | totalValueLocked | BigDecimal! | | Liquidity across all pools in token units at the end of the day | | totalValueLockedUSD | BigDecimal! | | Total value of liquidity across all pools in token units in derived USD at the end of the day | | priceUSD | BigDecimal! | | Price of token in USD at the end of the day | | feesUSD | BigDecimal! | | Total Fee Collected in derived USD at the end of the day | | open | BigDecimal! | | Open Price of the token | | high | BigDecimal! | | High Price of the token | | low | BigDecimal! | | Low Price of the token | | close | BigDecimal! | | Close Price of the token | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tokendaydata#referencing-functions "Direct link to Referencing Functions") ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [updateTokenDayData()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalUpdates.ts#updatetokendaydata) | ✅ | ✅ | ✅ | ✅ | On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tokendaydata#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tokendaydata#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/tokendaydata.md) --- # Changelog | Uniswap [Skip to main content](https://docs.uniswap.org/archived/changelog#__docusaurus_skipToContent_fallback) | Date | Abstract | Transaction | Sybil Reference | | --- | --- | --- | --- | | June 12, 2021 | Reduce the UNI proposal submission threshold to 2.5M | [Etherscan](https://etherscan.io/tx/0xacda6ebe63dfc2b34a8b3e3f6297a424e4cf25cd68add6613f902099bd7432e4) | [https://sybil.org/#/proposals/uniswap/4](https://sybil.org/#/proposals/uniswap/4) | | August 26, 2021 | Upgrade Governance Contract to Compound's Governor Bravo | [Etherscan](https://etherscan.io/tx/0x505870232ebd6cefd2a59c760924664212f72759e58fd2df82d61b67ffe0dd75) | [https://sybil.org/#/proposals/uniswap/8](https://sybil.org/#/proposals/uniswap/8) | Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/archived/07-changelog.md) --- # Subgraph Configuration | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/subgraph-configs#__docusaurus_skipToContent_fallback) On this page ### Subgraphs[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/subgraph-configs#subgraphs "Direct link to Subgraphs") info The subgraphs link are picked from the clients specified in [v3-info](https://github.com/Uniswap/v3-info/blob/master/src/apollo/client.ts) | Subgraph | Code Branch Referred | Graft Base | Graft Block | NFT Position Manager Address | NFT Position Manager Start Block | | --- | --- | --- | --- | --- | --- | | [Mainnet](https://thegraph.com/hosted-service/subgraph/uniswap/uniswap-v3) | [main](https://github.com/Uniswap/v3-subgraph/tree/main) | QmS13421u6qsbVdBCrZhdRaZw2wH67drwF3urmueJvvJ5P | 13591197 | 0xC36442b4a4522E871399CD717aBDD847Ab11FE88 | 12369651 | | [Polygon](https://thegraph.com/hosted-service/subgraph/ianlapham/uniswap-v3-polygon) | [polygon](https://github.com/Uniswap/v3-subgraph/tree/polygon) | QmUKRxaVLRpn18UA9mwukAwRQudH9TfBW5wiKCWEJghUS8 | 25459720 | 0xC36442b4a4522E871399CD717aBDD847Ab11FE88 | 22760586 | | [Arbitrum-One](https://thegraph.com/hosted-service/subgraph/ianlapham/uniswap-arbitrum-one) | [arbitrum-minimal](https://github.com/Uniswap/v3-subgraph/tree/arbitrum-minimal) | None | None | None | None | | [Optimism](https://thegraph.com/hosted-service/subgraph/ianlapham/optimism-post-regenesis) | [ian/optimism-fix](https://github.com/Uniswap/v3-subgraph/tree/ian/optimism-fix) | Qmf9i13TJknQwcamcLbb75hEhbf3nqDi321XWhtFBj3P5s | 10028767 | 0xC36442b4a4522E871399CD717aBDD847Ab11FE88 | 0 | On this page * [Subgraphs](https://docs.uniswap.org/api/subgraph/subgraphs-devs/subgraph-configs#subgraphs) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/subgraph-configs.md) --- # Glossary | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/glossary#__docusaurus_skipToContent_fallback) On this page Automated Market Maker[​](https://docs.uniswap.org/concepts/glossary#automated-market-maker "Direct link to Automated Market Maker") ------------------------------------------------------------------------------------------------------------------------------------- An automated market maker is a smart contract on Ethereum that holds liquidity reserves. Users can trade against these reserves at prices determined by a fixed formula. Anyone may contribute liquidity to these smart contracts, earning pro-rata trading fees in return. Asset[​](https://docs.uniswap.org/concepts/glossary#asset "Direct link to Asset") ---------------------------------------------------------------------------------- While a digital asset can take many forms, the Uniswap Protocol supports ERC-20 token pairs, and represents a position in the form of an NFT (ERC-721). Concentrated Liquidity[​](https://docs.uniswap.org/concepts/glossary#concentrated-liquidity "Direct link to Concentrated Liquidity") ------------------------------------------------------------------------------------------------------------------------------------- Liquidity that is allocated within a determined price range. Constant Product Formula[​](https://docs.uniswap.org/concepts/glossary#constant-product-formula "Direct link to Constant Product Formula") ------------------------------------------------------------------------------------------------------------------------------------------- The automated market making algorithm used by Uniswap. In v1 and v2, this was x\*y=k. Core[​](https://docs.uniswap.org/concepts/glossary#core "Direct link to Core") ------------------------------------------------------------------------------- Smart contracts that are considered foundational, and are essential for Uniswap to exist. Upgrading to a new version of core would require deploying an entirely new set of smart contracts on Ethereum and would be considered a new version of the Uniswap Protocol. ERC20[​](https://docs.uniswap.org/concepts/glossary#erc20 "Direct link to ERC20") ---------------------------------------------------------------------------------- ERC20 tokens are fungible tokens on Ethereum. Uniswap supports all standard ERC20 implementations. Factory[​](https://docs.uniswap.org/concepts/glossary#factory "Direct link to Factory") ---------------------------------------------------------------------------------------- A smart contract that deploys a unique smart contract for any ERC20/ERC20 trading pair. Flash Swap[​](https://docs.uniswap.org/concepts/glossary#flash-swap "Direct link to Flash Swap") ------------------------------------------------------------------------------------------------- A trade that uses the tokens purchased before paying for them. Invariant[​](https://docs.uniswap.org/concepts/glossary#invariant "Direct link to Invariant") ---------------------------------------------------------------------------------------------- The “k” value in the constant product formula X\*Y=K Liquidity Provider / "LP"[​](https://docs.uniswap.org/concepts/glossary#liquidity-provider--lp "Direct link to Liquidity Provider / "LP"") ------------------------------------------------------------------------------------------------------------------------------------------- A liquidity provider is someone who deposits ERC20 tokens into a given liquidity pool. Liquidity providers take on price risk and are compensated with trading fees. Liquidity[​](https://docs.uniswap.org/concepts/glossary#liquidity "Direct link to Liquidity") ---------------------------------------------------------------------------------------------- Digital assets that are stored in a Uniswap pool contract, and are able to be traded against by traders. Mid Price[​](https://docs.uniswap.org/concepts/glossary#mid-price "Direct link to Mid Price") ---------------------------------------------------------------------------------------------- The price between the available buy and sell prices. In Uniswap v1 and v2, this is the ratio of the two ERC20 token reserves. In V3, this is the ratio of the two ERC20 token reserves available within the current active tick. Observation[​](https://docs.uniswap.org/concepts/glossary#observation "Direct link to Observation") ---------------------------------------------------------------------------------------------------- An instance of historical price and liquidity data of a given pair. Pair[​](https://docs.uniswap.org/concepts/glossary#pair "Direct link to Pair") ------------------------------------------------------------------------------- A smart contract deployed from a Uniswap v1 or v2 factory contract that enables trading between two ERC20 tokens. Pair contracts are now called Pools in v3. Periphery[​](https://docs.uniswap.org/concepts/glossary#periphery "Direct link to Periphery") ---------------------------------------------------------------------------------------------- External smart contracts that are useful, but not required for Uniswap to exist. New periphery contracts can always be deployed without migrating liquidity. Pool[​](https://docs.uniswap.org/concepts/glossary#pool "Direct link to Pool") ------------------------------------------------------------------------------- A contract deployed by the V3 factory that pairs two ERC-20 assets. Different pools may have different fees despite containing the same token pair. Pools were previously called Pairs before the introduction of multiple fee options. Position[​](https://docs.uniswap.org/concepts/glossary#position "Direct link to Position") ------------------------------------------------------------------------------------------- An instance of liquidity defined by upper and lower tick. And the amount of liquidity contained therein. Price Impact[​](https://docs.uniswap.org/concepts/glossary#price-impact "Direct link to Price Impact") ------------------------------------------------------------------------------------------------------- The difference between the mid-price and the execution price **caused by your trade size relative to the pool’s liquidity**. This is an expected result of the constant product formula in AMMs. Protocol Fees[​](https://docs.uniswap.org/concepts/glossary#protocol-fees "Direct link to Protocol Fees") ---------------------------------------------------------------------------------------------------------- Fees that are rewarded to the protocol itself, rather than to liquidity providers. Range[​](https://docs.uniswap.org/concepts/glossary#range "Direct link to Range") ---------------------------------------------------------------------------------- Any interval between two ticks of any distance. Range Order[​](https://docs.uniswap.org/concepts/glossary#range-order "Direct link to Range Order") ---------------------------------------------------------------------------------------------------- An approximation of a limit order, in which a single asset is provided as liquidity across a specified range, and is continuously swapped to the destination address as the spot price crosses the range. Reserves[​](https://docs.uniswap.org/concepts/glossary#reserves "Direct link to Reserves") ------------------------------------------------------------------------------------------- The liquidity available within a pair. This was more commonly referenced before concentrated liquidity was introduced. Slippage[​](https://docs.uniswap.org/concepts/glossary#slippage "Direct link to Slippage") ------------------------------------------------------------------------------------------- The total difference between the expected price at the time of submitting a transaction and the actual execution price, which may include price impact and other market movements that occur before the transaction is mined. Spot Price[​](https://docs.uniswap.org/concepts/glossary#spot-price "Direct link to Spot Price") ------------------------------------------------------------------------------------------------- The current price of a token relative to another within a given pair. Swap Fees[​](https://docs.uniswap.org/concepts/glossary#swap-fees "Direct link to Swap Fees") ---------------------------------------------------------------------------------------------- The fees collected upon swapping which are rewarded to liquidity providers. Tick Interval[​](https://docs.uniswap.org/concepts/glossary#tick-interval "Direct link to Tick Interval") ---------------------------------------------------------------------------------------------------------- The price space between two nearest ticks. Tick[​](https://docs.uniswap.org/concepts/glossary#tick "Direct link to Tick") ------------------------------------------------------------------------------- The boundaries between discrete areas in price space. On this page * [Automated Market Maker](https://docs.uniswap.org/concepts/glossary#automated-market-maker) * [Asset](https://docs.uniswap.org/concepts/glossary#asset) * [Concentrated Liquidity](https://docs.uniswap.org/concepts/glossary#concentrated-liquidity) * [Constant Product Formula](https://docs.uniswap.org/concepts/glossary#constant-product-formula) * [Core](https://docs.uniswap.org/concepts/glossary#core) * [ERC20](https://docs.uniswap.org/concepts/glossary#erc20) * [Factory](https://docs.uniswap.org/concepts/glossary#factory) * [Flash Swap](https://docs.uniswap.org/concepts/glossary#flash-swap) * [Invariant](https://docs.uniswap.org/concepts/glossary#invariant) * [Liquidity Provider / "LP"](https://docs.uniswap.org/concepts/glossary#liquidity-provider--lp) * [Liquidity](https://docs.uniswap.org/concepts/glossary#liquidity) * [Mid Price](https://docs.uniswap.org/concepts/glossary#mid-price) * [Observation](https://docs.uniswap.org/concepts/glossary#observation) * [Pair](https://docs.uniswap.org/concepts/glossary#pair) * [Periphery](https://docs.uniswap.org/concepts/glossary#periphery) * [Pool](https://docs.uniswap.org/concepts/glossary#pool) * [Position](https://docs.uniswap.org/concepts/glossary#position) * [Price Impact](https://docs.uniswap.org/concepts/glossary#price-impact) * [Protocol Fees](https://docs.uniswap.org/concepts/glossary#protocol-fees) * [Range](https://docs.uniswap.org/concepts/glossary#range) * [Range Order](https://docs.uniswap.org/concepts/glossary#range-order) * [Reserves](https://docs.uniswap.org/concepts/glossary#reserves) * [Slippage](https://docs.uniswap.org/concepts/glossary#slippage) * [Spot Price](https://docs.uniswap.org/concepts/glossary#spot-price) * [Swap Fees](https://docs.uniswap.org/concepts/glossary#swap-fees) * [Tick Interval](https://docs.uniswap.org/concepts/glossary#tick-interval) * [Tick](https://docs.uniswap.org/concepts/glossary#tick) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/glossary.md) --- # Uniswap Overview | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/overview#__docusaurus_skipToContent_fallback) On this page Protocol, Interface, Labs[​](https://docs.uniswap.org/concepts/overview#protocol-interface-labs "Direct link to Protocol, Interface, Labs") -------------------------------------------------------------------------------------------------------------------------------------------- To begin, we should make clear the distinctions between the different areas of "Uniswap", some of which may confuse new users. * **[Uniswap Labs](https://x.com/Uniswap) **: The company which developed the Uniswap protocol, along with the web interface. * **[Uniswap Foundation](https://www.uniswapfoundation.org/) **: A non-profit organization that supports the development of the Uniswap protocol and its DeFi ecosystem. * **[Uniswap Protocol](https://github.com/Uniswap/contracts) **: A suite of persistent, non-upgradable smart contracts that together create an automated market maker, a protocol that facilitates peer-to-peer market making and swapping of ERC-20 tokens on the Ethereum blockchain. * **[Uniswap Interface](https://app.uniswap.org/) **: A web interface that allows for easy interaction with the Uniswap protocol. The interface is only one of many ways one may interact with the Uniswap protocol. * **[Uniswap Governance](https://gov.uniswap.org/) **: A governance system for governing the Uniswap Protocol, enabled by the UNI token. On this page * [Protocol, Interface, Labs](https://docs.uniswap.org/concepts/overview#protocol-interface-labs) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/what-is-uniswap.md) --- # Adversarial Circumstances | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#__docusaurus_skipToContent_fallback) On this page This document explores some adversarial circumstances which Uniswap Governance may encounter in the future. Its goal is to help those interested in Uniswap Governance understand the reasoning behind some of its design, its limitations, and potential avenues for growth. Scenario 1[​](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#scenario-1 "Direct link to Scenario 1") ----------------------------------------------------------------------------------------------------------------------------- A good faith proposal is brought to vote but is found to have an exploitable edge case. A bad faith actor uses a series of DeFi leveraging strategies to quickly buy enough UNI during the voting period to sway the vote in favor of the proposal, passing it and exploiting the vulnerability. ### Circumvention[​](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#circumvention "Direct link to Circumvention") UNI voting power must be delegated to an address either entirely before a proposal has been submitted or during the proposal delay period. For now, the proposal delay is set to one block, which is about 15 seconds. A proposal delay of one block leaves no opportunity for a third party to find an exploitable edge case and opportunistically purchase uni, self delegate and sway the vote. In the future, Uniswap Governance may vote to increase the proposal delay. While there are obvious benefits to an increased proposal delay, It may introduce some potential adverse outcomes such as opportunistic edge case exploitation. Scenario 2[​](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#scenario-2 "Direct link to Scenario 2") ----------------------------------------------------------------------------------------------------------------------------- A bad faith proposal is crafted and submitted to vote, which is unambiguously not in the best interest of Uniswap Governance. Multiple parties collude ahead of time to corner the UNI market to force the proposal through, gain access to the UNI reserves, and drain the funds. ### Circumvention[​](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#circumvention-1 "Direct link to Circumvention") Since UNI is a freely tradable asset, anyone can attempt a governance takeover via market buying. That said, to force-pass a bad faith vote would require a minimum of 40 million UNI. If not outright impossible, this amount would be prohibitively expensive and likely cost more when accounting for price fluctuation than the net gain from the attack. If a group somehow achieved a bad faith takeover, Timelock's delay would give affected agents time to withdraw their assets from the protocol. This would also be an opportunity to fork the protocol, a path that would likely be taken by the remaining good-faith actors. Scenario 3[​](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#scenario-3 "Direct link to Scenario 3") ----------------------------------------------------------------------------------------------------------------------------- A single party uses a flash loan to push through a proposal, potentially creating a pseudo-DDOS attack by spamming governance with proposals and preventing effective use. ### Circumvention[​](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#circumvention-2 "Direct link to Circumvention") A delegated balance of 2.5 million UNI is required to submit a vote, but the balance check is set exactly one block in the past. This prevents any flash loan proposals from being created, as flash loans cannot execute outside of a single block. The proposer must also maintain a minimum balance of 2.5 million UNI throughout the voting period, or anyone may cancel the proposal. This balance maintenance check prevents many highly leveraged proposal techniques that may span several blocks. Scenario 4[​](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#scenario-4 "Direct link to Scenario 4") ----------------------------------------------------------------------------------------------------------------------------- A bad faith proposal is created, which will genuinely incentivize bad faith voting. Example: "The treasury will be drained. Any votes in favor will be sent the balance of the treasury. Any votes opposed will be locked from the funds of the treasury." ### Circumvention[​](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#circumvention-3 "Direct link to Circumvention") No mechanism explicitly prevents this type of scenario, but market forces disincentivize it. Because the treasury is comprised of UNI tokens exclusively, the market would react appropriately if a vote were to pass that would jeopardize the economic viability of Uniswap Governance and the UNI token. By the time the vote would pass, UNI's price would have fallen so low as to make the attack fruitless. UNI acting as the only asset of the governance treasury disincentivizes this form of bad faith voting. Uniswap Governance may choose in the future to diversify governance assets. While there are many benefits to this path, some fringe possibilities such as incentivized bad faith voting may appear. On this page * [Scenario 1](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#scenario-1) * [Circumvention](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#circumvention) * [Scenario 2](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#scenario-2) * [Circumvention](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#circumvention-1) * [Scenario 3](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#scenario-3) * [Circumvention](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#circumvention-2) * [Scenario 4](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#scenario-4) * [Circumvention](https://docs.uniswap.org/concepts/governance/adversarial-circumstances#circumvention-3) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/governance/04-adversarial-circumstances.md) --- # Core Functions | Uniswap [Skip to main content](https://docs.uniswap.org/category/core-functions#__docusaurus_skipToContent_fallback) [📄️ core.ts\ -----------\ \ path: /src/mappings/core.ts](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts) [📄️ factory.ts\ --------------\ \ path: /src/mappings/factory.ts](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/factory.ts) [📄️ position-manager.ts\ -----------------------\ \ The complete file is missing for arbitrum-one](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts) --- # Contracts | Uniswap [Skip to main content](https://docs.uniswap.org/category/contracts#__docusaurus_skipToContent_fallback) [📄️ Factory Contract\ --------------------\ \ Contract Details](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/factory) [📄️ NonFungiblePositionManager Contract\ ---------------------------------------\ \ Contract Details](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/nonfungiblepositionmanager) [📄️ Pool Contract (Templatized)\ -------------------------------\ \ Contract Details](https://docs.uniswap.org/api/subgraph/subgraphs-devs/contracts/pool) --- # Glossary | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/governance/glossary#__docusaurus_skipToContent_fallback) * **UNI:** An ERC-20 token that designates the weight of a user's voting rights. The more UNI a user has in their wallet, the more weight their delegation or vote on a proposal holds. * **Delegation:** UNI holders cannot vote or create proposals until they delegate their voting rights to an address. Delegation can be given to one address at a time, including the holder's own address. Note that delegation does not lock tokens; it simply adds votes to the chosen delegation address. * **Proposal:** A proposal is executable code that modifies the governance contract or treasury and how they work. In order to create a proposal, a user must have at least 0.25% (2.5M UNI) of all UNI delegated to their address. Proposals are stored in the "proposals" mapping of the Governor smart contract. All proposals are subject to a 7-day voting period. If the proposer does not maintain their vote weight balance throughout the voting period, the proposal may be canceled by anyone. * **Quorum:** In order for a vote to pass, it must achieve quorum of 4% of all UNI (40M) voting in the affirmative. The purpose of the quorum is to ensure that the only measures that pass have adequate voter participation. * **Voting:** Users can vote for or against single proposals once they have voting rights delegated to their address. Votes can be cast while a proposal is in the "Active" state. Votes can be submitted immediately using "castVote" or submitted later with "castVoteBySig" (For more info on castVoteBySig and offline signatures, see EIP-712). If the majority of votes (and a 4% quorum of UNI) vote for a proposal, the proposal may be queued in the Timelock. * **Voting Period:** Once a proposal has been put forward, Uniswap community members will have a seven day period (the Voting Period) to cast their votes. * **Timelock:** All governance and other administrative actions are required to sit in the Timelock for a minimum of 2 days, after which they can be implemented. Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/governance/05-glossary.md) --- # Beginners' Guide to Voting | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/governance/guide-to-voting#__docusaurus_skipToContent_fallback) On this page This guide contains everything you need to start voting in Uniswap Governance. To participate you will need: * [UNI Tokens](https://uniswap.org/blog/uni/) * ETH for transaction costs * A wallet that supports the Ethereum protocol and holds UNI tokens. (We suggest the [Uniswap wallet](https://wallet.uniswap.org/) ). * To [delegate](https://docs.uniswap.org/concepts/governance/guide-to-voting#delegation) your tokens before the vote is active. The governance [process](https://docs.uniswap.org/concepts/governance/process) begins in the [Governance Forum](https://gov.uniswap.org/) , where you can find proposals under consideration, gather information about community sentiment, and engage with the community. Once a given proposal is ready for an onchain vote, it will appear in the Uniswap [voting dashboard](https://vote.uniswapfoundation.org/) - where you can view all current and former Uniswap proposals. ![](https://docs.uniswap.org/assets/images/Proposals_Overview-45a7f1bc8cab6113e2f7388e7621b3ea.png) Clicking a proposal will show all the necessary information, documentation, and discussion needed for a voter to make an informed decision, and help visualize how the voting transpired. ![](https://docs.uniswap.org/assets/images/Proposal_Active-cabd5b3b1c61959b9b5969d4e59e2e6b.png) _**Once a proposal has reached the voting stage it represents real, executable code which will alter the functionality of Uniswap Governance or anything under its jurisdiction. Proper care should be taken to ensure that the code represented in the proposal has been audited and is found to be in good faith.**_ Delegation[​](https://docs.uniswap.org/concepts/governance/guide-to-voting#delegation "Direct link to Delegation") ------------------------------------------------------------------------------------------------------------------- UNI is a tradable asset and functions like most other standard ERC20 tokens, except it has a deeper power as a voting mechanism. In order for UNI to be used as a vote, the owner must first go through the delegation process. Delegating UNI binds the voting power of your tokens to an address so it may be used to vote. This address could be yourself, or a trusted party who you believe will vote in the best interest of Uniswap Governance. To submit a proposal, an address must have 1,000,000 UNI delegated to it. For a proposal to pass, 40,000,000 UNI (from any number of addresses) must vote on it, and the majority must be in favor. To delegate your UNI tokens, visit the [Uniswap voting dashboard](https://vote.uniswapfoundation.org/delegates) . Connect your Wallet, browse delegates, and click "Delegate" on your chosen delegate. ![](https://docs.uniswap.org/assets/images/Delegate_Selection-b37109958d87602455383f332d1eb3bf.png) ![](https://docs.uniswap.org/assets/images/Delegate_Button-5bf388398ee481d5a91efe52b75c591a.png) You can also delegate to yourself if you wish to participate in voting directly. After connecting your wallet, click your wallet address, then "view my profile." From there, you can click "Delegate" on your own profile to delegate your voting power to yourself. Once you click this button, you will see a screen that gives you the option to self delegate, or add a delegate address. If you wish to delegate your UNI voting power to your own address, click “Self Delegate”. You can also update your delegation at any time. ![](https://docs.uniswap.org/assets/images/Delegate_To_Self-b903241667ba6cd85b2816271fe17d80.png) When you click “Self Delegate”, a transaction will pop up in your wallet. If this doesn’t happen, double check that you have connected your wallet, turn off any popup blockers, and try again. Click "Confirm". When the transaction has processed, you will see that the updated voting power on your profile. Note that delegating your voting power is an event that is captured on chain, so setting and updating your delegation costs gas. An important note: much like voter registration in a larger democracy, for UNI to be used in a vote it must be delegated before both the voting period. This means if you want your vote to count, you must delegate it in anticipation of any proposal you may be interested in. If you are unsure of how best to vote and are interested in delegating your UNI voting power to another party, you can visit the [Delegation Pitch](https://gov.uniswap.org/c/delegation-pitch/6) section of the Governance Forum. Here parties participating in Uniswap Governance pitch their platform and voting agenda for users to read and discuss. Voting[​](https://docs.uniswap.org/concepts/governance/guide-to-voting#voting "Direct link to Voting") ------------------------------------------------------------------------------------------------------- If you have self delegated and there is an active proposal, you are ready to vote in Uniswap Governance. To cast your vote, navigate to the proposals page and click on an active proposal. ![](https://docs.uniswap.org/assets/images/Proposals_Overview-45a7f1bc8cab6113e2f7388e7621b3ea.png) After reviewing the attached details and deciding your opinion, choose “Vote For”, or “Vote Against”. Once you’ve chosen, a window will pop up allowing you to execute the vote. When you click to cast your vote, your wallet will pop up asking you to confirm your transaction. Click “submit” or "confirm", wait a bit, and check that the transaction has been confirmed. You can view your votes from your profile, or on the proposal itself. ![](https://docs.uniswap.org/assets/images/Vote_Confirmation-cee3fef4d1ab95d386e284f6404d5647.png) That’s it! Once your transaction has been confirmed, you will have cast your vote and participated in Uniswap Governance. On this page * [Delegation](https://docs.uniswap.org/concepts/governance/guide-to-voting#delegation) * [Voting](https://docs.uniswap.org/concepts/governance/guide-to-voting#voting) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/governance/03-guide-to-voting.md) --- # Functions | Uniswap [Skip to main content](https://docs.uniswap.org/category/functions#__docusaurus_skipToContent_fallback) [🗃️ Core Functions\ ------------------\ \ 3 items](https://docs.uniswap.org/category/core-functions) [🗃️ Utility Functions\ ---------------------\ \ 8 items](https://docs.uniswap.org/category/utility-functions) [📄️ Pool Mapping\ ----------------\ \ The file is present in Optimism only](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/poolMapping.ts) --- # Utility Functions | Uniswap [Skip to main content](https://docs.uniswap.org/category/utility-functions#__docusaurus_skipToContent_fallback) [📄️ constants.ts\ ----------------\ \ path: /src/utils/constants.ts](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/constants.ts) [📄️ index.ts\ ------------\ \ path: /src/utils/index.ts](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/index.ts) [📄️ intervalUpdates.ts\ ----------------------\ \ path: /src/utils/intervalUpdates.ts](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalUpdates.ts) [📄️ pricing.ts\ --------------\ \ path: /src/utils/pricing.ts](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/pricing.ts) [📄️ staticTokenDefinition.ts\ ----------------------------\ \ path: /src/utils/staticTokenDefinition.ts](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/staticTokenDefinition.ts) [📄️ tick.ts\ -----------\ \ path: /src/utils/tick.ts](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/tick.ts) [📄️ token.ts\ ------------\ \ path: /src/utils/token.ts](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/token.ts) [📄️ backfill.ts\ ---------------\ \ The file is present only for the optimism subgraph](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/backfill.ts) --- # Overview | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/governance/overview#__docusaurus_skipToContent_fallback) On this page Code[​](https://docs.uniswap.org/concepts/governance/overview#code "Direct link to Code") ------------------------------------------------------------------------------------------ [`governance`](https://github.com/Uniswap/governance) UNI Address[​](https://docs.uniswap.org/concepts/governance/overview#uni-address "Direct link to UNI Address") --------------------------------------------------------------------------------------------------------------- `UNI` is deployed at `0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984` on the Ethereum [mainnet](https://etherscan.io/address/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984) , and the [Ropsten](https://ropsten.etherscan.io/address/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984) , [Rinkeby](https://rinkeby.etherscan.io/address/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984) , [Görli](https://goerli.etherscan.io/address/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984) , and [Kovan](https://kovan.etherscan.io/address/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984) testnets. It was built from commit [ab22c08](https://github.com/Uniswap/governance/commit/ab22c084bacb2636a1aebf9759890063eb6e4946) . ### ABI[​](https://docs.uniswap.org/concepts/governance/overview#abi "Direct link to ABI") import Uni from '@uniswap/governance/build/Uni.json' [https://unpkg.com/@uniswap/governance@1.0.2/build/Uni.json](https://unpkg.com/@uniswap/governance@1.0.2/build/Uni.json) Timelock[​](https://docs.uniswap.org/concepts/governance/overview#timelock "Direct link to Timelock") ------------------------------------------------------------------------------------------------------ `Timelock` is deployed at `0x1a9C8182C09F50C8318d769245beA52c32BE35BC` on the Ethereum [mainnet](https://etherscan.io/address/0x1a9C8182C09F50C8318d769245beA52c32BE35BC) , and the [Ropsten](https://ropsten.etherscan.io/address/0x1a9C8182C09F50C8318d769245beA52c32BE35BC) , [Rinkeby](https://rinkeby.etherscan.io/address/0x1a9C8182C09F50C8318d769245beA52c32BE35BC) , [Görli](https://goerli.etherscan.io/address/0x1a9C8182C09F50C8318d769245beA52c32BE35BC) , and [Kovan](https://kovan.etherscan.io/address/0x1a9C8182C09F50C8318d769245beA52c32BE35BC) testnets. It was built from commit [ab22c08](https://github.com/Uniswap/governance/commit/ab22c084bacb2636a1aebf9759890063eb6e4946) . ### ABI[​](https://docs.uniswap.org/concepts/governance/overview#abi-1 "Direct link to ABI") import Timelock from '@uniswap/governance/build/Timelock.json' [https://unpkg.com/@uniswap/governance@1.0.2/build/Timelock.json](https://unpkg.com/@uniswap/governance@1.0.2/build/Timelock.json) GovernorAlpha (Deprecated)[​](https://docs.uniswap.org/concepts/governance/overview#governoralpha-deprecated "Direct link to GovernorAlpha (Deprecated)") ---------------------------------------------------------------------------------------------------------------------------------------------------------- `GovernorAlpha` is deployed at `0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F` on the Ethereum [mainnet](https://etherscan.io/address/0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F) , and the [Ropsten](https://ropsten.etherscan.io/address/0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F) , [Rinkeby](https://rinkeby.etherscan.io/address/0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F) , [Görli](https://goerli.etherscan.io/address/0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F) , and [Kovan](https://kovan.etherscan.io/address/0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F) testnets. It was built from commit [ab22c08](https://github.com/Uniswap/governance/commit/ab22c084bacb2636a1aebf9759890063eb6e4946) . ### ABI[​](https://docs.uniswap.org/concepts/governance/overview#abi-2 "Direct link to ABI") The `GovernorAlpha` ABI is viewable on [Etherscan](https://etherscan.io/address/0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F) , as well as via an [npm package](https://www.npmjs.com/package/@uniswap/governance) . [https://unpkg.com/@uniswap/governance@1.0.2/build/GovernorAlpha.json](https://unpkg.com/@uniswap/governance@1.0.2/build/GovernorAlpha.json) import GovernorAlpha from '@uniswap/governance/build/GovernorAlpha.json' GovernorAlpha v2 (Deprecated)[​](https://docs.uniswap.org/concepts/governance/overview#governoralpha-v2-deprecated "Direct link to GovernorAlpha v2 (Deprecated)") ------------------------------------------------------------------------------------------------------------------------------------------------------------------- `GovernorAlpha v2` is deployed at `0xC4e172459f1E7939D522503B81AFAaC1014CE6F6` on the Ethereum [mainnet](https://etherscan.io/address/0xC4e172459f1E7939D522503B81AFAaC1014CE6F6) . ### ABI[​](https://docs.uniswap.org/concepts/governance/overview#abi-3 "Direct link to ABI") The `GovernorAlpha v2` ABI is viewable on [Etherscan](https://etherscan.io/address/0xC4e172459f1E7939D522503B81AFAaC1014CE6F6) GovernorBravo (Current)[​](https://docs.uniswap.org/concepts/governance/overview#governorbravo-current "Direct link to GovernorBravo (Current)") ------------------------------------------------------------------------------------------------------------------------------------------------- `GovernorBravo` is deployed at `0x408ED6354d4973f66138C91495F2f2FCbd8724C3` on the Ethereum [mainnet](https://etherscan.io/address/0x408ED6354d4973f66138C91495F2f2FCbd8724C3#code) . ### ABI[​](https://docs.uniswap.org/concepts/governance/overview#abi-4 "Direct link to ABI") The Governor Bravo ABI can be found on [Etherscan](https://etherscan.io/address/0x408ED6354d4973f66138C91495F2f2FCbd8724C3#code) . Miscellaneous Addresses[​](https://docs.uniswap.org/concepts/governance/overview#miscellaneous-addresses "Direct link to Miscellaneous Addresses") --------------------------------------------------------------------------------------------------------------------------------------------------- **The following addresses only exist on the Ethereum mainnet.** The UNI merkle distributor address is `0x090D4613473dEE047c3f2706764f49E0821D256e`. The staking rewards factory address is `0x3032Ab3Fa8C01d786D29dAdE018d7f2017918e12`. The four staking rewards addresses are: 0x6c3e4cb2e96b01f4b866965a91ed4437839a121a0x7fba4b8dc5e7616e59622806932dbea72537a56b0xa1484c3aa22a66c62b77e0ae78e15258bd0cb7110xca35e32e7926b96a9988f61d510e038108d8068e The four year-long vesting contract addresses are: 0x4750c43867ef5f89869132eccf19b9b6c4286e1a0xe3953d9d317b834592ab58ab2c7a6ad22b54075d0x4b4e140d1f131fdad6fb59c13af796fd194e41350x3d30b1ab88d487b0f3061f40de76845bec3f1e94 The `feeToSetterVester` address is `0x18e433c7Bf8A2E1d0197CE5d8f9AFAda1A771360`. The `feeTo` address is `0xDAF819c2437a82f9e01f6586207ebF961a7f0970`. On this page * [Code](https://docs.uniswap.org/concepts/governance/overview#code) * [UNI Address](https://docs.uniswap.org/concepts/governance/overview#uni-address) * [ABI](https://docs.uniswap.org/concepts/governance/overview#abi) * [Timelock](https://docs.uniswap.org/concepts/governance/overview#timelock) * [ABI](https://docs.uniswap.org/concepts/governance/overview#abi-1) * [GovernorAlpha (Deprecated)](https://docs.uniswap.org/concepts/governance/overview#governoralpha-deprecated) * [ABI](https://docs.uniswap.org/concepts/governance/overview#abi-2) * [GovernorAlpha v2 (Deprecated)](https://docs.uniswap.org/concepts/governance/overview#governoralpha-v2-deprecated) * [ABI](https://docs.uniswap.org/concepts/governance/overview#abi-3) * [GovernorBravo (Current)](https://docs.uniswap.org/concepts/governance/overview#governorbravo-current) * [ABI](https://docs.uniswap.org/concepts/governance/overview#abi-4) * [Miscellaneous Addresses](https://docs.uniswap.org/concepts/governance/overview#miscellaneous-addresses) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/governance/01-overview.md) --- # Process | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/governance/process#__docusaurus_skipToContent_fallback) On this page This is a living document which represents the current process guidelines for developing and advancing Uniswap Governance Proposals. It was last updated September 2024. Tools[​](https://docs.uniswap.org/concepts/governance/process#tools "Direct link to Tools") -------------------------------------------------------------------------------------------- Uniswap Governance takes place in several venues. Each serves its own particular purpose. 1. [_Governance Forum_](https://gov.uniswap.org/) A Discourse-hosted forum for governance-related discussion. Community members must register for an account before sharing or liking posts. New members must read 4 topics and a combined 15 posts over the course of at least 10 minutes before they may post themselves. 2. [_Snapshot_](https://snapshot.box/#/s:uniswapgovernance.eth) A simple voting interface that allows users to signal sentiment off-chain. Votes on Snapshot are weighted by the number of UNI delegated to the address used to vote. 3. [_Uniswap Agora_](https://vote.uniswapfoundation.org/) The [Uniswap Foundation](https://www.uniswapfoundation.org/) supports this voting and delegation interface. [Tally](https://www.tally.xyz/gov/uniswap) is another excellent app that supports proposal creation, delegation, and voting. Process[​](https://docs.uniswap.org/concepts/governance/process#process "Direct link to Process") -------------------------------------------------------------------------------------------------- Below we outline the current Uniswap governance process, detailing where these venues fit in. These processes are subject to change according to feedback from the Uniswap community. ### Phase 1: Request for Comment (RFC)[​](https://docs.uniswap.org/concepts/governance/process#phase-1-request-for-comment-rfc "Direct link to Phase 1: Request for Comment (RFC)") _Timeframe_: At least 7 days _Form_: [Governance Forum](https://gov.uniswap.org/) Post As a proposer, you should use the RFC phase to introduce the community to your proposal. Your post should detail exactly what you are asking delegates to vote on as well as your rationale for why it is a good idea. You should be prepared to answer questions about your proposal. Willingness to adjust based on community feedback is a hallmark of successful past proposals. To post a RFC, label your post “RFC - \[Your Title Here\]”. Prior to moving to Phase 2, give the community at least 7 days to read and comment on the RFC. Please respond to questions in the comments, and take feedback into account in the next iteration of the proposal posted in Phase 2. ### Phase 2: Temperature Check[​](https://docs.uniswap.org/concepts/governance/process#phase-2-temperature-check "Direct link to Phase 2: Temperature Check") _Timeframe_: 5 days _Quorum_: 10M UNI _Form_: [Snapshot Poll](https://snapshot.box/#/s:uniswapgovernance.eth) The purpose of the Temperature Check is to signal community sentiment on a proposal prior to moving towards an onchain vote. To create a Temperature Check: 1. Incorporate the community feedback from the RFC phase into the proposal. 2. Create and post this version of the proposal in the [Governance Forum](https://gov.uniswap.org/) with the title “Temperature Check — \[Your Title Here\]”. Include a link to the RFC post. You will update the post to include a link to the Snapshot poll after you’ve posted that. 3. Create a [Snapshot poll](https://snapshot.box/#/s:uniswapgovernance.eth) . The voting options should consist of those which have gained support in the RFC Phase. This poll can be either binary or multiple choice but must include a `No change` option. Set the poll duration to 5 days. Include a link to the Forum Temperature Check post. 4. Update the Forum post with a link to the Snapshot Poll. At the end of 5 days, the option with the majority of votes wins. There must be at least 10M UNI `Yes` votes to move onto Phase 3. If the “No change” option wins, the proposal will not move onto the Phase 3. ### Phase 3: Governance Proposal[​](https://docs.uniswap.org/concepts/governance/process#phase-3-governance-proposal "Direct link to Phase 3: Governance Proposal") _Timeframe_: 2 day waiting period, 7 day voting period, 2 day timelock _Threshold_: 1M UNI _Quorum_: 40M UNI votes in favor Form: [Governance Proposal](https://vote.uniswapfoundation.org/) ![](https://docs.uniswap.org/assets/images/Proposal_Flow-8ca9bfffde99de9627f7b352a5578936.png) Phase 3 is the final step of the governance process. If this vote passes, then a change will be enacted onchain. To create an onchain Governance Proposal: 1. Incorporate any last iterations to your proposal based on feedback prior to posting. 2. Create a topic in the [Governance Forum](https://gov.uniswap.org/) titled "Governance Proposal — \[Your Title Here\]" and link to previous forum posts and the Temperature Check Snapshot poll. 3. Create your proposal. This can be done either through an interface (e.g. [Tally](https://tally.xyz/gov/uniswap) ) or through writing the calldata for more complicated proposal logic. If the proposal passed, this calldata will execute. If writing the calldata yourself, please review the logic with a qualified Uniswap community member prior to posting the proposal. 4. Ensure that at least 1 million UNI is delegated to your address in order to submit a proposal, or find a delegate who has enough delegated UNI to meet the proposal threshold to propose on your behalf. 5. Once you submit the proposal, a two-day voting delay will start. After the voting delay finishes, a ~seven-day voting period begins. If the proposal passes, a two-day timelock must pass before you can execute the proposed code. Changes to the Governance Process[​](https://docs.uniswap.org/concepts/governance/process#changes-to-the-governance-process "Direct link to Changes to the Governance Process") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Timeframe: 7 days _Quorum_: 40M UNI Form: [Snapshot Poll](https://snapshot.box/#/s:uniswapgovernance.eth) In the future, the community governance process above may need to undergo additional changes to continue to meet the needs of the Uniswap community. While an onchain vote is not required to change the majority of this process, a clear display of community support and acceptance is important for process changes to have legitimacy. Thus, changes to all off-chain community governance processes should be voted on through an off-chain Snapshot vote. There should be a 7-day voting period and 40M UNI quorum. On this page * [Tools](https://docs.uniswap.org/concepts/governance/process#tools) * [Process](https://docs.uniswap.org/concepts/governance/process#process) * [Phase 1: Request for Comment (RFC)](https://docs.uniswap.org/concepts/governance/process#phase-1-request-for-comment-rfc) * [Phase 2: Temperature Check](https://docs.uniswap.org/concepts/governance/process#phase-2-temperature-check) * [Phase 3: Governance Proposal](https://docs.uniswap.org/concepts/governance/process#phase-3-governance-proposal) * [Changes to the Governance Process](https://docs.uniswap.org/concepts/governance/process#changes-to-the-governance-process) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/governance/02-process.md) --- # Resources | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/resources#__docusaurus_skipToContent_fallback) This page will be periodically updated with helpful resources for calculations and software design as they are made available. * [**Uniswap v2 Visualization**](https://www.desmos.com/calculator/j8eppi5vvu) * [**Uniswap v3 Visualization**](https://www.desmos.com/calculator/q2kxfue441) * [**Uniswap v3 (Multiple Positions) Visualization**](https://www.desmos.com/calculator/oduetjzfp4) * [**v2 / v3 Calculations**](https://docs.google.com/spreadsheets/d/1VH-lbF9RDUpVozGeA3BtWwypjW66MjcD1DnOYzcHmzk/edit#gid=0) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/resources.md) --- # Research | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/research#__docusaurus_skipToContent_fallback) The [Uniswap Foundation](https://www.uniswapfoundation.org/) supports the protocol's growth and decentralization through strategic research initiatives, empowering our community with grants and resources to conduct groundbreaking research and develop practical implementations that advance the frontier DeFi. Featured research from our community: Authors: Austin Adams > This research paper analyzes how cheaper and faster blockchain networks impact Uniswap v3's performance compared to Ethereum mainnet, revealing that reduced transaction costs lead to better gas-adjusted execution and more efficient capital deployment by liquidity providers. Faster block times and lower costs enable increased arbitrage activity, resulting in higher fee returns for liquidity providers, though there's evidence that 2-second block times may not be optimal compared to a first-come-first-served model. Evidence suggests that many current AMM limitations stem from blockchain constraints rather than protocol design, and these issues can be significantly improved through faster, cheaper transactions. * [Layer 2 be or Layer not 2 be: Scaling on Uniswap v3 \[Mar 2024\]](https://arxiv.org/abs/2403.09494) Who Wins Ethereum Block Building Auctions and Why? ================================================== Authors: Burak Öz, Danning Sui, Thomas Thiery, Florian Matthes > The MEV-Boost block auction contributes approximately 90% of all Ethereum blocks. Between October 2023 and March 2024, only three builders produced 80% of them, highlighting the concentration of power within the block builder market. To foster competition and preserve Ethereum's decentralized ethos and censorship-resistance properties, understanding the dominant players' competitive edges is essential. This identifies features that play a significant role in builders' ability to win blocks and earn profits by conducting a comprehensive empirical analysis of MEV-Boost auctions over a six-month period. * [Who Wins Ethereum Block Building Auctions and Why? \[Jul 2024\]](https://arxiv.org/abs/2407.13931) MEV Capture and Decentralization in Execution Tickets ===================================================== Authors: Jonah Burian, Davide Crapis, Fahad Saleh > Provides an economic model of Execution Tickets and uses it to study the ability of the Ethereum protocol to capture MEV from block construction, demonstrating that Execution Tickets extract all MEV when all buyers are homogeneous, risk neutral and face no capital costs. We also show that MEV capture decreases with risk aversion and capital costs. Moreover, when buyers are heterogeneous, MEV capture can be especially low and a single dominant buyer can extract much of the MEV. This adverse effect can be partially mitigated by the presence of a Proposer Builder Separation (PBS) mechanism, which gives ET buyers access to a market of specialized builders, but in practice centralization vectors still persist. With PBS, ETs are concentrated among those with the highest ex-ante MEV extraction ability and lowest cost of capital. We show how it is possible that large investors that are not builders but have substantial advantage in capital cost can come to dominate the ET market. * [MEV Capture and Decentralization in Execution Tickets \[Aug 2024\]](https://arxiv.org/abs/2408.11255) What Drives Liquidity on Decentralized Exchanges? Evidence from the Uniswap Protocol ==================================================================================== Authors: Alex Evans > Geometric mean market makers (G3Ms), such as Uniswap and Balancer, comprise a popular class of automated market makers (AMMs) defined by the following rule: the reserves of the AMM before and after each trade must have the same (weighted) geometric mean. This paper extends several results known for constant-weight G3Ms to the general case of G3Ms with time-varying and potentially stochastic weights. These results include the returns and no-arbitrage prices of liquidity pool (LP) shares that investors receive for supplying liquidity to G3Ms. Using these expressions, we show how to create G3Ms whose LP shares replicate the payoffs of financial derivatives. The resulting hedges are model-independent and exact for derivative contracts whose payoff functions satisfy an elasticity constraint. These strategies allow LP shares to replicate various trading strategies and financial contracts, including standard options. G3Ms are thus shown to be capable of recreating a variety of active trading strategies through passive positions in LP shares. * [What Drives Liquidity on Decentralized Exchanges? Evidence from the Uniswap Protocol \[Oct 2024\]](https://arxiv.org/abs/2410.19107) The Evolution of Decentralized Exchange: Risks, Benefits, and Oversight ======================================================================= Authors: Campbell R. Harvey, Joel Hasbrouck, Fahad Saleh > A decentralized exchange or DEX is an application deployed on a blockchain that allows investors to exchange digital assets at pricing terms determined by a preset exchange rate formula. This technology has several unique features, including accessibility to all investors, transparency of pricing, and simultaneity of execution and settlement. Notably, trading via a DEX is feasible for any asset tokenized on a blockchain. In turn, given that assets such as stocks and bonds could be tokenized easily, it is particularly important to understand the risks posed by DEXs. This paper examines both the benefits and risks to investors from DEXs, explores the role of private and public liquidity pools and analyzes possible regulatory approaches. * [The Evolution of Decentralized Exchange: Risks, Benefits, and Oversight \[Oct 2024\]](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4861942) Research Initiatives: Get Involved ================================== * [TLDR (The Latest in DeFi Research):](https://www.thelatestindefi.org/) empowers engineers, academics, and students through research fellowships with grants and expert mentorship, culminating in an annual conference to showcase groundbreaking work. * [CBER CtCe (Crafting the Cryptoeconomy):](https://x.com/UniswapFND/status/1859719158763749514) developed to generate and promote practical yet rigorous research in cryptoeconomics by connecting researchers, economists and practitioners through workshops, grants and conferences. * [DEX Analytics Portal:](https://dexanalytics.org/) accurate, verified, and ergonomic DEX and Uniswap datasets to save researchers time. Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/research.md) --- # Concentrated Liquidity | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/protocol/concentrated-liquidity#__docusaurus_skipToContent_fallback) On this page Your browser does not support the video tag. * * * note Concentrated liquidity, first introduced as a native feature in Uniswap v3, maintains the same core implementation in v4, ensuring consistency in how liquidity providers can focus their capital. Introduction[​](https://docs.uniswap.org/concepts/protocol/concentrated-liquidity#introduction "Direct link to Introduction") ------------------------------------------------------------------------------------------------------------------------------ The defining idea of Uniswap v3 is concentrated liquidity: liquidity that is allocated within a custom price range. In earlier versions, liquidity was distributed uniformly along the price curve between 0 and infinity. The previously uniform distribution allowed trading across the entire price interval (0, ∞) without any loss of liquidity. However, in many pools, the majority of the liquidity was never used. Consider stablecoin pairs, where the relative price of the two assets stays relatively constant. The liquidity outside the typical price range of a stablecoin pair is rarely touched. For example, the v2 DAI/USDC pair utilizes ~0.50% of the total available capital for trading between $0.99 and $1.01, the price range in which LPs would expect to see the most volume - and consequently earn the most fees. With v3, liquidity providers may concentrate their capital to smaller price intervals than (0, ∞). In a stablecoin/stablecoin pair, for example, an LP may choose to allocate capital solely to the 0.99 - 1.01 range. As a result, traders are offered deeper liquidity around the mid-price, and LPs earn more trading fees with their capital. We call liquidity concentrated to a finite interval a position. LPs may have many different positions per pool, creating individualized price curves that reflect the preferences of each LP. Active Liquidity[​](https://docs.uniswap.org/concepts/protocol/concentrated-liquidity#active-liquidity "Direct link to Active Liquidity") ------------------------------------------------------------------------------------------------------------------------------------------ As the price of an asset rises or falls, it may exit the price bounds that LPs have set in a position. When the price exits a position's interval, the position's liquidity is no longer active and no longer earns fees. As price moves in one direction, LPs gain more of the one asset as swappers demand the other, until their entire liquidity consists of only one asset. (In v2, we don't typically see this behavior because LPs rarely reach the upper or lower bound of the price of two assets, i.e., 0 and ∞). If the price ever reenters the interval, the liquidity becomes active again, and in-range LPs begin earning fees once more. Importantly, LPs are free to create as many positions as they see fit, each with its own price interval. Concentrated liquidity serves as a mechanism to let the market decide what a sensible distribution of liquidity is, as rational LPs are incentivized to concentrate their liquidity while ensuring that their liquidity remains active. Ticks[​](https://docs.uniswap.org/concepts/protocol/concentrated-liquidity#ticks "Direct link to Ticks") --------------------------------------------------------------------------------------------------------- To achieve concentrated liquidity, the once continuous spectrum of price space has been partitioned with ticks. Ticks are the boundaries between discrete areas in price space. Ticks are spaced such that an increase or decrease of 1 tick represents a 0.01% increase or decrease in price at any point in price space. Ticks function as boundaries for liquidity positions. When a position is created, the provider must choose the lower and upper tick that will represent their position's borders. As the spot price changes during swapping, the pool contract will continuously exchange the outbound asset for the inbound, progressively using all the liquidity available within the current tick interval[1](https://docs.uniswap.org/concepts/protocol/concentrated-liquidity#user-content-fn-1) until the next tick is reached. At this point, the contract switches to a new tick and activates any dormant liquidity within a position that has a boundary at the newly active tick. While each pool has the same number of underlying ticks, in practice only a portion of them are able to serve as active ticks. Due to the nature of the v3 smart contracts, tick spacing is directly correlated to the swap fee. Lower fee tiers allow closer potentially active ticks, and higher fees allow a relatively wider spacing of potential active ticks. While inactive ticks have no impact on transaction cost during swaps, crossing an active tick does increase the cost of the transaction in which it is crossed, as the tick crossing will activate the liquidity within any new positions using the given tick as a border. In areas where capital efficiency is paramount, such as stable coin pairs, narrower tick spacing increases the granularity of liquidity provisioning and will likely lower price impact when swapping - the result being significantly improved prices for stable coin swaps. For more information on fee levels and their correlation to tick spacing, see the [whitepaper](https://uniswap.org/whitepaper-v3.pdf) . Footnotes[​](https://docs.uniswap.org/concepts/protocol/concentrated-liquidity#footnote-label "Direct link to Footnotes") -------------------------------------------------------------------------------------------------------------------------- 1. Tick interval refers to the area of price space between two nearest active ticks [↩](https://docs.uniswap.org/concepts/protocol/concentrated-liquidity#user-content-fnref-1) On this page * [Introduction](https://docs.uniswap.org/concepts/protocol/concentrated-liquidity#introduction) * [Active Liquidity](https://docs.uniswap.org/concepts/protocol/concentrated-liquidity#active-liquidity) * [Ticks](https://docs.uniswap.org/concepts/protocol/concentrated-liquidity#ticks) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/protocol/concentrated-liquidity.md) --- # Fees | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/protocol/fees#__docusaurus_skipToContent_fallback) On this page note While v3 uses predefined fee tiers (0.01%, 0.05%, 0.3%, and 1%), v4 introduces flexible fees that can range from 0% to 100%, offering greater customization options for pools. Swap Fees[​](https://docs.uniswap.org/concepts/protocol/fees#swap-fees "Direct link to Swap Fees") --------------------------------------------------------------------------------------------------- Swap fees are distributed pro-rata to all in-range[1](https://docs.uniswap.org/concepts/protocol/fees#user-content-fn-1) liquidity at the time of the swap. If the spot price moves out of a position’s range, the given liquidity is no longer active and does not generate any fees. If the spot price reverses and reenters the position’s range, the position’s liquidity becomes active again and will generate fees. Swap fees are not automatically reinvested as they were in previous versions of Uniswap. Instead, they are collected separately from the pool and must be manually redeemed when the owner wishes to collect their fees. Pool Fees Tiers[​](https://docs.uniswap.org/concepts/protocol/fees#pool-fees-tiers "Direct link to Pool Fees Tiers") --------------------------------------------------------------------------------------------------------------------- Uniswap v3 introduces multiple pools for each token pair, each with a different swapping fee. Liquidity providers may initially create pools at three fee levels: 0.05%, 0.30%, and 1%. More fee levels may be added by UNI governance, e.g. the 0.01% fee level added by [this](https://vote.uniswapfoundation.org/proposals/9) governance proposal in December 2021, as executed [here](https://etherscan.io/tx/0x5c84f89a67237db7500538b81af61ebd827c081302dd73a1c20c8f6efaaf4f3c) . Breaking pairs into separate pools was previously untenable due to the issue of liquidity fragmentation. Any incentive alignments achieved by more fee optionality invariably resulted in a net loss to traders, due to lower pairwise liquidity and the resulting increase in price impact upon swapping. The introduction of concentrated liquidity decouples total liquidity from price impact. With price impact concerns out of the way, breaking pairs into multiple pools becomes a feasible approach to improving the functionality of a pool for assets previously underserved by the 0.30% swap fee. Finding The Right Pool Fee[​](https://docs.uniswap.org/concepts/protocol/fees#finding-the-right-pool-fee "Direct link to Finding The Right Pool Fee") ------------------------------------------------------------------------------------------------------------------------------------------------------ We anticipate that certain types of assets will gravitate towards specific fee tiers, based on where the incentives for both swappers and liquidity providers come nearest to alignment. We expect low volatility assets (stable coins) will likely congregate in the lowest fee tier, as the price risk for liquidity providers holding these assets is very low, and those swapping will be motivated to pursue an execution price closest to 1:1 as they can get. Similarly, we anticipate more exotic assets, or those traded rarely, will naturally gravitate towards a higher fee - as liquidity providers will be motivated to offset the cost risk of holding these assets for the duration of their position. Protocol Fees[​](https://docs.uniswap.org/concepts/protocol/fees#protocol-fees "Direct link to Protocol Fees") --------------------------------------------------------------------------------------------------------------- Both Uniswap v3 and v4 include a protocol fee mechanism that can be activated through UNI governance. This fee structure offers greater flexibility compared to v2, allowing governance to adjust the fraction of swap fees allocated to the protocol. For detailed information about protocol fees, refer to the [v3 whitepaper](https://uniswap.org/whitepaper-v3.pdf) and [v4 whitepaper](https://uniswap.org/whitepaper-v4.pdf) . Footnotes[​](https://docs.uniswap.org/concepts/protocol/fees#footnote-label "Direct link to Footnotes") -------------------------------------------------------------------------------------------------------- 1. In-range liquidity refers to the liquidity contained in any positions which span both sides of the spot price. [↩](https://docs.uniswap.org/concepts/protocol/fees#user-content-fnref-1) On this page * [Swap Fees](https://docs.uniswap.org/concepts/protocol/fees#swap-fees) * [Pool Fees Tiers](https://docs.uniswap.org/concepts/protocol/fees#pool-fees-tiers) * [Finding The Right Pool Fee](https://docs.uniswap.org/concepts/protocol/fees#finding-the-right-pool-fee) * [Protocol Fees](https://docs.uniswap.org/concepts/protocol/fees#protocol-fees) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/protocol/fees.md) --- # Token Integration Issues | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/protocol/integration-issues#__docusaurus_skipToContent_fallback) On this page Fee-on-transfer and rebasing tokens will not function correctly on v3. Fee-on-transfer Tokens[​](https://docs.uniswap.org/concepts/protocol/integration-issues#fee-on-transfer-tokens "Direct link to Fee-on-transfer Tokens") -------------------------------------------------------------------------------------------------------------------------------------------------------- Fee-on-transfer tokens will not function with our router contracts. As a workaround, the token creators may create a token wrapper or a customized router. We will not be making a router that supports fee-on-transfer tokens in the future. Rebasing Tokens[​](https://docs.uniswap.org/concepts/protocol/integration-issues#rebasing-tokens "Direct link to Rebasing Tokens") ----------------------------------------------------------------------------------------------------------------------------------- Rebasing tokens will succeed in pool creation and swapping, but liquidity providers will bear the loss of a negative rebase when their position becomes active, with no way to recover the loss. On this page * [Fee-on-transfer Tokens](https://docs.uniswap.org/concepts/protocol/integration-issues#fee-on-transfer-tokens) * [Rebasing Tokens](https://docs.uniswap.org/concepts/protocol/integration-issues#rebasing-tokens) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/protocol/integration-issues.md) --- # Range Orders | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/protocol/range-orders#__docusaurus_skipToContent_fallback) On this page note Range orders have the same implementation in both Uniswap v3 and v4, offering consistent functionality across both versions. Customizable liquidity positions, along with single-sided asset provisioning, allow for a new style of swapping with automated market makers: the range order. In typical order book markets, anyone can easily set a limit order: to buy or sell an asset at a specific predetermined price, allowing the order to be filled at an indeterminate time in the future. With Uniswap v3, one can approximate a limit order by providing a single asset as liquidity within a specific range. Like traditional limit orders, range orders may be set with the expectation they will execute at some point in the future, with the target asset available for withdrawal after the spot price has crossed the full range of the order. Unlike some markets where limit orders may incur fees, the range order maker generates fees while the order is filled. This is due to the range order technically being a form of liquidity provisioning rather than a typical swap. Possibilities of Range orders[​](https://docs.uniswap.org/concepts/protocol/range-orders#possibilities-of-range-orders "Direct link to Possibilities of Range orders") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- The nature of AMM design makes some styles of limit orders possible, while others cannot be replicated. The following are four examples of range orders and their traditional counterparts; the first two are possible, the second two are not. > One important distinction: range orders, unlike traditional limit orders, will be **unfilled** if the spot price crosses the given range and then reverses to recross in the opposite direction before the target asset is withdrawn. While you will be earning LP fees during this time, if the goal is to exit fully in the desired destination asset, you will need to keep an eye on the order and either manually remove your liquidity when the order has been filled or use a third party position manager service to withdraw on your behalf. ### Take-Profit Orders[​](https://docs.uniswap.org/concepts/protocol/range-orders#take-profit-orders "Direct link to Take-Profit Orders") > The current price of a DAI / ETH pool is 1,500 DAI / ETH. You would like to sell your ETH for DAI when the price of ETH reaches 1,600 DAI / ETH. This is possible, as the price space above the spot price is denominated in the higher valued asset, ETH. You can provide ETH at a price of 1,600 DAI / ETH and have the order filled when the spot price crosses your position. ![RangeOrder1](https://docs.uniswap.org/assets/images/RangeOrder1-b9d8771ff290b67b408790362ac6838e.png) ![RangeOrder1](https://docs.uniswap.org/assets/images/RangeOrder2-9578c6d42b3b8d3d062d0956aee84f1c.png) * * * ### Buy Limit Orders[​](https://docs.uniswap.org/concepts/protocol/range-orders#buy-limit-orders "Direct link to Buy Limit Orders") > The Current price of a DAI / ETH pool is 1,500 DAI / ETH. You expect that ETH will rebound after it drops to 1,000 at the next market downturn, so you would like to place a range order swapping DAI to ETH at the price of 1,000 DAI / ETH. This is possible, as the price space below the spot price is denominated in the lower-priced asset, DAI. You can provide DAI at the price of 1,000 DAI / ETH, which will be swapped for ETH when the spot price of ETH drops past 1,000 DAI / ETH. As the above examples show, in Uniswap v3, the two paired assets in a given pool are separated above and below the spot price, with the higher price asset available above the spot price and the lower-priced asset below. The following examples show limit order styles that are unable to be replicated due to the separation of assets in price space. * * * ### Buy Stop Orders[​](https://docs.uniswap.org/concepts/protocol/range-orders#buy-stop-orders "Direct link to Buy Stop Orders") > The current price of a DAI / ETH pool is 1,500 DAI / ETH. You expect the price of ETH to rocket up to 3,000 once it hits 2,000 DAI/ ETH, So you would like to place a range order from DAI to ETH at a price of 2,000 DAI/ETH. This is not possible as the price space above 1,500 DAI / ETH is denominated in ETH - and thus, you cannot provide the DAI necessary at your desired price to be swapped into ETH. * * * ### Stop-Loss Orders[​](https://docs.uniswap.org/concepts/protocol/range-orders#stop-loss-orders "Direct link to Stop-Loss Orders") > The current price of a DAI / ETH pool is 1,500 DAI / ETH. You expect once the price of ETH drops to below 1,000, it will tank to 200. So you would like to place a range order from ETH to DAI at a price of 1,000. This is not possible as the price space below the spot price is denominated in DAI, and so you cannot allocate the ETH necessary at 1,000 to be swapped into DAI. * * * Fees[​](https://docs.uniswap.org/concepts/protocol/range-orders#fees "Direct link to Fees") -------------------------------------------------------------------------------------------- The fees due to your liquidity position will be denominated in both tokens of the given pair. In any of the above examples, after swapping ETH for DAI, or DAI for ETH, a small amount of both ETH and DAI will be due to your account as liquidity provisioning rewards. Approaches to concentration when setting range orders are up to the user. Selecting a wider range may generate more fees if there is price churn within your range, at the cost of increasing the risk of having your order unfilled if the spot price reverses before completing your full range. On this page * [Possibilities of Range orders](https://docs.uniswap.org/concepts/protocol/range-orders#possibilities-of-range-orders) * [Take-Profit Orders](https://docs.uniswap.org/concepts/protocol/range-orders#take-profit-orders) * [Buy Limit Orders](https://docs.uniswap.org/concepts/protocol/range-orders#buy-limit-orders) * [Buy Stop Orders](https://docs.uniswap.org/concepts/protocol/range-orders#buy-stop-orders) * [Stop-Loss Orders](https://docs.uniswap.org/concepts/protocol/range-orders#stop-loss-orders) * [Fees](https://docs.uniswap.org/concepts/protocol/range-orders#fees) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/protocol/range-orders.md) --- # Oracle | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/protocol/oracle#__docusaurus_skipToContent_fallback) On this page note Uniswap v4 does not include built-in oracle functionality. If you're unfamiliar with oracles, check out the Ethereum Foundation's [oracle overview](https://ethereum.org/en/developers/docs/oracles/) . All Uniswap v3 pools can serve as oracles, offering access to historical price and liquidity data. This capability unlocks a wide range of on-chain use cases. Historical data is stored as an array of observations. At first, each pool tracks only a single observation, overwriting it as blocks elapse. This limits how far into the past users may access data. However, any party willing to pay the transaction fees may [increase the number of tracked observations](https://docs.uniswap.org/contracts/v3/reference/core/UniswapV3Pool#increaseobservationcardinalitynext) (up to a maximum of `65535`), expanding the period of data availability to ~9 days or more. Storing price and liquidity history directly in the pool contract substantially reduces the potential for logical errors on the part of the calling contract, and reduces integration costs by eliminating the need to store historical values. Additionally, the v3 oracle's considerable maximum length makes oracle price manipulation significantly more difficult, as the calling contract may cheaply construct a time-weighted average over any arbitrary range inside of (or fully encompassing) the length of the oracle array. Observations[​](https://docs.uniswap.org/concepts/protocol/oracle#observations "Direct link to Observations") -------------------------------------------------------------------------------------------------------------- `Observation`s take the following form: struct Observation { // the block timestamp of the observation uint32 blockTimestamp; // the tick accumulator, i.e. tick * time elapsed since the pool was first initialized int56 tickCumulative; // the seconds per liquidity, i.e. seconds elapsed / max(1, liquidity) since the pool was first initialized uint160 secondsPerLiquidityCumulativeX128; // whether or not the observation is initialized bool initialized;} `Observation`s may be retrieved via the [`observations`](https://docs.uniswap.org/contracts/v3/reference/core/interfaces/pool/IUniswapV3PoolState#observations) method on v3 pools. However, this is _not_ the recommended way to consume oracle data. Instead, prefer [`observe`](https://docs.uniswap.org/contracts/v3/reference/core/UniswapV3Pool#observe) : function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s); Each time `observe` is called, the caller must specify an array containing any number of seconds ago, denoting the times to return observations from. Note that each of the given times must be more recent (or as old as) the oldest stored observation. Note: if the times don't correspond exactly to a block in which an observation was written, a counterfactual observation will be constructed, removing the need for the caller to interpolate manually. This is one of the primary reasons to use `observe` over `observations`. Note that because the oracle is only updated at most once every block, calling `observe` with a `secondsAgo` value of `0` will return the most recently written observation, which can only be as recent as the beginning of the current block (or older). Tick Accumulator[​](https://docs.uniswap.org/concepts/protocol/oracle#tick-accumulator "Direct link to Tick Accumulator") -------------------------------------------------------------------------------------------------------------------------- The tick accumulator stores the cumulative sum of the active tick at the time of the observation. The tick accumulator value increases monotonically and grows by the value of the current tick - per second. To derive the arithmetic mean tick over an interval, the caller needs to retrieve two observations, one after the other, take the delta of the two values, and divide by the time elapsed between them. Calculating a TWAP from the tick accumulator is also covered in the [**whitepaper**](https://uniswap.org/whitepaper-v3.pdf) . Note that using an arithmetic mean tick to derive a price corresponds to a _geometric_ mean price. See [OracleLibrary](https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/libraries/OracleLibrary.sol) for an example of how to use the tick accumulator. Liquidity Accumulator[​](https://docs.uniswap.org/concepts/protocol/oracle#liquidity-accumulator "Direct link to Liquidity Accumulator") ----------------------------------------------------------------------------------------------------------------------------------------- The liquidity accumulator stores the value of seconds / in-range liquidity at the time of the observation. The liquidity accumulator value increases monotonically and grows by the value of seconds / in-range liquidity - per second. To derive the harmonic mean liquidity over an interval, the caller needs to retrieve two observations, one after the other, take the delta of the two values, then divide the time elapsed by this value. Calculating TWAL is addressed in finer detail in the [**whitepaper**](https://uniswap.org/whitepaper-v3.pdf) . note The in-range liquidity accumulator should be used with care. Because the current tick and the current in-range liquidity can be entirely uncorrelated, there are scenarios in which taking the arithmetic mean tick and the harmonic mean liquidity over the same interval in a pool can inaccurately characterize this pool relative to another. For example, if the current tick on pool A is 0 for 5 seconds, and 100 for 5 seconds, the tick accumulator will be 50. If over this same interval, the in-range liquidity was 5000 and 50, the harmonic mean liquidity will be ~99. Compare this to pool B (composed of the same assets) where the tick was 50 and the in-range liquidity was ~99 for 10 seconds. The accumulator values will be identical, but the underlying behavior is of course quite different. Deriving Price From A Tick[​](https://docs.uniswap.org/concepts/protocol/oracle#deriving-price-from-a-tick "Direct link to Deriving Price From A Tick") -------------------------------------------------------------------------------------------------------------------------------------------------------- > When we use "active tick" or otherwise to refer to the current tick of a pool, we mean the lower tick boundary that is closest to the current price. When a pool is created, each token is assigned to either `token0` or `token1` based on the contract address of the tokens in the pair. Whether or not a token is `token0` or `token1` is meaningless; it is only used to maintain a fixed assignment for the purpose of relative valuation and general logic in the pool contract. Deriving an asset price from the current tick is achievable due to the fixed expression across the pool contract of token0 in terms of token1. * * * An example of finding the price of WETH in a WETH / USDC pool, where WETH is `token0` and USDC is `token1`: You have an oracle reading that shows a return of `tickCumulative` as \[`70_000`, `1_070_000`\], with an elapsed time between the observations of 10 seconds. We can derive the average tick over this interval by taking the difference in accumulator values (`1_070_000` - `70_000` = `1_000_000`), and dividing by the time elapsed (`1_000_000` / `10` = `100_000`). With a tick reading of `100_000`, we can find the value of `token1` (USDC) in terms of `token0` (WETH) by using the current tick as `i` in the formula `p(i) = 1.0001**i` (see 6.1 in the [whitepaper](https://uniswap.org/whitepaper-v3.pdf) ). `1.0001**100_000 ≅ 22015.5` USDC / WETH * * * Ticks are signed integers and can be expressed as a negative number, so for any circumstances where `token0` is of a lower value than `token1`, a negative tick value will be returned by `tickCumulative` and a relative value of `< 0` will be returned by a calculation of `token0` in terms of `token1`. Oracles Integrations on Layer 2 Rollups[​](https://docs.uniswap.org/concepts/protocol/oracle#oracles-integrations-on-layer-2-rollups "Direct link to Oracles Integrations on Layer 2 Rollups") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Arbitrum One[​](https://docs.uniswap.org/concepts/protocol/oracle#arbitrum-one "Direct link to Arbitrum One") On Arbitrum One, multiple transactions can be part of a block, and [multiple blocks](https://arbiscan.io/blocks) are usually created per second (up to a maximum of 4 blocks per second). Their `block.timestamp` reflect the time at which the block was produced based on the sequencer's clock (see [Arbitrum's sequencer documentation](https://docs.arbitrum.io/sequencer) to learn more about its trust assumptions), so observations have enough granularity to make the oracle more difficult to manipulate. Thus, Uniswap pools on Arbitrum One are suitable for providing oracle prices. For more information on how block numbers and time work on Arbitrum One, please see the [Arbitrum documentation portal](https://docs.arbitrum.io/time) . On this page * [Observations](https://docs.uniswap.org/concepts/protocol/oracle#observations) * [Tick Accumulator](https://docs.uniswap.org/concepts/protocol/oracle#tick-accumulator) * [Liquidity Accumulator](https://docs.uniswap.org/concepts/protocol/oracle#liquidity-accumulator) * [Deriving Price From A Tick](https://docs.uniswap.org/concepts/protocol/oracle#deriving-price-from-a-tick) * [Oracles Integrations on Layer 2 Rollups](https://docs.uniswap.org/concepts/protocol/oracle#oracles-integrations-on-layer-2-rollups) * [Arbitrum One](https://docs.uniswap.org/concepts/protocol/oracle#arbitrum-one) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/protocol/oracle.md) --- # The Uniswap Protocol | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/uniswap-protocol#__docusaurus_skipToContent_fallback) On this page Introduction[​](https://docs.uniswap.org/concepts/uniswap-protocol#introduction "Direct link to Introduction") --------------------------------------------------------------------------------------------------------------- The Uniswap protocol is a peer-to-peer[1](https://docs.uniswap.org/concepts/uniswap-protocol#user-content-fn-1) system designed for exchanging cryptocurrencies [(ERC-20 Tokens)](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/) on the [Ethereum](https://ethereum.org/) blockchain. The protocol is implemented as a set of persistent, non-upgradable smart contracts; designed to prioritize censorship resistance, security, self-custody, and to function without any trusted intermediaries who may selectively restrict access. There are currently four versions of the Uniswap protocol. [v1](https://docs.uniswap.org/contracts/v1/overview) and [v2](https://docs.uniswap.org/contracts/v2/overview) are open source and licensed under GPL. [v3](https://docs.uniswap.org/contracts/v3/overview) introduced concentrated liquidity and is open source with slight modifications, which are viewable [here](https://github.com/Uniswap/uniswap-v3-core/blob/main/LICENSE) . [v4](https://docs.uniswap.org/contracts/v4/overview) introduces the singleton pool architecture and hooks system, enabling unprecedented protocol customization, and uses a dual license structure viewable [here](https://github.com/Uniswap/v4-core/tree/main/licenses) . Each version of Uniswap, once deployed, will function in perpetuity, with 100% uptime, provided the continued existence of the Ethereum blockchain. How does the Uniswap protocol compare to a typical market?[​](https://docs.uniswap.org/concepts/uniswap-protocol#how-does-the-uniswap-protocol-compare-to-a-typical-market "Direct link to How does the Uniswap protocol compare to a typical market?") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- To understand how the Uniswap protocol differs from a traditional exchange, it is helpful to first look at two subjects: how the Automated Market Maker design deviates from traditional central limit order book-based exchanges, and how permissionless systems depart from conventional permissioned systems. ### Order Book VS AMM[​](https://docs.uniswap.org/concepts/uniswap-protocol#order-book-vs-amm "Direct link to Order Book VS AMM") Most publicly accessible markets use a central limit [order book](https://www.investopedia.com/terms/o/order-book.asp) style of exchange, where buyers and sellers create orders organized by price level that are progressively filled as demand shifts. Anyone who has traded stocks through brokerage firms will be familiar with an order book system. The Uniswap protocol takes a different approach, using an Automated Market Maker (AMM), sometimes referred to as a Constant Function Market Maker, in place of an order book. Through its evolution, the protocol has enhanced this model: [v3](https://docs.uniswap.org/contracts/v3/overview) introduced concentrated liquidity for capital efficiency, and [v4](https://docs.uniswap.org/contracts/v4/overview) 's singleton pool architecture and hooks system enable unprecedented customization of pool behavior while maintaining the core AMM principles. At a very high level, an AMM replaces the buy and sell orders in an order book market with a liquidity pool of two assets, both valued relative to each other. As one asset is traded for the other, the relative prices of the two assets shift, and a new market rate for both is determined. In this dynamic, a buyer or seller trades directly with the pool, rather than with specific orders left by other parties. The advantages and disadvantages of Automated Market Makers versus their traditional order book counterparts are under active research by a growing number of parties. We have collected some notable examples on our [research page](https://docs.uniswap.org/concepts/research) . ### Permissionless Systems[​](https://docs.uniswap.org/concepts/uniswap-protocol#permissionless-systems "Direct link to Permissionless Systems") The second departure from traditional markets is the permissionless and immutable design of the Uniswap protocol. These design decisions were inspired by Ethereum's core tenets, and our commitment to the ideals of permissionless access and immutability as indispensable components of a future in which anyone in the world can access financial services without fear of discrimination or counter-party risk. Permissionless design means that the protocol's services are entirely open for public use, with no ability to selectively restrict who can or cannot use them. Anyone can swap, provide liquidity, or create new markets at will. This is a departure from traditional financial services, which typically restrict access based on geography, wealth status, and age. The protocol is also immutable, in other words not upgradeable. No party is able to pause the contracts, reverse trade execution, or otherwise change the behavior of the protocol in any way. It is worth noting that Uniswap Governance has the right (but no obligation) to divert a percentage of swap fees on any pool to a specified address. However, this capability is known to all participants in advance, and to prevent abuse, the percentage is constrained between 10% and 25%. Where can I find more information[​](https://docs.uniswap.org/concepts/uniswap-protocol#where-can-i-find-more-information "Direct link to Where can I find more information") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ For research into the economics of AMMs, game theory, or optimization research, check out our [research](https://docs.uniswap.org/concepts/research) page. For features implemented in v3 that expand and refine the AMM design, see the [v3 Concepts](https://docs.uniswap.org/concepts/protocol/concentrated-liquidity) page. For the latest innovations in v4, including singleton pools and hooks, see the [v4 Concepts](https://docs.uniswap.org/concepts/protocol/hooks) page. Footnotes[​](https://docs.uniswap.org/concepts/uniswap-protocol#footnote-label "Direct link to Footnotes") ----------------------------------------------------------------------------------------------------------- 1. Ethereum protocols are sometimes referred to as peer-to-contract systems as well. These are similar to a peer-to-peer systems, but with immutable, persistent programs known as smart contracts taking the place of a peer. [↩](https://docs.uniswap.org/concepts/uniswap-protocol#user-content-fnref-1) On this page * [Introduction](https://docs.uniswap.org/concepts/uniswap-protocol#introduction) * [How does the Uniswap protocol compare to a typical market?](https://docs.uniswap.org/concepts/uniswap-protocol#how-does-the-uniswap-protocol-compare-to-a-typical-market) * [Order Book VS AMM](https://docs.uniswap.org/concepts/uniswap-protocol#order-book-vs-amm) * [Permissionless Systems](https://docs.uniswap.org/concepts/uniswap-protocol#permissionless-systems) * [Where can I find more information](https://docs.uniswap.org/concepts/uniswap-protocol#where-can-i-find-more-information) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/uniswap-protocol.md) --- # Hooks | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/protocol/hooks#__docusaurus_skipToContent_fallback) On this page Introduction[​](https://docs.uniswap.org/concepts/protocol/hooks#introduction "Direct link to Introduction") ------------------------------------------------------------------------------------------------------------- Uniswap v4 inherits all of the capital efficiency gains of Uniswap v3 while introducing major architectural improvements. The key innovations are the Hook System and Singleton Architecture, which together enable unprecedented protocol customization and gas optimization. Hooks[​](https://docs.uniswap.org/concepts/protocol/hooks#hooks "Direct link to Hooks") ---------------------------------------------------------------------------------------- Hooks allow developers to customize and extend the behavior of liquidity pools. They are external smart contracts that can be attached to individual pools to intercept and modify the execution flow at specific points during pool-related actions. The logic is executed before and/or after major operations such as pool creation, liquidity addition and removal, swapping, and donations. Through these hook functions, developers can build sophisticated features like custom AMMs with different pricing curves, yield farming protocols, advanced trading features including limit orders, dynamic fee strategies, and custom oracle implementations. Each pool can have one hook (though a hook can serve multiple pools), hooks are optional and specified during pool creation, and developers can implement any combination of hook functions based on their needs. Singleton Architecture[​](https://docs.uniswap.org/concepts/protocol/hooks#singleton-architecture "Direct link to Singleton Architecture") ------------------------------------------------------------------------------------------------------------------------------------------- The hook system in v4 is built on top of a revolutionary architectural change known as the singleton design. Unlike previous versions where each pool was a separate smart contract, v4 manages all pools through a single contract called the [PoolManager](https://docs.uniswap.org/contracts/v4/concepts/PoolManager) . This architectural innovation brings several key improvements: * **Efficient Pool Creation**: Pools are created as state updates rather than contract deployments, significantly reducing gas costs * **Gas Optimization**: Multi-hop swaps and complex operations are streamlined through a single contract * **Flash Accounting**: Token balances are tracked internally and settled at the end of transactions, minimizing transfers * **Native ETH Support**: Direct ETH trading without the need to wrap to WETH, improving user experience These core features are just the beginning of what's possible with Uniswap v4. To explore all features including flash accounting, native ETH support, dynamic fees, and custom accounting, check out the [v4 whitepaper](https://uniswap.org/whitepaper-v4.pdf) . For technical implementations and detailed guides, visit the [v4 technical documentation](https://docs.uniswap.org/contracts/v4/overview) . On this page * [Introduction](https://docs.uniswap.org/concepts/protocol/hooks#introduction) * [Hooks](https://docs.uniswap.org/concepts/protocol/hooks#hooks) * [Singleton Architecture](https://docs.uniswap.org/concepts/protocol/hooks#singleton-architecture) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/protocol/hooks.md) --- # Swaps | Uniswap [Skip to main content](https://docs.uniswap.org/concepts/protocol/swaps#__docusaurus_skipToContent_fallback) On this page Introduction[​](https://docs.uniswap.org/concepts/protocol/swaps#introduction "Direct link to Introduction") ------------------------------------------------------------------------------------------------------------- Swaps are the most common way of interacting with the Uniswap protocol. For end-users, swapping is straightforward: a user selects an ERC-20 token that they own and a token they would like to trade it for. Executing a swap sells the currently owned tokens for the proportional[1](https://docs.uniswap.org/concepts/protocol/swaps#user-content-fn-1) amount of the tokens desired, minus the swap fee, which is awarded to liquidity providers[2](https://docs.uniswap.org/concepts/protocol/swaps#user-content-fn-2) . Swapping with the Uniswap protocol is a permissionless process. > note: Using web interfaces (websites) to swap via the Uniswap protocol can introduce additional permission structures, and may result in different execution behavior compared to using the Uniswap protocol directly. To learn more about the differences between the protocol and a web interface, see What is Uniswap. Swaps using the Uniswap protocol are different from traditional order book trades in that they are not executed against discrete orders on a first-in-first-out basis — rather, swaps execute against a passive pool of liquidity, with liquidity providers earning fees proportional to their capital committed Price Impact[​](https://docs.uniswap.org/concepts/protocol/swaps#price-impact "Direct link to Price Impact") ------------------------------------------------------------------------------------------------------------- In a traditional order-book market, a sizeable market-buy order may deplete the available liquidity of a prior limit-sell and continue to execute against a subsequent limit-sell order at a higher price. The result is the final execution price of the order is somewhere in between the two limit-sell prices against which the order was filled. Price impact affects the execution price of a swap similarly but is a result of a different dynamic. When using an automated market maker, the relative value of one asset in terms of the other continuously shifts during the execution of a swap, leaving the final execution price somewhere between where the relative price started - and ended. This dynamic affects every swap using the Uniswap protocol, as it is an inextricable part of AMM design. As the amount of liquidity available at different price points can vary, the price impact for a given swap size will change relative to the amount of liquidity available at any given point in price space. The greater the liquidity available at a given price, the lower the price impact for a given swap size. The lesser the liquidity available, the higher the price impact. Approximate[3](https://docs.uniswap.org/concepts/protocol/swaps#user-content-fn-3) price impact is anticipated in real-time via the Uniswap interface, and warnings appear if unusually high price impact will occur during a swap. Anyone executing a swap will have the ability to assess the circumstances of price impact when needed. Slippage[​](https://docs.uniswap.org/concepts/protocol/swaps#slippage "Direct link to Slippage") ------------------------------------------------------------------------------------------------- The other relevant detail to consider when approaching swaps with the Uniswap protocol is slippage. Slippage is the term we use to describe alterations to a given price that could occur while a submitted transaction is pending. When transactions are submitted to Ethereum, their order of execution is established by the amount of "gas" offered as a fee for executing each transaction. The higher the fee offered, the faster the transaction is executed. The transactions with a lower gas fee will remain pending for an indeterminate amount of time. During this time, the price environment in which the transaction will eventually be executed will change, as other swaps will be taking place. Slippage tolerances establish a margin of change acceptable to the user beyond price impact. As long as the execution price is within the slippage range, e.g., %1, the transaction will be executed. If the execution price ends up outside of the accepted slippage range, the transaction will fail, and the swap will not occur. A comparable situation in a traditional market would be a market-buy order executed after a delay. One can know the expected price of a market-buy order when submitted, but much can change in the time between submission and execution. Safety Checks[​](https://docs.uniswap.org/concepts/protocol/swaps#safety-checks "Direct link to Safety Checks") ---------------------------------------------------------------------------------------------------------------- Price impact and slippage can both change while a transaction is pending, which is why we have built numerous safety checks into the Uniswap protocol to protect end-users from drastic changes in the execution environment of their swap. Some of the most commonly encountered safety checks: * **Expired** : A transaction error that occurs if a swap is pending longer than a predetermined deadline. The deadline is a point in time after which the swap will be canceled to protect against unusually long pending periods and the changes in price that typically accompany the passage of time. * **INSUFFICIENT\_OUTPUT\_AMOUNT** : When a user submits a swap, the Uniswap interface will send an estimate of how much of the purchased token the user should expect to receive. If the anticipated output amount of a swap does not match the estimate within a certain margin of error (the slippage tolerance), the swap will be canceled. This attempts to protect the user from any drastic and unfavorable price changes while their transaction is pending. Footnotes[​](https://docs.uniswap.org/concepts/protocol/swaps#footnote-label "Direct link to Footnotes") --------------------------------------------------------------------------------------------------------- 1. Proportional in this instance takes into account many factors, including the relative price of one token in terms of the other, slippage, price impact, and other factors related to the open and adversarial nature of Ethereum. [↩](https://docs.uniswap.org/concepts/protocol/swaps#user-content-fnref-1) 2. For information about liquidity provision, see the liquidity user guide [↩](https://docs.uniswap.org/concepts/protocol/swaps#user-content-fnref-2) 3. The Uniswap interface informs the user about the circumstances of their swap, but it is not guaranteed. [↩](https://docs.uniswap.org/concepts/protocol/swaps#user-content-fnref-3) On this page * [Introduction](https://docs.uniswap.org/concepts/protocol/swaps#introduction) * [Price Impact](https://docs.uniswap.org/concepts/protocol/swaps#price-impact) * [Slippage](https://docs.uniswap.org/concepts/protocol/swaps#slippage) * [Safety Checks](https://docs.uniswap.org/concepts/protocol/swaps#safety-checks) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/concepts/protocol/swaps.md) --- # Transaction | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction#__docusaurus_skipToContent_fallback) On this page Entity capturing uniswap transaction details with a list of mint, burn, swap, flash and collects events emitted within a transaction. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction#schema "Direct link to Schema") ------------------------------------------------------------------------------------------------------------------- | Field | Type | derivedFrom | Description | | --- | --- | --- | --- | | id | ID! | | Transaction Hash | | blockNumber | BigInt! | | Block Number where the transaction was added to the chain | | timestamp | BigInt! | | Timestamp of the block where the transaction was added to the chain | | gasUsed | BigInt! | | Amount of Gas Units Consumed to execute the transaction | | gasPrice | BigInt! | | Cost of one unit Gas paid for the transaction | | mints | \[[Mint](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/mint)
\]! | @derivedFrom(field: "transaction") | [Mint](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/mint)
entities created in this transaction | | burns | \[[Burn](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/burn)
\]! | @derivedFrom(field: "transaction") | [Burn](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/burn)
entities created in this transaction | | swaps | \[[Swap](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/swap)
\]! | @derivedFrom(field: "transaction") | [Swap](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/swap)
entities created in this transaction | | flashed | \[[Flash](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/flash)
\]! | @derivedFrom(field: "transaction") | [Flash](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/flash)
entities created in this transaction | | collects | \[[Collect](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/collect)
\]! | @derivedFrom(field: "transaction") | [Collect](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/collect)
entities created in this transaction | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction#referencing-functions "Direct link to Referencing Functions") ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [loadTransaction()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/index.ts#loadtransaction) | ✅ | | ✅ | ✅ | | [handleMint()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handlemint) | | ✅ | | | | [handleBurn()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleburn) | | ✅ | | | | [handleSwap()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/core.ts#handleswap) | | ✅ | | | | [getPosition()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#getposition) | | ✅ | | | | [savePositionSnapshot()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/mappings/position-manager.ts#savepositionsnapshot) | | ✅ | | | On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/transaction#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/transaction.md) --- # TokenHourData | Uniswap [Skip to main content](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tokenhourdata#__docusaurus_skipToContent_fallback) On this page Entities capturing the hourly metrics for a token across all of Uniswap. Schema[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tokenhourdata#schema "Direct link to Schema") --------------------------------------------------------------------------------------------------------------------- | Field | Type | derivedFrom | Description | | --- | --- | --- | --- | | id | ID! | | TokenHourData Entity ID. Format: `-` | | periodStartUnix | Int! | | Timestamp rounded to the hour by dividing by 3600 | | token | [Token](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
! | | [Token Entity](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/token)
for which the hourly metric were recorded | | volume | BigDecimal! | | Hourly swap volume of the token | | volumeUSD | BigDecimal! | | Hourly swap volume of the token in derived USD | | untrackedVolumeUSD | BigDecimal! | | Hourly swap volume of the token in derived USD (including in pools with tokens with unreliable USD value) | | totalValueLocked | BigDecimal! | | Liquidity across all pools in token units at the end of the hour | | totalValueLockedUSD | BigDecimal! | | Total value of liquidity across all pools in token units in derived USD at the end of the hour | | priceUSD | BigDecimal! | | Price of token in USD at the end of the hour | | feesUSD | BigDecimal! | | Total Fee Collected in derived USD at the end of the hour | | open | BigDecimal! | | Open Price of the token | | high | BigDecimal! | | High Price of the token | | low | BigDecimal! | | Low Price of the token | | close | BigDecimal! | | Close Price of the token | Referencing Functions[​](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tokenhourdata#referencing-functions "Direct link to Referencing Functions") ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | FunctionName | Create | Read | Update | Save | | --- | --- | --- | --- | --- | | [updateTokenHourData()](https://docs.uniswap.org/api/subgraph/subgraphs-devs/functions-n-handlers/utils/intervalUpdates.ts#updatetokenhourdata) | ✅ | ✅ | ✅ | ✅ | On this page * [Schema](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tokenhourdata#schema) * [Referencing Functions](https://docs.uniswap.org/api/subgraph/subgraphs-devs/schemas/tokenhourdata#referencing-functions) Ask AI [Edit this page](https://github.com/uniswap/uniswap-docs/tree/main/docs/api/subgraph/subgraphs-devs/schemas/tokenhourdata.md) --- # Unknown Uniswap v2 Core Hayden Adams hayden@uniswap.org Noah Zinsmeister noah@uniswap.org Dan Robinson dan@paradigm.xyz March 2020 Abstract This technical whitepaper explains some of the design decisions behind the Uniswap v2 core contracts. It covers the contracts’ new features—including arbitrary pairs between ERC20s, a hardened price oracle that allows other contracts to estimate the time-weighted average price over a given interval, “flash swaps” that allow traders to receive assets and use them elsewhere before paying for them later in the transaction, and a protocol fee that can be turned on in the future. It also re-architects the contracts to reduce their attack surface. This whitepaper describes the mechanics of Uniswap v2’s “core” contracts including the pair contract that stores liquidity providers’ funds—and the factory contract used to instantiate pair contracts. 1 Introduction Uniswap v1 is an on-chain system of smart contracts on the Ethereum blockchain, imple- menting an automated liquidity protocol based on a “constant product formula” \[1\]. Each Uniswap v1 pair stores pooled reserves of two assets, and provides liquidity for those two assets, maintaining the invariant that the product of the reserves cannot decrease. Traders pay a 30-basis-point fee on trades, which goes to liquidity providers. The contracts are non-upgradeable. Uniswap v2 is a new implementation based on the same formula, with several new highly- desirable features. Most significantly, it enables the creation of arbitrary ERC20/ERC20 pairs, rather than supporting only pairs between ERC20 and ETH. It also provides a hard- ened price oracle that accumulates the relative price of the two assets at the beginning of each block. This allows other contracts on Ethereum to estimate the time-weighted average price for the two assets over arbitrary intervals. Finally, it enables “flash swaps” where users can receive assets freely and use them elsewhere on the chain, only paying for (or returning) those assets at the end of the transaction. While the contract is not generally upgradeable, there is a private key that has the ability to update a variable on the factory contract to turn on an on-chain 5-basis-point fee on trades. This fee will initially be turned off, but could be turned on in the future, after which liquidity providers would earn 25 basis points on every trade, rather than 30 basis points. As discussed in section 3, Uniswap v2 also fixes some minor issues with Uniswap v1, as well as rearchitecting the implementation, reducing Uniswap’s attack surface and making the system more easily upgradeable by minimizing the logic in the “core” contract that holds liquidity providers’ funds. 1 This paper describes the mechanics of that core contract, as well as the factory contract used to instantiate those contracts. Actually using Uniswap v2 will require calling the pair contract through a “router” contract that computes the trade or deposit amount and transfers funds to the pair contract. 2 New features 2.1 ERC-20 pairs Uniswap v1 used ETH as a bridge currency. Every pair included ETH as one of its assets. This makes routing simpler—every trade between ABC and XYZ goes through the ETH/ABC pair and the ETH/XYZ pair—and reduces fragmentation of liquidity. However, this rule imposes significant costs on liquidity providers. All liquidity providers have exposure to ETH, and suffer impermanent loss based on changes in the prices of other assets relative to ETH. When two assets ABC and XYZ are correlated—for example, if they are both USD stablecoins—liquidity providers on a Uniswap pair ABC/XYZ would generally be subject to less impermanent loss than the ABC/ETH or XYZ/ETH pairs. Using ETH as a mandatory bridge currency also imposes costs on traders. Traders have to pay twice as much in fees as they would on a direct ABC/XYZ pair, and they suffer slippage twice. Uniswap v2 allows liquidity providers to create pair contracts for any two ERC-20s. A proliferation of pairs between arbitrary ERC-20s could make it somewhat more difficult to find the best path to trade a particular pair, but routing can be handled at a higher layer (either off-chain or through an on-chain router or aggregator). 2.2 Price oracle The marginal price offered by Uniswap (not including fees) at timetcan be computed by dividing the reserves of assetaby the reserves of assetb. p t = r a t r b t (1) Since arbitrageurs will trade with Uniswap if this price is incorrect (by a sufficient amount to make up for the fee), the price offered by Uniswap tends to track the relative market price of the assets, as shown by Angeris et al \[2\]. This means it can be used as an approximate price oracle. However, Uniswap v1 is not safe to use as an on-chain price oracle, because it is very easy to manipulate. Suppose some other contract uses the current ETH-DAI price to settle a derivative. An attacker who wishes to manipulate the measured price can buy ETH from the ETH-DAI pair, trigger settlement on the derivative contract (causing it to settle based on the inflated price), and then sell ETH back to the pair to trade it back to the true price. 1 This might even be done as an atomic transaction, or by a miner who controls the ordering of transactions within a block. Uniswap v2 improves this oracle functionality by measuring and recording the price beforethe first trade of each block (or equivalently,afterthe last trade of the previous 1 For a real-world example of how using Uniswap v1 as an oracle can make a contract vulnerable to such an attack, see \[3\]. 2 block). This price is more difficult to manipulate than prices during a block. If the attacker submits a transaction that attempts to manipulate the price at the end of a block, some other arbitrageur may be able to submit another transaction to trade back immediately afterward in the same block. A miner (or an attacker who uses enough gas to fill an entire block) could manipulate the price at the end of a block, but unless they mine the next block as well, they may not have a particular advantage in arbitraging the trade back. Specifically, Uniswap v2accumulatesthis price, by keeping track of the cumulative sum of prices at the beginning of each block in which someone interacts with the contract. Each price is weighted by the amount of time that has passed since the last block in which it was updated, according to the block timestamp. 2 This means that the accumulator value at any given time (after being updated) should be the sum of the spot price at each second in the history of the contract. a t = t ∑ i=1 p i (2) To estimate thetime-weighted average pricefrom timet 1 tot 2 , an external caller can checkpoint the accumulator’s value att 1 and then again att 2 , subtract the first value from the second, and divide by the number of seconds elapsed. (Note that the contract itself does not store historical values for this accumulator—the caller has to call the contract at the beginning of the period to read and store this value.) p t 1 ,t 2 = ∑ t 2 i=t 1 p i t 2 −t 1 = ∑ t 2 i=1 p i − ∑ t 1 i=1 p i t 2 −t 1 = a t 2 −a t 1 t 2 −t 1 (3) Users of the oracle can choose when to start and end this period. Choosing a longer period makes it more expensive for an attacker to manipulate the TWAP, although it results in a less up-to-date price. One complication: should we measure the price of asset A in terms of asset B, or the price of asset B in terms of asset A? While the spot price of A in terms of B is always the reciprocal of the spot price of B in terms of A, the mean price of asset A in terms of asset B over a particular period of time isnotequal to the reciprocal of the mean price of asset B in terms of asset A. 3 For example, if the USD/ETH price is 100 in block 1 and 300 in block 2, the average USD/ETH price will be 200 USD/ETH, but the average ETH/USD price will be 1/150 ETH/USD. Since the contract cannot know which of the two assets users would want to use as the unit of account, Uniswap v2 tracks both prices. Another complication is that it is possible for someone to send assets to the pair con- tract—and thus change its balances and marginal price—withoutinteracting with it, and thus without triggering an oracle update. If the contract simply checked its own balances and updated the oracle based on the current price, an attacker could manipulate the oracle by sending an asset to the contract immediately before calling it for the first time in a block. If the last trade was in a block whose timestamp was X seconds ago, the contract would incorrectly multiply thenewprice by X before accumulating it, even though nobody 2 Since miners have some freedom to set the block timestamp, users of the oracle should be aware that these values may not correspond precisely to real-world times. 3 The arithmetic mean price of asset A in terms of asset B over a given period is equal to the reciprocal of theharmonicmean price of asset B in terms of asset A over that period. If the contract measured the geometricmean price, then the prices would be the reciprocals of each other. However, the geometric mean TWAP is less commonly used, and is difficult to compute on Ethereum. 3 has had an opportunity to trade at that price. To prevent this, the core contract caches its reserves after each interaction, and updates the oracle using the price derived from the cached reserves rather than the current reserves. In addition to protecting the oracle from manipulation, this change enables the contract re-architecture described below in section 3.2. 2.2.1 Precision Because Solidity does not have first-class support for non-integer numeric data types, the Uniswap v2 uses a simple binary fixed point format to encode and manipulate prices. Specifically, prices at a given moment are stored as UQ112.112 numbers, meaning that 112 fractional bits of precision are specified on either side of the decimal point, with no sign. These numbers have a range of \[0, 2 112 −1\] 4 and a precision of 1 2 112 . The UQ112.112 format was chosen for a pragmatic reason — because these numbers can be stored in a uint224, this leaves 32 bits of a 256 bit storage slot free. It also happens that the reserves, each stored in a uint112, also leave 32 bits free in a (packed) 256 bit storage slot. These free spaces are used for the accumulation process described above. Specifically, the reserves are stored alongside the timestamp of the most recent block with at least one trade, modded with 2 32 so that it fits into 32 bits. Additionally, although the price at any given moment (stored as a UQ112.112 number) is guaranteed to fit in 224 bits, the accumulation of this price over an interval is not. The extra 32 bits on the end of the storage slots for the accumulated price of A/B and B/A are used to store overflow bits resulting from repeated summations of prices. This design means that the price oracle only adds an additional three SSTORE operations (a current cost of about 15,000 gas) to the first trade in each block. The primary downside is that 32 bits isn’t quite enough to store timestamp values that will reasonably never overflow. In fact, the date when the Unix timestamp overflows a uint32 is 02/07/2106. To ensure that this system continues to function properly after this date, and every multiple of 2 32 −1 seconds thereafter, oracles are simply required to check prices at least once per interval (approximately 136 years). This is because the core method of accumulation (and modding of timestamp), is actually overflow-safe, meaning that trades across overflow intervals can be appropriately accounted for given that oracles are using the proper (simple) overflow arithmetic to compute deltas. 2.3 Flash Swaps In Uniswap v1, a user purchasing ABC with XYZ needs to send the XYZ to the contract before they could receive the ABC. This is inconvenient if that user needs the ABC they are buying in order to obtain the XYZ they are paying with. For example, the user might be using that ABC to purchase XYZ in some other contract in order to arbitrage a price difference from Uniswap, or they could be unwinding a position on Maker or Compound by selling the collateral to repay Uniswap. Uniswap v2 adds a new feature that allows a user to receive and use an assetbeforepaying for it, as long as they make the payment within the same atomic transaction. Theswap function makes a call to an optional user-specified callback contract in between transferring out the tokens requested by the user and enforcing the invariant. Once the callback is complete, the contract checks the new balances and confirms that the invariant is satisfied 4 The theoretical upper bound of 2 112 −( 1 2 112 ) does not apply in this setting, as UQ112.112 numbers in Uniswap are always generated from the ratio of two uint112s. The largest such ratio is 2 112 −1 1 = 2 112 −1. 4 (after adjusting for fees on the amounts paid in). If the contract does not have sufficient funds, it reverts the entire transaction. A user can also repay the Uniswap pool using the same token, rather than completing the swap. This is effectively the same as letting anyone flash-borrow any of assets stored in a Uniswap pool (for the same 0.30% fee as Uniswap charges for trading). 5 2.4 Protocol fee Uniswap v2 includes a 0.05% protocol fee that can be turned on and off. If turned on, this fee would be sent to afeeToaddress specified in the factory contract. Initially,feeTois not set, and no fee is collected. A pre-specified address—feeToSetter—can call thesetFeeTofunction on the Uniswap v2 factory contract, settingfeeToto a different value.feeToSettercan also call thesetFeeToSetterto change thefeeToSetteraddress itself. If thefeeToaddress is set, the protocol will begin charging a 5-basis-point fee, which is taken as a 1 6 cut of the 30-basis-point fees earned by liquidity providers. That is, traders will continue to pay a 0.30% fee on all trades; 83.3% of that fee (0.25% of the amount traded) will go to liquidity providers, and 16.6% of that fee (0.05% of the amount traded) will go to thefeeToaddress. Collecting this 0.05% fee at the time of the trade would impose an additional gas cost on every trade. To avoid this, accumulated fees are collected only when liquidity is deposited or withdrawn. The contract computes the accumulated fees, and mints new liquidity tokens to the fee beneficiary, immediately before any tokens are minted or burned. The total collected fees can be computed by measuring the growth in √ k(that is, √ x·y) since the last time fees were collected. 6 This formula gives you the accumulated fees between t 1 andt 2 as a percentage of the liquidity in the pool att 2 : f 1,2 = 1− √ k 1 √ k 2 (4) If the fee was activated beforet 1 , thefeeToaddress should capture 1 6 of fees that were accumulated betweent 1 andt 2 . Therefore, we want to mint new liquidity tokens to the feeToaddress that representφ·f 1,2 of the pool, whereφis 1 6 . That is, we want to chooses m to satisfy the following relationship, wheres 1 is the total quantity of outstanding shares at timet 1 : s m s m +s 1 =φ·f 1,2 (5) After some manipulation, including substituting 1− √ k 1 √ k 2 forf 1,2 and solving fors m , we can rewrite this as: s m = √ k 2 − √ k 1 ( 1 φ −1)· √ k 2 + √ k 1 ·s 1 (6) Settingφto 1 6 gives us the following formula: 5 Because Uniswap charges fees on input amounts, the fee relative to thewithdrawnamount is actually slightly higher: 1 1−0.003 −1 = 3 997 ≈0.3009203%. 6 We can use this invariant, which does not account for liquidity tokens that were minted or burned, because we know that fees are collected every time liquidity is deposited or withdrawn. 5 s m = √ k 2 − √ k 1 5· √ k 2 + √ k 1 ·s 1 (7) Suppose the initial depositor puts 100 DAI and 1 ETH into a pair, receiving 10 shares. Some time later (without any other depositor having participated in that pair), they attempt to withdraw it, at a time when the pair has 96 DAI and 1.5 ETH. Plugging those values into the above formula gives us the following: s m = √ 1.5·96− √ 1·100 5· √ 1.5·96 + √ 1·100 ·10≈0.0286(8) 2.5 Meta transactions for pool shares Pool shares minted by Uniswap v2 pairs natively support meta transactions. This means users can authorize a transfer of their pool shares with a signature 7 , rather than an on-chain transaction from their address. Anyone can submit this signature on the user’s behalf by calling thepermitfunction, paying gas fees and possibly performing other actions in the same transaction. 3 Other changes 3.1 Solidity Uniswap v1 is implemented in Vyper, a Python-like smart contract language. Uniswap v2 is implemented in the more widely-used Solidity, since it requires some capabilities that were not yet available in Vyper (such as the ability to interpret the return values of non-standard ERC-20 tokens, as well as access to new opcodes such aschainidvia inline assembly) at the time it was being developed. 3.2 Contract re-architecture One design priority for Uniswap v2 is to minimize the surface area and complexity of the core pair contract—the contract that stores liquidity providers’ assets. Any bugs in this contract could be disastrous, since millions of dollars of liquidity might be stolen or frozen. When evaluating the security of this core contract, the most important question is whether it protectsliquidity providersfrom having their assets stolen or locked. Any feature that is meant to support or protecttraders—other than the basic functionality of allowing one asset in the pool to be swapped for another—can be handled in a “router” contract. In fact, even part of the swap functionality can be pulled out into the router contract. As mentioned above, Uniswap v2 stores the last recorded balance of each asset (in order to prevent a particular manipulative exploit of the oracle mechanism). The new architecture takes advantage of this to further simplify the Uniswap v1 contract. In Uniswap v2, the seller sends the asset to the core contractbeforecalling the swap function. Then, the contract measures how much of the asset it has received, by comparing the last recorded balance to its current balance. This means the core contract is agnostic 7 The signed message conforms to the EIP-712 standard, the same one used by meta transactions for tokens like CHAI and DAI. 6 to the way in which the trader transfers the asset. Instead of transferFrom, it could be a meta transaction, or any other future mechanism for authorizing the transfer of ERC-20s. 3.2.1 Adjustment for fee Uniswap v1’s trading fee is applied by reducing the amount paid into the contract by 0.3% before enforcing the constant-product invariant. The contract implicitly enforces the following formula: (x 1 −0.003·x in ))·y 1 >=x 0 ·y 0 (9) With flash swaps, Uniswap v2 introduces the possibility thatx in andy in might both be non-zero (when a user wants to pay the pair back using the same asset, rather than swapping). To handle such cases while properly applying fees, the contract is written to enforce the following invariant: 8 (x 1 −0.003·x in )·(y 1 −0.003·y in )>=x 0 ·y 0 (10) To simplify this calculation on-chain, we can multiply each side of the inequality by 1,000,000: (1000·x 1 −3·x in )·(1000·y 1 −3·y in )>= 1000000·x 0 ·y 0 (11) 3.2.2 sync() and skim() To protect against bespoke token implementations that can update the pair contract’s balance, and to more gracefully handle tokens whose total supply can be greater than 2 112 , Uniswap v2 has two bail-out functions:sync()andskim(). sync()functions as a recovery mechanism in the case that a token asynchronously deflates the balance of a pair. In this case, trades will receive sub-optimal rates, and if no liquidity provider is willing to rectify the situation, the pair is stuck.sync()exists to set the reserves of the contract to the current balances, providing a somewhat graceful recovery from this situation. skim()functions as a recovery mechanism in case enough tokens are sent to an pair to overflow the two uint112 storage slots for reserves, which could otherwise cause trades to fail.skim()allows a user to withdraw the difference between the current balance of the pair and 2 112 −1 to the caller, if that difference is greater than 0. 3.3 Handling non-standard and unusual tokens The ERC-20 standard requires that transfer() and transferFrom() return a boolean in- dicating the success or failure of the call \[4\]. The implementations of one or both of these functions on some tokens—including popular ones like Tether (USDT) and Binance Coin (BNB)—instead have no return value. Uniswap v1 interprets the missing return value of these improperly defined functions as false—that is, as an indication that the transfer was not successful—and reverts the transaction, causing the attempted transfer to fail. 8 Note that using the new architecture,x in is not provided by the user; instead, it is calculated by measuring the contract’s balance after the callback,x 1 , and subtracting (x 0 -x out ) from it. This logic does not distinguish between assets sent into the contract before it is called and assets sent into the contract during the callback.y in is computed in the same way, based ony 0 ,y 1 , andy out . 7 Uniswap v2 handles non-standard implementations differently. Specifically, if a transfer() call 9 has no return value, Uniswap v2 interprets it as a success rather than as a failure. This change should not affect any ERC-20 tokens that conform to the standard (because in those tokens, transfer() always has a return value). Uniswap v1 also makes the assumption that calls to transfer() and transferFrom() cannot trigger a reentrant call to the Uniswap pair contract. This assumption is violated by certain ERC-20 tokens, including ones that support ERC-777’s “hooks” \[5\]. To fully support such tokens, Uniswap v2 includes a “lock” that directly prevents reentrancy to all public state- changing functions. This also protects against reentrancy from the user-specified callback in a flash swap, as described in section 2.3. 3.4 Initialization of liquidity token supply When a new liquidity provider deposits tokens into an existing Uniswap pair, the number of liquidity tokens minted is computed based on the existing quantity of tokens: s minted = x deposited x starting ·s starting (12) But what if they are the first depositor? In that case,x starting is 0, so this formula will not work. Uniswap v1 sets the initial share supply to be equal to the amount of ETH deposited (in wei). This was a somewhat reasonable value, because if the initial liquidity was deposited at the correct price, then 1 liquidity pool share (which, like ETH, is an 18-decimal token) would be worth approximately 2 ETH. However, this meant that the value of a liquidity pool share was dependent on the ratio at which liquidity was initially deposited, which was fairly arbitrary, especially since there was no guarantee that that ratio reflected the true price. Additionally, Uniswap v2 supports arbitrary pairs, so many pairs will not include ETH at all. Instead, Uniswap v2 initially mints shares equal to thegeometric meanof the amounts deposited: s minted = √ x deposited ·y deposited (13) This formula ensures that the value of a liquidity pool share at any time is essentially independent of the ratio at which liquidity was initially deposited. For example, suppose that the price of 1 ABC is currently 100 XYZ. If the initial deposit had been 2 ABC and 200 XYZ (a ratio of 1:100), the depositor would have received √ 2·200 = 20 shares. Those shares should now still be worth 2 ABC and 200 XYZ, plus accumulated fees. If the initial deposit had been 2 ABC and 800 XYZ (a ratio of 1:400), the depositor would have received √ 2·800 = 40 pool shares. 10 The above formula ensures that a liquidity pool share will never be worth less than the geometric mean of the reserves in that pool. However, it is possible for the value of 9 As described above in section 3.2, Uniswap v2 core does not use transferFrom(). 10 This also reduces the likelihood of rounding errors, since the number of bits in the quantity of shares will be approximately the mean of the number of bits in the quantity of asset X in the reserves, and the number of bits in the quantity of asset Y in the reserves: log 2 √ x·y= log 2 x+ log 2 y 2 (14) 8 a liquidity pool share to grow over time, either by accumulating trading fees or through “donations” to the liquidity pool. In theory, this could result in a situation where the value of the minimum quantity of liquidity pool shares (1e-18 pool shares) is worth so much that it becomes infeasible for small liquidity providers to provide any liquidity. To mitigate this, Uniswap v2 burns the first 1e-15 (0.000000000000001) pool shares that are minted (1000 times the minimum quantity of pool shares), sending them to the zero address instead of to the minter. This should be a negligible cost for almost any token pair. 11 But it dramatically increases the cost of the above attack. In order to raise the value of a liquidity pool share to $100, the attacker would need to donate $100,000 to the pool, which would be permanently locked up as liquidity. 3.5 Wrapping ETH The interface for transacting with Ethereum’s native asset, ETH, is different from the standard interface for interacting with ERC-20 tokens. As a result, many other protocols on Ethereum do not support ETH, instead using a canonical ”wrapped ETH” token, WETH \[6\]. Uniswap v1 is an exception. Since every Uniswap v1 pair included ETH as one asset, it made sense to handle ETH directly, which was slightly more gas-efficient. Since Uniswap v2 supports arbitrary ERC-20 pairs, it now no longer makes sense to support unwrapped ETH. Adding such support would double the size of the core codebase, and risks fragmentation of liquidity between ETH and WETH pairs 12 . Native ETH needs to be wrapped into WETH before it can be traded on Uniswap v2. 3.6 Deterministic pair addresses As in Uniswap v1, all Uniswap v2 pair contracts are instantiated by a single factory contract. In Uniswap v1, these pair contracts were created using the CREATE opcode, which meant that the address of such a contract depended on the order in which that pair was created. Uniswap v2 uses Ethereum’s new CREATE2 opcode \[8\] to generate a pair contract with a deterministic address. This means that it is possible to calculate a pair’s address (if it exists) off-chain, without having to look at the chain state. 3.7 Maximum token balance In order to efficiently implement the oracle mechanism, Uniswap v2 only support reserve balances of up to 2 112 −1. This number is high enough to support 18-decimal-place tokens with a totalSupply over 1 quadrillion. If either reserve balance does go above 2 112 −1, any call to theswapfunction will begin to fail (due to a check in the\_update()function). To recover from this situation, any user can call theskim()function to remove excess assets from the liquidity pool. 11 In theory, there are some cases where this burn could be non-negligible, such as pairs between high-value zero-decimal tokens. However, these pairs are a poor fit for Uniswap anyway, since rounding errors would make trading infeasible. 12 As of this writing, one of the highest-liquidity pairs on Uniswap v1 is the pair between ETH and WETH \[7\]. 9 References \[1\] Hayden Adams. 2018.url:https://hackmd.io/@477aQ9OrQTCbVR3fq1Qzxg/HJ9jLsfTz? type=view. \[2\] Guillermo Angeris et al.An analysis of Uniswap markets. 2019. arXiv:1911.03380 \[q-fin.TR\]. \[3\] samczsun.Taking undercollateralized loans for fun and for profit. Sept. 2019.url: https://samczsun.com/taking- undercollateralized- loans- for- fun- and- for-profit/. \[4\] Fabian Vogelsteller and Vitalik Buterin. Nov. 2015.url:https://eips.ethereum. org/EIPS/eip-20. \[5\] Jordi Baylina Jacques Dafflon and Thomas Shababi.EIP 777: ERC777 Token Standard. Nov. 2017.url:https://eips.ethereum.org/EIPS/eip-777. \[6\] Radar.WTF is WETH?url:https://weth.io/. \[7\] Uniswap.info.Wrapped Ether (WETH).url:https://uniswap.info/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2. \[8\] Vitalik Buterin.EIP 1014: Skinny CREATE2. Apr. 2018.url:https://eips.ethereum. org/EIPS/eip-1014. 4 Disclaimer This paper is for general information purposes only. It does not constitute investment advice or a recommendation or solicitation to buy or sell any investment and should not be used in the evaluation of the merits of making any investment decision. It should not be relied upon for accounting, legal or tax advice or investment recommendations. This paper reflects current opinions of the authors and is not made on behalf of Paradigm or its affiliates and does not necessarily reflect the opinions of Paradigm, its affiliates or individuals associated with Paradigm. The opinions reflected herein are subject to change without being updated. 10 --- # Unknown \# Uniswap Documentation - LLM Context File This file provides structured context for Large Language Models about the Uniswap Protocol documentation. ## About Uniswap Uniswap is a decentralized exchange protocol built on Ethereum that enables users to swap ERC-20 tokens without intermediaries. The protocol uses an automated market maker (AMM) model with liquidity pools rather than order books. ## Current Protocol Versions ### Uniswap v4 (Latest) - \*\*Status\*\*: Recently launched, actively developed - \*\*Key Features\*\*: Hooks, singleton architecture, flash accounting, custom pools - \*\*Documentation\*\*: \`/contracts/v4/\`, \`/sdk/v4/\` - \*\*Major Innovation\*\*: Hooks system allows custom logic in pools ### Uniswap v3 - \*\*Status\*\*: Mature, widely used - \*\*Key Features\*\*: Concentrated liquidity, multiple fee tiers, NFT positions - \*\*Documentation\*\*: \`/contracts/v3/\`, \`/sdk/v3/\` - \*\*Innovation\*\*: Capital efficiency through concentrated liquidity ### Uniswap v2 - \*\*Status\*\*: Legacy, still functional - \*\*Key Features\*\*: Simple AMM, fixed liquidity ranges - \*\*Documentation\*\*: \`/contracts/v2/\`, \`/sdk/v2/\` ## Documentation Structure ### Core Concepts (\`/concepts/\`) - Protocol overview and fundamentals - How AMMs work - Liquidity provision concepts - Governance and tokenomics ### Smart Contracts (\`/contracts/\`) - \*\*v4\*\*: Latest contract documentation, hooks, examples - \*\*v3\*\*: Core contracts, periphery contracts, guides - \*\*v2\*\*: Legacy contract documentation - \*\*UniswapX\*\*: Intent-based trading protocol ### SDKs (\`/sdk/\`) - \*\*v4-SDK\*\*: TypeScript SDK for v4 integration - \*\*v3-SDK\*\*: Comprehensive TypeScript SDK for v3 - \*\*v2-SDK\*\*: Legacy SDK for v2 ### APIs (\`/api/\`) - \*\*Subgraph\*\*: GraphQL API for querying protocol data - \*\*Routing API\*\*: For finding optimal swap routes ## Key Topics by Category ### For Developers 1. \*\*Getting Started\*\*: Protocol basics, choosing versions 2. \*\*Integration\*\*: SDK usage, contract interactions 3. \*\*Advanced\*\*: Custom hooks, flash loans, arbitrage ### For Liquidity Providers 1. \*\*Concepts\*\*: Impermanent loss, fee earnings, ranges 2. \*\*Strategies\*\*: Position management, rebalancing 3. \*\*Risk Management\*\*: Price impact, slippage ### For Traders 1. \*\*Swapping\*\*: How trades work, routing, slippage 2. \*\*Advanced Trading\*\*: MEV protection, limit orders 3. \*\*Interfaces\*\*: Web app usage, integration options ## Technical Implementation Details ### Smart Contracts - \*\*Core Contracts\*\*: Factory, Pool, Router patterns - \*\*Security\*\*: Audits, formal verification, testing - \*\*Gas Optimization\*\*: Efficient operations, batch transactions ### Integration Patterns - \*\*Direct Integration\*\*: Contract-to-contract calls - \*\*SDK Integration\*\*: TypeScript/JavaScript applications - \*\*Subgraph Queries\*\*: Data fetching and analytics ### Common Use Cases 1. \*\*DeFi Protocols\*\*: Integrating swaps into other protocols 2. \*\*Wallets\*\*: Adding swap functionality 3. \*\*Arbitrage Bots\*\*: MEV and price difference exploitation 4. \*\*Analytics\*\*: Protocol metrics and user behavior ## Version Migration Guides ### v2 to v3 Migration - Concentrated liquidity concepts - Position management differences - Fee tier selection ### v3 to v4 Migration - Hooks architecture understanding - Singleton pattern benefits - Gas efficiency improvements ## Ecosystem and Governance ### Uniswap Foundation - Ecosystem growth and grants - Community governance support - Research and development funding ### Uniswap Labs - Core protocol development - Interface development - Commercial applications ### Governance - UNI token voting - Proposal processes - Community decision making ## Common Issues and Solutions ### Integration Challenges 1. \*\*Slippage Management\*\*: Setting appropriate tolerances 2. \*\*MEV Protection\*\*: Using private mempools, flashbots 3. \*\*Gas Optimization\*\*: Batch operations, efficient routing ### Development Pitfalls 1. \*\*Price Manipulation\*\*: Using time-weighted averages 2. \*\*Reentrancy\*\*: Proper security patterns 3. \*\*Oracle Usage\*\*: Avoiding price manipulation ## Resources and References ### Official Links - Main Protocol: https://uniswap.org - Documentation: https://docs.uniswap.org - GitHub: https://github.com/Uniswap - Governance: https://gov.uniswap.org ### Community - Discord: https://discord.gg/uniswap - Twitter: https://twitter.com/Uniswap - Research Forum: https://gov.uniswap.org ### Developer Tools - Interface: https://app.uniswap.org - Analytics: https://info.uniswap.org - Subgraph: TheGraph hosted service ## AI Assistant Guidelines When helping users with Uniswap-related questions: 1. \*\*Version Awareness\*\*: Always clarify which version (v2/v3/v4) the user needs 2. \*\*Security First\*\*: Emphasize security best practices, audits, testing 3. \*\*Gas Efficiency\*\*: Consider gas costs in recommendations 4. \*\*Latest Updates\*\*: v4 is the newest with hooks - recommend for new projects 5. \*\*Integration Complexity\*\*: Start with SDK examples before low-level contracts 6. \*\*Risk Disclosure\*\*: Always mention risks like impermanent loss, smart contract risks ## Recent Updates and Changes - \*\*v4 Launch\*\*: New hooks system, singleton architecture - \*\*UniswapX\*\*: Intent-based trading protocol - \*\*Mobile Interface\*\*: Improved mobile trading experience - \*\*Governance Evolution\*\*: Continued decentralization efforts This documentation covers a comprehensive DeFi protocol with multiple versions, extensive developer tools, and active community governance. Always refer users to the most recent documentation and emphasize security best practices. ---