Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions docs/ai-coding/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Using LLMs.txt or LLMs-full.txt
description: Uniswap docs are LLM-ready and help developers build on Uniswap v4 faster and more efficiently.
---

## Understanding Context Windows

AI models have a context window, which is the amount of text they can process at once. This is typically the number of tokens that can be processed in a single request (more like it's memory capacity).
Once the context window fills up, parts of your conversational history may be lost.

It is exactly for this reason, providing relevant context upfront is critical.

## llms.txt and llms-full.txt

Depending on the model's context window, you can either use llms.txt or llms-full.txt. Most of the modern models have a [context window of about 100k tokens](https://codingscape.com/blog/llms-with-largest-context-windows).

For most cases we are good to go with llms.txt as it is more compact and provides the LLM with necessary information about links from the documentation and what it does.

If you are using a model with a larger context window, you can use llms-full.txt. It is a more verbose version of llms.txt and provides the LLM with more information about the documentation.

## Using llms.txt or llms-full.txt file

You can provide your code editor with a llms.txt or llms-full.txt file to use Unichain docs as a context for your code.

Here's how to do it for some common code editors:

#### Cursor
1. Navigate to Cursor Settings > Features > Docs
2. Select “Add new doc” and paste the following URL:
```
https://docs.uniswap.org/v4-llms.txt
```
or

```
https://docs.uniswap.org/v4-llms-full.txt
```
3. Use @docs -> Uniswap to reference Uniswap docs in your chat.

#### Windsurf

Windsurf doesn't have a permanent settings menu for adding documentation context, so you need to reference it in each conversation where you want to use it.
1. You can directly add it to the Cascade window (CMD+L) using:
```
@docs:https://docs.uniswap.org/v4-llms.txt
```
or

```
@docs:https://docs.uniswap.org/v4-llms-full.txt
```

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
id: adversarial-circumstances
title: Adversarial Circumstances
sidebar_position: 4
---

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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
id: glossary
title: Glossary
sidebar_position: 5
---

- **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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
id: guide-to-voting
title: Beginners' Guide to Voting
sidebar_position: 3
---

This guide contains everything you need to start voting in Uniswap Governance.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
id: overview
title: Overview
sidebar_position: 1
---

## Code
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
id: process
title: Process
sidebar_position: 2
---

This is a living document which represents the current process guidelines for developing and advancing Uniswap Governance Proposals. It was last updated September 2024.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: PoolManager
sidebar_position: 6
---

In Uniswap v3, each liquidity pool was represented by a separate smart contract deployed through the Uniswapv3Factory contract. While this approach provided flexibility, it also led to increased gas costs for pool creation and multi-hop swaps.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Dynamic Fees
sidebar_position: 7
---

Uniswap v4 introduces dynamic fees, allowing for flexible and responsive fee structures managed through hooks. This feature enables pools to adapt fees to changing market conditions, potentially improving liquidity provider profitability and overall market efficiency.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: ERC-6909
sidebar_position: 3
---

Uniswap v4 uses [ERC-6909](https://eips.ethereum.org/EIPS/eip-6909) to further improve gas-efficiency on token claims and redemptions.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# v4 Fee Structure Guide
---
id: fee structure
title: v4 Fee Structure Guide
sidebar_position: 9
---

## Overview of Fee Types

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Flash Accounting
sidebar_position: 2
---

# Flash Accounting
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Hooks
sidebar_position: 4
---

Uniswap v4 introduces Hooks, a system that allows developers to customize and extend the behavior of liquidity pools.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Integrated Routing with UniswapX
sidebar_position: 8
---

The [Uniswap Interface](https://app.uniswap.org) will be ramping up support for hooks in its standard routing system progressively over time. Hook builders looking to get immediate access to flow from the interface can do so by running a UniswapX filler for their hooked pools.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Subscribers
sidebar_position: 5
---

Subscribers, new in Uniswap v4, allow for liquidity-position owners to opt-in to a contract that receives _notifications_.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: v4 vs v3
sidebar_position: 1
---

While Uniswap v4's underlying concentrated liquidity is the same as Uniswap v3,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: ERC-6909
sidebar_position: 5
---

# Introduction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Access msg.sender Inside a Hook
sidebar_position: 9
---

## Introduction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Custom Accounting
sidebar_position: 3
---

# Introduction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Flash Accounting
sidebar_position: 8
---

# Introduction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
title: Hook Deployment
sidebar_position: 2
---

## Hook Flags

As mentioned in [Concept of Hooks](../../concepts/04-hooks.mdx), hook contracts indicate their implemented functions by __encoding its behavior in the address of the contract__. The `PoolManager` uses these permissions to determine which hook functions to call for a given pool. See `PoolManager` deployment addresses [here](/contracts/v4/deployments).
As mentioned in [Concept of Hooks](../../concepts/hooks.mdx), hook contracts indicate their implemented functions by __encoding its behavior in the address of the contract__. The `PoolManager` uses these permissions to determine which hook functions to call for a given pool. See `PoolManager` deployment addresses [here](/contracts/v4/deployments).

Each hook function e.g. `beforeSwap` - corresponds to a certain _flag_. For example, the `beforeSwap` function is correlated to the [`BEFORE_SWAP_FLAG`](https://github.com/Uniswap/v4-core/blob/main/src/libraries/Hooks.sol#L37) which has a value of `1 << 7`.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Building Your First Hook
sidebar_position: 1
---

# Introduction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Position Manager
sidebar_position: 6
---

# Introduction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Reading Pool State
sidebar_position: 2
---

## Introduction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: StateView
sidebar_position: 7
---

# Introduction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Swap routing
sidebar_position: 4
---

# Introduction to Universal Router for Uniswap v4 Swaps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Unlock Callback & Deltas
sidebar_position: 1
---

### Refresher
Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions docs/contracts/v4/quickstart/04-hooks/_category_.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Create Pool
sidebar_position: 1
---

## Context
Expand Down
5 changes: 5 additions & 0 deletions docs/contracts/v4/quickstart/hooks/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Hooks",
"collapsed": true,
"position": 4
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: AsyncSwap Hooks
sidebar_position: 3
---

One feature enabled by [custom accounting](/contracts/v4/guides/custom-accounting) is​​​​‌ AsyncSwap swap. This feature allows hook developers to replace the v4 (v3-style) swap logic.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Liquidity Hooks
sidebar_position: 2
---

This guide will walk through on an example of adding and removing liquidity. There are four hook functions available to customize and extend these behavior:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Set Up Local Environment
sidebar_position: 0
---

Before writing the hook let's first have a local environment properly configured e.g. deploying pool manager, utility routers and test tokens.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Swap Hooks
sidebar_position: 1
---

Swaps are the most common interaction with the Uniswap protocol. When it comes to swap there are two hook functions available to customize and extend its behavior:
Expand Down
5 changes: 5 additions & 0 deletions docs/contracts/v4/quickstart/manage-liquidity/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Manage Liquidity",
"collapsed": true,
"position": 2
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Batch Modify
sidebar_position: 6
---

### Context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Burn Position
sidebar_position: 5
---

### Context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
title: Collect Fees
sidebar_position: 4
---

### Setup

See the [setup guide](./00-setup-liquidity.mdx)
See the [setup guide](./setup-liquidity.mdx)

# Guide

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Decrease Liquidity
sidebar_position: 3
---

### Context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Increase Liquidity
sidebar_position: 2
---

### Context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Mint Position
sidebar_position: 1
---

Similar to Uniswap v3, liquidity positions are minted as ERC-721 tokens and depend on a *periphery* contract.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Setup
sidebar_position: 0
---

# Setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Subscriber
sidebar_position: 5
---

# Context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Swap
sidebar_position: 3
---

# Swapping on Uniswap v4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
id: create-pool
title: Create Pool
sidebar_position: 2
---

## Introduction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
id: pool-data
title: Fetching Pool Data
sidebar_position: 1
---

## Introduction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
id: add-remove-liquidity
title: Adding and Removing Liquidity
sidebar_position: 4
---

## Introduction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
id: collect-fees
title: Collecting Fee
sidebar_position: 3
---

## Introduction
Expand Down
Loading