Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4 soft launch #777

Merged
merged 35 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c6b1f64
reorg
saucepoint Sep 7, 2024
5444ca3
formatting & notes
saucepoint Sep 7, 2024
0edb8af
organize manage liquidity
saucepoint Sep 7, 2024
2ad677f
Some early v4 deployments (#744)
saucepoint Sep 10, 2024
2d46785
v4 concepts: erc6909 (#745)
0xdevant Sep 12, 2024
b70ab81
v4 overview (#742)
saucepoint Sep 12, 2024
f0e5257
v4 concepts: flash accounting (#747)
0xdevant Sep 13, 2024
50f3d34
V4-vs-V3 (#749)
Alexhandru Sep 13, 2024
6626366
v4 guides: mint position (#743)
saucepoint Sep 13, 2024
90159df
Fee collection tutorial (#751)
Alexhandru Sep 15, 2024
3300bc7
documentation for batch modify (#764)
saucepoint Sep 17, 2024
39d7885
add BalanceDelta reference guide with mdx formatting (#763)
krisoshea-eth Sep 17, 2024
ac033b9
add BeforeSwapDelta reference guide with mdx formatting (#762)
krisoshea-eth Sep 17, 2024
03fc543
add Currency reference guide with mdx formatting (#761)
krisoshea-eth Sep 17, 2024
190dc0a
Add hooks concept doc with updated MDX formating (#752)
krisoshea-eth Sep 17, 2024
754d3e9
Add transient state library reference description with mdx formatting…
krisoshea-eth Sep 17, 2024
c27116d
Add NoOp hooks guide with mdx formatting (#756)
krisoshea-eth Sep 17, 2024
28091bd
Add PoolManager Concept doc with updated mdx formatting (#753)
krisoshea-eth Sep 17, 2024
4195b14
Add intro to dynamic fees concept doc with updated mdx formatting (#754)
krisoshea-eth Sep 17, 2024
f6654f4
Add volatility based dynamic fee hook guide with mdx formatting (#755)
krisoshea-eth Sep 17, 2024
8c267b5
add PoolKey reference guide with mdx formatting (#758)
krisoshea-eth Sep 17, 2024
6144405
add LiquidityAmounts Reference guide with mdx formatting (#759)
krisoshea-eth Sep 17, 2024
014b361
add IPoolManager reference guide with mdx formatting (#760)
krisoshea-eth Sep 17, 2024
dd04160
v4 guides: hook setup (#750)
0xdevant Sep 17, 2024
4522d97
Reorganize v4 Technical Reference (#765)
saucepoint Sep 17, 2024
1b18e0d
v4 guides: hook swap (#766)
0xdevant Sep 18, 2024
6b4aeed
Subscribers (#771)
saucepoint Sep 18, 2024
8e413bf
fixed wrong param types (#769)
Alexhandru Sep 20, 2024
a932006
complement to v4 concepts: erc6909 (#772)
0xdevant Sep 20, 2024
c08e77e
Increase liquidity (#774)
saucepoint Sep 20, 2024
9d66fe7
v4 guides: decrease liquidity (#775)
0xdevant Sep 20, 2024
506dde5
v4 guides: hook liquidity (#767)
0xdevant Sep 20, 2024
e10ca58
Burn position guide (#770)
Alexhandru Sep 20, 2024
43f8782
Unlock callback and deltas (#773)
Alexhandru Sep 20, 2024
4aed10f
Dev v4 cleanup (#776)
saucepoint Sep 20, 2024
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
7 changes: 7 additions & 0 deletions 02-overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Overview
---

# Overview

(TODO: explain core contracts, and how users should expect to use them)
2 changes: 1 addition & 1 deletion docs/contracts/v3/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "V3 Protocol",
"position": 2,
"collapsed": false
"collapsed": true
}
43 changes: 0 additions & 43 deletions docs/contracts/v4/concepts/01-intro-to-v4.mdx

This file was deleted.

63 changes: 63 additions & 0 deletions docs/contracts/v4/concepts/01-v4-vs-v3.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: V4 vs V3
---

While Uniswap v4's underlying concentrated liquidity is the same as Uniswap v3,
there are some key differences in the architecture and accounting.

# Singleton Design

### Pool Creation

**V4**: The singleton contract facilitates the creation of a pool and
also stores its state. This pattern reduces costs when creating a pool
and doing multi-hop swaps. Because pools are _contract state_ and not entirely new _contracts_ themselves, pool creation is significantly cheaper.

**V3**: A factory contract is responsible for pool creation. The pool is
a separate contract instance that manages its own state. Pool initialization
is costly because contract creation is gas-intensive

### Flash Accounting

**V4**: The singleton uses _flash accounting_, meaning a caller that unlocks the PoolManager
is allowed to cause balance-changing operations (multiple swaps, multiple liquidity modifications, etc)
and only needs to perform token transfers at the very end of the sequence.

**V3**: Because flash accounting is missing from V3, it is the responsibility
of the integrating contract to perform token transfers, after each individual call, to each individual pool contract

# Liquidity Fee Accounting

**V4**: Accrued fees act like a credit when modifying liquidity.
Increasing liquidity will convert the fee revenue to liquidity
inside the position while decreasing liquidity will automatically
require the withdrawal of unclaimed fee revenue.

An additional parameter _salt_ can be provided when creating liquidity. The
_salt_ is used to distinguish positions of the same range on the same pool.
This separation may be preferred to simplify fee accounting. If two users share the same
range and state in `PoolManager`, integrating contracts must be careful in managing
fees

**V3**: Liquidity positions of the same range and pool will share the same state. While believed to
be more gas efficient at the time, integrating contracts will need to handle fee management since
the state is shared on the core pool contract

# Native ETH

**V4**: Pool pairs support native tokens, in doing so ETH swappers and
liquidity providers benefit from gas cost reductions from cheaper
transfers and removal of additional wrapping costs.

**V3**: ETH needs to be wrapped first before being paired with other tokens.
This results in higher gas costs because of wrapping and transferring
a wrapped native token.

# Subscribers

Only V4: Owners can now set a subscriber for their positions.
A subscriber contract will get notified every time the position's liquidity
or owner changes. Subscribers enable staking / liquidity-mining, but users do not need
to transfer their ERC-721 token.

**V3**: Staking in v3 requires users to transfer their ERC-721 token to a contract, putting the underlying assets at risk for malicious behavior.
29 changes: 0 additions & 29 deletions docs/contracts/v4/concepts/02-1-overview.mdx

This file was deleted.

195 changes: 0 additions & 195 deletions docs/contracts/v4/concepts/02-2-pool-manager-and-initialization.mdx

This file was deleted.

Loading
Loading