From 5826a49e9e6bb2c6d2c37976d348972b6f9af48c Mon Sep 17 00:00:00 2001 From: Peaupoosh <45771097+Pduhard@users.noreply.github.com> Date: Wed, 9 Oct 2024 17:36:18 +0200 Subject: [PATCH 01/19] docs: typo in 04-price-oracle.md, requets => requests (#790) --- docs/sdk/v3/guides/advanced/04-price-oracle.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/v3/guides/advanced/04-price-oracle.md b/docs/sdk/v3/guides/advanced/04-price-oracle.md index 9b9bc9e7e..8033130f2 100644 --- a/docs/sdk/v3/guides/advanced/04-price-oracle.md +++ b/docs/sdk/v3/guides/advanced/04-price-oracle.md @@ -235,7 +235,7 @@ The full code to the following code snippets can be found in [`oracle.ts`](https ```typescript let requests = [] for (let i = 0; i < 10; i++) { - requets.push(poolContract.observations(i)) + requests.push(poolContract.observations(i)) } const results = await Promise.all(requests) From 36e12f486d5af49d63887e70569bf7f38e4dfeae Mon Sep 17 00:00:00 2001 From: Peaupoosh <45771097+Pduhard@users.noreply.github.com> Date: Wed, 9 Oct 2024 17:38:14 +0200 Subject: [PATCH 02/19] docs: links to price oracle example repository (#791) --- docs/sdk/v3/guides/advanced/04-price-oracle.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/sdk/v3/guides/advanced/04-price-oracle.md b/docs/sdk/v3/guides/advanced/04-price-oracle.md index 8033130f2..a7d5d2fba 100644 --- a/docs/sdk/v3/guides/advanced/04-price-oracle.md +++ b/docs/sdk/v3/guides/advanced/04-price-oracle.md @@ -6,8 +6,8 @@ title: Uniswap as a Price Oracle ## Introduction This guide will cover how to fetch price observations from a V3 pool to get onchain asset prices. -It is based on the [Price Oracle example](https://github.com/Uniswap/examples/tree/main/v3-sdk/price-oracle), found in the Uniswap code examples [repository](https://github.com/Uniswap/example). -To run this example, check out the guide's [README](https://github.com/Uniswap/examples/blob/main/v3-sdk/price-oracle/README.md) and follow the setup instructions. +It is based on the [Price Oracle example](https://github.com/Uniswap/examples/tree/main/v3-sdk/oracle), found in the Uniswap code examples [repository](https://github.com/Uniswap/example). +To run this example, check out the guide's [README](https://github.com/Uniswap/examples/blob/main/v3-sdk/oracle/README.md) and follow the setup instructions. :::info If you need a briefer on the SDK and to learn more about how these guides connect to the examples repository, please visit our [background](./01-background.md) page! @@ -30,7 +30,7 @@ For this guide, the following Uniswap packages are used: - [`@uniswap/v3-sdk`](https://www.npmjs.com/package/@uniswap/v3-sdk) -The core code of this guide can be found in [`oracle.ts`](https://github.com/Uniswap/examples/tree/main/v3-sdk/price-oracle/src/libs/oracle.ts) +The core code of this guide can be found in [`oracle.ts`](https://github.com/Uniswap/examples/tree/main/v3-sdk/oracle/src/libs/oracle.ts) ## Understanding Observations From 451a7d02b0a6805668eb8366f7b6841b291bbddf Mon Sep 17 00:00:00 2001 From: nullbitx8 <92404251+nullbitx8@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:49:14 -0400 Subject: [PATCH 03/19] Fix: typo (#785) --- docs/contracts/v4/concepts/04-hooks.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/contracts/v4/concepts/04-hooks.mdx b/docs/contracts/v4/concepts/04-hooks.mdx index d354fc272..23d392c3a 100644 --- a/docs/contracts/v4/concepts/04-hooks.mdx +++ b/docs/contracts/v4/concepts/04-hooks.mdx @@ -51,9 +51,9 @@ The liquidity modification hooks are extremely granular for security purposes. The introduction of hooks in Uniswap V4 opens up a world of possibilities for developers to innovate and build new DeFi protocols. Some potential use cases include: -- Customized AMMs with different pricing curves that xy = k. +- Customized AMMs with different pricing curves than xy = k. - Yield farming and liquidity mining protocols that incentivize liquidity provision. - Derivative and synthetic asset platforms built on top of Uniswap V4 liquidity. - Lending hooks integrated with Uniswap V4 pools. -As a hook developer you can easily bootstrap the codebase of an entirely new DeFi protocol through hook designs, which subsequently drives down your audit costs and allows you to develop faster. However, it's important to note that just because you made a hook, that does not mean you will get liquidity routed to your hook from the Uniswap frontend. \ No newline at end of file +As a hook developer you can easily bootstrap the codebase of an entirely new DeFi protocol through hook designs, which subsequently drives down your audit costs and allows you to develop faster. However, it's important to note that just because you made a hook, that does not mean you will get liquidity routed to your hook from the Uniswap frontend. From 4d5d063a15a8cb180ef609fbdc193ca403019f76 Mon Sep 17 00:00:00 2001 From: See Yi Jie <36152992+seeyijie@users.noreply.github.com> Date: Thu, 10 Oct 2024 00:12:24 +0800 Subject: [PATCH 04/19] Add custom error selector (#794) Co-authored-by: saucepoint <98790946+saucepoint@users.noreply.github.com> --- .../v4/reference/errors/_category_.json | 5 + docs/contracts/v4/reference/errors/errors.mdx | 93 +++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 docs/contracts/v4/reference/errors/_category_.json create mode 100644 docs/contracts/v4/reference/errors/errors.mdx diff --git a/docs/contracts/v4/reference/errors/_category_.json b/docs/contracts/v4/reference/errors/_category_.json new file mode 100644 index 000000000..7b00c0be1 --- /dev/null +++ b/docs/contracts/v4/reference/errors/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "Errors", + "position": 0, + "collapsed": false +} diff --git a/docs/contracts/v4/reference/errors/errors.mdx b/docs/contracts/v4/reference/errors/errors.mdx new file mode 100644 index 000000000..c044678f5 --- /dev/null +++ b/docs/contracts/v4/reference/errors/errors.mdx @@ -0,0 +1,93 @@ +--- +title: Custom Error Selectors +--- +# Custom Error Selectors +These are custom error selectors for Uniswap v4 contracts. + +## IPoolManager.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `IPoolManager.CurrencyNotSettled.selector` | `0x5212cba1` | +| `IPoolManager.PoolNotInitialized.selector` | `0x486aa307` | +| `IPoolManager.AlreadyUnlocked.selector` | `0x5090d6c6` | +| `IPoolManager.ManagerLocked.selector` | `0x54e3ca0d` | +| `IPoolManager.TickSpacingTooLarge.selector` | `0xb02b5dc2` | +| `IPoolManager.TickSpacingTooSmall.selector` | `0x16fe7696` | +| `IPoolManager.CurrenciesOutOfOrderOrEqual.selector` | `0xeaa6c6eb` | +| `IPoolManager.UnauthorizedDynamicLPFeeUpdate.selector` | `0x30d21641` | +| `IPoolManager.SwapAmountCannotBeZero.selector` | `0xbe8b8507` | +| `IPoolManager.NonZeroNativeValue.selector` | `0x19d245cf` | + +## Hooks.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `Hooks.HookAddressNotValid.selector` | `0xe65af6a0` | +| `Hooks.InvalidHookResponse.selector` | `0x1e048e1d` | +| `Hooks.FailedHookCall.selector` | `0x36bc48c5` | +| `Hooks.HookDeltaExceedsSwapAmount.selector` | `0xfa0b71d6` | + +## Pool.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `Pool.TicksMisordered.selector` | `0xc4433ed5` | +| `Pool.TickLowerOutOfBounds.selector` | `0xd5e2f7ab` | +| `Pool.TickUpperOutOfBounds.selector` | `0x1ad777f8` | +| `Pool.TickLiquidityOverflow.selector` | `0xb8e3c385` | +| `Pool.TickNotInitialized.selector` | `0x82a774d3` | +| `Pool.PoolAlreadyInitialized.selector` | `0x7983c051` | +| `Pool.PoolNotInitialized.selector` | `0x486aa307` | +| `Pool.PriceLimitAlreadyExceeded.selector` | `0x7c9c6e8f` | +| `Pool.PriceLimitOutOfBounds.selector` | `0x9e4d7cc7` | +| `Pool.NoLiquidityToReceiveFees.selector` | `0xa74f97ab` | +| `Pool.InvalidFeeForExactOut.selector` | `0x96206246` | + +## IProtocolFees.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `IProtocolFees.ProtocolFeeCannotBeFetched.selector` | `0x1ee49702` | +| `IProtocolFees.InvalidProtocolFee.selector` | `0xba97f838` | +| `IProtocolFees.InvalidCaller.selector` | `0x48f5c3ed` | + +## LPFeeLibrary.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `LPFeeLibrary.FeeTooLarge.selector` | `0xfc5bee12` | + +## Position.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|----------------| +| `Position.CannotUpdateEmptyPosition.selector` | `0xaefeb924` | + +## Reserves.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|----------------| +| `Reserves.ReservesMustBeSynced.selector` | `0x8774be48` | + +## SqrtPriceMath.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `SqrtPriceMath.InvalidPriceOrLiquidity.selector` | `0x4f2461b8` | +| `SqrtPriceMath.InvalidPrice.selector` | `0x00bfc921` | +| `SqrtPriceMath.NotEnoughLiquidity.selector` | `0x4323a555` | +| `SqrtPriceMath.PriceOverflow.selector` | `0xf5c787f1` | + +## TickBitmap.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `TickBitmap.TickMisaligned.selector` | `0xd4d8f3e6` | + +## TickMath.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `TickMath.InvalidTick.selector` | `0xce8ef7fc` | +| `TickMath.InvalidSqrtPrice.selector` | `0x31efafe8` | \ No newline at end of file From 6b00744ea7edc6500ce1f8b750b1f72248bec4ca Mon Sep 17 00:00:00 2001 From: vendrell46 Date: Thu, 10 Oct 2024 16:06:57 +0100 Subject: [PATCH 05/19] Adding Reading Pool State guide to docs (#793) --- .../v4/guides/07-read-pool-state.mdx | 260 +++++++++++++++++- 1 file changed, 257 insertions(+), 3 deletions(-) diff --git a/docs/contracts/v4/guides/07-read-pool-state.mdx b/docs/contracts/v4/guides/07-read-pool-state.mdx index 9c29a4cd1..bdb08fc3f 100644 --- a/docs/contracts/v4/guides/07-read-pool-state.mdx +++ b/docs/contracts/v4/guides/07-read-pool-state.mdx @@ -2,8 +2,262 @@ title: Reading Pool State --- -## 🚧 Under construction 🚧 +## Introduction -Please see [StateLibrary](https://github.com/Uniswap/v4-core/blob/main/src/libraries/StateLibrary.sol) +Unlike previous versions, v4 uses a different approach for storing and accessing pool data, which requires understanding the use of [`StateLibrary`](/contracts/v4/reference/core/libraries/StateLibrary) and [`extsload`](/contracts/v4/reference/core/Extsload). -and how it's used in [tests](https://github.com/Uniswap/v4-core/blob/main/test/PoolManagerInitialize.t.sol#L91) \ No newline at end of file +## Understanding the PoolManager Architecture + +### The Singleton Design + +In Uniswap v4, all pools are managed by a single `PoolManager` contract, unlike v3 where each pool was a separate contract. This design offers simplified management since all pools are now accessible through a single contract. + +This approach significantly reduces deployment costs, simplifies protocol upgrades, and enables more efficient cross-pool interactions. It also allows for easier implementation of new features across all pools simultaneously. + +### Pools as Library Calls + +In v4, pools are stored as complex structs, with Solidity libraries handling state changes. The `PoolManager` contract uses these libraries to perform operations on the pool state: + +```solidity +contract PoolManager { + using Pool for Pool.State; + mapping(PoolId => Pool.State) internal pools; + + function swap(PoolId id, ...) external { + pools[id].swap(...); // Library call + } +} +``` + +This design allows all AMM logic to be encapsulated within the `PoolManager` contract. + +## Reading Pool State in v4 + +In Uniswap v4, reading pool state involves a few key concepts and mechanisms that differ from previous versions. At the core of this new structure is a complex mapping within the PoolManager contract: + +```solidity +mapping(PoolId id => Pool.State) internal _pools; +``` + +This mapping represents a fundamental shift in pool data storage: + +1. Each pool is identified by a unique `PoolId`. +2. The `Pool.State` is a struct that contains all the state variables for a single pool. +3. This struct itself contains several nested mappings and complex data structures. + +For example, the `Pool.State` struct might look something like this (simplified for illustration): + +```solidity +struct State { + uint160 sqrtPriceX96; + int24 tick; + uint128 liquidity; + uint256 feeGrowthGlobal0X128; + uint256 feeGrowthGlobal1X128; + mapping(int24 => TickInfo) ticks; + mapping(bytes32 => Position.Info) positions; + // ... other fields +} +``` + +This complex structure allows for efficient storage of multiple pools and their associated data within a single contract. However, it also means that traditional getter functions would be inefficient or impractical for accessing this data, especially for nested mappings like `ticks` and `positions`. + +To address this, Uniswap V4 introduces the StateLibrary and the concept of using `extsload` for reading pool state. These mechanisms provide efficient ways to access the data stored in this complex structure. + +### The StateLibrary and `extsload` + +```solidity +abstract contract Extsload is IExtsload { + /// @inheritdoc IExtsload + function extsload(bytes32 slot) external view returns (bytes32) { + assembly ("memory-safe") { + mstore(0, sload(slot)) + return(0, 0x20) + } + } + + // [...] +} +``` + +The `StateLibrary` is a crucial component in Uniswap v4 for reading pool state. It utilizes the `extsload` function, which is an external wrapper for the `SLOAD` opcode. This allows for efficient reading of arbitrary storage slots. + +**How `extsload` works:** + +- It takes a storage slot as input. +- It reads the value stored in that slot directly, using `SLOAD`, from the contract's storage. +- It returns the value as a `bytes32`. + +This method is more gas-efficient than traditional getter functions, especially when reading multiple storage slots. + +Moreover, using `extsload` instead of hand-written Solidity view functions lowers the contract bytecode size. This optimization is particularly important for Uniswap v4, as the core contracts are nearly at Ethereum's contract size limit. + +### TransientStateLibrary and `exttload` + +```solidity +abstract contract Extsload is IExtsload { + /// @inheritdoc IExtsload + function extsload(bytes32 slot) external view returns (bytes32) { + assembly ("memory-safe") { + mstore(0, sload(slot)) + return(0, 0x20) + } + } + + // [...] +} +``` + +While `StateLibrary` deals with persistent storage, [`TransientStateLibrary`](/contracts/v4/reference/core/libraries/transient-state-library) is used for handling transient storage. Transient storage, introduced in EIP-1153, is a way to store data that is only needed for the duration of a transaction, making it ideal for temporary data. + +It uses the [`exttload`](/contracts/v4/reference/core/Exttload) function, which is similar to `extsload`, but for transient storage; it is an external wrapper for the `TLOAD` opcode. + +## Implementing a `PoolStateReader` Contract + +Let's create a `PoolStateReader` contract that showcases different methods for reading pool state. For each function, we'll explain its purpose, how it works, and provide an example use case. + +```solidity +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol"; +import {PoolKey} from "v4-core/types/PoolKey.sol"; +import {PoolId, PoolIdLibrary} from "v4-core/types/PoolId.sol"; + +contract PoolStateReader { + using PoolIdLibrary for PoolKey; + + IPoolManager public immutable poolManager; + + constructor(IPoolManager _poolManager) { + poolManager = _poolManager; + } + + // Functions will be implemented here +} +``` + +Before we start, we need to import `StateLibrary` from the libraries available in v4-core. + +```solidity +import {StateLibrary} from "v4-core/libraries/StateLibrary.sol"; +``` + +Let's focus on this important line that we should add: + +```solidity +using StateLibrary for IPoolManager; +``` + +This line is crucial for our PoolStateReader contract because it allows us to call StateLibrary functions as if they were methods of the IPoolManager interface, like for instance now we will be able to do `poolManager.getSlot0()`. + +Now we’re up for breaking down each wrapper function that we're going to be adding to our helper contract, explain the purpose of the pool manager function to read the state, and provide use cases to make sure we understand its utility: + +### `getSlot0()` + +```solidity +function getPoolState(PoolKey calldata key) external view returns ( + uint160 sqrtPriceX96, + int24 tick, + uint24 protocolFee, + uint24 lpFee +) { + return poolManager.getSlot0(key.toId()); +} +``` + +**Explanation:** + +This function retrieves the current state of the pool, including its price, tick, and fee settings. It uses the `getSlot0()` function from `StateLibrary`, which efficiently reads these values from a single storage slot. + +- `sqrtPriceX96`: The current price, encoded as a square root and scaled by 2^96. This encoding allows for efficient price calculations in the Uniswap algorithm. +- `tick`: The current tick, representing the quantized price. Ticks are used to efficiently track and update liquidity positions. +- `protocolFee`: The current protocol fee, represented in hundredths of a bip (i.e., units of 0.0001%). +- `lpFee`: The current liquidity provider fee, also represented in hundredths of a bip. + +**Use Case:** + +This function is essential for any application that needs to know the current state of a Uniswap v4 pool. For example: + +- A price oracle could use this to get the current price of the pool. +- A trading bot could use this to determine if a trade is profitable given the current price and fees. +- A liquidity management system could use the `tick` to decide where to place new liquidity. + +### `getLiquidity()` + +```solidity +function getPoolLiquidity(PoolKey calldata key) external view returns (uint128 liquidity) { + return poolManager.getLiquidity(key.toId()); +} +``` + +**Explanation:** + +This function retrieves the current total liquidity in the pool. Liquidity in Uniswap v4 represents the amount of assets available for trading within the current price range. + +**Use Case:** + +Understanding the total liquidity is crucial for several scenarios: + +- Assessing the depth of the market and potential slippage for large trades. +- Monitoring the depth and growth of a pool over time. + +### `getPositionInfo` + +```solidity +function getPositionInfo( + PoolKey calldata key, + address owner, + int24 tickLower, + int24 tickUpper, + bytes32 salt +) external view returns ( + uint128 liquidity, + uint256 feeGrowthInside0LastX128, + uint256 feeGrowthInside1LastX128 +) { + return poolManager.getPositionInfo(key.toId(), owner, tickLower, tickUpper, bytes32(salt)); +} +``` + +**Explanation:** + +This function retrieves information about a specific liquidity position. It returns: + +- `liquidity`: The amount of liquidity in the position. +- `feeGrowthInside0LastX128` and `feeGrowthInside1LastX128`: The last recorded cumulative fees earned per unit of liquidity for each token. + +**Use Case:** + +This function is crucial for applications that need to manage or analyze individual liquidity positions: + +- A liquidity management dashboard could use this to display a user's current positions and earned fees. +- An automated liquidity provision system could use this to decide when to rebalance or compound rewards. +- An analytics tool could use this to calculate the performance of different liquidity provision strategies. + +### `getFeeGrowthGlobal` + +```solidity +function getFeeGrowthGlobal(PoolKey calldata key) external view returns ( + uint256 feeGrowthGlobal0X128, + uint256 feeGrowthGlobal1X128 +) { + return poolManager.getFeeGrowthGlobal(key.toId()); +} +``` + +**Explanation:** + +This function retrieves the global fee growth for both tokens in the pool. These values represent the cumulative fees per unit of liquidity since the pool's inception. + +**Use Case:** + +Global fee growth is essential for several advanced operations: + +- Calculating the fees earned by a position that has been held for a long time. +- Analyzing the overall fee generation of a pool over its lifetime. +- Comparing the performance of different pools or fee tiers. + +--- + +For additional reference, see [`StateLibrary`](/contracts/v4/reference/core/libraries/StateLibrary) and [`Extsload`](/contracts/v4/reference/core/Extsload) \ No newline at end of file From fad26304772cde06474e829a089b33fc6a0abe67 Mon Sep 17 00:00:00 2001 From: saucepoint <98790946+saucepoint@users.noreply.github.com> Date: Fri, 11 Oct 2024 11:32:01 -0400 Subject: [PATCH 06/19] V4 create pool (#788) --- .../v4/quickstart/01-create-pool.mdx | 173 +++++++++++++++++- .../00-setup-liquidity.mdx | 28 ++- 2 files changed, 196 insertions(+), 5 deletions(-) diff --git a/docs/contracts/v4/quickstart/01-create-pool.mdx b/docs/contracts/v4/quickstart/01-create-pool.mdx index 4ce142c22..82eb5a1e6 100644 --- a/docs/contracts/v4/quickstart/01-create-pool.mdx +++ b/docs/contracts/v4/quickstart/01-create-pool.mdx @@ -2,6 +2,175 @@ title: Create Pool --- -## 🚧 Under construction 🚧 +## Context -Please see https://www.v4-by-example.org/initialize +Creating a pool on Uniswap v4 is permissionless and enables the trading of an asset. Uniswap v4 is a popular destination for creating markets due to its: + +* Proven track record and battle-tested codebase +* Concentrated liquidity, unlocking capital efficiency +* Flexibile pool design through dynamic fees and hooks +* Gas-efficient architecture +* Integrations with alternative trading venues + +For more information, developers should see [Uniswap v4 Overview](/contracts/v4/overview) + +The guide covers two approaches to creating a pool: +1. Create a pool only +2. Create a pool and add initial liquidity, with one transaction + +### Setup + +Developing with Uniswap v4 _requires [foundry](https://book.getfoundry.sh)_ + +Install the dependencies: +```bash +forge install uniswap/v4-core +forge install uniswap/v4-periphery +``` + +## Guide: Create a Pool Only + +To initialize a Uniswap v4 Pool _without initial liquidity_, developers should call [`PoolManager.initialize()`](/contracts/v4/reference/core/interfaces/IPoolManager#initialize) + +Creating a pool without liquidity may be useful for "reserving" a pool for future use, when initial liquidity is not available, or when external market makers would provide the starting liquidity + +### 1. Configure the Pool + +```solidity +import {PoolKey} from "v4-core/src/types/PoolKey.sol"; + +PoolKey memory pool = PoolKey({ + currency0: currency0, + currency1: currency1, + fee: lpFee, + tickSpacing: tickSpacing, + hooks: hookContract +}); +``` +> For native token pairs (Ether), use `CurrencyLibrary.ADDRESS_ZERO` as `currency0` + +[PoolKey](/contracts/v4/reference/core/types/PoolKey) uniquely identifies a pool + +* _Currencies_ should be sorted, `uint160(currency0) < uint160(currency1)` +* _lpFee_ is the fee expressed in pips, i.e. 3000 = 0.30% +* _tickSpacing_ is the granularity of the pool. Lower values are more precise but may be more expensive to trade on +* _hookContract_ is the address of the hook contract + +A note on `tickSpacing`: + +Lower tick spacing provides improved price precision; however, smaller tick spaces will cause swaps to cross ticks more often, incurring higher gas costs + +As a reference, Uniswap v3 pools are configured with: + +| Fee | Fee Value | Tick Spacing | +|-------|-----------|--------------| +| 0.01% | 100 | 1 | +| 0.05% | 500 | 10 | +| 0.30% | 3000 | 60 | +| 1.00% | 10_000 | 200 | + +### 2. Call `initialize` +Pools are initialized with a starting price +```solidity +IPoolManager(manager).initialize(pool, startingPrice); +``` +* the _startingPrice_ is expressed as sqrtPriceX96: `floor(sqrt(token1 / token0) * 2^96)` + - i.e. `79228162514264337593543950336` is the starting price for a 1:1 pool + +## Guide: Create a Pool & Add Liquidity +Uniswap v4's `PositionManager` supports atomic creation of a pool and initial liquidity using [_multicall_](/contracts/v4/reference/periphery/base/Multicall_v4). Developers can create a trading pool, with liquidity, in a single transaction: + +### 1. Initialize the parameters provided to `multicall()` +```solidity +bytes[] memory params = new bytes[](2); +``` +* The first call, `params[0]`, will encode `initializePool` parameters +* The second call, `params[1]`, will encode a _mint_ operation for `modifyLiquidities` + +### 2. Configure the pool +```solidity +PoolKey memory pool = PoolKey({ + currency0: currency0, + currency1: currency1, + fee: lpFee, + tickSpacing: tickSpacing, + hooks: hookContract +}); +``` +> For native token pairs (Ether), use `CurrencyLibrary.ADDRESS_ZERO` as `currency0` + +[PoolKey](/contracts/v4/reference/core/types/PoolKey) uniquely identifies a pool +* _Currencies_ should be sorted, `uint160(currency0) < uint160(currency1)` +* _lpFee_ is the fee expressed in pips, i.e. 3000 = 0.30% +* _tickSpacing_ is the granularity of the pool. Lower values are more precise but more expensive to trade +* _hookContract_ is the address of the hook contract + +### 3. Encode the [`initializePool`](/contracts/v4/reference/periphery/base/PoolInitializer) parameters +Pools are initialized with a starting price +```solidity +params[0] = abi.encodeWithSelector( + PositionManager.initializePool.selector, + pool, + startingPrice +); +``` +* the _startingPrice_ is expressed as _sqrtPriceX96_: `floor(sqrt(token1 / token0) * 2^96)` + - `79228162514264337593543950336` is the starting price for a 1:1 pool + +### 4. Initialize the _mint-liquidity_ parameters +PositionManager's `modifyLiquidities` uses an encoded command system +```solidity +bytes memory actions = abi.encodePacked(uint8(Actions.MINT_POSITION), uint8(Actions.SETTLE_PAIR)); +``` +* The first command `MINT_POSITION` creates a new liquidity position +* The second command `SETTLE_PAIR` indicates that tokens are to be paid by the caller, to create the position + +### 5. Encode the `MINT_POSITION` parameters +```solidity +bytes[] memory mintParams = new bytes[](2); +mintParams[0] = abi.encode(pool, tickLower, tickUpper, liquidity, amount0Max, amount1Max, recipient, hookData); +``` +* _pool_ the same `PoolKey` defined above, in pool-creation +* _tickLower_ and _tickUpper_ are the range of the position, must be a multiple of `pool.tickSpacing` +* _liquidity_ is the amount of liquidity units to add, see `LiquidityAmounts` for converting token amounts to liquidity units +* _amount0Max_ and _amount1Max_ are the maximum amounts of token0 and token1 the caller is willing to transfer +* _recipient_ is the address that will receive the liquidity position (ERC-721) +* _hookData_ is the optional hook data + +### 6. Encode the `SETTLE_PAIR` parameters + Creating a position on a pool requires the caller to transfer `currency0` and `currency1` tokens +```solidity +mintParams[1] = abi.encode(pool.currency0, pool.currency1); +``` + +### 7. Encode the [`modifyLiquidites`](/contracts/v4/reference/periphery/PositionManager#modifyliquidities) call +```solidity +uint256 deadline = block.timestamp + 60; +params[1] = abi.encodeWithSelector( + posm.modifyLiquidities.selector, abi.encode(actions, mintParams), deadline +); +``` + +### 8. Approve the tokens +`PositionManager` uses `Permit2` for token transfers +* Repeat for both tokens +```solidity +// approve permit2 as a spender +IERC20(token).approve(address(permit2), type(uint256).max); + +// approve `PositionManager` as a spender +IAllowanceTransfer(address(permit2)).approve(token, address(positionManager), type(uint160).max, type(uint48).max); +``` + +### 9. Execute the multicall +The `multicall` is used to execute multiple calls in a single transaction +```solidity +PositionManager(posm).multicall(params); +``` +For pools paired with native tokens (Ether), provide `value` in the contract call +```solidity +PositionManager(posm).multicall{value: ethToSend}(params); +``` +> Excess Ether is **NOT** refunded unless developers encoded `SWEEP` in the `actions` parameter + +For a full end-to-end script, developers should see [v4-template's scripts](https://github.com/uniswapfoundation/v4-template/tree/main/script) diff --git a/docs/contracts/v4/quickstart/02-manage-liquidity/00-setup-liquidity.mdx b/docs/contracts/v4/quickstart/02-manage-liquidity/00-setup-liquidity.mdx index 8ef5b891b..96b8de76b 100644 --- a/docs/contracts/v4/quickstart/02-manage-liquidity/00-setup-liquidity.mdx +++ b/docs/contracts/v4/quickstart/02-manage-liquidity/00-setup-liquidity.mdx @@ -24,6 +24,28 @@ forge install --- -## Manual - -(TODO: Add instructions for manual setup) \ No newline at end of file +## Manual Setup + +After cloning the repository, and installing foundry, developers can manually set up their Uniswap v4 environment: + +1. Initialize a foundry project + ```bash + forge init . --force + ``` + +2. Install dependencies + ```bash + forge install uniswap/v4-core + forge install uniswap/v4-periphery + ``` + +3. Set the `remappings.txt` to: + ``` + @uniswap/v4-core/=lib/v4-core/ + forge-gas-snapshot/=lib/v4-core/lib/forge-gas-snapshot/src/ + forge-std/=lib/v4-core/lib/forge-std/src/ + permit2/=lib/v4-periphery/lib/permit2/ + solmate/=lib/v4-core/lib/solmate/ + v4-core/=lib/v4-core/ + v4-periphery/=lib/v4-periphery/ + ``` From 7d8e2c5bf653edc56949f2c336253ef4a6532cb6 Mon Sep 17 00:00:00 2001 From: saucepoint <98790946+saucepoint@users.noreply.github.com> Date: Fri, 11 Oct 2024 12:28:55 -0400 Subject: [PATCH 07/19] note on v4 and uniswap x (#795) Co-authored-by: Alex Karys Co-authored-by: Alice <34962750+hensha256@users.noreply.github.com> --- .../v4/concepts/08-integrated-routing-uniswap-x.mdx | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/contracts/v4/concepts/08-integrated-routing-uniswap-x.mdx diff --git a/docs/contracts/v4/concepts/08-integrated-routing-uniswap-x.mdx b/docs/contracts/v4/concepts/08-integrated-routing-uniswap-x.mdx new file mode 100644 index 000000000..4bad9e4f5 --- /dev/null +++ b/docs/contracts/v4/concepts/08-integrated-routing-uniswap-x.mdx @@ -0,0 +1,13 @@ +--- +title: Integrated Routing with UniswapX +--- + +The [Uniswap Interface](https://app.uniswap.org) will be ramping up support for hooks in it's 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. + +At a high level, hook builders' filler implementations will need to do the following: + +1. (On Mainnet) Subscribe to the UniswapX RFQ system and submit fillable bids from orders they receive +2. Listen to the public feed for orders they won or that are open to be filled publicly +3. Execute those orders against pools that use their hooks + +Developers should check [UniswapX Documentation](/contracts/uniswapx/overview) to get started. From 0251da5b777c452b08c2f18abad442d0b7f1e9aa Mon Sep 17 00:00:00 2001 From: Alex Karys Date: Tue, 15 Oct 2024 13:19:41 -0700 Subject: [PATCH 08/19] Update 01-overview.md (#799) --- docs/contracts/uniswapx/01-overview.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/contracts/uniswapx/01-overview.md b/docs/contracts/uniswapx/01-overview.md index 396b1edbf..2374a4f20 100644 --- a/docs/contracts/uniswapx/01-overview.md +++ b/docs/contracts/uniswapx/01-overview.md @@ -30,14 +30,14 @@ UniswapX introduces a new participant in the Uniswap ecosystem, the _Filler_. Th Anyone can fill orders on UniswapX, get started by reading our [Filler Integration Guide](/contracts/uniswapx/guides/createfiller). -## Parametizing UniswapX Orders -The UniswapX protocol does not explicitly parameterize the pricing of orders like the Exclusive Dutch Order, rather order parameterization is left to be configured by the order constructor. +## Parametizing UniswapX Orders on Mainnet +The UniswapX protocol on Mainnet does not explicitly parameterize the pricing of orders like the Exclusive Dutch Order, rather order parameterization is left to be configured by the order constructor. -In the current Uniswap Labs interface implementation of UniswapX, some fillers may choose to help parameterize orders by participating as quoters. These fillers can *only* win a quote if they guarantee improved swapper execution over Uniswap v3 or v2 liquidity pools. Fillers who win a quote will receive execution priority for a limited period of time to fill orders they submitted wining quotes for. +In the current Uniswap Labs interface implementation of UniswapX, some fillers may choose to help parameterize orders on Mainnet by participating as quoters. These fillers can *only* win a quote if they guarantee improved swapper execution over Uniswap v3 or v2 liquidity pools. Fillers who win a quote will receive execution priority for a limited period of time to fill orders they submitted wining quotes for. -To ensure a smooth swapping experience for traders during the beta period, the set of Quoters will be vetted by Uniswap Labs following UniswapX’s launch, with plans to make the quoting system fully permissionless in the near future. +To ensure a smooth swapping experience for traders, the set of Quoters will be vetted by Uniswap Labs following UniswapX’s launch, with plans to make the quoting system fully permissionless in the near future. -If you are interested in participating as a Quoter during the beta period, please reach out [here](mailto:quoters@uniswap.org). +If you are interested in participating as a Quoter, please reach out [here](mailto:quoters@uniswap.org). # UniswapX Protocol Architecture From 4a2f92b18e1565b173ed9dee5c16fbe2c8b8918d Mon Sep 17 00:00:00 2001 From: Rachel-Eichenberger <60412342+Rachel-Eichenberger@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:38:33 -0700 Subject: [PATCH 09/19] Update for v2 sepolia (#801) --- .../v2/reference/smart-contracts/08-deployment-addresses.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/contracts/v2/reference/smart-contracts/08-deployment-addresses.md b/docs/contracts/v2/reference/smart-contracts/08-deployment-addresses.md index ea5e7488e..27cc52365 100644 --- a/docs/contracts/v2/reference/smart-contracts/08-deployment-addresses.md +++ b/docs/contracts/v2/reference/smart-contracts/08-deployment-addresses.md @@ -10,6 +10,7 @@ Contract addresses for the [`Uniswap V2 Factory`](https://github.com/Uniswap/v2- | Network | Factory Contract Address | V2Router02 Contract Address | | ---------------------------------------------------- | -------------------------------------------- | -------------------------------------------- | | Mainnet | `0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f` | `0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D` | +| Sepolia | `0xB7f907f7A9eBC822a80BD25E224be42Ce0A698A0` | `0x53544492C78D478294B5b1Fb8059a5D6C9aBBC67` | | Arbitrum | `0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9` | `0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24` | | Avalanche | `0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C` | `0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24` | | BNB Chain | `0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6` | `0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24` | From 72f128fadd3a54e871a9a6035c95b22f0a6b51d9 Mon Sep 17 00:00:00 2001 From: Rachel-Eichenberger <60412342+Rachel-Eichenberger@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:59:40 -0700 Subject: [PATCH 10/19] Add Worldchain deployments (#802) --- .../08-deployment-addresses.md | 1 + .../deployments/WorldChain-Deployments.md | 54 +++++++++++++++++++ .../v3/reference/deployments/deployments.md | 1 + 3 files changed, 56 insertions(+) create mode 100644 docs/contracts/v3/reference/deployments/WorldChain-Deployments.md diff --git a/docs/contracts/v2/reference/smart-contracts/08-deployment-addresses.md b/docs/contracts/v2/reference/smart-contracts/08-deployment-addresses.md index 27cc52365..35fc75ea9 100644 --- a/docs/contracts/v2/reference/smart-contracts/08-deployment-addresses.md +++ b/docs/contracts/v2/reference/smart-contracts/08-deployment-addresses.md @@ -19,3 +19,4 @@ Contract addresses for the [`Uniswap V2 Factory`](https://github.com/Uniswap/v2- | Polygon | `0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C` | `0xedf6066a2b290C185783862C7F4776A2C8077AD1` | | Blast | `0x5C346464d33F90bABaf70dB6388507CC889C1070` | `0xBB66Eb1c5e875933D44DAe661dbD80e5D9B03035` | | Zora | `0x0F797dC7efaEA995bB916f268D919d0a1950eE3C` | `0xa00F34A632630EFd15223B1968358bA4845bEEC7` | +| WorldChain | `0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f` | `0x541aB7c31A119441eF3575F6973277DE0eF460bd` | diff --git a/docs/contracts/v3/reference/deployments/WorldChain-Deployments.md b/docs/contracts/v3/reference/deployments/WorldChain-Deployments.md new file mode 100644 index 000000000..45c7b7d92 --- /dev/null +++ b/docs/contracts/v3/reference/deployments/WorldChain-Deployments.md @@ -0,0 +1,54 @@ +--- +id: WorldChain-deployments +title: WorldChain Deployment Addresses +--- + +# Uniswap Contract Deployments + +The latest version of `@uniswap/v3-core`, `@uniswap/v3-periphery`, and `@uniswap/swap-router-contracts` are deployed at the addresses listed below. Integrators should **no longer assume that they are deployed to the same addresses across chains** and be extremely careful to confirm mappings below. + +| Contract | WorldChain | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------- | +| [UniswapV3Factory](https://github.com/Uniswap/uniswap-v3-core/blob/v1.0.0/contracts/UniswapV3Factory.sol) | `0x7a5028BDa40e7B173C278C5342087826455ea25a` | +| [Multicall2](https://worldchain-mainnet.explorer.alchemy.com/address/0x0a22c04215c97E3F532F4eF30e0aD9458792dAB9) | `0x0a22c04215c97E3F532F4eF30e0aD9458792dAB9` | +| [ProxyAdmin](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.1-solc-0.7-2/contracts/proxy/ProxyAdmin.sol) | `0x8B52DaCB7B5d9A959CDcD5419061c0eDD1296c29` | +| [TickLens](https://github.com/Uniswap/uniswap-v3-periphery/blob/v1.0.0/contracts/lens/TickLens.sol) | `0xE61df0CaC9d85876aCE5E3037005D80943570623` | +| [NFTDescriptor](https://github.com/Uniswap/uniswap-v3-periphery/blob/v1.0.0/contracts/libraries/NFTDescriptor.sol) | `0x38c68A1D60C47973EcE5bc1725B65D8Bec438192` | +| [NonfungibleTokenPositionDescriptor](https://github.com/Uniswap/uniswap-v3-periphery/blob/v1.0.0/contracts/NonfungibleTokenPositionDescriptor.sol) | `0x70410a302c4a5c52C659b780941c947Abd437FeB` | +| [TransparentUpgradeableProxy](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.1-solc-0.7-2/contracts/proxy/TransparentUpgradeableProxy.sol) | `0xe6FcB4952b2d3Fab6DA4BC165831f5575e093feC` | +| [NonfungiblePositionManager](https://github.com/Uniswap/uniswap-v3-periphery/blob/v1.0.0/contracts/NonfungiblePositionManager.sol) | `0xec12a9F9a09f50550686363766Cc153D03c27b5e` | +| [V3Migrator](https://github.com/Uniswap/uniswap-v3-periphery/blob/v1.0.0/contracts/V3Migrator.sol) | `0x9EBDdCBa71C9027E1eB45135672a30bcFEec9de3` | +| [QuoterV2](https://github.com/Uniswap/v3-periphery/blob/main/contracts/lens/QuoterV2.sol) | `0x10158D43e6cc414deE1Bd1eB0EfC6a5cBCfF244c` | +| [SwapRouter02](https://github.com/Uniswap/swap-router-contracts/blob/main/contracts/SwapRouter02.sol) | `0x091AD9e2e6e5eD44c1c66dB50e49A601F9f36cF6` | +| [Permit2](https://github.com/Uniswap/permit2) | `0x000000000022D473030F116dDEE9F6B43aC78BA3` | +| [UniversalRouter](https://github.com/Uniswap/universal-router) | `0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D` | + + +These addresses are final and were deployed from these npm package versions: + +- [`@uniswap/v3-core@1.0.0`](https://github.com/Uniswap/uniswap-v3-core/tree/v1.0.0) +- [`@uniswap/v3-periphery@1.0.0`](https://github.com/Uniswap/uniswap-v3-periphery/tree/v1.0.0) +- [`@uniswap/swap-router-contracts@1.1.0`](https://github.com/Uniswap/swap-router-contracts/tree/v1.1.0) + + +# Universal Router + +The `UniversalRouter` contract is the current preferred entrypoint for ERC20 and NFT swaps, replacing, among other contracts, `SwapRouter02`. An up-to-date list of [deploy addresses by chain is hosted on Github](https://github.com/Uniswap/sdks/blob/main/sdks/universal-router-sdk/src/utils/constants.ts). + +# Uniswap Pool Deployments + +Every Uniswap pool is a unique instance of the `UniswapV3Pool` contract and is deployed at its own unique address. The contract source code of the pool will be auto-verified on etherscan. For example, here is the [ETH/USDC 0.3% pool](https://etherscan.io/address/0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8) on Ethereum mainnet. + +You can look up the address of an existing pool on [Uniswap Info](https://info.uniswap.org/#/) or by calling the [`getPool`](../reference/core/interfaces/IUniswapV3Factory.md#getpool) function on the `UniswapV3Factory` contract. + +```solidity +getPool("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", 3000) +``` + +# Wrapped Native Token Addresses + +The Uniswap Protocol supports trading of ERC20 tokens. In order to swap a native asset like ETH (or MATIC on Polygon), the Uniswap protocol wraps these assets in an ERC20 wrapped native token contract. The protocol uses the following WETH9 addresses on Ethereum and WMATIC addresses on Polygon. + +| Network | ChainId | Wrapped Native Token | Address | +| ------------------- | -------- | -------------------- | -------------------------------------------- | +| WorldChain | `480` | WETH | `0x4200000000000000000000000000000000000006` | diff --git a/docs/contracts/v3/reference/deployments/deployments.md b/docs/contracts/v3/reference/deployments/deployments.md index 0d0d7e197..b5f657e5e 100644 --- a/docs/contracts/v3/reference/deployments/deployments.md +++ b/docs/contracts/v3/reference/deployments/deployments.md @@ -20,6 +20,7 @@ Please do not assume contracts are deployed to the same addresses across chains, - [`Blast`](./Blast-Deployments.md) - [`ZKsync`](./ZKsync-Deployments.md) - [`Zora`](./Zora-Deployments.md) +- [`WorldChain`](./WorldChain-Deployments.md) These addresses are final and were deployed from these npm package versions: From 116ce3fa8175e5aa38a3605c3ba3f869638548d3 Mon Sep 17 00:00:00 2001 From: dschwartz-defi Date: Fri, 18 Oct 2024 17:40:23 -0700 Subject: [PATCH 11/19] update deployment contract addresses (#803) Co-authored-by: David Schwartz --- docs/contracts/v4/deployments.mdx | 52 ++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/docs/contracts/v4/deployments.mdx b/docs/contracts/v4/deployments.mdx index 5ddd2b9d5..f6db2c6d2 100644 --- a/docs/contracts/v4/deployments.mdx +++ b/docs/contracts/v4/deployments.mdx @@ -13,26 +13,50 @@ be up to date with the latest changes. For the latest deployments, please see the [foundry artifacts](https://github.com/Uniswap/v4-periphery/tree/main/broadcast) +## Unichain Sepolia: 1301 + +| Contract | Address | +|--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------| +| [PoolManager](https://github.com/Uniswap/v4-core/blob/main/src/PoolManager.sol) | [`0xc81462fec8b23319f288047f8a03a57682a35c1a`](https://sepolia.uniscan.xyz/address/0xc81462fec8b23319f288047f8a03a57682a35c1a#code) | +| [Universal Router](https://github.com/Uniswap/universal-router/blob/dev/contracts/UniversalRouter.sol) | [`0x5418a6d871d327a1cefe6deb97153f07cbf6030e`](https://sepolia.uniscan.xyz/address/0x5418a6d871d327a1cefe6deb97153f07cbf6030e#code) | +| [PositionManager](https://github.com/Uniswap/v4-periphery/blob/main/src/PositionManager.sol) | [`0xb433cb9bcdf4cfcc5cab7d34f90d1a7deefd27b9`](https://sepolia.uniscan.xyz/address/0xb433cb9bcdf4cfcc5cab7d34f90d1a7deefd27b9#code) | +| [StateView](https://github.com/Uniswap/v4-periphery/blob/main/src/lens/StateView.sol) | [`0xde04c804dc75e90d8a64e5589092a1d6692efa45`](https://sepolia.uniscan.xyz/address/0xde04c804dc75e90d8a64e5589092a1d6692efa45#code) | +| [Quoter](https://github.com/Uniswap/v4-periphery/blob/main/src/lens/Quoter.sol) | [`0xfe6cf50c4cfe801dd2aef9c1b3ce24f551944df8`](https://sepolia.uniscan.xyz/address/0xfe6cf50c4cfe801dd2aef9c1b3ce24f551944df8#code) | +| [PoolSwapTest](https://github.com/Uniswap/v4-core/blob/main/src/test/PoolSwapTest.sol) | [`0xe437355299114d35ffcbc0c39e163b24a8e9cbf1`](https://sepolia.uniscan.xyz/address/0xe437355299114d35ffcbc0c39e163b24a8e9cbf1#code) | +| [PoolModifyLiquidityTest](https://github.com/Uniswap/v4-core/blob/main/src/test/PoolModifyLiquidityTest.sol) | [`0xc81462fec8b23319f288047f8a03a57682a35c1a`](https://sepolia.uniscan.xyz/address/0xc81462fec8b23319f288047f8a03a57682a35c1a#code) | + +## OP Sepolia: 11155420 + +| Contract | Address | +|--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------| +| [PoolManager](https://github.com/Uniswap/v4-core/blob/main/src/PoolManager.sol) | [`0xe5df461803a59292c6c03978c17857479c40bc46`](https://sepolia-optimistic.etherscan.io/address/0xe5df461803a59292c6c03978c17857479c40bc46#code) | +| [Universal Router](https://github.com/Uniswap/universal-router/blob/dev/contracts/UniversalRouter.sol) | [`0x78e7F1502A9e4115dEbd6876E0AC4FaEBDB96880`](https://sepolia-optimistic.etherscan.io/address/0x78e7F1502A9e4115dEbd6876E0AC4FaEBDB96880#code) | +| [PositionManager](https://github.com/Uniswap/v4-periphery/blob/main/src/PositionManager.sol) | [`0xef3853450006ce9fb12b540486c920c9a705f502`](https://sepolia-optimistic.etherscan.io/address/0xef3853450006ce9fb12b540486c920c9a705f502#code) | +| [StateView](https://github.com/Uniswap/v4-periphery/blob/main/src/lens/StateView.sol) | [`0x5c038ee8ab7bd7699037e277874f1c611ad0c28f`](https://sepolia-optimistic.etherscan.io/address/0x5c038ee8ab7bd7699037e277874f1c611ad0c28f#code) | +| [Quoter](https://github.com/Uniswap/v4-periphery/blob/main/src/lens/Quoter.sol) | [`0x60abeb98b3b95a0c5786261c1ab830e3d2383f9e`](https://sepolia-optimistic.etherscan.io/address/0x60abeb98b3b95a0c5786261c1ab830e3d2383f9e#code) | +| [PoolSwapTest](https://github.com/Uniswap/v4-core/blob/main/src/test/PoolSwapTest.sol) | [`0x5ba874e13d2cf3161f89d1b1d1732d14226dbf16`](https://sepolia-optimistic.etherscan.io/address/0x5ba874e13d2cf3161f89d1b1d1732d14226dbf16#code) | +| [PoolModifyLiquidityTest](https://github.com/Uniswap/v4-core/blob/main/src/test/PoolModifyLiquidityTest.sol) | [`0xd962b16f4ec712d705106674e944b04614f077be`](https://sepolia-optimistic.etherscan.io/address/0xd962b16f4ec712d705106674e944b04614f077be#code) | + ## Sepolia: 11155111 | Contract | Address | |--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------| -| [PoolManager](https://github.com/Uniswap/v4-core/blob/main/src/PoolManager.sol) | [`0xe8e23e97fa135823143d6b9cba9c699040d51f70`](https://sepolia.etherscan.io/address/0xe8e23e97fa135823143d6b9cba9c699040d51f70#code) | -| [Universal Router](https://github.com/Uniswap/universal-router/blob/dev/contracts/UniversalRouter.sol) | [`0x95273d871c8156636e114b63797d78D7E1720d81`](https://sepolia.etherscan.io/address/0x95273d871c8156636e114b63797d78D7E1720d81#code) | -| [PositionManager](https://github.com/Uniswap/v4-periphery/blob/main/src/PositionManager.sol) | [`0x0048d1c09771bb87b6a44e1294769e1dfd698584`](https://sepolia.etherscan.io/address/0x0048d1c09771bb87b6a44e1294769e1dfd698584#code) | -| [StateView](https://github.com/Uniswap/v4-periphery/blob/main/src/lens/StateView.sol) | [`0x6bb7157fb50e3ae4983ccdc62fb8173c03c6b0a7`](https://sepolia.etherscan.io/address/0x6bb7157fb50e3ae4983ccdc62fb8173c03c6b0a7#code) | -| [Quoter](https://github.com/Uniswap/v4-periphery/blob/main/src/lens/Quoter.sol) | [`0x0000000000000000000000000000000000000000`](https://sepolia.etherscan.io/address/0x0000000000000000000000000000000000000000#code) | -| [PoolSwapTest](https://github.com/Uniswap/v4-core/blob/main/src/test/PoolSwapTest.sol) | [`0x0937c4d65d7cddbf02e75b88dd33f536b201c2a6`](https://sepolia.etherscan.io/address/0x0937c4d65d7cddbf02e75b88dd33f536b201c2a6#code) | -| [PoolModifyLiquidityTest](https://github.com/Uniswap/v4-core/blob/main/src/test/PoolModifyLiquidityTest.sol) | [`0x94df58ccb1ac6e5958b8ee1e2491f224414a2bf7`](https://sepolia.etherscan.io/address/0x94df58ccb1ac6e5958b8ee1e2491f224414a2bf7#code) | +| [PoolManager](https://github.com/Uniswap/v4-core/blob/main/src/PoolManager.sol) | [`0x8c4bcbe6b9ef47855f97e675296fa3f6fafa5f1a`](https://sepolia.etherscan.io/address/0x8c4bcbe6b9ef47855f97e675296fa3f6fafa5f1a#code) | +| [Universal Router](https://github.com/Uniswap/universal-router/blob/dev/contracts/UniversalRouter.sol) | [`0x4d73a4411ca1c660035e4aecc8270e5dddec8c17`](https://sepolia.etherscan.io/address/0x4d73a4411ca1c660035e4aecc8270e5dddec8c17#code) | +| [PositionManager](https://github.com/Uniswap/v4-periphery/blob/main/src/PositionManager.sol) | [`0x1b1c77b606d13b09c84d1c7394b96b147bc03147`](https://sepolia.etherscan.io/address/0x1b1c77b606d13b09c84d1c7394b96b147bc03147#code) | +| [StateView](https://github.com/Uniswap/v4-periphery/blob/main/src/lens/StateView.sol) | [`0x823d45b1329bcf3b369f08f36ba2690ff8e058c3`](https://sepolia.etherscan.io/address/0x823d45b1329bcf3b369f08f36ba2690ff8e058c3#code) | +| [Quoter](https://github.com/Uniswap/v4-periphery/blob/main/src/lens/Quoter.sol) | [`0xcd8716395d55ad17496448a4b2c42557001e9743`](https://sepolia.etherscan.io/address/0xcd8716395d55ad17496448a4b2c42557001e9743#code) | +| [PoolSwapTest](https://github.com/Uniswap/v4-core/blob/main/src/test/PoolSwapTest.sol) | [`0xe49d2815c231826cab58017e214bed19fe1c2dd4`](https://sepolia.etherscan.io/address/0xe49d2815c231826cab58017e214bed19fe1c2dd4#code) | +| [PoolModifyLiquidityTest](https://github.com/Uniswap/v4-core/blob/main/src/test/PoolModifyLiquidityTest.sol) | [`0x496cd7097f0bdd32774da3d2f1ef0adf430b7e81`](https://sepolia.etherscan.io/address/0x496cd7097f0bdd32774da3d2f1ef0adf430b7e81#code) | ## Base Sepolia: 84532 | Contract | Address | |--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------| -| [PoolManager](https://github.com/Uniswap/v4-core/blob/main/src/PoolManager.sol) | [`0xf242ce588b030d0895c51c0730f2368680f80644`](https://sepolia.basescan.org/address/0xf242ce588b030d0895c51c0730f2368680f80644#code) | -| [Universal Router](https://github.com/Uniswap/universal-router/blob/dev/contracts/UniversalRouter.sol) | [`0x927038542746c06F1b2F7F550a3c90AEBdDa4E85`](https://sepolia.basescan.org/address/0x927038542746c06F1b2F7F550a3c90AEBdDa4E85#code) | -| [PositionManager](https://github.com/Uniswap/v4-periphery/blob/main/src/PositionManager.sol) | [`0xa2f16f0bb5dea7c9a6675ec88193471dee805e6e`](https://sepolia.basescan.org/address/0xa2f16f0bb5dea7c9a6675ec88193471dee805e6e#code) | -| [StateView](https://github.com/Uniswap/v4-periphery/blob/main/src/lens/StateView.sol) | [`0xfb3e0c6f74eb1a21cc1da29aec80d2dfe6c9a317`](https://sepolia.basescan.org/address/0xfb3e0c6f74eb1a21cc1da29aec80d2dfe6c9a317#code) | -| [Quoter](https://github.com/Uniswap/v4-periphery/blob/main/src/lens/Quoter.sol) | [`0xf3a39c86dbd13c45365e57fb90fe413371f65af8`](https://sepolia.basescan.org/address/0xf3a39c86dbd13c45365e57fb90fe413371f65af8#code) | -| [PoolSwapTest](https://github.com/Uniswap/v4-core/blob/main/src/test/PoolSwapTest.sol) | [`0xff34e285f8ed393e366046153e3c16484a4dd674`](https://sepolia.basescan.org/address/0xff34e285f8ed393e366046153e3c16484a4dd674#code) | -| [PoolModifyLiquidityTest](https://github.com/Uniswap/v4-core/blob/main/src/test/PoolModifyLiquidityTest.sol) | [`0x841b5a0b3dbc473c8a057e2391014aa4c4751351`](https://sepolia.basescan.org/address/0x841b5a0b3dbc473c8a057e2391014aa4c4751351#code) | \ No newline at end of file +| [PoolManager](https://github.com/Uniswap/v4-core/blob/main/src/PoolManager.sol) | [`0x7da1d65f8b249183667cde74c5cbd46dd38aa829`](https://sepolia.basescan.org/address/0x7da1d65f8b249183667cde74c5cbd46dd38aa829#code) | +| [Universal Router](https://github.com/Uniswap/universal-router/blob/dev/contracts/UniversalRouter.sol) | [`0x95273d871c8156636e114b63797d78D7E1720d81`](https://sepolia.basescan.org/address/0x95273d871c8156636e114b63797d78D7E1720d81#code) | +| [PositionManager](https://github.com/Uniswap/v4-periphery/blob/main/src/PositionManager.sol) | [`0xcdbe7b1ed817ef0005ece6a3e576fbae2ea5eafe`](https://sepolia.basescan.org/address/0xcdbe7b1ed817ef0005ece6a3e576fbae2ea5eafe#code) | +| [StateView](https://github.com/Uniswap/v4-periphery/blob/main/src/lens/StateView.sol) | [`0xe521e3c12d2faaa931ae79602278480c91c50f92`](https://sepolia.basescan.org/address/0xe521e3c12d2faaa931ae79602278480c91c50f92#code) | +| [Quoter](https://github.com/Uniswap/v4-periphery/blob/main/src/lens/Quoter.sol) | [`0xeb1aadac0a10ac2edfcbe496c3bcbc1dea4f994b`](https://sepolia.basescan.org/address/0xeb1aadac0a10ac2edfcbe496c3bcbc1dea4f994b#code) | +| [PoolSwapTest](https://github.com/Uniswap/v4-core/blob/main/src/test/PoolSwapTest.sol) | [`0x96e3495b712c6589f1d2c50635fde68cf17ac83c`](https://sepolia.basescan.org/address/0x96e3495b712c6589f1d2c50635fde68cf17ac83c#code) | +| [PoolModifyLiquidityTest](https://github.com/Uniswap/v4-core/blob/main/src/test/PoolModifyLiquidityTest.sol) | [`0xc94a4c0a89937e278a0d427bb393134e68d5ec09`](https://sepolia.basescan.org/address/0xc94a4c0a89937e278a0d427bb393134e68d5ec09#code) | \ No newline at end of file From 3a084fba084146f76e2d7cf74b3632d4a93ea309 Mon Sep 17 00:00:00 2001 From: Rachel-Eichenberger <60412342+Rachel-Eichenberger@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:15:40 -0400 Subject: [PATCH 12/19] Update Sepolia ETH v2 contracts (#808) --- .../v2/reference/smart-contracts/08-deployment-addresses.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contracts/v2/reference/smart-contracts/08-deployment-addresses.md b/docs/contracts/v2/reference/smart-contracts/08-deployment-addresses.md index 35fc75ea9..ccca401a1 100644 --- a/docs/contracts/v2/reference/smart-contracts/08-deployment-addresses.md +++ b/docs/contracts/v2/reference/smart-contracts/08-deployment-addresses.md @@ -10,7 +10,7 @@ Contract addresses for the [`Uniswap V2 Factory`](https://github.com/Uniswap/v2- | Network | Factory Contract Address | V2Router02 Contract Address | | ---------------------------------------------------- | -------------------------------------------- | -------------------------------------------- | | Mainnet | `0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f` | `0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D` | -| Sepolia | `0xB7f907f7A9eBC822a80BD25E224be42Ce0A698A0` | `0x53544492C78D478294B5b1Fb8059a5D6C9aBBC67` | +| Sepolia | `0xF62c03E08ada871A0bEb309762E260a7a6a880E6` | `0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3` | | Arbitrum | `0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9` | `0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24` | | Avalanche | `0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C` | `0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24` | | BNB Chain | `0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6` | `0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24` | From 2afab769ef84631880725f222fa6321f1dfd0a49 Mon Sep 17 00:00:00 2001 From: vendrell46 Date: Mon, 4 Nov 2024 18:37:27 +0000 Subject: [PATCH 13/19] Adding Custom Accounting guide (#806) Co-authored-by: saucepoint <98790946+saucepoint@users.noreply.github.com> --- .../v4/guides/08-custom-accounting.mdx | 238 ++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 docs/contracts/v4/guides/08-custom-accounting.mdx diff --git a/docs/contracts/v4/guides/08-custom-accounting.mdx b/docs/contracts/v4/guides/08-custom-accounting.mdx new file mode 100644 index 000000000..f8c39a0c1 --- /dev/null +++ b/docs/contracts/v4/guides/08-custom-accounting.mdx @@ -0,0 +1,238 @@ +--- +title: Custom Accounting +--- + +# Introduction +Uniswap v4 introduces a set of powerful, interconnected features that proposes a new way automated market makers (AMMs) can function. Custom accounting, hook fees, custom curves, and return deltas might seem like distinct concepts, but they form a cohesive system that enables unprecedented flexibility in decentralized exchange mechanisms. + +These features are grouped together because they collectively represent the core of Uniswap v4’s customizability. They all relate to how pool state is managed and modified, working in tandem to allow developers to create highly tailored AMM experiences. From dynamic fee structures to unique bonding curves. + +# Brief Overview of Concepts + +Before we dive into the details of custom accounting, hook fees, custom curves, and return deltas, let’s explore how these features work in Uniswap v4. + +## Delta Accounting in v4 + +As described in [Flash Accounting](/contracts/v4/concepts/flash-accounting) Uniswap v4 tracks net token transfers with transient storage. Unlike previous versions that tracked absolute token balances, v4 records changes to these balances (*deltas*). This approach is at the core of v4’s enhanced flexibility and efficiency. + +In the v4 architecture, the `PoolManager` manages credits or debits per address. After a swap router contract interacts with the PoolManager, the core contract determines that the swap router owes input tokens and must claim output tokens. Token balances are tracked as accumulated deltas in transient storage; and only the final deltas incur token transfers + +Delta accounting provides several key benefits: + +1. More efficient state management, especially for complex operations involving multiple steps. +2. Easier integration with hooks, allowing for custom logic to be applied to state changes. +3. Improved gas efficiency for many operations, as it reduces the number of storage writes. + +This system forms the foundation upon which other v4 features, such as hook fees and custom curves, are built. It allows for more complex pool behaviors while maintaining efficiency and flexibility. + +## Hook Fees in v4 + +Hook fees are a feature in Uniswap v4 that allow hook developers to monetize their hooks or implement custom value distribution mechanisms. Unlike pool fees or dynamic fees, hook fees are entirely separate and are implemented through custom logic in the hook itself. + +Key characteristics of hook fees in Uniswap v4: + +**Separate from Pool Fees** + +Hook fees are distinct from the standard pool fees. They can be implemented alongside pool fees without interfering with the core fee structure. + +**Implemented in beforeSwap** + +Hook fees are typically calculated and applied in the `beforeSwap` function, allowing them to modify the swap parameters before the core swap logic is executed. + +**Use of BeforeSwapDelta** + +Hook fees often utilize the `BeforeSwapDelta` mechanism to adjust swap amounts and transfer deltas from the hook to the swap router, enabling precise control over how the fee affects the swap. + +**Flexible Implementation** + +Developers have full control over how hook fees are calculated, collected, and distributed. This allows for complex fee structures tailored to specific use cases. In other words, developers can implement static fees, percentage-based fees, or even a fee that changes. + +**Potential Use Cases** + +- Monetization of hook development +- Implementation of withdrawal penalties (e.g., to penalize just-in-time liquidity provision) +- Custom value distribution for liquidity providers + +Keep reading because at the bottom we are providing a step by step guide on how to implement hook fees. + +## Custom Curves in v4 + +Custom Curves in Uniswap v4 represent a big change in AMM design flexibility. Unlike [Uniswap v2](/contracts/v2/concepts/protocol-overview/how-uniswap-works) where the x*y=k formula was hardcoded, v4 allows developers to implement a wide variety of pricing models. + +This is made possible through the hook system, particularly hooks that can interact with the swap process. Custom curves allow developers to eject the native concentrated liquidity pricing mechanism. These hooks can intercept swap requests, apply custom pricing logic, and return modified swap parameters. This enables the creation of pools with unique characteristics, such as: + +- Stable asset pairs with minimal price impact +- Curves for special token types like rebasing tokens, RWAs, vault tokens + +For example, creating a custom curve for a stable swap pool would involve designing a pricing function that maintains tighter price ranges when assets are near parity. This could be achieved by implementing a curve that's flatter in the middle (where assets are at their expected 1:1 ratio) and steeper at the edges (to discourage large imbalances). + +This type of custom curve could significantly improve capital efficiency for stable asset pairs, reducing slippage for traders and potentially attracting more liquidity to the pool. It showcases how Uniswap v4's flexible architecture allows for tailored solutions to specific trading scenarios, opening up new possibilities in decentralized exchange design. + +## Return Deltas in v4 + +Return deltas are a fundamental mechanism in Uniswap v4's custom accounting system. They allow for precise, programmatic adjustments to the outcomes of operations within the protocol. + +Key aspects of return deltas: + +1. **Dual Adjustment**: Return deltas simultaneously modify the balance changes (deltas) for both the hook contract and the swap router. This dual nature ensures that custom logic is accurately reflected across the entire system. +2. **Credits and Debts Modification**: By adjusting these deltas, return deltas effectively alter the credits and debts owed by the hook and the swap router. This allows for complex economic models to be implemented directly within the protocol. +3. **Native Pricing Bypass**: Return deltas enable hooks to implement custom curves that can completely bypass Uniswap's native pricing mechanism. This opens up possibilities for entirely new types of automated market makers within the Uniswap ecosystem. +4. **Hook Fee Implementation**: Through return deltas, hooks can implement their own fee structures, separate from the core protocol fees. + +In essence, return deltas allow for bespoke modification of an operation's result -- enabling features that were previously impossible in earlier versions of the protocol. + +# Implementing Hook Fees: A Step-by-Step Guide + +In this guide, we'll walk through the process of implementing a custom fee hook in Uniswap v4. We'll not only show you how to write the code but also explain what's happening under the hood at each step. + +## Step 1: Setting Up the Hook + +First, let's create our basic hook structure: + +```solidity +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +import {BaseHook} from "v4-periphery/src/BaseHook.sol"; +import {Hooks} from "v4-core/src/libraries/Hooks.sol"; +import {IPoolManager} from "v4-core/src/interfaces/IPoolManager.sol"; +import {PoolKey} from "v4-core/src/types/PoolKey.sol"; +import {Currency} from "v4-core/src/types/Currency.sol"; +import {BeforeSwapDelta, toBeforeSwapDelta} from "v4-core/src/types/BeforeSwapDelta.sol"; + +contract HookFeeExample is BaseHook { + uint256 public constant HOOK_FEE_PERCENTAGE = 10;// 0.01% fee + uint256 public constant FEE_DENOMINATOR = 100000; + + constructor(IPoolManager _poolManager) BaseHook(_poolManager) {} + + function getHookPermissions() public pure override returns (Hooks.Permissions memory) { + return Hooks.Permissions({ + beforeInitialize: false, + afterInitialize: false, + beforeAddLiquidity: false, + beforeRemoveLiquidity: false, + afterAddLiquidity: false, + afterRemoveLiquidity: false, + beforeSwap: true, + afterSwap: false, + beforeDonate: false, + afterDonate: false, + beforeSwapReturnDelta: true, + afterSwapReturnDelta: false, + afterAddLiquidityReturnDelta: false, + afterRemoveLiquidityReturnDelta: false + }); + } +} + +``` + +Here, we're setting up our hook with a constant fee of 0.01% and enabling the `beforeSwap` and `beforeSwapReturnDelta` permissions. + +## Step 2: Implementing the beforeSwap Function + +Now, let's implement our `beforeSwap` function: + +```solidity +function beforeSwap( + address, + PoolKey calldata key, + IPoolManager.SwapParams calldata params, + bytes calldata +) external override returns (bytes4, BeforeSwapDelta, uint24) { + // Implementation details will be explained in the following sub-steps +} + +``` + +### Step 2.1: Calculate the swap amount and fee + +We determine the absolute swap amount and calculate our fee based on it. + +```solidity +uint256 swapAmount = params.amountSpecified < 0 + ? uint256(-params.amountSpecified) + : uint256(params.amountSpecified); +uint256 feeAmount = (swapAmount * HOOK_FEE_PERCENTAGE) / FEE_DENOMINATOR; + +``` + +### Step 2.2: Collect the fee + +We use `poolManager.take` to collect the fee. This creates a debt for our hook in the specified currency. + +```solidity +Currency feeCurrency = params.zeroForOne ? key.currency0 : key.currency1; +poolManager.take(feeCurrency, address(this), feeAmount); + +``` + +### Step 2.3: Create the BeforeSwapDelta + +This is where the magic happens. We create a `BeforeSwapDelta` that represents our fee. The `toBeforeSwapDelta` function takes two parameters: + +- The specified delta: This is our fee amount. It's positive because we're adding it to the hook's balance. +- The unspecified delta: We set this to 0 as we're not affecting the other currency. + +```solidity +BeforeSwapDelta returnDelta = toBeforeSwapDelta( + int128(int256(feeAmount)), // Specified delta (fee amount) + 0 // Unspecified delta (no change) +); + +``` + +### Step 2.4: Return values + +We return the function selector, our `returnDelta`, and 0 for the fee override. + +```solidity +return (BaseHook.beforeSwap.selector, returnDelta, 0); +``` + +## Step 3: Understanding the BeforeSwapDelta Mechanism + +Now, let's dive deeper into how the `BeforeSwapDelta` works and how it affects the overall swap process. + +1. **Initial State**: +Let's say a user wants to swap 100 USDC for USDT + - Hook's delta: (0, 0) + - User's swap request: -100 USDC (negative because they're selling) + +2. **After Hook Execution**: +Our hook has taken a 1 USDC fee (assuming 1% for simplicity): + - Hook's delta: (-1 USDC, 0) // The hook now owes 1 USDC to the pool + - BeforeSwapDelta returned: (1 USDC, 0) // This will be added to the hook's delta and subtracted from the swap delta + +3. **PoolManager Processing**: +The PoolManager applies our `BeforeSwapDelta` +The pool then swaps 99 USDC for, let's say, 98 USDT. + +```solidity +amountToSwap = params.amountSpecified + hookDelta.getSpecifiedDelta(); +-99 USDC = -100 USDC + 1 USDC +``` + +4. **Delta Resolution**: +The PoolManager then resolves the deltas: + +```solidity +// Hook's new delta +newHookDelta = oldHookDelta + returnDelta +(0, 0) = (-1 USDC, 0) + (1 USDC, 0) + +// Swap delta for router +swapDelta = (-99 USDC, 98 USDT) - (1 USDC, 0) + = (-100 USDC, 98 USDT) +``` + +5. **Final Outcome**: + - The hook's debt is cleared: It took 1 USDC as a fee, but "returned" it to the swap process. + - The router (on behalf of the user) must pay 100 USDC (original amount including fee) and receives 98 USDT. + +This process demonstrates how `BeforeSwapDelta` effectively "transfers" the hook's outstanding delta to the swap router, ensuring that the user pays the fee while the hook collects it, all within a single atomic transaction. + +## Conclusion + +By implementing hook fees this way, we've leveraged Uniswap v4's delta accounting system to create a seamless fee collection mechanism. This approach allows for complex fee structures and behaviors without disrupting the core swap process or requiring separate fee transfers. \ No newline at end of file From c181c5542a602afac115548f9cf02098349b5483 Mon Sep 17 00:00:00 2001 From: Charles Azanlekor Date: Thu, 7 Nov 2024 08:52:50 +0100 Subject: [PATCH 14/19] Update IPoolManager.mdx (#810) --- docs/contracts/v4/reference/core/IPoolManager.mdx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/contracts/v4/reference/core/IPoolManager.mdx b/docs/contracts/v4/reference/core/IPoolManager.mdx index a3c0bae85..5c8f1029b 100644 --- a/docs/contracts/v4/reference/core/IPoolManager.mdx +++ b/docs/contracts/v4/reference/core/IPoolManager.mdx @@ -30,7 +30,7 @@ Used in the `swap` function to define the behavior of our swap. ## initialize ```solidity -function initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hookData) +function initialize(PoolKey memory key, uint160 sqrtPriceX96) external returns (int24 tick); ``` @@ -41,7 +41,6 @@ Initialize a new pool by defining its parameters: token pair, fee tier, tick spa |---------------|-----------|--------------------------------------------------| | key | PoolKey | The key defining the pool to initialize | | sqrtPriceX96 | uint160 | The initial sqrt price of the pool as a Q64.96 value | -| hookData | bytes | Any additional data to pass to our hook contract on the before/after initialization hooks | Returns the initial tick value of the pool. @@ -115,4 +114,4 @@ Donates the specified currency amounts to the pool. | amount1 | uint256 | The amount of token1 to donate | | hookData | bytes | Any data to pass to a hook contract on the before/afterDonate hooks| -Returns the balance delta representing the donated amounts. \ No newline at end of file +Returns the balance delta representing the donated amounts. From 9b2b4ea60ea2ed4991d9afc670ef9bf332b52f10 Mon Sep 17 00:00:00 2001 From: "nahee.app" Date: Mon, 11 Nov 2024 23:50:19 -0500 Subject: [PATCH 15/19] prettier and coderabbit (#26) * prettier and coderabbit * pr template --- .coderabbit.yaml | 15 +++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 27 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .coderabbit.yaml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 000000000..e1dd5c811 --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,15 @@ +# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json +language: 'en-US' +early_access: false +reviews: + profile: 'chill' + request_changes_workflow: false + high_level_summary: true + poem: true + review_status: true + collapse_walkthrough: false + auto_review: + enabled: true + drafts: false +chat: + auto_reply: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..eb70b2820 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,27 @@ +### Description + + + +### Type(s) of changes + + + +- [ ] Bug fix +- [ ] New feature +- [ ] Update to an existing feature + +### Motivation for PR + + + +### How Has This Been Tested? + + + +### Applicable screenshots + + + +### Follow-up PR + + From 284c4f096beb74a5610809547120a02fdcf28cd7 Mon Sep 17 00:00:00 2001 From: ant <0xdevant@gmail.com> Date: Thu, 14 Nov 2024 14:14:01 +0800 Subject: [PATCH 16/19] fix: typo on 03-routing.md (#807) --- docs/sdk/v3/guides/swaps/03-routing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sdk/v3/guides/swaps/03-routing.md b/docs/sdk/v3/guides/swaps/03-routing.md index 2e35b6459..df10c9de3 100644 --- a/docs/sdk/v3/guides/swaps/03-routing.md +++ b/docs/sdk/v3/guides/swaps/03-routing.md @@ -11,7 +11,7 @@ This guide will cover how to use Uniswap's smart order router to compute optimal If you need a briefer on the SDK and to learn more about how these guides connect to the examples repository, please visit our [background](./01-background.md) page! ::: -In this example we will trade between **WETH and USDC**, but you can configure your example to us any two currencies and amount of input currency. +In this example we will trade between **WETH and USDC**, but you can configure your example to use any two currencies and amount of input currency. The guide will **cover**: @@ -72,7 +72,7 @@ const router = new AlphaRouter({ ## Creating a route We will use the [SwapRouter02](https://github.com/Uniswap/v3-periphery/blob/v1.0.0/contracts/SwapRouter.sol) for our trade. -The `smart-order-router` package provides us with a SwapOptionsSwapRouter02` interface, defining the wallet to use, slippage tolerance, and deadline for the transaction that we need to interact with the contract: +The `smart-order-router` package provides us with a `SwapOptionsSwapRouter02` interface, defining the wallet to use, slippage tolerance, and deadline for the transaction that we need to interact with the contract: ```typescript import { SwapOptionsSwapRouter02, SwapType } from '@uniswap/smart-order-router' From dcc22c5c8dc93baed402c84cd757c5362fb1b066 Mon Sep 17 00:00:00 2001 From: Marcello <126456879+marcello-pv01@users.noreply.github.com> Date: Thu, 14 Nov 2024 07:14:23 +0100 Subject: [PATCH 17/19] Fix typo (#805) --- docs/contracts/v4/concepts/05-subscribers.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contracts/v4/concepts/05-subscribers.mdx b/docs/contracts/v4/concepts/05-subscribers.mdx index 44cc75f47..84ed32152 100644 --- a/docs/contracts/v4/concepts/05-subscribers.mdx +++ b/docs/contracts/v4/concepts/05-subscribers.mdx @@ -2,7 +2,7 @@ title: Subscribers --- -Subscribers, new in Uniswap v4, allow for liquidity-position owners to opt-in to a contract that receives _notifcations_. +Subscribers, new in Uniswap v4, allow for liquidity-position owners to opt-in to a contract that receives _notifications_. The new design is intended to support _liquidity mining_, additional rewards given to in-range liquidity providers. Through notification logic, position owners do not need to risk their liquidity position and its underlying assets. In Uniswap v3, _liquidity mining_ was supported by fully transferring the liquidity position to an external contract; this old design would give the external contract full ownership and control of the liquidity position. From 46c2c78696b67360a1d5618595a85e7dce2adf78 Mon Sep 17 00:00:00 2001 From: saucepoint <98790946+saucepoint@users.noreply.github.com> Date: Thu, 14 Nov 2024 07:32:29 -0800 Subject: [PATCH 18/19] Update v4 Technical Reference (#814) --- docs/contracts/v4/reference/core/ERC6909.md | 3 +- .../v4/reference/core/ERC6909Claims.md | 3 +- docs/contracts/v4/reference/core/Extsload.md | 3 +- docs/contracts/v4/reference/core/Exttload.md | 3 +- .../v4/reference/core/NoDelegateCall.md | 3 +- .../v4/reference/core/PoolManager.md | 20 +- .../v4/reference/core/ProtocolFees.md | 32 +- .../core/interfaces/IERC20Minimal.md | 3 +- .../core/interfaces/IERC6909Claims.md | 3 +- .../v4/reference/core/interfaces/IExtsload.md | 3 +- .../v4/reference/core/interfaces/IExttload.md | 3 +- .../v4/reference/core/interfaces/IHooks.md | 21 +- .../reference/core/interfaces/IPoolManager.md | 12 +- .../core/interfaces/IProtocolFees.md | 31 +- .../core/interfaces/IUnlockCallback.md | 3 +- .../v4/reference/core/libraries/BitMath.md | 3 +- .../reference/core/libraries/CurrencyDelta.md | 3 +- .../core/libraries/CurrencyReserves.md | 3 +- .../reference/core/libraries/CustomRevert.md | 20 +- .../reference/core/libraries/FixedPoint128.md | 3 +- .../reference/core/libraries/FixedPoint96.md | 3 +- .../v4/reference/core/libraries/FullMath.md | 3 +- .../v4/reference/core/libraries/Hooks.md | 26 +- .../reference/core/libraries/LPFeeLibrary.md | 5 +- .../reference/core/libraries/LiquidityMath.md | 3 +- .../v4/reference/core/libraries/Lock.md | 3 +- .../core/libraries/NonzeroDeltaCount.md | 3 +- .../v4/reference/core/libraries/ParseBytes.md | 3 +- .../v4/reference/core/libraries/Pool.md | 7 +- .../v4/reference/core/libraries/Position.md | 3 +- .../core/libraries/ProtocolFeeLibrary.md | 3 +- .../v4/reference/core/libraries/SafeCast.md | 3 +- .../reference/core/libraries/SqrtPriceMath.md | 3 +- .../reference/core/libraries/StateLibrary.md | 3 +- .../v4/reference/core/libraries/SwapMath.md | 3 +- .../v4/reference/core/libraries/TickBitmap.md | 3 +- .../v4/reference/core/libraries/TickMath.md | 3 +- .../core/libraries/TransientStateLibrary.md | 3 +- .../v4/reference/core/libraries/UnsafeMath.md | 7 +- .../v4/reference/core/test/ActionsRouter.md | 164 +------- .../v4/reference/core/test/BaseTestHooks.md | 7 +- .../v4/reference/core/test/CurrencyTest.md | 3 +- .../v4/reference/core/test/CustomCurveHook.md | 3 +- .../reference/core/test/DeltaReturningHook.md | 3 +- .../core/test/DynamicFeesTestHook.md | 8 +- .../core/test/DynamicReturnFeeTestHook.md | 3 +- .../core/test/EmptyRevertContract.md | 3 +- .../v4/reference/core/test/EmptyTestHooks.md | 11 +- .../v4/reference/core/test/FeeTakingHook.md | 3 +- .../v4/reference/core/test/Fuzzers.md | 3 +- .../v4/reference/core/test/HooksTest.md | 3 +- .../v4/reference/core/test/LPFeeTakingHook.md | 3 +- .../reference/core/test/LiquidityMathTest.md | 3 +- .../v4/reference/core/test/MockContract.md | 3 +- .../reference/core/test/MockERC6909Claims.md | 3 +- .../v4/reference/core/test/MockHooks.md | 13 +- .../v4/reference/core/test/NativeERC20.md | 3 +- .../reference/core/test/NoDelegateCallTest.md | 3 +- .../v4/reference/core/test/PoolClaimsTest.md | 3 +- .../v4/reference/core/test/PoolDonateTest.md | 3 +- .../core/test/PoolEmptyUnlockTest.md | 3 +- .../core/test/PoolModifyLiquidityTest.md | 3 +- .../test/PoolModifyLiquidityTestNoChecks.md | 3 +- .../core/test/PoolNestedActionsTest.md | 3 +- .../v4/reference/core/test/PoolSwapTest.md | 3 +- .../v4/reference/core/test/PoolTakeTest.md | 3 +- .../v4/reference/core/test/PoolTestBase.md | 3 +- .../core/test/ProtocolFeesImplementation.md | 17 +- .../reference/core/test/ProxyPoolManager.md | 13 +- .../reference/core/test/SkipCallsTestHook.md | 12 +- .../core/test/SqrtPriceMathEchidnaTest.md | 3 +- .../reference/core/test/SwapRouterNoChecks.md | 3 +- .../v4/reference/core/test/TestERC20.md | 3 +- .../reference/core/test/TestInvalidERC20.md | 3 +- .../core/test/TickMathEchidnaTest.md | 3 +- .../v4/reference/core/test/TickMathTest.md | 3 +- .../test/TickOverflowSafetyEchidnaTest.md | 3 +- .../v4/reference/core/types/PoolId.md | 3 +- .../v4/reference/core/types/Slot0.md | 3 +- .../reference/periphery/PositionDescriptor.md | 149 +++++++ .../v4/reference/periphery/PositionManager.md | 45 +- .../periphery/UniswapV4DeployerCompetition.md | 122 ++++++ .../v4/reference/periphery/V4Router.md | 15 +- .../periphery/base/BaseActionsRouter.md | 3 +- .../v4/reference/periphery/base/BaseHook.md | 9 +- .../reference/periphery/base/BaseV4Quoter.md | 3 +- .../reference/periphery/base/DeltaResolver.md | 35 +- .../v4/reference/periphery/base/EIP712_v4.md | 3 +- .../periphery/base/ERC721Permit_v4.md | 10 +- .../periphery/base/ImmutableState.md | 6 +- .../reference/periphery/base/Multicall_v4.md | 3 +- .../reference/periphery/base/NativeWrapper.md | 61 +++ .../v4/reference/periphery/base/Notifier.md | 15 +- .../periphery/base/Permit2Forwarder.md | 3 +- .../periphery/base/PoolInitializer.md | 9 +- .../periphery/base/ReentrancyLock.md | 3 +- .../reference/periphery/base/SafeCallback.md | 3 +- .../periphery/base/UnorderedNonce.md | 3 +- .../periphery/interfaces/IEIP712_v4.md | 3 +- .../periphery/interfaces/IERC721Permit_v4.md | 3 +- .../periphery/interfaces/IImmutableState.md | 14 + .../periphery/interfaces/IMulticall_v4.md | 3 +- .../periphery/interfaces/INotifier.md | 19 +- .../interfaces/IPositionDescriptor.md | 29 ++ .../periphery/interfaces/IPositionManager.md | 15 +- .../reference/periphery/interfaces/IQuoter.md | 3 +- .../periphery/interfaces/ISubscriber.md | 3 +- .../IUniswapV4DeployerCompetition.md | 85 ++++ .../periphery/interfaces/IV4Router.md | 8 +- .../reference/periphery/interfaces/IWETH9.md | 26 ++ .../v4/reference/periphery/lens/Quoter.md | 3 +- .../v4/reference/periphery/lens/StateView.md | 3 +- .../periphery/libraries/ActionConstants.md | 3 +- .../reference/periphery/libraries/Actions.md | 21 +- .../periphery/libraries/AddressStringUtil.md | 59 +++ .../periphery/libraries/BipsLibrary.md | 36 ++ .../periphery/libraries/CalldataDecoder.md | 12 +- .../libraries/CurrencyRatioSortOrder.md | 52 +++ .../periphery/libraries/Descriptor.md | 383 ++++++++++++++++++ .../periphery/libraries/ERC721PermitHash.md | 3 +- .../periphery/libraries/HexStrings.md | 39 ++ .../reference/periphery/libraries/Locker.md | 3 +- .../reference/periphery/libraries/PathKey.md | 3 +- .../periphery/libraries/PositionConfig.md | 3 +- .../periphery/libraries/PositionConfigId.md | 62 ++- .../libraries/PositionInfoLibrary.md | 150 +------ .../periphery/libraries/QuoterRevert.md | 3 +- .../v4/reference/periphery/libraries/SVG.md | 377 +++++++++++++++++ .../libraries/SafeCurrencyMetadata.md | 133 ++++++ .../periphery/libraries/SlippageCheck.md | 3 +- .../periphery/libraries/VanityAddressLib.md | 94 +++++ scripts/v4-forge-doc.sh | 13 +- submodules/v4-core | 2 +- submodules/v4-periphery | 2 +- 134 files changed, 2090 insertions(+), 692 deletions(-) create mode 100644 docs/contracts/v4/reference/periphery/PositionDescriptor.md create mode 100644 docs/contracts/v4/reference/periphery/UniswapV4DeployerCompetition.md create mode 100644 docs/contracts/v4/reference/periphery/base/NativeWrapper.md create mode 100644 docs/contracts/v4/reference/periphery/interfaces/IImmutableState.md create mode 100644 docs/contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md create mode 100644 docs/contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md create mode 100644 docs/contracts/v4/reference/periphery/interfaces/IWETH9.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/AddressStringUtil.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/BipsLibrary.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/CurrencyRatioSortOrder.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/Descriptor.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/HexStrings.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/SVG.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/SafeCurrencyMetadata.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/VanityAddressLib.md diff --git a/docs/contracts/v4/reference/core/ERC6909.md b/docs/contracts/v4/reference/core/ERC6909.md index c78872297..546b47212 100644 --- a/docs/contracts/v4/reference/core/ERC6909.md +++ b/docs/contracts/v4/reference/core/ERC6909.md @@ -1,6 +1,5 @@ # ERC6909 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/ERC6909.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/ERC6909.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IERC6909Claims](contracts/v4/reference/core/interfaces/IERC6909Claims.md) diff --git a/docs/contracts/v4/reference/core/ERC6909Claims.md b/docs/contracts/v4/reference/core/ERC6909Claims.md index 9f9000dc8..861421777 100644 --- a/docs/contracts/v4/reference/core/ERC6909Claims.md +++ b/docs/contracts/v4/reference/core/ERC6909Claims.md @@ -1,6 +1,5 @@ # ERC6909Claims -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/ERC6909Claims.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/ERC6909Claims.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ERC6909](contracts/v4/reference/core/ERC6909.md) diff --git a/docs/contracts/v4/reference/core/Extsload.md b/docs/contracts/v4/reference/core/Extsload.md index 5a002ea92..e57d84f6a 100644 --- a/docs/contracts/v4/reference/core/Extsload.md +++ b/docs/contracts/v4/reference/core/Extsload.md @@ -1,6 +1,5 @@ # Extsload -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/Extsload.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/Extsload.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IExtsload](contracts/v4/reference/core/interfaces/IExtsload.md) diff --git a/docs/contracts/v4/reference/core/Exttload.md b/docs/contracts/v4/reference/core/Exttload.md index ec8ad2254..4c376946b 100644 --- a/docs/contracts/v4/reference/core/Exttload.md +++ b/docs/contracts/v4/reference/core/Exttload.md @@ -1,6 +1,5 @@ # Exttload -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/Exttload.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/Exttload.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IExttload](contracts/v4/reference/core/interfaces/IExttload.md) diff --git a/docs/contracts/v4/reference/core/NoDelegateCall.md b/docs/contracts/v4/reference/core/NoDelegateCall.md index 605f10922..cf7cfd3f7 100644 --- a/docs/contracts/v4/reference/core/NoDelegateCall.md +++ b/docs/contracts/v4/reference/core/NoDelegateCall.md @@ -1,6 +1,5 @@ # NoDelegateCall -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/NoDelegateCall.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/NoDelegateCall.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Base contract that provides a modifier for preventing delegatecall to methods in a child contract diff --git a/docs/contracts/v4/reference/core/PoolManager.md b/docs/contracts/v4/reference/core/PoolManager.md index 47b80f1d6..52cb440bd 100644 --- a/docs/contracts/v4/reference/core/PoolManager.md +++ b/docs/contracts/v4/reference/core/PoolManager.md @@ -1,6 +1,5 @@ # PoolManager -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/PoolManager.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/PoolManager.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IPoolManager](contracts/v4/reference/core/interfaces/IPoolManager.md), [ProtocolFees](contracts/v4/reference/core/ProtocolFees.md), [NoDelegateCall](contracts/v4/reference/core/NoDelegateCall.md), [ERC6909Claims](contracts/v4/reference/core/ERC6909Claims.md), [Extsload](contracts/v4/reference/core/Extsload.md), [Exttload](contracts/v4/reference/core/Exttload.md) @@ -40,6 +39,13 @@ This will revert if the contract is locked modifier onlyWhenUnlocked(); ``` +### constructor + + +```solidity +constructor(address initialOwner) ProtocolFees(initialOwner); +``` + ### unlock All interactions on the contract that account deltas require unlocking. A caller that calls `unlock` must implement @@ -72,10 +78,7 @@ Initialize the state for a given pool ID ```solidity -function initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hookData) - external - noDelegateCall - returns (int24 tick); +function initialize(PoolKey memory key, uint160 sqrtPriceX96) external noDelegateCall returns (int24 tick); ``` **Parameters** @@ -83,7 +86,6 @@ function initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hoo |----|----|-----------| |`key`|`PoolKey`|The pool key for the pool to initialize| |`sqrtPriceX96`|`uint160`|The initial square root price| -|`hookData`|`bytes`|The data to pass through to the initialize hooks| **Returns** @@ -207,14 +209,14 @@ native funds, this function can be called with the native currency to then be ab ```solidity -function sync(Currency currency) external onlyWhenUnlocked; +function sync(Currency currency) external; ``` ### take Called by the user to net out some value owed to the user -*Can also be used as a mechanism for _free_ flash loans* +*Will revert if the requested amount is not available, consider using `mint` instead* ```solidity diff --git a/docs/contracts/v4/reference/core/ProtocolFees.md b/docs/contracts/v4/reference/core/ProtocolFees.md index ce63a3b0b..7b3b069e4 100644 --- a/docs/contracts/v4/reference/core/ProtocolFees.md +++ b/docs/contracts/v4/reference/core/ProtocolFees.md @@ -1,6 +1,5 @@ # ProtocolFees -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/ProtocolFees.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/ProtocolFees.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IProtocolFees](contracts/v4/reference/core/interfaces/IProtocolFees.md), Owned @@ -23,14 +22,7 @@ Returns the current protocol fee controller address ```solidity -IProtocolFeeController public protocolFeeController; -``` - - -### BLOCK_LIMIT_BPS - -```solidity -uint256 private constant BLOCK_LIMIT_BPS = 100; +address public protocolFeeController; ``` @@ -39,7 +31,7 @@ uint256 private constant BLOCK_LIMIT_BPS = 100; ```solidity -constructor() Owned(msg.sender); +constructor(address initialOwner) Owned(initialOwner); ``` ### setProtocolFeeController @@ -48,13 +40,13 @@ Sets the protocol fee controller ```solidity -function setProtocolFeeController(IProtocolFeeController controller) external onlyOwner; +function setProtocolFeeController(address controller) external onlyOwner; ``` **Parameters** |Name|Type|Description| |----|----|-----------| -|`controller`|`IProtocolFeeController`|The new protocol fee controller| +|`controller`|`address`|The new protocol fee controller| ### setProtocolFee @@ -120,20 +112,6 @@ function _isUnlocked() internal virtual returns (bool); function _getPool(PoolId id) internal virtual returns (Pool.State storage); ``` -### _fetchProtocolFee - -Fetch the protocol fees for a given pool - -*the success of this function is false if the call fails or the returned fees are invalid* - -*to prevent an invalid protocol fee controller from blocking pools from being initialized -the success of this function is NOT checked on initialize and if the call fails, the protocol fees are set to 0.* - - -```solidity -function _fetchProtocolFee(PoolKey memory key) internal returns (uint24 protocolFee); -``` - ### _updateProtocolFees diff --git a/docs/contracts/v4/reference/core/interfaces/IERC20Minimal.md b/docs/contracts/v4/reference/core/interfaces/IERC20Minimal.md index 37700680b..ccf622088 100644 --- a/docs/contracts/v4/reference/core/interfaces/IERC20Minimal.md +++ b/docs/contracts/v4/reference/core/interfaces/IERC20Minimal.md @@ -1,6 +1,5 @@ # IERC20Minimal -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/external/IERC20Minimal.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/external/IERC20Minimal.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contains a subset of the full ERC20 interface that is used in Uniswap V3 diff --git a/docs/contracts/v4/reference/core/interfaces/IERC6909Claims.md b/docs/contracts/v4/reference/core/interfaces/IERC6909Claims.md index 48c33b0f2..4c6596707 100644 --- a/docs/contracts/v4/reference/core/interfaces/IERC6909Claims.md +++ b/docs/contracts/v4/reference/core/interfaces/IERC6909Claims.md @@ -1,6 +1,5 @@ # IERC6909Claims -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/external/IERC6909Claims.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/external/IERC6909Claims.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Interface for claims over a contract balance, wrapped as a ERC6909 diff --git a/docs/contracts/v4/reference/core/interfaces/IExtsload.md b/docs/contracts/v4/reference/core/interfaces/IExtsload.md index d7e7aaf31..0d561f591 100644 --- a/docs/contracts/v4/reference/core/interfaces/IExtsload.md +++ b/docs/contracts/v4/reference/core/interfaces/IExtsload.md @@ -1,6 +1,5 @@ # IExtsload -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/IExtsload.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/IExtsload.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Interface for functions to access any storage slot in a contract diff --git a/docs/contracts/v4/reference/core/interfaces/IExttload.md b/docs/contracts/v4/reference/core/interfaces/IExttload.md index 37275893b..bfc72755c 100644 --- a/docs/contracts/v4/reference/core/interfaces/IExttload.md +++ b/docs/contracts/v4/reference/core/interfaces/IExttload.md @@ -1,6 +1,5 @@ # IExttload -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/IExttload.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/IExttload.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Interface for functions to access any transient storage slot in a contract diff --git a/docs/contracts/v4/reference/core/interfaces/IHooks.md b/docs/contracts/v4/reference/core/interfaces/IHooks.md index 3f567d0dd..4e287403f 100644 --- a/docs/contracts/v4/reference/core/interfaces/IHooks.md +++ b/docs/contracts/v4/reference/core/interfaces/IHooks.md @@ -1,6 +1,5 @@ # IHooks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/IHooks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/IHooks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) V4 decides whether to invoke specific hooks by inspecting the least significant bits of the address that the hooks contract is deployed to. @@ -18,9 +17,7 @@ The hook called before the state of a pool is initialized ```solidity -function beforeInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96, bytes calldata hookData) - external - returns (bytes4); +function beforeInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96) external returns (bytes4); ``` **Parameters** @@ -29,7 +26,6 @@ function beforeInitialize(address sender, PoolKey calldata key, uint160 sqrtPric |`sender`|`address`|The initial msg.sender for the initialize call| |`key`|`PoolKey`|The key for the pool being initialized| |`sqrtPriceX96`|`uint160`|The sqrt(price) of the pool as a Q64.96| -|`hookData`|`bytes`|Arbitrary data handed into the PoolManager by the initializer to be be passed on to the hook| **Returns** @@ -44,13 +40,9 @@ The hook called after the state of a pool is initialized ```solidity -function afterInitialize( - address sender, - PoolKey calldata key, - uint160 sqrtPriceX96, - int24 tick, - bytes calldata hookData -) external returns (bytes4); +function afterInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96, int24 tick) + external + returns (bytes4); ``` **Parameters** @@ -60,7 +52,6 @@ function afterInitialize( |`key`|`PoolKey`|The key for the pool being initialized| |`sqrtPriceX96`|`uint160`|The sqrt(price) of the pool as a Q64.96| |`tick`|`int24`|The current tick after the state of a pool is initialized| -|`hookData`|`bytes`|Arbitrary data handed into the PoolManager by the initializer to be be passed on to the hook| **Returns** @@ -183,7 +174,7 @@ function afterRemoveLiquidity( |`sender`|`address`|The initial msg.sender for the remove liquidity call| |`key`|`PoolKey`|The key for the pool| |`params`|`IPoolManager.ModifyLiquidityParams`|The parameters for removing liquidity| -|`delta`|`BalanceDelta`|The caller's balance delta after adding liquidity; the sum of principal delta, fees accrued, and hook delta| +|`delta`|`BalanceDelta`|The caller's balance delta after removing liquidity; the sum of principal delta, fees accrued, and hook delta| |`feesAccrued`|`BalanceDelta`|The fees accrued since the last time fees were collected from this position| |`hookData`|`bytes`|Arbitrary data handed into the PoolManager by the liquidity provider to be be passed on to the hook| diff --git a/docs/contracts/v4/reference/core/interfaces/IPoolManager.md b/docs/contracts/v4/reference/core/interfaces/IPoolManager.md index 5e031e1b2..b0266b131 100644 --- a/docs/contracts/v4/reference/core/interfaces/IPoolManager.md +++ b/docs/contracts/v4/reference/core/interfaces/IPoolManager.md @@ -1,6 +1,5 @@ # IPoolManager -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/IPoolManager.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/IPoolManager.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IProtocolFees](contracts/v4/reference/core/interfaces/IProtocolFees.md), [IERC6909Claims](contracts/v4/reference/core/interfaces/IERC6909Claims.md), [IExtsload](contracts/v4/reference/core/interfaces/IExtsload.md), [IExttload](contracts/v4/reference/core/interfaces/IExttload.md) @@ -41,7 +40,7 @@ Initialize the state for a given pool ID ```solidity -function initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hookData) external returns (int24 tick); +function initialize(PoolKey memory key, uint160 sqrtPriceX96) external returns (int24 tick); ``` **Parameters** @@ -49,7 +48,6 @@ function initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hoo |----|----|-----------| |`key`|`PoolKey`|The pool key for the pool to initialize| |`sqrtPriceX96`|`uint160`|The initial square root price| -|`hookData`|`bytes`|The data to pass through to the initialize hooks| **Returns** @@ -168,7 +166,9 @@ function sync(Currency currency) external; Called by the user to net out some value owed to the user -*Can also be used as a mechanism for _free_ flash loans* +*Will revert if the requested amount is not available, consider using `mint` instead* + +*Can also be used as a mechanism for free flash loans* ```solidity @@ -319,7 +319,7 @@ event Initialize( |`tickSpacing`|`int24`|The minimum number of ticks between initialized ticks| |`hooks`|`IHooks`|The hooks contract address for the pool, or address(0) if none| |`sqrtPriceX96`|`uint160`|The price of the pool on initialization| -|`tick`|`int24`|The initial tick of the pool corresponding to the intialized price| +|`tick`|`int24`|The initial tick of the pool corresponding to the initialized price| ### ModifyLiquidity Emitted when a liquidity position is modified diff --git a/docs/contracts/v4/reference/core/interfaces/IProtocolFees.md b/docs/contracts/v4/reference/core/interfaces/IProtocolFees.md index d33660f52..147919d5b 100644 --- a/docs/contracts/v4/reference/core/interfaces/IProtocolFees.md +++ b/docs/contracts/v4/reference/core/interfaces/IProtocolFees.md @@ -1,6 +1,5 @@ # IProtocolFees -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/IProtocolFees.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/IProtocolFees.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Interface for all protocol-fee related functions in the pool manager @@ -49,13 +48,13 @@ Sets the protocol fee controller ```solidity -function setProtocolFeeController(IProtocolFeeController controller) external; +function setProtocolFeeController(address controller) external; ``` **Parameters** |Name|Type|Description| |----|----|-----------| -|`controller`|`IProtocolFeeController`|The new protocol fee controller| +|`controller`|`address`|The new protocol fee controller| ### collectProtocolFees @@ -91,13 +90,13 @@ Returns the current protocol fee controller address ```solidity -function protocolFeeController() external view returns (IProtocolFeeController); +function protocolFeeController() external view returns (address); ``` **Returns** |Name|Type|Description| |----|----|-----------| -|``|`IProtocolFeeController`|IProtocolFeeController The currency protocol fee controller| +|``|`address`|address The current protocol fee controller address| ## Events @@ -118,14 +117,6 @@ event ProtocolFeeUpdated(PoolId indexed id, uint24 protocolFee); ``` ## Errors -### ProtocolFeeCannotBeFetched -Thrown when not enough gas is provided to look up the protocol fee - - -```solidity -error ProtocolFeeCannotBeFetched(); -``` - ### ProtocolFeeTooLarge Thrown when protocol fee is set too high @@ -134,19 +125,19 @@ Thrown when protocol fee is set too high error ProtocolFeeTooLarge(uint24 fee); ``` -### ContractUnlocked -Thrown when the contract is unlocked +### InvalidCaller +Thrown when collectProtocolFees or setProtocolFee is not called by the controller. ```solidity -error ContractUnlocked(); +error InvalidCaller(); ``` -### InvalidCaller -Thrown when collectProtocolFees or setProtocolFee is not called by the controller. +### ProtocolFeeCurrencySynced +Thrown when collectProtocolFees is attempted on a token that is synced. ```solidity -error InvalidCaller(); +error ProtocolFeeCurrencySynced(); ``` diff --git a/docs/contracts/v4/reference/core/interfaces/IUnlockCallback.md b/docs/contracts/v4/reference/core/interfaces/IUnlockCallback.md index 694cd96c8..b957d272c 100644 --- a/docs/contracts/v4/reference/core/interfaces/IUnlockCallback.md +++ b/docs/contracts/v4/reference/core/interfaces/IUnlockCallback.md @@ -1,6 +1,5 @@ # IUnlockCallback -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/callback/IUnlockCallback.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/callback/IUnlockCallback.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Interface for the callback executed when an address unlocks the pool manager diff --git a/docs/contracts/v4/reference/core/libraries/BitMath.md b/docs/contracts/v4/reference/core/libraries/BitMath.md index 4c883ff37..6c5312714 100644 --- a/docs/contracts/v4/reference/core/libraries/BitMath.md +++ b/docs/contracts/v4/reference/core/libraries/BitMath.md @@ -1,6 +1,5 @@ # BitMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/BitMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/BitMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Author:** Solady (https://github.com/Vectorized/solady/blob/8200a70e8dc2a77ecb074fc2e99a2a0d36547522/src/utils/LibBit.sol) diff --git a/docs/contracts/v4/reference/core/libraries/CurrencyDelta.md b/docs/contracts/v4/reference/core/libraries/CurrencyDelta.md index 8f5773d74..b54cb3b5e 100644 --- a/docs/contracts/v4/reference/core/libraries/CurrencyDelta.md +++ b/docs/contracts/v4/reference/core/libraries/CurrencyDelta.md @@ -1,6 +1,5 @@ # CurrencyDelta -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/CurrencyDelta.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/CurrencyDelta.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) *this library implements the equivalent of a mapping, as transient storage can only be accessed in assembly* diff --git a/docs/contracts/v4/reference/core/libraries/CurrencyReserves.md b/docs/contracts/v4/reference/core/libraries/CurrencyReserves.md index efcf3b9c4..17b49bd67 100644 --- a/docs/contracts/v4/reference/core/libraries/CurrencyReserves.md +++ b/docs/contracts/v4/reference/core/libraries/CurrencyReserves.md @@ -1,6 +1,5 @@ # CurrencyReserves -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/CurrencyReserves.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/CurrencyReserves.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## State Variables diff --git a/docs/contracts/v4/reference/core/libraries/CustomRevert.md b/docs/contracts/v4/reference/core/libraries/CustomRevert.md index bac7499bd..89652ce6a 100644 --- a/docs/contracts/v4/reference/core/libraries/CustomRevert.md +++ b/docs/contracts/v4/reference/core/libraries/CustomRevert.md @@ -1,6 +1,5 @@ # CustomRevert -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/CustomRevert.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/CustomRevert.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contains functions for reverting with custom errors with different argument types efficiently @@ -76,12 +75,23 @@ function revertWith(bytes4 selector, address value1, address value2) internal pu ### bubbleUpAndRevertWith -bubble up the revert message returned by a call and revert with the selector provided +bubble up the revert message returned by a call and revert with a wrapped ERC-7751 error -*this function should only be used with custom errors of the type `CustomError(address target, bytes revertReason)`* +*this method can be vulnerable to revert data bombs* ```solidity -function bubbleUpAndRevertWith(bytes4 selector, address addr) internal pure; +function bubbleUpAndRevertWith(address revertingContract, bytes4 revertingFunctionSelector, bytes4 additionalContext) + internal + pure; +``` + +## Errors +### WrappedError +*ERC-7751 error for wrapping bubbled up reverts* + + +```solidity +error WrappedError(address target, bytes4 selector, bytes reason, bytes details); ``` diff --git a/docs/contracts/v4/reference/core/libraries/FixedPoint128.md b/docs/contracts/v4/reference/core/libraries/FixedPoint128.md index 1697cd59b..c92cc7621 100644 --- a/docs/contracts/v4/reference/core/libraries/FixedPoint128.md +++ b/docs/contracts/v4/reference/core/libraries/FixedPoint128.md @@ -1,6 +1,5 @@ # FixedPoint128 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/FixedPoint128.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/FixedPoint128.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) diff --git a/docs/contracts/v4/reference/core/libraries/FixedPoint96.md b/docs/contracts/v4/reference/core/libraries/FixedPoint96.md index 0e1ba21f7..7d098dacd 100644 --- a/docs/contracts/v4/reference/core/libraries/FixedPoint96.md +++ b/docs/contracts/v4/reference/core/libraries/FixedPoint96.md @@ -1,6 +1,5 @@ # FixedPoint96 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/FixedPoint96.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/FixedPoint96.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) diff --git a/docs/contracts/v4/reference/core/libraries/FullMath.md b/docs/contracts/v4/reference/core/libraries/FullMath.md index 5228571ae..3fa739f7e 100644 --- a/docs/contracts/v4/reference/core/libraries/FullMath.md +++ b/docs/contracts/v4/reference/core/libraries/FullMath.md @@ -1,6 +1,5 @@ # FullMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/FullMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/FullMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision diff --git a/docs/contracts/v4/reference/core/libraries/Hooks.md b/docs/contracts/v4/reference/core/libraries/Hooks.md index 10b8f7cf4..2988766c9 100644 --- a/docs/contracts/v4/reference/core/libraries/Hooks.md +++ b/docs/contracts/v4/reference/core/libraries/Hooks.md @@ -1,6 +1,5 @@ # Hooks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/Hooks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/Hooks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) V4 decides whether to invoke specific hooks by inspecting the least significant bits of the address that the hooks contract is deployed to. @@ -158,7 +157,7 @@ function isValidHookAddress(IHooks self, uint24 fee) internal pure returns (bool ### callHook -performs a hook call using the given calldata on the given hook that doesnt return a delta +performs a hook call using the given calldata on the given hook that doesn't return a delta ```solidity @@ -201,9 +200,7 @@ calls beforeInitialize hook if permissioned and validates return value ```solidity -function beforeInitialize(IHooks self, PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hookData) - internal - noSelfCall(self); +function beforeInitialize(IHooks self, PoolKey memory key, uint160 sqrtPriceX96) internal noSelfCall(self); ``` ### afterInitialize @@ -212,9 +209,7 @@ calls afterInitialize hook if permissioned and validates return value ```solidity -function afterInitialize(IHooks self, PoolKey memory key, uint160 sqrtPriceX96, int24 tick, bytes calldata hookData) - internal - noSelfCall(self); +function afterInitialize(IHooks self, PoolKey memory key, uint160 sqrtPriceX96, int24 tick) internal noSelfCall(self); ``` ### beforeModifyLiquidity @@ -326,21 +321,14 @@ Hook did not return its selector error InvalidHookResponse(); ``` -### Wrap__FailedHookCall -thrown when a hook call fails +### HookCallFailed +Additional context for ERC-7751 wrapped error when a hook call fails ```solidity -error Wrap__FailedHookCall(address hook, bytes revertReason); +error HookCallFailed(); ``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`hook`|`address`|| -|`revertReason`|`bytes`|bubbled up revert reason| - ### HookDeltaExceedsSwapAmount The hook's delta changed the swap from exactIn to exactOut or vice versa diff --git a/docs/contracts/v4/reference/core/libraries/LPFeeLibrary.md b/docs/contracts/v4/reference/core/libraries/LPFeeLibrary.md index a9fcddb3f..d09280aeb 100644 --- a/docs/contracts/v4/reference/core/libraries/LPFeeLibrary.md +++ b/docs/contracts/v4/reference/core/libraries/LPFeeLibrary.md @@ -1,13 +1,12 @@ # LPFeeLibrary -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/LPFeeLibrary.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/LPFeeLibrary.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Library of helper functions for a pools LP fee ## State Variables ### DYNAMIC_FEE_FLAG -An lp fee of exactly 0b1000000... signals a dynamic fee pool. This isnt a valid static fee as it is > MAX_LP_FEE +An lp fee of exactly 0b1000000... signals a dynamic fee pool. This isn't a valid static fee as it is > MAX_LP_FEE ```solidity diff --git a/docs/contracts/v4/reference/core/libraries/LiquidityMath.md b/docs/contracts/v4/reference/core/libraries/LiquidityMath.md index 03c1136b8..3f5de6eba 100644 --- a/docs/contracts/v4/reference/core/libraries/LiquidityMath.md +++ b/docs/contracts/v4/reference/core/libraries/LiquidityMath.md @@ -1,6 +1,5 @@ # LiquidityMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/LiquidityMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/LiquidityMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/libraries/Lock.md b/docs/contracts/v4/reference/core/libraries/Lock.md index b578a70d9..f64208181 100644 --- a/docs/contracts/v4/reference/core/libraries/Lock.md +++ b/docs/contracts/v4/reference/core/libraries/Lock.md @@ -1,6 +1,5 @@ # Lock -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/Lock.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/Lock.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) This is a temporary library that allows us to use transient storage (tstore/tload) TODO: This library can be deleted when we have the transient keyword support in solidity. diff --git a/docs/contracts/v4/reference/core/libraries/NonzeroDeltaCount.md b/docs/contracts/v4/reference/core/libraries/NonzeroDeltaCount.md index bff21999c..8a04de784 100644 --- a/docs/contracts/v4/reference/core/libraries/NonzeroDeltaCount.md +++ b/docs/contracts/v4/reference/core/libraries/NonzeroDeltaCount.md @@ -1,6 +1,5 @@ # NonzeroDeltaCount -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/NonzeroDeltaCount.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/NonzeroDeltaCount.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) This is a temporary library that allows us to use transient storage (tstore/tload) for the nonzero delta count. diff --git a/docs/contracts/v4/reference/core/libraries/ParseBytes.md b/docs/contracts/v4/reference/core/libraries/ParseBytes.md index a5e153249..682a92878 100644 --- a/docs/contracts/v4/reference/core/libraries/ParseBytes.md +++ b/docs/contracts/v4/reference/core/libraries/ParseBytes.md @@ -1,6 +1,5 @@ # ParseBytes -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/ParseBytes.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/ParseBytes.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Parses bytes returned from hooks and the byte selector used to check return selectors from hooks. diff --git a/docs/contracts/v4/reference/core/libraries/Pool.md b/docs/contracts/v4/reference/core/libraries/Pool.md index d5c0fd413..8e0d37c16 100644 --- a/docs/contracts/v4/reference/core/libraries/Pool.md +++ b/docs/contracts/v4/reference/core/libraries/Pool.md @@ -1,6 +1,5 @@ # Pool -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/Pool.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/Pool.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) a library with all actions that can be performed on a pool @@ -19,9 +18,7 @@ function checkTicks(int24 tickLower, int24 tickUpper) private pure; ```solidity -function initialize(State storage self, uint160 sqrtPriceX96, uint24 protocolFee, uint24 lpFee) - internal - returns (int24 tick); +function initialize(State storage self, uint160 sqrtPriceX96, uint24 lpFee) internal returns (int24 tick); ``` ### setProtocolFee diff --git a/docs/contracts/v4/reference/core/libraries/Position.md b/docs/contracts/v4/reference/core/libraries/Position.md index 221ec3a00..d7b9c8670 100644 --- a/docs/contracts/v4/reference/core/libraries/Position.md +++ b/docs/contracts/v4/reference/core/libraries/Position.md @@ -1,6 +1,5 @@ # Position -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/Position.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/Position.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Positions represent an owner address' liquidity between a lower and upper tick boundary diff --git a/docs/contracts/v4/reference/core/libraries/ProtocolFeeLibrary.md b/docs/contracts/v4/reference/core/libraries/ProtocolFeeLibrary.md index 52e5bd26c..0c71798c5 100644 --- a/docs/contracts/v4/reference/core/libraries/ProtocolFeeLibrary.md +++ b/docs/contracts/v4/reference/core/libraries/ProtocolFeeLibrary.md @@ -1,6 +1,5 @@ # ProtocolFeeLibrary -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/ProtocolFeeLibrary.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/ProtocolFeeLibrary.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) library of functions related to protocol fees diff --git a/docs/contracts/v4/reference/core/libraries/SafeCast.md b/docs/contracts/v4/reference/core/libraries/SafeCast.md index 8865bf34a..3edb69a61 100644 --- a/docs/contracts/v4/reference/core/libraries/SafeCast.md +++ b/docs/contracts/v4/reference/core/libraries/SafeCast.md @@ -1,6 +1,5 @@ # SafeCast -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/SafeCast.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/SafeCast.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contains methods for safely casting between types diff --git a/docs/contracts/v4/reference/core/libraries/SqrtPriceMath.md b/docs/contracts/v4/reference/core/libraries/SqrtPriceMath.md index a6ca55748..8154eed72 100644 --- a/docs/contracts/v4/reference/core/libraries/SqrtPriceMath.md +++ b/docs/contracts/v4/reference/core/libraries/SqrtPriceMath.md @@ -1,6 +1,5 @@ # SqrtPriceMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/SqrtPriceMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/SqrtPriceMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contains the math that uses square root of price as a Q64.96 and liquidity to compute deltas diff --git a/docs/contracts/v4/reference/core/libraries/StateLibrary.md b/docs/contracts/v4/reference/core/libraries/StateLibrary.md index bdec514ac..e3a7e141a 100644 --- a/docs/contracts/v4/reference/core/libraries/StateLibrary.md +++ b/docs/contracts/v4/reference/core/libraries/StateLibrary.md @@ -1,6 +1,5 @@ # StateLibrary -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/StateLibrary.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/StateLibrary.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) A helper library to provide state getters that use extsload diff --git a/docs/contracts/v4/reference/core/libraries/SwapMath.md b/docs/contracts/v4/reference/core/libraries/SwapMath.md index 3a3ccd4a2..72c4cb9fb 100644 --- a/docs/contracts/v4/reference/core/libraries/SwapMath.md +++ b/docs/contracts/v4/reference/core/libraries/SwapMath.md @@ -1,6 +1,5 @@ # SwapMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/SwapMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/SwapMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contains methods for computing the result of a swap within a single tick price range, i.e., a single tick. diff --git a/docs/contracts/v4/reference/core/libraries/TickBitmap.md b/docs/contracts/v4/reference/core/libraries/TickBitmap.md index 975119714..43aa6f80d 100644 --- a/docs/contracts/v4/reference/core/libraries/TickBitmap.md +++ b/docs/contracts/v4/reference/core/libraries/TickBitmap.md @@ -1,6 +1,5 @@ # TickBitmap -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/TickBitmap.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/TickBitmap.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Stores a packed mapping of tick index to its initialized state diff --git a/docs/contracts/v4/reference/core/libraries/TickMath.md b/docs/contracts/v4/reference/core/libraries/TickMath.md index f1c7e664d..99e490a4d 100644 --- a/docs/contracts/v4/reference/core/libraries/TickMath.md +++ b/docs/contracts/v4/reference/core/libraries/TickMath.md @@ -1,6 +1,5 @@ # TickMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/TickMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/TickMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports prices between 2**-128 and 2**128 diff --git a/docs/contracts/v4/reference/core/libraries/TransientStateLibrary.md b/docs/contracts/v4/reference/core/libraries/TransientStateLibrary.md index bd9be0025..85b115065 100644 --- a/docs/contracts/v4/reference/core/libraries/TransientStateLibrary.md +++ b/docs/contracts/v4/reference/core/libraries/TransientStateLibrary.md @@ -1,6 +1,5 @@ # TransientStateLibrary -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/TransientStateLibrary.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/TransientStateLibrary.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) A helper library to provide state getters that use exttload diff --git a/docs/contracts/v4/reference/core/libraries/UnsafeMath.md b/docs/contracts/v4/reference/core/libraries/UnsafeMath.md index 0b6423831..dc23f66fa 100644 --- a/docs/contracts/v4/reference/core/libraries/UnsafeMath.md +++ b/docs/contracts/v4/reference/core/libraries/UnsafeMath.md @@ -1,6 +1,5 @@ # UnsafeMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/UnsafeMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/UnsafeMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contains methods that perform common math functions but do not do any overflow or underflow checks @@ -10,7 +9,7 @@ Contains methods that perform common math functions but do not do any overflow o Returns ceil(x / y) -*division by 0 has unspecified behavior, and must be checked externally* +*division by 0 will return 0, and should be checked externally* ```solidity @@ -34,7 +33,7 @@ function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z); Calculates floor(a×b÷denominator) -*division by 0 has unspecified behavior, and must be checked externally* +*division by 0 will return 0, and should be checked externally* ```solidity diff --git a/docs/contracts/v4/reference/core/test/ActionsRouter.md b/docs/contracts/v4/reference/core/test/ActionsRouter.md index a4d256f30..710e50229 100644 --- a/docs/contracts/v4/reference/core/test/ActionsRouter.md +++ b/docs/contracts/v4/reference/core/test/ActionsRouter.md @@ -1,145 +1,23 @@ -# ActionsRouter -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/ActionsRouter.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) - -**Inherits:** -[IUnlockCallback](/src/interfaces/callback/IUnlockCallback.sol/interface.IUnlockCallback.md), Test, GasSnapshot - -A router that handles an arbitrary input of actions. -TODO: Can continue to add functions per action. - - -## State Variables -### manager - -```solidity -IPoolManager manager; -``` - - -## Functions -### constructor - - -```solidity -constructor(IPoolManager _manager); -``` - -### unlockCallback - - -```solidity -function unlockCallback(bytes calldata data) external returns (bytes memory); -``` - -### executeActions - - -```solidity -function executeActions(Actions[] memory actions, bytes[] memory params) external payable; -``` - -### _settle - - -```solidity -function _settle() internal; -``` - -### _settleNative - - -```solidity -function _settleNative(bytes memory params) internal; -``` - -### _settleFor - - -```solidity -function _settleFor(bytes memory params) internal; -``` - -### _take - - -```solidity -function _take(bytes memory params) internal; -``` - -### _prankTakeFrom - - -```solidity -function _prankTakeFrom(bytes memory params) internal; -``` - -### _sync - - -```solidity -function _sync(bytes memory params) internal; -``` - -### _mint - - -```solidity -function _mint(bytes memory params) internal; -``` - -### _clear - - -```solidity -function _clear(bytes memory params) internal; -``` - -### _assertBalanceEquals - - -```solidity -function _assertBalanceEquals(bytes memory params) internal view; -``` - -### _assertReservesEquals - - -```solidity -function _assertReservesEquals(bytes memory params) internal view; -``` - -### _assertDeltaEquals - - -```solidity -function _assertDeltaEquals(bytes memory params) internal view; -``` - -### _assertNonzeroDeltaCountEquals - - -```solidity -function _assertNonzeroDeltaCountEquals(bytes memory params) internal view; -``` - -### _transferFrom - - -```solidity -function _transferFrom(bytes memory params) internal; -``` - -## Errors -### ActionNotSupported - -```solidity -error ActionNotSupported(); -``` - -### CheckParameters - -```solidity -error CheckParameters(); +# Actions +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/ActionsRouter.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + + +```solidity +enum Actions { + SETTLE, + SETTLE_NATIVE, + SETTLE_FOR, + TAKE, + PRANK_TAKE_FROM, + SYNC, + MINT, + CLEAR, + ASSERT_BALANCE_EQUALS, + ASSERT_RESERVES_EQUALS, + ASSERT_DELTA_EQUALS, + ASSERT_NONZERO_DELTA_COUNT_EQUALS, + TRANSFER_FROM, + COLLECT_PROTOCOL_FEES +} ``` diff --git a/docs/contracts/v4/reference/core/test/BaseTestHooks.md b/docs/contracts/v4/reference/core/test/BaseTestHooks.md index 2e8e924e0..5e48fe74c 100644 --- a/docs/contracts/v4/reference/core/test/BaseTestHooks.md +++ b/docs/contracts/v4/reference/core/test/BaseTestHooks.md @@ -1,6 +1,5 @@ # BaseTestHooks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/BaseTestHooks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/BaseTestHooks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IHooks](contracts/v4/reference/core/interfaces/IHooks.md) @@ -11,14 +10,14 @@ ```solidity -function beforeInitialize(address, PoolKey calldata, uint160, bytes calldata) external virtual returns (bytes4); +function beforeInitialize(address, PoolKey calldata, uint160) external virtual returns (bytes4); ``` ### afterInitialize ```solidity -function afterInitialize(address, PoolKey calldata, uint160, int24, bytes calldata) external virtual returns (bytes4); +function afterInitialize(address, PoolKey calldata, uint160, int24) external virtual returns (bytes4); ``` ### beforeAddLiquidity diff --git a/docs/contracts/v4/reference/core/test/CurrencyTest.md b/docs/contracts/v4/reference/core/test/CurrencyTest.md index c3119de34..7e9daa498 100644 --- a/docs/contracts/v4/reference/core/test/CurrencyTest.md +++ b/docs/contracts/v4/reference/core/test/CurrencyTest.md @@ -1,6 +1,5 @@ # CurrencyTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/CurrencyTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/CurrencyTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/CustomCurveHook.md b/docs/contracts/v4/reference/core/test/CustomCurveHook.md index 873aee153..6cd49cac6 100644 --- a/docs/contracts/v4/reference/core/test/CustomCurveHook.md +++ b/docs/contracts/v4/reference/core/test/CustomCurveHook.md @@ -1,6 +1,5 @@ # CustomCurveHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/CustomCurveHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/CustomCurveHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md) diff --git a/docs/contracts/v4/reference/core/test/DeltaReturningHook.md b/docs/contracts/v4/reference/core/test/DeltaReturningHook.md index 683df0a79..199613a9c 100644 --- a/docs/contracts/v4/reference/core/test/DeltaReturningHook.md +++ b/docs/contracts/v4/reference/core/test/DeltaReturningHook.md @@ -1,6 +1,5 @@ # DeltaReturningHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/DeltaReturningHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/DeltaReturningHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md) diff --git a/docs/contracts/v4/reference/core/test/DynamicFeesTestHook.md b/docs/contracts/v4/reference/core/test/DynamicFeesTestHook.md index 0396f4846..99103f98d 100644 --- a/docs/contracts/v4/reference/core/test/DynamicFeesTestHook.md +++ b/docs/contracts/v4/reference/core/test/DynamicFeesTestHook.md @@ -1,6 +1,5 @@ # DynamicFeesTestHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/DynamicFeesTestHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/DynamicFeesTestHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md) @@ -40,10 +39,7 @@ function setFee(uint24 _fee) external; ```solidity -function afterInitialize(address, PoolKey calldata key, uint160, int24, bytes calldata) - external - override - returns (bytes4); +function afterInitialize(address, PoolKey calldata key, uint160, int24) external override returns (bytes4); ``` ### beforeSwap diff --git a/docs/contracts/v4/reference/core/test/DynamicReturnFeeTestHook.md b/docs/contracts/v4/reference/core/test/DynamicReturnFeeTestHook.md index 54175aeda..e6c75c018 100644 --- a/docs/contracts/v4/reference/core/test/DynamicReturnFeeTestHook.md +++ b/docs/contracts/v4/reference/core/test/DynamicReturnFeeTestHook.md @@ -1,6 +1,5 @@ # DynamicReturnFeeTestHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/DynamicReturnFeeTestHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/DynamicReturnFeeTestHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md) diff --git a/docs/contracts/v4/reference/core/test/EmptyRevertContract.md b/docs/contracts/v4/reference/core/test/EmptyRevertContract.md index 4debb6afe..433eda3c0 100644 --- a/docs/contracts/v4/reference/core/test/EmptyRevertContract.md +++ b/docs/contracts/v4/reference/core/test/EmptyRevertContract.md @@ -1,6 +1,5 @@ # EmptyRevertContract -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/EmptyRevertContract.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/EmptyRevertContract.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/EmptyTestHooks.md b/docs/contracts/v4/reference/core/test/EmptyTestHooks.md index 45d387d19..1009622a1 100644 --- a/docs/contracts/v4/reference/core/test/EmptyTestHooks.md +++ b/docs/contracts/v4/reference/core/test/EmptyTestHooks.md @@ -1,6 +1,5 @@ # EmptyTestHooks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/EmptyTestHooks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/EmptyTestHooks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IHooks](contracts/v4/reference/core/interfaces/IHooks.md) @@ -18,18 +17,14 @@ constructor(); ```solidity -function beforeInitialize(address, PoolKey calldata, uint160, bytes calldata) external pure override returns (bytes4); +function beforeInitialize(address, PoolKey calldata, uint160) external pure override returns (bytes4); ``` ### afterInitialize ```solidity -function afterInitialize(address, PoolKey calldata, uint160, int24, bytes calldata) - external - pure - override - returns (bytes4); +function afterInitialize(address, PoolKey calldata, uint160, int24) external pure override returns (bytes4); ``` ### beforeAddLiquidity diff --git a/docs/contracts/v4/reference/core/test/FeeTakingHook.md b/docs/contracts/v4/reference/core/test/FeeTakingHook.md index 14753a00c..0b7b64e71 100644 --- a/docs/contracts/v4/reference/core/test/FeeTakingHook.md +++ b/docs/contracts/v4/reference/core/test/FeeTakingHook.md @@ -1,6 +1,5 @@ # FeeTakingHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/FeeTakingHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/FeeTakingHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md) diff --git a/docs/contracts/v4/reference/core/test/Fuzzers.md b/docs/contracts/v4/reference/core/test/Fuzzers.md index cd688d408..3efe7fe1b 100644 --- a/docs/contracts/v4/reference/core/test/Fuzzers.md +++ b/docs/contracts/v4/reference/core/test/Fuzzers.md @@ -1,6 +1,5 @@ # Fuzzers -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/Fuzzers.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/Fuzzers.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** StdUtils diff --git a/docs/contracts/v4/reference/core/test/HooksTest.md b/docs/contracts/v4/reference/core/test/HooksTest.md index b2ad68fa2..7b31b70a8 100644 --- a/docs/contracts/v4/reference/core/test/HooksTest.md +++ b/docs/contracts/v4/reference/core/test/HooksTest.md @@ -1,6 +1,5 @@ # HooksTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/HooksTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/HooksTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/LPFeeTakingHook.md b/docs/contracts/v4/reference/core/test/LPFeeTakingHook.md index 3fb4560dc..e238227eb 100644 --- a/docs/contracts/v4/reference/core/test/LPFeeTakingHook.md +++ b/docs/contracts/v4/reference/core/test/LPFeeTakingHook.md @@ -1,6 +1,5 @@ # LPFeeTakingHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/LPFeeTakingHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/LPFeeTakingHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md) diff --git a/docs/contracts/v4/reference/core/test/LiquidityMathTest.md b/docs/contracts/v4/reference/core/test/LiquidityMathTest.md index 9b1233578..2f1def5ca 100644 --- a/docs/contracts/v4/reference/core/test/LiquidityMathTest.md +++ b/docs/contracts/v4/reference/core/test/LiquidityMathTest.md @@ -1,6 +1,5 @@ # LiquidityMathTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/LiquidityMathTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/LiquidityMathTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/MockContract.md b/docs/contracts/v4/reference/core/test/MockContract.md index f71b022b0..e3fde7523 100644 --- a/docs/contracts/v4/reference/core/test/MockContract.md +++ b/docs/contracts/v4/reference/core/test/MockContract.md @@ -1,6 +1,5 @@ # MockContract -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/MockContract.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/MockContract.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** Proxy diff --git a/docs/contracts/v4/reference/core/test/MockERC6909Claims.md b/docs/contracts/v4/reference/core/test/MockERC6909Claims.md index 189fc85bc..da1a5b0b4 100644 --- a/docs/contracts/v4/reference/core/test/MockERC6909Claims.md +++ b/docs/contracts/v4/reference/core/test/MockERC6909Claims.md @@ -1,6 +1,5 @@ # MockERC6909Claims -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/MockERC6909Claims.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/MockERC6909Claims.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ERC6909Claims](contracts/v4/reference/core/ERC6909Claims.md) diff --git a/docs/contracts/v4/reference/core/test/MockHooks.md b/docs/contracts/v4/reference/core/test/MockHooks.md index 544b7e7f5..12552e7e0 100644 --- a/docs/contracts/v4/reference/core/test/MockHooks.md +++ b/docs/contracts/v4/reference/core/test/MockHooks.md @@ -1,6 +1,5 @@ # MockHooks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/MockHooks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/MockHooks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IHooks](contracts/v4/reference/core/interfaces/IHooks.md) @@ -96,20 +95,14 @@ mapping(PoolId => uint16) public lpFees; ```solidity -function beforeInitialize(address, PoolKey calldata, uint160, bytes calldata hookData) - external - override - returns (bytes4); +function beforeInitialize(address, PoolKey calldata, uint160) external override returns (bytes4); ``` ### afterInitialize ```solidity -function afterInitialize(address, PoolKey calldata, uint160, int24, bytes calldata hookData) - external - override - returns (bytes4); +function afterInitialize(address, PoolKey calldata, uint160, int24) external override returns (bytes4); ``` ### beforeAddLiquidity diff --git a/docs/contracts/v4/reference/core/test/NativeERC20.md b/docs/contracts/v4/reference/core/test/NativeERC20.md index 2a7bf1d3f..d58ae4255 100644 --- a/docs/contracts/v4/reference/core/test/NativeERC20.md +++ b/docs/contracts/v4/reference/core/test/NativeERC20.md @@ -1,6 +1,5 @@ # NativeERC20 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/NativeERC20.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/NativeERC20.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** Test diff --git a/docs/contracts/v4/reference/core/test/NoDelegateCallTest.md b/docs/contracts/v4/reference/core/test/NoDelegateCallTest.md index 2113d21f6..32eca69a3 100644 --- a/docs/contracts/v4/reference/core/test/NoDelegateCallTest.md +++ b/docs/contracts/v4/reference/core/test/NoDelegateCallTest.md @@ -1,6 +1,5 @@ # NoDelegateCallTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/NoDelegateCallTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/NoDelegateCallTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [NoDelegateCall](contracts/v4/reference/core/NoDelegateCall.md) diff --git a/docs/contracts/v4/reference/core/test/PoolClaimsTest.md b/docs/contracts/v4/reference/core/test/PoolClaimsTest.md index 814b573d4..d2da97fa1 100644 --- a/docs/contracts/v4/reference/core/test/PoolClaimsTest.md +++ b/docs/contracts/v4/reference/core/test/PoolClaimsTest.md @@ -1,6 +1,5 @@ # PoolClaimsTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolClaimsTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolClaimsTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolDonateTest.md b/docs/contracts/v4/reference/core/test/PoolDonateTest.md index 6711be4fd..b3ae0bee3 100644 --- a/docs/contracts/v4/reference/core/test/PoolDonateTest.md +++ b/docs/contracts/v4/reference/core/test/PoolDonateTest.md @@ -1,6 +1,5 @@ # PoolDonateTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolDonateTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolDonateTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolEmptyUnlockTest.md b/docs/contracts/v4/reference/core/test/PoolEmptyUnlockTest.md index 77b16f1d4..685fd4475 100644 --- a/docs/contracts/v4/reference/core/test/PoolEmptyUnlockTest.md +++ b/docs/contracts/v4/reference/core/test/PoolEmptyUnlockTest.md @@ -1,6 +1,5 @@ # PoolEmptyUnlockTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolEmptyUnlockTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolEmptyUnlockTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IUnlockCallback](/src/interfaces/callback/IUnlockCallback.sol/interface.IUnlockCallback.md) diff --git a/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTest.md b/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTest.md index fed6cc3a5..cc7ee5792 100644 --- a/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTest.md +++ b/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTest.md @@ -1,6 +1,5 @@ # PoolModifyLiquidityTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolModifyLiquidityTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolModifyLiquidityTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTestNoChecks.md b/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTestNoChecks.md index 0dfe79578..eb56c1405 100644 --- a/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTestNoChecks.md +++ b/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTestNoChecks.md @@ -1,6 +1,5 @@ # PoolModifyLiquidityTestNoChecks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolModifyLiquidityTestNoChecks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolModifyLiquidityTestNoChecks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolNestedActionsTest.md b/docs/contracts/v4/reference/core/test/PoolNestedActionsTest.md index 5e905eea8..49ead8a86 100644 --- a/docs/contracts/v4/reference/core/test/PoolNestedActionsTest.md +++ b/docs/contracts/v4/reference/core/test/PoolNestedActionsTest.md @@ -1,6 +1,5 @@ # NestedActionExecutor -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolNestedActionsTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolNestedActionsTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** Test, [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolSwapTest.md b/docs/contracts/v4/reference/core/test/PoolSwapTest.md index 79dbc23c9..eeb9fbb65 100644 --- a/docs/contracts/v4/reference/core/test/PoolSwapTest.md +++ b/docs/contracts/v4/reference/core/test/PoolSwapTest.md @@ -1,6 +1,5 @@ # PoolSwapTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolSwapTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolSwapTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolTakeTest.md b/docs/contracts/v4/reference/core/test/PoolTakeTest.md index c1fc3522b..f98d96956 100644 --- a/docs/contracts/v4/reference/core/test/PoolTakeTest.md +++ b/docs/contracts/v4/reference/core/test/PoolTakeTest.md @@ -1,6 +1,5 @@ # PoolTakeTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolTakeTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolTakeTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolTestBase.md b/docs/contracts/v4/reference/core/test/PoolTestBase.md index d08f9b757..cd9114f0e 100644 --- a/docs/contracts/v4/reference/core/test/PoolTestBase.md +++ b/docs/contracts/v4/reference/core/test/PoolTestBase.md @@ -1,6 +1,5 @@ # PoolTestBase -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolTestBase.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolTestBase.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IUnlockCallback](/src/interfaces/callback/IUnlockCallback.sol/interface.IUnlockCallback.md) diff --git a/docs/contracts/v4/reference/core/test/ProtocolFeesImplementation.md b/docs/contracts/v4/reference/core/test/ProtocolFeesImplementation.md index 9b6fe3366..2b1da1a8f 100644 --- a/docs/contracts/v4/reference/core/test/ProtocolFeesImplementation.md +++ b/docs/contracts/v4/reference/core/test/ProtocolFeesImplementation.md @@ -1,6 +1,5 @@ # ProtocolFeesImplementation -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/ProtocolFeesImplementation.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/ProtocolFeesImplementation.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ProtocolFees](contracts/v4/reference/core/ProtocolFees.md) @@ -22,6 +21,13 @@ bool internal isUnlocked; ## Functions +### constructor + + +```solidity +constructor() ProtocolFees(msg.sender); +``` + ### setPrice @@ -50,13 +56,6 @@ function setIsUnlocked(bool newValue) public; function _isUnlocked() internal view override returns (bool); ``` -### fetchProtocolFee - - -```solidity -function fetchProtocolFee(PoolKey memory key) public returns (uint24); -``` - ### updateProtocolFees diff --git a/docs/contracts/v4/reference/core/test/ProxyPoolManager.md b/docs/contracts/v4/reference/core/test/ProxyPoolManager.md index 89e430fa3..cf0365e99 100644 --- a/docs/contracts/v4/reference/core/test/ProxyPoolManager.md +++ b/docs/contracts/v4/reference/core/test/ProxyPoolManager.md @@ -1,6 +1,5 @@ # ProxyPoolManager -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/ProxyPoolManager.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/ProxyPoolManager.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IPoolManager](contracts/v4/reference/core/interfaces/IPoolManager.md), [ProtocolFees](contracts/v4/reference/core/ProtocolFees.md), [NoDelegateCall](contracts/v4/reference/core/NoDelegateCall.md), [ERC6909Claims](contracts/v4/reference/core/ERC6909Claims.md), [Extsload](contracts/v4/reference/core/Extsload.md), [Exttload](contracts/v4/reference/core/Exttload.md) @@ -42,7 +41,7 @@ address internal immutable _delegateManager; ```solidity -constructor(address delegateManager); +constructor(address delegateManager) ProtocolFees(msg.sender); ``` ### onlyWhenUnlocked @@ -86,10 +85,7 @@ Initialize the state for a given pool ID ```solidity -function initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hookData) - external - noDelegateCall - returns (int24 tick); +function initialize(PoolKey memory key, uint160 sqrtPriceX96) external noDelegateCall returns (int24 tick); ``` **Parameters** @@ -97,7 +93,6 @@ function initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hoo |----|----|-----------| |`key`|`PoolKey`|The pool key for the pool to initialize| |`sqrtPriceX96`|`uint160`|The initial square root price| -|`hookData`|`bytes`|The data to pass through to the initialize hooks| **Returns** @@ -217,7 +212,7 @@ function sync(Currency currency) public; Called by the user to net out some value owed to the user -*Can also be used as a mechanism for _free_ flash loans* +*Will revert if the requested amount is not available, consider using `mint` instead* ```solidity diff --git a/docs/contracts/v4/reference/core/test/SkipCallsTestHook.md b/docs/contracts/v4/reference/core/test/SkipCallsTestHook.md index 7bc7eb18c..25f641476 100644 --- a/docs/contracts/v4/reference/core/test/SkipCallsTestHook.md +++ b/docs/contracts/v4/reference/core/test/SkipCallsTestHook.md @@ -1,6 +1,5 @@ # SkipCallsTestHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/SkipCallsTestHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/SkipCallsTestHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md), Test @@ -33,17 +32,14 @@ function setManager(IPoolManager _manager) external; ```solidity -function beforeInitialize(address, PoolKey calldata key, uint160 sqrtPriceX96, bytes calldata hookData) - external - override - returns (bytes4); +function beforeInitialize(address, PoolKey calldata key, uint160 sqrtPriceX96) external override returns (bytes4); ``` ### afterInitialize ```solidity -function afterInitialize(address, PoolKey calldata key, uint160 sqrtPriceX96, int24, bytes calldata hookData) +function afterInitialize(address, PoolKey calldata key, uint160 sqrtPriceX96, int24) external override returns (bytes4); @@ -148,7 +144,7 @@ function afterDonate(address, PoolKey calldata key, uint256 amt0, uint256 amt1, ```solidity -function _initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hookData) public; +function _initialize(PoolKey memory key, uint160 sqrtPriceX96) public; ``` ### _swap diff --git a/docs/contracts/v4/reference/core/test/SqrtPriceMathEchidnaTest.md b/docs/contracts/v4/reference/core/test/SqrtPriceMathEchidnaTest.md index 2cfe2cc5d..43ade74ce 100644 --- a/docs/contracts/v4/reference/core/test/SqrtPriceMathEchidnaTest.md +++ b/docs/contracts/v4/reference/core/test/SqrtPriceMathEchidnaTest.md @@ -1,6 +1,5 @@ # SqrtPriceMathEchidnaTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/SqrtPriceMathEchidnaTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/SqrtPriceMathEchidnaTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/SwapRouterNoChecks.md b/docs/contracts/v4/reference/core/test/SwapRouterNoChecks.md index 71492fe1d..d15f52e68 100644 --- a/docs/contracts/v4/reference/core/test/SwapRouterNoChecks.md +++ b/docs/contracts/v4/reference/core/test/SwapRouterNoChecks.md @@ -1,6 +1,5 @@ # SwapRouterNoChecks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/SwapRouterNoChecks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/SwapRouterNoChecks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/TestERC20.md b/docs/contracts/v4/reference/core/test/TestERC20.md index ab11fad9b..1c923ea38 100644 --- a/docs/contracts/v4/reference/core/test/TestERC20.md +++ b/docs/contracts/v4/reference/core/test/TestERC20.md @@ -1,6 +1,5 @@ # TestERC20 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/TestERC20.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/TestERC20.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IERC20Minimal](contracts/v4/reference/core/interfaces/IERC20Minimal.md) diff --git a/docs/contracts/v4/reference/core/test/TestInvalidERC20.md b/docs/contracts/v4/reference/core/test/TestInvalidERC20.md index 2806696ee..7961429ad 100644 --- a/docs/contracts/v4/reference/core/test/TestInvalidERC20.md +++ b/docs/contracts/v4/reference/core/test/TestInvalidERC20.md @@ -1,6 +1,5 @@ # TestInvalidERC20 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/TestInvalidERC20.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/TestInvalidERC20.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IERC20Minimal](contracts/v4/reference/core/interfaces/IERC20Minimal.md) diff --git a/docs/contracts/v4/reference/core/test/TickMathEchidnaTest.md b/docs/contracts/v4/reference/core/test/TickMathEchidnaTest.md index c8a82b170..c711f44ad 100644 --- a/docs/contracts/v4/reference/core/test/TickMathEchidnaTest.md +++ b/docs/contracts/v4/reference/core/test/TickMathEchidnaTest.md @@ -1,6 +1,5 @@ # TickMathEchidnaTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/TickMathEchidnaTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/TickMathEchidnaTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/TickMathTest.md b/docs/contracts/v4/reference/core/test/TickMathTest.md index 125d626fa..3fea9bc35 100644 --- a/docs/contracts/v4/reference/core/test/TickMathTest.md +++ b/docs/contracts/v4/reference/core/test/TickMathTest.md @@ -1,6 +1,5 @@ # TickMathTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/TickMathTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/TickMathTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/TickOverflowSafetyEchidnaTest.md b/docs/contracts/v4/reference/core/test/TickOverflowSafetyEchidnaTest.md index 94994b341..14bef07ef 100644 --- a/docs/contracts/v4/reference/core/test/TickOverflowSafetyEchidnaTest.md +++ b/docs/contracts/v4/reference/core/test/TickOverflowSafetyEchidnaTest.md @@ -1,6 +1,5 @@ # TickOverflowSafetyEchidnaTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/TickOverflowSafetyEchidnaTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/TickOverflowSafetyEchidnaTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## State Variables diff --git a/docs/contracts/v4/reference/core/types/PoolId.md b/docs/contracts/v4/reference/core/types/PoolId.md index 75802b558..844f1586e 100644 --- a/docs/contracts/v4/reference/core/types/PoolId.md +++ b/docs/contracts/v4/reference/core/types/PoolId.md @@ -1,6 +1,5 @@ # PoolId -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/types/PoolId.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/types/PoolId.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ```solidity diff --git a/docs/contracts/v4/reference/core/types/Slot0.md b/docs/contracts/v4/reference/core/types/Slot0.md index 0ad18c3b8..383f019b3 100644 --- a/docs/contracts/v4/reference/core/types/Slot0.md +++ b/docs/contracts/v4/reference/core/types/Slot0.md @@ -1,6 +1,5 @@ # Slot0 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/types/Slot0.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/types/Slot0.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) *Slot0 is a packed version of solidity structure. Using the packaged version saves gas by not storing the structure fields in memory slots. diff --git a/docs/contracts/v4/reference/periphery/PositionDescriptor.md b/docs/contracts/v4/reference/periphery/PositionDescriptor.md new file mode 100644 index 000000000..e41a18eed --- /dev/null +++ b/docs/contracts/v4/reference/periphery/PositionDescriptor.md @@ -0,0 +1,149 @@ +# PositionDescriptor +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/PositionDescriptor.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +[IPositionDescriptor](contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md) + +Produces a string containing the data URI for a JSON metadata string + + +## State Variables +### DAI + +```solidity +address private constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F; +``` + + +### USDC + +```solidity +address private constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; +``` + + +### USDT + +```solidity +address private constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7; +``` + + +### TBTC + +```solidity +address private constant TBTC = 0x8dAEBADE922dF735c38C80C7eBD708Af50815fAa; +``` + + +### WBTC + +```solidity +address private constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599; +``` + + +### wrappedNative + +```solidity +address public immutable wrappedNative; +``` + + +### nativeCurrencyLabel + +```solidity +string public nativeCurrencyLabel; +``` + + +### poolManager + +```solidity +IPoolManager public immutable poolManager; +``` + + +## Functions +### constructor + + +```solidity +constructor(IPoolManager _poolManager, address _wrappedNative, string memory _nativeCurrencyLabel); +``` + +### tokenURI + +Produces the URI describing a particular token ID + +*Note this URI may be a data: URI with the JSON contents directly inlined* + + +```solidity +function tokenURI(IPositionManager positionManager, uint256 tokenId) external view override returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`positionManager`|`IPositionManager`|The position manager for which to describe the token| +|`tokenId`|`uint256`|The ID of the token for which to produce a description, which may not be valid| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The URI of the ERC721-compliant metadata| + + +### flipRatio + +Returns true if currency0 has higher priority than currency1 + + +```solidity +function flipRatio(address currency0, address currency1) public view returns (bool); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currency0`|`address`|The first currency address| +|`currency1`|`address`|The second currency address| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bool`|flipRatio True if currency0 has higher priority than currency1| + + +### currencyRatioPriority + +Returns the priority of a currency. +For certain currencies on mainnet, the smaller the currency, the higher the priority + + +```solidity +function currencyRatioPriority(address currency) public view returns (int256); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currency`|`address`|The currency address| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`int256`|priority The priority of the currency| + + +## Errors +### InvalidTokenId + +```solidity +error InvalidTokenId(uint256 tokenId); +``` + diff --git a/docs/contracts/v4/reference/periphery/PositionManager.md b/docs/contracts/v4/reference/periphery/PositionManager.md index 930bb5413..85cc0372c 100644 --- a/docs/contracts/v4/reference/periphery/PositionManager.md +++ b/docs/contracts/v4/reference/periphery/PositionManager.md @@ -1,9 +1,8 @@ # PositionManager -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/PositionManager.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/PositionManager.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** -[IPositionManager](contracts/v4/reference/periphery/interfaces/IPositionManager.md), [ERC721Permit_v4](contracts/v4/reference/periphery/base/ERC721Permit_v4.md), [PoolInitializer](contracts/v4/reference/periphery/base/PoolInitializer.md), [Multicall_v4](contracts/v4/reference/periphery/base/Multicall_v4.md), [DeltaResolver](contracts/v4/reference/periphery/base/DeltaResolver.md), [ReentrancyLock](contracts/v4/reference/periphery/base/ReentrancyLock.md), [BaseActionsRouter](contracts/v4/reference/periphery/base/BaseActionsRouter.md), [Notifier](contracts/v4/reference/periphery/base/Notifier.md), [Permit2Forwarder](contracts/v4/reference/periphery/base/Permit2Forwarder.md) +[IPositionManager](contracts/v4/reference/periphery/interfaces/IPositionManager.md), [ERC721Permit_v4](contracts/v4/reference/periphery/base/ERC721Permit_v4.md), [PoolInitializer](contracts/v4/reference/periphery/base/PoolInitializer.md), [Multicall_v4](contracts/v4/reference/periphery/base/Multicall_v4.md), [DeltaResolver](contracts/v4/reference/periphery/base/DeltaResolver.md), [ReentrancyLock](contracts/v4/reference/periphery/base/ReentrancyLock.md), [BaseActionsRouter](contracts/v4/reference/periphery/base/BaseActionsRouter.md), [Notifier](contracts/v4/reference/periphery/base/Notifier.md), [Permit2Forwarder](contracts/v4/reference/periphery/base/Permit2Forwarder.md), [NativeWrapper](contracts/v4/reference/periphery/base/NativeWrapper.md) The PositionManager (PosM) contract is responsible for creating liquidity positions on v4. PosM mints and manages ERC721 tokens associated with each position. @@ -21,6 +20,13 @@ uint256 public nextTokenId = 1; ``` +### tokenDescriptor + +```solidity +IPositionDescriptor public immutable tokenDescriptor; +``` + + ### positionInfo ```solidity @@ -40,11 +46,18 @@ mapping(bytes25 poolId => PoolKey poolKey) public poolKeys; ```solidity -constructor(IPoolManager _poolManager, IAllowanceTransfer _permit2, uint256 _unsubscribeGasLimit) +constructor( + IPoolManager _poolManager, + IAllowanceTransfer _permit2, + uint256 _unsubscribeGasLimit, + IPositionDescriptor _tokenDescriptor, + IWETH9 _weth9 +) BaseActionsRouter(_poolManager) Permit2Forwarder(_permit2) - ERC721Permit_v4("Uniswap V4 Positions NFT", "UNI-V4-POSM") - Notifier(_unsubscribeGasLimit); + ERC721Permit_v4("Uniswap v4 Positions NFT", "UNI-V4-POSM") + Notifier(_unsubscribeGasLimit) + NativeWrapper(_weth9); ``` ### checkDeadline @@ -81,6 +94,22 @@ modifier onlyIfApproved(address caller, uint256 tokenId) override; |`tokenId`|`uint256`|the unique identifier of the ERC721 token| +### onlyIfPoolManagerLocked + +Enforces that the PoolManager is locked. + + +```solidity +modifier onlyIfPoolManagerLocked() override; +``` + +### tokenURI + + +```solidity +function tokenURI(uint256 tokenId) public view override returns (string memory); +``` + ### modifyLiquidities Unlocks Uniswap v4 PoolManager and batches actions for modifying liquidity @@ -273,9 +302,11 @@ function _setUnsubscribed(uint256 tokenId) internal override; *overrides solmate transferFrom in case a notification to subscribers is needed* +*will revert if pool manager is locked* + ```solidity -function transferFrom(address from, address to, uint256 id) public virtual override; +function transferFrom(address from, address to, uint256 id) public virtual override onlyIfPoolManagerLocked; ``` ### getPoolAndPositionInfo diff --git a/docs/contracts/v4/reference/periphery/UniswapV4DeployerCompetition.md b/docs/contracts/v4/reference/periphery/UniswapV4DeployerCompetition.md new file mode 100644 index 000000000..b3f60bdad --- /dev/null +++ b/docs/contracts/v4/reference/periphery/UniswapV4DeployerCompetition.md @@ -0,0 +1,122 @@ +# UniswapV4DeployerCompetition +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/UniswapV4DeployerCompetition.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +[IUniswapV4DeployerCompetition](contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md) + +A contract to crowdsource a salt for the best Uniswap V4 address + + +## State Variables +### bestAddressSalt +*The salt for the best address found so far* + + +```solidity +bytes32 public bestAddressSalt; +``` + + +### bestAddressSubmitter +*The submitter of the best address found so far* + + +```solidity +address public bestAddressSubmitter; +``` + + +### competitionDeadline +*The deadline for the competition* + + +```solidity +uint256 public immutable competitionDeadline; +``` + + +### initCodeHash +*The init code hash of the V4 contract* + + +```solidity +bytes32 public immutable initCodeHash; +``` + + +### deployer +*The deployer who can initiate the deployment of the v4 PoolManager, until the exclusive deploy deadline.* + +*After this deadline anyone can deploy.* + + +```solidity +address public immutable deployer; +``` + + +### exclusiveDeployDeadline +*The deadline for exclusive deployment by deployer after deadline* + + +```solidity +uint256 public immutable exclusiveDeployDeadline; +``` + + +## Functions +### constructor + + +```solidity +constructor( + bytes32 _initCodeHash, + uint256 _competitionDeadline, + address _exclusiveDeployer, + uint256 _exclusiveDeployLength +); +``` + +### updateBestAddress + +Updates the best address if the new address has a better vanity score + +*The first 20 bytes of the salt must be either address(0) or msg.sender* + + +```solidity +function updateBestAddress(bytes32 salt) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`salt`|`bytes32`|The salt to use to compute the new address with CREATE2| + + +### deploy + +deploys the Uniswap v4 PoolManager contract + +*The bytecode must match the initCodeHash* + + +```solidity +function deploy(bytes memory bytecode) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`bytecode`|`bytes`|The bytecode of the Uniswap v4 PoolManager contract| + + +### bestAddress + +*returns the best address found so far* + + +```solidity +function bestAddress() public view returns (address); +``` + diff --git a/docs/contracts/v4/reference/periphery/V4Router.md b/docs/contracts/v4/reference/periphery/V4Router.md index 6f660622f..16d1464e5 100644 --- a/docs/contracts/v4/reference/periphery/V4Router.md +++ b/docs/contracts/v4/reference/periphery/V4Router.md @@ -1,11 +1,10 @@ # V4Router -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/V4Router.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/V4Router.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IV4Router](contracts/v4/reference/periphery/interfaces/IV4Router.md), [BaseActionsRouter](contracts/v4/reference/periphery/base/BaseActionsRouter.md), [DeltaResolver](contracts/v4/reference/periphery/base/DeltaResolver.md) -Abstract contract that contains all internal logic needed for routing through Uniswap V4 pools +Abstract contract that contains all internal logic needed for routing through Uniswap v4 pools *the entry point to executing actions in this contract is calling `BaseActionsRouter._executeActions` An inheriting contract should call _executeActions at the point that they wish actions to be executed* @@ -58,12 +57,8 @@ function _swapExactOutput(IV4Router.ExactOutputParams calldata params) private; ```solidity -function _swap( - PoolKey memory poolKey, - bool zeroForOne, - int256 amountSpecified, - uint160 sqrtPriceLimitX96, - bytes calldata hookData -) private returns (int128 reciprocalAmount); +function _swap(PoolKey memory poolKey, bool zeroForOne, int256 amountSpecified, bytes calldata hookData) + private + returns (int128 reciprocalAmount); ``` diff --git a/docs/contracts/v4/reference/periphery/base/BaseActionsRouter.md b/docs/contracts/v4/reference/periphery/base/BaseActionsRouter.md index b62d9e0d0..8e2e220f9 100644 --- a/docs/contracts/v4/reference/periphery/base/BaseActionsRouter.md +++ b/docs/contracts/v4/reference/periphery/base/BaseActionsRouter.md @@ -1,6 +1,5 @@ # BaseActionsRouter -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/BaseActionsRouter.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/BaseActionsRouter.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [SafeCallback](contracts/v4/reference/periphery/base/SafeCallback.md) diff --git a/docs/contracts/v4/reference/periphery/base/BaseHook.md b/docs/contracts/v4/reference/periphery/base/BaseHook.md index 807a727d6..cee0f211c 100644 --- a/docs/contracts/v4/reference/periphery/base/BaseHook.md +++ b/docs/contracts/v4/reference/periphery/base/BaseHook.md @@ -1,6 +1,5 @@ # BaseHook -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/hooks/BaseHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/hooks/BaseHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** IHooks, [SafeCallback](contracts/v4/reference/periphery/base/SafeCallback.md) @@ -71,7 +70,7 @@ The hook called before the state of a pool is initialized ```solidity -function beforeInitialize(address, PoolKey calldata, uint160, bytes calldata) external virtual returns (bytes4); +function beforeInitialize(address, PoolKey calldata, uint160) external virtual returns (bytes4); ``` **Parameters** @@ -80,7 +79,6 @@ function beforeInitialize(address, PoolKey calldata, uint160, bytes calldata) ex |``|`address`|| |``|`PoolKey`|| |``|`uint160`|| -|``|`bytes`|| **Returns** @@ -95,7 +93,7 @@ The hook called after the state of a pool is initialized ```solidity -function afterInitialize(address, PoolKey calldata, uint160, int24, bytes calldata) external virtual returns (bytes4); +function afterInitialize(address, PoolKey calldata, uint160, int24) external virtual returns (bytes4); ``` **Parameters** @@ -105,7 +103,6 @@ function afterInitialize(address, PoolKey calldata, uint160, int24, bytes callda |``|`PoolKey`|| |``|`uint160`|| |``|`int24`|| -|``|`bytes`|| **Returns** diff --git a/docs/contracts/v4/reference/periphery/base/BaseV4Quoter.md b/docs/contracts/v4/reference/periphery/base/BaseV4Quoter.md index 19fc5ab59..5f209f8a6 100644 --- a/docs/contracts/v4/reference/periphery/base/BaseV4Quoter.md +++ b/docs/contracts/v4/reference/periphery/base/BaseV4Quoter.md @@ -1,6 +1,5 @@ # BaseV4Quoter -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/BaseV4Quoter.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/BaseV4Quoter.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [SafeCallback](contracts/v4/reference/periphery/base/SafeCallback.md) diff --git a/docs/contracts/v4/reference/periphery/base/DeltaResolver.md b/docs/contracts/v4/reference/periphery/base/DeltaResolver.md index 13f3a80ff..6138f6d54 100644 --- a/docs/contracts/v4/reference/periphery/base/DeltaResolver.md +++ b/docs/contracts/v4/reference/periphery/base/DeltaResolver.md @@ -1,6 +1,5 @@ # DeltaResolver -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/DeltaResolver.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/DeltaResolver.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ImmutableState](contracts/v4/reference/periphery/base/ImmutableState.md) @@ -15,6 +14,8 @@ Abstract contract used to sync, send, and settle funds to the pool manager Take an amount of currency out of the PoolManager +*Returns early if the amount is 0* + ```solidity function _take(Currency currency, address recipient, uint256 amount) internal; @@ -34,6 +35,8 @@ Pay and settle a currency to the PoolManager *The implementing contract must ensure that the `payer` is a secure address* +*Returns early if the amount is 0* + ```solidity function _settle(Currency currency, address payer, uint256 amount) internal; @@ -126,6 +129,26 @@ Calculates the amount for a take action function _mapTakeAmount(uint256 amount, Currency currency) internal view returns (uint256); ``` +### _mapWrapUnwrapAmount + +Calculates the sanitized amount before wrapping/unwrapping. + + +```solidity +function _mapWrapUnwrapAmount(Currency inputCurrency, uint256 amount, Currency outputCurrency) + internal + view + returns (uint256); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`inputCurrency`|`Currency`|The currency, either native or wrapped native, that this contract holds| +|`amount`|`uint256`|The amount to wrap or unwrap. Can be CONTRACT_BALANCE, OPEN_DELTA or a specific amount| +|`outputCurrency`|`Currency`|The currency after the wrap/unwrap that the user may owe a balance in on the poolManager| + + ## Errors ### DeltaNotPositive Emitted trying to settle a positive delta. @@ -143,3 +166,11 @@ Emitted trying to take a negative delta. error DeltaNotNegative(Currency currency); ``` +### InsufficientBalance +Emitted when the contract does not have enough balance to wrap or unwrap. + + +```solidity +error InsufficientBalance(); +``` + diff --git a/docs/contracts/v4/reference/periphery/base/EIP712_v4.md b/docs/contracts/v4/reference/periphery/base/EIP712_v4.md index c6e7d86cc..6e6748bf1 100644 --- a/docs/contracts/v4/reference/periphery/base/EIP712_v4.md +++ b/docs/contracts/v4/reference/periphery/base/EIP712_v4.md @@ -1,6 +1,5 @@ # EIP712_v4 -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/EIP712_v4.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/EIP712_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IEIP712_v4](contracts/v4/reference/periphery/interfaces/IEIP712_v4.md) diff --git a/docs/contracts/v4/reference/periphery/base/ERC721Permit_v4.md b/docs/contracts/v4/reference/periphery/base/ERC721Permit_v4.md index f164a7986..d82aa5e8a 100644 --- a/docs/contracts/v4/reference/periphery/base/ERC721Permit_v4.md +++ b/docs/contracts/v4/reference/periphery/base/ERC721Permit_v4.md @@ -1,6 +1,5 @@ # ERC721Permit_v4 -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/ERC721Permit_v4.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/ERC721Permit_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** ERC721, [IERC721Permit_v4](contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md), [EIP712_v4](contracts/v4/reference/periphery/base/EIP712_v4.md), [UnorderedNonce](contracts/v4/reference/periphery/base/UnorderedNonce.md) @@ -144,10 +143,3 @@ function _approve(address owner, address spender, uint256 id) internal; function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool); ``` -### tokenURI - - -```solidity -function tokenURI(uint256) public pure override returns (string memory); -``` - diff --git a/docs/contracts/v4/reference/periphery/base/ImmutableState.md b/docs/contracts/v4/reference/periphery/base/ImmutableState.md index 237bf3816..00f002714 100644 --- a/docs/contracts/v4/reference/periphery/base/ImmutableState.md +++ b/docs/contracts/v4/reference/periphery/base/ImmutableState.md @@ -1,6 +1,8 @@ # ImmutableState -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/ImmutableState.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/ImmutableState.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +[IImmutableState](contracts/v4/reference/periphery/interfaces/IImmutableState.md) A collection of immutable state variables, commonly used across multiple contracts diff --git a/docs/contracts/v4/reference/periphery/base/Multicall_v4.md b/docs/contracts/v4/reference/periphery/base/Multicall_v4.md index b271c7c01..61625ecdc 100644 --- a/docs/contracts/v4/reference/periphery/base/Multicall_v4.md +++ b/docs/contracts/v4/reference/periphery/base/Multicall_v4.md @@ -1,6 +1,5 @@ # Multicall_v4 -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/Multicall_v4.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/Multicall_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IMulticall_v4](contracts/v4/reference/periphery/interfaces/IMulticall_v4.md) diff --git a/docs/contracts/v4/reference/periphery/base/NativeWrapper.md b/docs/contracts/v4/reference/periphery/base/NativeWrapper.md new file mode 100644 index 000000000..c97b5c7df --- /dev/null +++ b/docs/contracts/v4/reference/periphery/base/NativeWrapper.md @@ -0,0 +1,61 @@ +# NativeWrapper +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/NativeWrapper.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +[ImmutableState](contracts/v4/reference/periphery/base/ImmutableState.md) + +Used for wrapping and unwrapping native + + +## State Variables +### WETH9 +The address for WETH9 + + +```solidity +IWETH9 public immutable WETH9; +``` + + +## Functions +### constructor + + +```solidity +constructor(IWETH9 _weth9); +``` + +### _wrap + +*The amount should already be <= the current balance in this contract.* + + +```solidity +function _wrap(uint256 amount) internal; +``` + +### _unwrap + +*The amount should already be <= the current balance in this contract.* + + +```solidity +function _unwrap(uint256 amount) internal; +``` + +### receive + + +```solidity +receive() external payable; +``` + +## Errors +### InvalidEthSender +Thrown when an unexpected address sends ETH to this contract + + +```solidity +error InvalidEthSender(); +``` + diff --git a/docs/contracts/v4/reference/periphery/base/Notifier.md b/docs/contracts/v4/reference/periphery/base/Notifier.md index 4ae9c0e0d..787b9a04e 100644 --- a/docs/contracts/v4/reference/periphery/base/Notifier.md +++ b/docs/contracts/v4/reference/periphery/base/Notifier.md @@ -1,6 +1,5 @@ # Notifier -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/Notifier.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/Notifier.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [INotifier](contracts/v4/reference/periphery/interfaces/INotifier.md) @@ -60,6 +59,15 @@ modifier onlyIfApproved(address caller, uint256 tokenId) virtual; |`tokenId`|`uint256`|the tokenId of the position| +### onlyIfPoolManagerLocked + +Enforces that the PoolManager is locked. + + +```solidity +modifier onlyIfPoolManagerLocked() virtual; +``` + ### _setUnsubscribed @@ -85,6 +93,7 @@ Enables the subscriber to receive notifications for a respective position function subscribe(uint256 tokenId, address newSubscriber, bytes calldata data) external payable + onlyIfPoolManagerLocked onlyIfApproved(msg.sender, tokenId); ``` **Parameters** @@ -104,7 +113,7 @@ Removes the subscriber from receiving notifications for a respective position ```solidity -function unsubscribe(uint256 tokenId) external payable onlyIfApproved(msg.sender, tokenId); +function unsubscribe(uint256 tokenId) external payable onlyIfPoolManagerLocked onlyIfApproved(msg.sender, tokenId); ``` **Parameters** diff --git a/docs/contracts/v4/reference/periphery/base/Permit2Forwarder.md b/docs/contracts/v4/reference/periphery/base/Permit2Forwarder.md index 4f6619e6e..2be890f00 100644 --- a/docs/contracts/v4/reference/periphery/base/Permit2Forwarder.md +++ b/docs/contracts/v4/reference/periphery/base/Permit2Forwarder.md @@ -1,6 +1,5 @@ # Permit2Forwarder -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/Permit2Forwarder.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/Permit2Forwarder.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) PermitForwarder allows permitting this contract as a spender on permit2 diff --git a/docs/contracts/v4/reference/periphery/base/PoolInitializer.md b/docs/contracts/v4/reference/periphery/base/PoolInitializer.md index 8539df017..9a28f5fa4 100644 --- a/docs/contracts/v4/reference/periphery/base/PoolInitializer.md +++ b/docs/contracts/v4/reference/periphery/base/PoolInitializer.md @@ -1,6 +1,5 @@ # PoolInitializer -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/PoolInitializer.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/PoolInitializer.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ImmutableState](contracts/v4/reference/periphery/base/ImmutableState.md) @@ -17,10 +16,7 @@ Initialize a Uniswap v4 Pool ```solidity -function initializePool(PoolKey calldata key, uint160 sqrtPriceX96, bytes calldata hookData) - external - payable - returns (int24); +function initializePool(PoolKey calldata key, uint160 sqrtPriceX96) external payable returns (int24); ``` **Parameters** @@ -28,6 +24,5 @@ function initializePool(PoolKey calldata key, uint160 sqrtPriceX96, bytes callda |----|----|-----------| |`key`|`PoolKey`|the PoolKey of the pool to initialize| |`sqrtPriceX96`|`uint160`|the initial sqrtPriceX96 of the pool| -|`hookData`|`bytes`|the optional data passed to the hook's initialize functions| diff --git a/docs/contracts/v4/reference/periphery/base/ReentrancyLock.md b/docs/contracts/v4/reference/periphery/base/ReentrancyLock.md index f482528dd..ce94a6051 100644 --- a/docs/contracts/v4/reference/periphery/base/ReentrancyLock.md +++ b/docs/contracts/v4/reference/periphery/base/ReentrancyLock.md @@ -1,6 +1,5 @@ # ReentrancyLock -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/ReentrancyLock.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/ReentrancyLock.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) A transient reentrancy lock, that stores the caller's address as the lock diff --git a/docs/contracts/v4/reference/periphery/base/SafeCallback.md b/docs/contracts/v4/reference/periphery/base/SafeCallback.md index b43628eb8..744a26874 100644 --- a/docs/contracts/v4/reference/periphery/base/SafeCallback.md +++ b/docs/contracts/v4/reference/periphery/base/SafeCallback.md @@ -1,6 +1,5 @@ # SafeCallback -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/SafeCallback.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/SafeCallback.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ImmutableState](contracts/v4/reference/periphery/base/ImmutableState.md), IUnlockCallback diff --git a/docs/contracts/v4/reference/periphery/base/UnorderedNonce.md b/docs/contracts/v4/reference/periphery/base/UnorderedNonce.md index 29065b666..6c3ef1e39 100644 --- a/docs/contracts/v4/reference/periphery/base/UnorderedNonce.md +++ b/docs/contracts/v4/reference/periphery/base/UnorderedNonce.md @@ -1,6 +1,5 @@ # UnorderedNonce -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/UnorderedNonce.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/UnorderedNonce.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contract state and methods for using unordered nonces in signatures diff --git a/docs/contracts/v4/reference/periphery/interfaces/IEIP712_v4.md b/docs/contracts/v4/reference/periphery/interfaces/IEIP712_v4.md index d4ced84bc..a952f9023 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IEIP712_v4.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IEIP712_v4.md @@ -1,6 +1,5 @@ # IEIP712_v4 -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IEIP712_v4.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IEIP712_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) This interface is used for an EIP712 implementation diff --git a/docs/contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md b/docs/contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md index c2a7ac4e8..daf245ea2 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md @@ -1,6 +1,5 @@ # IERC721Permit_v4 -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IERC721Permit_v4.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IERC721Permit_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Extension to ERC721 that includes a permit function for signature based approvals diff --git a/docs/contracts/v4/reference/periphery/interfaces/IImmutableState.md b/docs/contracts/v4/reference/periphery/interfaces/IImmutableState.md new file mode 100644 index 000000000..1bf4160bb --- /dev/null +++ b/docs/contracts/v4/reference/periphery/interfaces/IImmutableState.md @@ -0,0 +1,14 @@ +# IImmutableState +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IImmutableState.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + + +## Functions +### poolManager + +The Uniswap v4 PoolManager contract + + +```solidity +function poolManager() external view returns (IPoolManager); +``` + diff --git a/docs/contracts/v4/reference/periphery/interfaces/IMulticall_v4.md b/docs/contracts/v4/reference/periphery/interfaces/IMulticall_v4.md index d29f0ea54..cc7151a03 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IMulticall_v4.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IMulticall_v4.md @@ -1,6 +1,5 @@ # IMulticall_v4 -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IMulticall_v4.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IMulticall_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Enables calling multiple methods in a single call to the contract diff --git a/docs/contracts/v4/reference/periphery/interfaces/INotifier.md b/docs/contracts/v4/reference/periphery/interfaces/INotifier.md index a0d0617c4..334987594 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/INotifier.md +++ b/docs/contracts/v4/reference/periphery/interfaces/INotifier.md @@ -1,6 +1,5 @@ # INotifier -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/INotifier.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/INotifier.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) This interface is used to opt in to sending updates to external contracts about position modifications or transfers @@ -35,6 +34,8 @@ Enables the subscriber to receive notifications for a respective position *payable so it can be multicalled with NATIVE related actions* +*will revert if pool manager is locked* + ```solidity function subscribe(uint256 tokenId, address newSubscriber, bytes calldata data) external payable; @@ -58,6 +59,8 @@ Removes the subscriber from receiving notifications for a respective position *Must always allow a user to unsubscribe. In the case of a malicious subscriber, a user can always unsubscribe safely, ensuring liquidity is always modifiable.* +*will revert if pool manager is locked* + ```solidity function unsubscribe(uint256 tokenId) external payable; @@ -126,28 +129,28 @@ Thrown when a user specifies a gas limit too low to avoid valid unsubscribe noti error GasLimitTooLow(); ``` -### Wrap__SubscriptionReverted +### SubscriptionReverted Wraps the revert message of the subscriber contract on a reverting subscription ```solidity -error Wrap__SubscriptionReverted(address subscriber, bytes reason); +error SubscriptionReverted(address subscriber, bytes reason); ``` -### Wrap__ModifyLiquidityNotificationReverted +### ModifyLiquidityNotificationReverted Wraps the revert message of the subscriber contract on a reverting modify liquidity notification ```solidity -error Wrap__ModifyLiquidityNotificationReverted(address subscriber, bytes reason); +error ModifyLiquidityNotificationReverted(address subscriber, bytes reason); ``` -### Wrap__TransferNotificationReverted +### TransferNotificationReverted Wraps the revert message of the subscriber contract on a reverting transfer notification ```solidity -error Wrap__TransferNotificationReverted(address subscriber, bytes reason); +error TransferNotificationReverted(address subscriber, bytes reason); ``` ### AlreadySubscribed diff --git a/docs/contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md b/docs/contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md new file mode 100644 index 000000000..c4a0f83c4 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md @@ -0,0 +1,29 @@ +# IPositionDescriptor +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IPositionDescriptor.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + + +## Functions +### tokenURI + +Produces the URI describing a particular token ID + +*Note this URI may be a data: URI with the JSON contents directly inlined* + + +```solidity +function tokenURI(IPositionManager positionManager, uint256 tokenId) external view returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`positionManager`|`IPositionManager`|The position manager for which to describe the token| +|`tokenId`|`uint256`|The ID of the token for which to produce a description, which may not be valid| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The URI of the ERC721-compliant metadata| + + diff --git a/docs/contracts/v4/reference/periphery/interfaces/IPositionManager.md b/docs/contracts/v4/reference/periphery/interfaces/IPositionManager.md index 03643f6b5..a57a35296 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IPositionManager.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IPositionManager.md @@ -1,9 +1,8 @@ # IPositionManager -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IPositionManager.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IPositionManager.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** -[INotifier](contracts/v4/reference/periphery/interfaces/INotifier.md) +[INotifier](contracts/v4/reference/periphery/interfaces/INotifier.md), [IImmutableState](contracts/v4/reference/periphery/interfaces/IImmutableState.md) Interface for the PositionManager contract @@ -118,3 +117,13 @@ Thrown when the block.timestamp exceeds the user-provided deadline error DeadlinePassed(uint256 deadline); ``` +### PoolManagerMustBeLocked +Thrown when calling transfer, subscribe, or unsubscribe when the PoolManager is unlocked. + +*This is to prevent hooks from being able to trigger notifications at the same time the position is being modified.* + + +```solidity +error PoolManagerMustBeLocked(); +``` + diff --git a/docs/contracts/v4/reference/periphery/interfaces/IQuoter.md b/docs/contracts/v4/reference/periphery/interfaces/IQuoter.md index 0de91e2b2..b824955d1 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IQuoter.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IQuoter.md @@ -1,6 +1,5 @@ # IQuoter -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IQuoter.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IQuoter.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Supports quoting the delta amounts for exact input or exact output swaps. diff --git a/docs/contracts/v4/reference/periphery/interfaces/ISubscriber.md b/docs/contracts/v4/reference/periphery/interfaces/ISubscriber.md index fd0ca8e00..1e1168a3f 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/ISubscriber.md +++ b/docs/contracts/v4/reference/periphery/interfaces/ISubscriber.md @@ -1,6 +1,5 @@ # ISubscriber -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/ISubscriber.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/ISubscriber.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Interface that a Subscriber contract should implement to receive updates from the v4 position manager diff --git a/docs/contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md b/docs/contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md new file mode 100644 index 000000000..5d028c7d3 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md @@ -0,0 +1,85 @@ +# IUniswapV4DeployerCompetition +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IUniswapV4DeployerCompetition.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +A competition to deploy the UniswapV4 contract with the best address + + +## Functions +### updateBestAddress + +Updates the best address if the new address has a better vanity score + +*The first 20 bytes of the salt must be either address(0) or msg.sender* + + +```solidity +function updateBestAddress(bytes32 salt) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`salt`|`bytes32`|The salt to use to compute the new address with CREATE2| + + +### deploy + +deploys the Uniswap v4 PoolManager contract + +*The bytecode must match the initCodeHash* + + +```solidity +function deploy(bytes memory bytecode) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`bytecode`|`bytes`|The bytecode of the Uniswap v4 PoolManager contract| + + +## Events +### NewAddressFound + +```solidity +event NewAddressFound(address indexed bestAddress, address indexed submitter, uint256 score); +``` + +## Errors +### InvalidBytecode + +```solidity +error InvalidBytecode(); +``` + +### CompetitionNotOver + +```solidity +error CompetitionNotOver(uint256 currentTime, uint256 deadline); +``` + +### CompetitionOver + +```solidity +error CompetitionOver(uint256 currentTime, uint256 deadline); +``` + +### NotAllowedToDeploy + +```solidity +error NotAllowedToDeploy(address sender, address deployer); +``` + +### WorseAddress + +```solidity +error WorseAddress(address newAddress, address bestAddress, uint256 newScore, uint256 bestScore); +``` + +### InvalidSender + +```solidity +error InvalidSender(bytes32 salt, address sender); +``` + diff --git a/docs/contracts/v4/reference/periphery/interfaces/IV4Router.md b/docs/contracts/v4/reference/periphery/interfaces/IV4Router.md index a28a11ef0..26413f4e6 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IV4Router.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IV4Router.md @@ -1,6 +1,8 @@ # IV4Router -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IV4Router.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IV4Router.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +[IImmutableState](contracts/v4/reference/periphery/interfaces/IImmutableState.md) Interface containing all the structs and errors for different v4 swap types @@ -33,7 +35,6 @@ struct ExactInputSingleParams { bool zeroForOne; uint128 amountIn; uint128 amountOutMinimum; - uint160 sqrtPriceLimitX96; bytes hookData; } ``` @@ -61,7 +62,6 @@ struct ExactOutputSingleParams { bool zeroForOne; uint128 amountOut; uint128 amountInMaximum; - uint160 sqrtPriceLimitX96; bytes hookData; } ``` diff --git a/docs/contracts/v4/reference/periphery/interfaces/IWETH9.md b/docs/contracts/v4/reference/periphery/interfaces/IWETH9.md new file mode 100644 index 000000000..4687b897a --- /dev/null +++ b/docs/contracts/v4/reference/periphery/interfaces/IWETH9.md @@ -0,0 +1,26 @@ +# IWETH9 +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/external/IWETH9.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +IERC20 + + +## Functions +### deposit + +Deposit ether to get wrapped ether + + +```solidity +function deposit() external payable; +``` + +### withdraw + +Withdraw wrapped ether to get ether + + +```solidity +function withdraw(uint256) external; +``` + diff --git a/docs/contracts/v4/reference/periphery/lens/Quoter.md b/docs/contracts/v4/reference/periphery/lens/Quoter.md index 878442a4a..e2c2ea943 100644 --- a/docs/contracts/v4/reference/periphery/lens/Quoter.md +++ b/docs/contracts/v4/reference/periphery/lens/Quoter.md @@ -1,6 +1,5 @@ # Quoter -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/lens/Quoter.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/lens/Quoter.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IQuoter](contracts/v4/reference/periphery/interfaces/IQuoter.md), [BaseV4Quoter](contracts/v4/reference/periphery/base/BaseV4Quoter.md) diff --git a/docs/contracts/v4/reference/periphery/lens/StateView.md b/docs/contracts/v4/reference/periphery/lens/StateView.md index a3d1ba952..c6cf2163e 100644 --- a/docs/contracts/v4/reference/periphery/lens/StateView.md +++ b/docs/contracts/v4/reference/periphery/lens/StateView.md @@ -1,6 +1,5 @@ # StateView -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/lens/StateView.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/lens/StateView.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ImmutableState](contracts/v4/reference/periphery/base/ImmutableState.md) diff --git a/docs/contracts/v4/reference/periphery/libraries/ActionConstants.md b/docs/contracts/v4/reference/periphery/libraries/ActionConstants.md index a48587bf9..488d67cd3 100644 --- a/docs/contracts/v4/reference/periphery/libraries/ActionConstants.md +++ b/docs/contracts/v4/reference/periphery/libraries/ActionConstants.md @@ -1,6 +1,5 @@ # ActionConstants -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/ActionConstants.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/ActionConstants.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Common constants used in actions diff --git a/docs/contracts/v4/reference/periphery/libraries/Actions.md b/docs/contracts/v4/reference/periphery/libraries/Actions.md index 1cb6d48ff..201ec9490 100644 --- a/docs/contracts/v4/reference/periphery/libraries/Actions.md +++ b/docs/contracts/v4/reference/periphery/libraries/Actions.md @@ -1,6 +1,5 @@ # Actions -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/Actions.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/Actions.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Library to define different pool actions. @@ -148,17 +147,31 @@ uint256 constant SWEEP = 0x19; ``` +### WRAP + +```solidity +uint256 constant WRAP = 0x20; +``` + + +### UNWRAP + +```solidity +uint256 constant UNWRAP = 0x21; +``` + + ### MINT_6909 ```solidity -uint256 constant MINT_6909 = 0x20; +uint256 constant MINT_6909 = 0x22; ``` ### BURN_6909 ```solidity -uint256 constant BURN_6909 = 0x21; +uint256 constant BURN_6909 = 0x23; ``` diff --git a/docs/contracts/v4/reference/periphery/libraries/AddressStringUtil.md b/docs/contracts/v4/reference/periphery/libraries/AddressStringUtil.md new file mode 100644 index 000000000..c3579398c --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/AddressStringUtil.md @@ -0,0 +1,59 @@ +# AddressStringUtil +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/AddressStringUtil.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +provides utility functions for converting addresses to strings + +*Reference: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/AddressStringUtil.sol* + + +## Functions +### toAsciiString + +Converts an address to the uppercase hex string, extracting only len bytes (up to 20, multiple of 2) + + +```solidity +function toAsciiString(address addr, uint256 len) internal pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`addr`|`address`|the address to convert| +|`len`|`uint256`|the number of bytes to extract| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|the hex string| + + +### char + +Converts a value into is corresponding ASCII character for the hex representation + + +```solidity +function char(uint8 b) private pure returns (bytes1 c); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`b`|`uint8`|the value to convert| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`c`|`bytes1`|the ASCII character| + + +## Errors +### InvalidAddressLength + +```solidity +error InvalidAddressLength(uint256 len); +``` + diff --git a/docs/contracts/v4/reference/periphery/libraries/BipsLibrary.md b/docs/contracts/v4/reference/periphery/libraries/BipsLibrary.md new file mode 100644 index 000000000..15c898068 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/BipsLibrary.md @@ -0,0 +1,36 @@ +# BipsLibrary +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/BipsLibrary.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + + +## State Variables +### BPS_DENOMINATOR + +```solidity +uint256 internal constant BPS_DENOMINATOR = 10_000; +``` + + +## Functions +### calculatePortion + + +```solidity +function calculatePortion(uint256 amount, uint256 bips) internal pure returns (uint256); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`amount`|`uint256`|The total amount to calculate a percentage of| +|`bips`|`uint256`|The percentage to calculate, in bips| + + +## Errors +### InvalidBips +emitted when an invalid percentage is provided + + +```solidity +error InvalidBips(); +``` + diff --git a/docs/contracts/v4/reference/periphery/libraries/CalldataDecoder.md b/docs/contracts/v4/reference/periphery/libraries/CalldataDecoder.md index 4bba1d718..7dcd1eae9 100644 --- a/docs/contracts/v4/reference/periphery/libraries/CalldataDecoder.md +++ b/docs/contracts/v4/reference/periphery/libraries/CalldataDecoder.md @@ -1,6 +1,5 @@ # CalldataDecoder -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/CalldataDecoder.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/CalldataDecoder.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## State Variables @@ -199,6 +198,15 @@ function decodeCurrencyAddressAndUint256(bytes calldata params) function decodeCurrencyAndUint256(bytes calldata params) internal pure returns (Currency currency, uint256 amount); ``` +### decodeUint256 + +*equivalent to: abi.decode(params, (uint256)) in calldata* + + +```solidity +function decodeUint256(bytes calldata params) internal pure returns (uint256 amount); +``` + ### decodeCurrencyUint256AndBool *equivalent to: abi.decode(params, (Currency, uint256, bool)) in calldata* diff --git a/docs/contracts/v4/reference/periphery/libraries/CurrencyRatioSortOrder.md b/docs/contracts/v4/reference/periphery/libraries/CurrencyRatioSortOrder.md new file mode 100644 index 000000000..090d83c4c --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/CurrencyRatioSortOrder.md @@ -0,0 +1,52 @@ +# CurrencyRatioSortOrder +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/CurrencyRatioSortOrder.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Provides constants for sorting currencies when displaying price ratios +Currencies given larger values will be in the numerator of the price ratio + +*Reference: https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/TokenRatioSortOrder.sol* + + +## State Variables +### NUMERATOR_MOST + +```solidity +int256 constant NUMERATOR_MOST = 300; +``` + + +### NUMERATOR_MORE + +```solidity +int256 constant NUMERATOR_MORE = 200; +``` + + +### NUMERATOR + +```solidity +int256 constant NUMERATOR = 100; +``` + + +### DENOMINATOR_MOST + +```solidity +int256 constant DENOMINATOR_MOST = -300; +``` + + +### DENOMINATOR_MORE + +```solidity +int256 constant DENOMINATOR_MORE = -200; +``` + + +### DENOMINATOR + +```solidity +int256 constant DENOMINATOR = -100; +``` + + diff --git a/docs/contracts/v4/reference/periphery/libraries/Descriptor.md b/docs/contracts/v4/reference/periphery/libraries/Descriptor.md new file mode 100644 index 000000000..00c26fbac --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/Descriptor.md @@ -0,0 +1,383 @@ +# Descriptor +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/Descriptor.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Describes NFT token positions + +*Reference: https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/NFTDescriptor.sol* + + +## State Variables +### sqrt10X128 + +```solidity +uint256 constant sqrt10X128 = 1076067327063303206878105757264492625226; +``` + + +## Functions +### constructTokenURI + +Constructs the token URI for a Uniswap v4 NFT + + +```solidity +function constructTokenURI(ConstructTokenURIParams memory params) internal pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`params`|`ConstructTokenURIParams`|Parameters needed to construct the token URI| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The token URI as a string| + + +### escapeSpecialCharacters + +Escapes special characters in a string if they are present + + +```solidity +function escapeSpecialCharacters(string memory symbol) internal pure returns (string memory); +``` + +### generateDescriptionPartOne + +Generates the first part of the description for a Uniswap v4 NFT + + +```solidity +function generateDescriptionPartOne( + string memory quoteCurrencySymbol, + string memory baseCurrencySymbol, + string memory poolManager +) private pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`quoteCurrencySymbol`|`string`|The symbol of the quote currency| +|`baseCurrencySymbol`|`string`|The symbol of the base currency| +|`poolManager`|`string`|The address of the pool manager| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The first part of the description| + + +### generateDescriptionPartTwo + +Generates the second part of the description for a Uniswap v4 NFTs + + +```solidity +function generateDescriptionPartTwo( + string memory tokenId, + string memory baseCurrencySymbol, + string memory quoteCurrency, + string memory baseCurrency, + string memory hooks, + string memory feeTier +) private pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tokenId`|`string`|The token ID| +|`baseCurrencySymbol`|`string`|The symbol of the base currency| +|`quoteCurrency`|`string`|The address of the quote currency| +|`baseCurrency`|`string`|The address of the base currency| +|`hooks`|`string`|The address of the hooks contract| +|`feeTier`|`string`|The fee tier of the pool| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The second part of the description| + + +### generateName + +Generates the name for a Uniswap v4 NFT + + +```solidity +function generateName(ConstructTokenURIParams memory params, string memory feeTier) + private + pure + returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`params`|`ConstructTokenURIParams`|Parameters needed to generate the name| +|`feeTier`|`string`|The fee tier of the pool| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The name of the NFT| + + +### generateDecimalString + + +```solidity +function generateDecimalString(DecimalStringParams memory params) private pure returns (string memory); +``` + +### tickToDecimalString + +Gets the price (quote/base) at a specific tick in decimal form +MIN or MAX are returned if tick is at the bottom or top of the price curve + + +```solidity +function tickToDecimalString( + int24 tick, + int24 tickSpacing, + uint8 baseCurrencyDecimals, + uint8 quoteCurrencyDecimals, + bool flipRatio +) internal pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tick`|`int24`|The tick (either tickLower or tickUpper)| +|`tickSpacing`|`int24`|The tick spacing of the pool| +|`baseCurrencyDecimals`|`uint8`|The decimals of the base currency| +|`quoteCurrencyDecimals`|`uint8`|The decimals of the quote currency| +|`flipRatio`|`bool`|True if the ratio was flipped| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The ratio value as a string| + + +### sigfigsRounded + + +```solidity +function sigfigsRounded(uint256 value, uint8 digits) private pure returns (uint256, bool); +``` + +### adjustForDecimalPrecision + +Adjusts the sqrt price for different currencies with different decimals + + +```solidity +function adjustForDecimalPrecision(uint160 sqrtRatioX96, uint8 baseCurrencyDecimals, uint8 quoteCurrencyDecimals) + private + pure + returns (uint256 adjustedSqrtRatioX96); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`sqrtRatioX96`|`uint160`|The sqrt price at a specific tick| +|`baseCurrencyDecimals`|`uint8`|The decimals of the base currency| +|`quoteCurrencyDecimals`|`uint8`|The decimals of the quote currency| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`adjustedSqrtRatioX96`|`uint256`|The adjusted sqrt price| + + +### abs + +Absolute value of a signed integer + + +```solidity +function abs(int256 x) private pure returns (uint256); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`x`|`int256`|The signed integer| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`uint256`|The absolute value of x| + + +### fixedPointToDecimalString + + +```solidity +function fixedPointToDecimalString(uint160 sqrtRatioX96, uint8 baseCurrencyDecimals, uint8 quoteCurrencyDecimals) + internal + pure + returns (string memory); +``` + +### feeToPercentString + +Converts fee amount in pips to decimal string with percent sign + + +```solidity +function feeToPercentString(uint24 fee) internal pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`fee`|`uint24`|fee amount| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|fee as a decimal string with percent sign| + + +### addressToString + + +```solidity +function addressToString(address addr) internal pure returns (string memory); +``` + +### generateSVGImage + +Generates the SVG image for a Uniswap v4 NFT + + +```solidity +function generateSVGImage(ConstructTokenURIParams memory params) internal pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`params`|`ConstructTokenURIParams`|Parameters needed to generate the SVG image| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG image as a string| + + +### overRange + +Checks if the current price is within your position range, above, or below + + +```solidity +function overRange(int24 tickLower, int24 tickUpper, int24 tickCurrent) private pure returns (int8); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tickLower`|`int24`|The lower tick| +|`tickUpper`|`int24`|The upper tick| +|`tickCurrent`|`int24`|The current tick| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`int8`|0 if the current price is within the position range, -1 if below, 1 if above| + + +### isSpecialCharacter + + +```solidity +function isSpecialCharacter(bytes1 b) private pure returns (bool); +``` + +### scale + + +```solidity +function scale(uint256 n, uint256 inMn, uint256 inMx, uint256 outMn, uint256 outMx) + private + pure + returns (string memory); +``` + +### currencyToColorHex + + +```solidity +function currencyToColorHex(uint256 currency, uint256 offset) internal pure returns (string memory str); +``` + +### getCircleCoord + + +```solidity +function getCircleCoord(uint256 currency, uint256 offset, uint256 tokenId) internal pure returns (uint256); +``` + +### sliceCurrencyHex + + +```solidity +function sliceCurrencyHex(uint256 currency, uint256 offset) internal pure returns (uint256); +``` + +## Structs +### ConstructTokenURIParams + +```solidity +struct ConstructTokenURIParams { + uint256 tokenId; + address quoteCurrency; + address baseCurrency; + string quoteCurrencySymbol; + string baseCurrencySymbol; + uint8 quoteCurrencyDecimals; + uint8 baseCurrencyDecimals; + bool flipRatio; + int24 tickLower; + int24 tickUpper; + int24 tickCurrent; + int24 tickSpacing; + uint24 fee; + address poolManager; + address hooks; +} +``` + +### DecimalStringParams + +```solidity +struct DecimalStringParams { + uint256 sigfigs; + uint8 bufferLength; + uint8 sigfigIndex; + uint8 decimalIndex; + uint8 zerosStartIndex; + uint8 zerosEndIndex; + bool isLessThanOne; + bool isPercent; +} +``` + diff --git a/docs/contracts/v4/reference/periphery/libraries/ERC721PermitHash.md b/docs/contracts/v4/reference/periphery/libraries/ERC721PermitHash.md index 7a85b7ece..db4f3475d 100644 --- a/docs/contracts/v4/reference/periphery/libraries/ERC721PermitHash.md +++ b/docs/contracts/v4/reference/periphery/libraries/ERC721PermitHash.md @@ -1,6 +1,5 @@ # ERC721PermitHash -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/ERC721PermitHash.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/ERC721PermitHash.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## State Variables diff --git a/docs/contracts/v4/reference/periphery/libraries/HexStrings.md b/docs/contracts/v4/reference/periphery/libraries/HexStrings.md new file mode 100644 index 000000000..e27d914ae --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/HexStrings.md @@ -0,0 +1,39 @@ +# HexStrings +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/HexStrings.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Provides function for converting numbers to hexadecimal strings + +*Reference: https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/HexStrings.sol* + + +## State Variables +### ALPHABET + +```solidity +bytes16 internal constant ALPHABET = "0123456789abcdef"; +``` + + +## Functions +### toHexStringNoPrefix + +Convert a number to a hex string without the '0x' prefix with a fixed length + + +```solidity +function toHexStringNoPrefix(uint256 value, uint256 length) internal pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`value`|`uint256`|The number to convert| +|`length`|`uint256`|The length of the output string, starting from the last character of the string| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The hex string| + + diff --git a/docs/contracts/v4/reference/periphery/libraries/Locker.md b/docs/contracts/v4/reference/periphery/libraries/Locker.md index a1b62cf3d..7bd349240 100644 --- a/docs/contracts/v4/reference/periphery/libraries/Locker.md +++ b/docs/contracts/v4/reference/periphery/libraries/Locker.md @@ -1,6 +1,5 @@ # Locker -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/Locker.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/Locker.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) This is a temporary library that allows us to use transient storage (tstore/tload) TODO: This library can be deleted when we have the transient keyword support in solidity. diff --git a/docs/contracts/v4/reference/periphery/libraries/PathKey.md b/docs/contracts/v4/reference/periphery/libraries/PathKey.md index c45203b92..bc6cc572e 100644 --- a/docs/contracts/v4/reference/periphery/libraries/PathKey.md +++ b/docs/contracts/v4/reference/periphery/libraries/PathKey.md @@ -1,6 +1,5 @@ # PathKey -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/PathKey.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/PathKey.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ```solidity diff --git a/docs/contracts/v4/reference/periphery/libraries/PositionConfig.md b/docs/contracts/v4/reference/periphery/libraries/PositionConfig.md index d337c1a39..aad00a0e5 100644 --- a/docs/contracts/v4/reference/periphery/libraries/PositionConfig.md +++ b/docs/contracts/v4/reference/periphery/libraries/PositionConfig.md @@ -1,6 +1,5 @@ # PositionConfig -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/PositionConfig.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/PositionConfig.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ```solidity diff --git a/docs/contracts/v4/reference/periphery/libraries/PositionConfigId.md b/docs/contracts/v4/reference/periphery/libraries/PositionConfigId.md index 42fd8b161..5ab31e8f1 100644 --- a/docs/contracts/v4/reference/periphery/libraries/PositionConfigId.md +++ b/docs/contracts/v4/reference/periphery/libraries/PositionConfigId.md @@ -1,15 +1,59 @@ -# PositionConfigId -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/PositionConfigId.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +# PositionConfigIdLibrary +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/PositionConfigId.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) -A configId is set per tokenId -The lower 255 bits are used to store the truncated hash of the corresponding PositionConfig -The upper bit is used to signal if the tokenId has a subscriber +## State Variables +### MASK_UPPER_BIT ```solidity -struct PositionConfigId { - bytes32 id; -} +bytes32 constant MASK_UPPER_BIT = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; +``` + + +### DIRTY_UPPER_BIT + +```solidity +bytes32 constant DIRTY_UPPER_BIT = 0x8000000000000000000000000000000000000000000000000000000000000000; +``` + + +## Functions +### getConfigId + +returns the truncated hash of the PositionConfig for a given tokenId + + +```solidity +function getConfigId(PositionConfigId storage _configId) internal view returns (bytes32 configId); +``` + +### setConfigId + +*We only set the config on mint, guaranteeing that the most significant bit is unset, so we can just assign the entire 32 bytes to the id.* + + +```solidity +function setConfigId(PositionConfigId storage _configId, bytes32 configId) internal; +``` + +### setSubscribe + + +```solidity +function setSubscribe(PositionConfigId storage configId) internal; +``` + +### setUnsubscribe + + +```solidity +function setUnsubscribe(PositionConfigId storage configId) internal; +``` + +### hasSubscriber + + +```solidity +function hasSubscriber(PositionConfigId storage configId) internal view returns (bool subscribed); ``` diff --git a/docs/contracts/v4/reference/periphery/libraries/PositionInfoLibrary.md b/docs/contracts/v4/reference/periphery/libraries/PositionInfoLibrary.md index bce95c32a..7fb825589 100644 --- a/docs/contracts/v4/reference/periphery/libraries/PositionInfoLibrary.md +++ b/docs/contracts/v4/reference/periphery/libraries/PositionInfoLibrary.md @@ -1,139 +1,23 @@ -# PositionInfoLibrary -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/PositionInfoLibrary.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +# PositionInfo +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/PositionInfoLibrary.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +*PositionInfo is a packed version of solidity structure. +Using the packaged version saves gas and memory by not storing the structure fields in memory slots. +Layout: +200 bits poolId | 24 bits tickUpper | 24 bits tickLower | 8 bits hasSubscriber +Fields in the direction from the least significant bit: +A flag to know if the tokenId is subscribed to an address +uint8 hasSubscriber; +The tickUpper of the position +int24 tickUpper; +The tickLower of the position +int24 tickLower; +The truncated poolId. Truncates a bytes32 value so the most signifcant (highest) 200 bits are used. +bytes25 poolId; +Note: If more bits are needed, hasSubscriber can be a single bit.* -## State Variables -### EMPTY_POSITION_INFO ```solidity -PositionInfo internal constant EMPTY_POSITION_INFO = PositionInfo.wrap(0); +type PositionInfo is uint256; ``` - -### MASK_UPPER_200_BITS - -```solidity -uint256 internal constant MASK_UPPER_200_BITS = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000; -``` - - -### MASK_8_BITS - -```solidity -uint256 internal constant MASK_8_BITS = 0xFF; -``` - - -### MASK_24_BITS - -```solidity -uint24 internal constant MASK_24_BITS = 0xFFFFFF; -``` - - -### SET_UNSUBSCRIBE - -```solidity -uint256 internal constant SET_UNSUBSCRIBE = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00; -``` - - -### SET_SUBSCRIBE - -```solidity -uint256 internal constant SET_SUBSCRIBE = 0x01; -``` - - -### TICK_LOWER_OFFSET - -```solidity -uint8 internal constant TICK_LOWER_OFFSET = 8; -``` - - -### TICK_UPPER_OFFSET - -```solidity -uint8 internal constant TICK_UPPER_OFFSET = 32; -``` - - -## Functions -### poolId - -*This poolId is NOT compatible with the poolId used in UniswapV4 core. It is truncated to 25 bytes, and just used to lookup PoolKey in the poolKeys mapping.* - - -```solidity -function poolId(PositionInfo info) internal pure returns (bytes25 _poolId); -``` - -### tickLower - - -```solidity -function tickLower(PositionInfo info) internal pure returns (int24 _tickLower); -``` - -### tickUpper - - -```solidity -function tickUpper(PositionInfo info) internal pure returns (int24 _tickUpper); -``` - -### hasSubscriber - - -```solidity -function hasSubscriber(PositionInfo info) internal pure returns (bool _hasSubscriber); -``` - -### setSubscribe - -*this does not actually set any storage* - - -```solidity -function setSubscribe(PositionInfo info) internal pure returns (PositionInfo _info); -``` - -### setUnsubscribe - -*this does not actually set any storage* - - -```solidity -function setUnsubscribe(PositionInfo info) internal pure returns (PositionInfo _info); -``` - -### initialize - -Creates the default PositionInfo struct - -*Called when minting a new position* - - -```solidity -function initialize(PoolKey memory _poolKey, int24 _tickLower, int24 _tickUpper) - internal - pure - returns (PositionInfo info); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_poolKey`|`PoolKey`|the pool key of the position| -|`_tickLower`|`int24`|the lower tick of the position| -|`_tickUpper`|`int24`|the upper tick of the position| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|`info`|`PositionInfo`|packed position info, with the truncated poolId and the hasSubscriber flag set to false| - - diff --git a/docs/contracts/v4/reference/periphery/libraries/QuoterRevert.md b/docs/contracts/v4/reference/periphery/libraries/QuoterRevert.md index 0560e94de..07c67fdc0 100644 --- a/docs/contracts/v4/reference/periphery/libraries/QuoterRevert.md +++ b/docs/contracts/v4/reference/periphery/libraries/QuoterRevert.md @@ -1,6 +1,5 @@ # QuoterRevert -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/QuoterRevert.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/QuoterRevert.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/periphery/libraries/SVG.md b/docs/contracts/v4/reference/periphery/libraries/SVG.md new file mode 100644 index 000000000..1b9b12214 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/SVG.md @@ -0,0 +1,377 @@ +# SVG +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/SVG.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Provides a function for generating an SVG associated with a Uniswap NFT + +*Reference: https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/NFTSVG.sol* + + +## State Variables +### curve1 + +```solidity +string constant curve1 = "M1 1C41 41 105 105 145 145"; +``` + + +### curve2 + +```solidity +string constant curve2 = "M1 1C33 49 97 113 145 145"; +``` + + +### curve3 + +```solidity +string constant curve3 = "M1 1C33 57 89 113 145 145"; +``` + + +### curve4 + +```solidity +string constant curve4 = "M1 1C25 65 81 121 145 145"; +``` + + +### curve5 + +```solidity +string constant curve5 = "M1 1C17 73 73 129 145 145"; +``` + + +### curve6 + +```solidity +string constant curve6 = "M1 1C9 81 65 137 145 145"; +``` + + +### curve7 + +```solidity +string constant curve7 = "M1 1C1 89 57.5 145 145 145"; +``` + + +### curve8 + +```solidity +string constant curve8 = "M1 1C1 97 49 145 145 145"; +``` + + +## Functions +### generateSVG + +Generate the SVG associated with a Uniswap v4 NFT + + +```solidity +function generateSVG(SVGParams memory params) internal pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`params`|`SVGParams`|The SVGParams struct containing the parameters for the SVG| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG string associated with the NFT| + + +### generateSVGDefs + +Generate the SVG defs that create the color scheme for the SVG + + +```solidity +function generateSVGDefs(SVGParams memory params) private pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`params`|`SVGParams`|The SVGParams struct containing the parameters to generate the SVG defs| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG defs string| + + +### generateSVGBorderText + +Generate the SVG for the moving border text displaying the quote and base currency addresses with their symbols + + +```solidity +function generateSVGBorderText( + string memory quoteCurrency, + string memory baseCurrency, + string memory quoteCurrencySymbol, + string memory baseCurrencySymbol +) private pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`quoteCurrency`|`string`|The quote currency| +|`baseCurrency`|`string`|The base currency| +|`quoteCurrencySymbol`|`string`|The quote currency symbol| +|`baseCurrencySymbol`|`string`|The base currency symbol| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG for the border NFT's border text| + + +### generateSVGCardMantle + +Generate the SVG for the card mantle displaying the quote and base currency symbols and fee tier + + +```solidity +function generateSVGCardMantle( + string memory quoteCurrencySymbol, + string memory baseCurrencySymbol, + string memory feeTier +) private pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`quoteCurrencySymbol`|`string`|The quote currency symbol| +|`baseCurrencySymbol`|`string`|The base currency symbol| +|`feeTier`|`string`|The fee tier| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG for the card mantle| + + +### generageSvgCurve + +Generate the SVG for the curve that represents the position. Fade up (top is faded) if current price is above your position range, fade down (bottom is faded) if current price is below your position range +Circles are generated at the ends of the curve if the position is in range, or at one end of the curve it is on if not in range + + +```solidity +function generageSvgCurve(int24 tickLower, int24 tickUpper, int24 tickSpacing, int8 overRange) + private + pure + returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tickLower`|`int24`|The lower tick| +|`tickUpper`|`int24`|The upper tick| +|`tickSpacing`|`int24`|The tick spacing| +|`overRange`|`int8`|Whether the current tick is in range, over range, or under range| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG for the curve| + + +### getCurve + +Get the curve based on the tick range +The smaller the tick range, the smaller/more linear the curve + + +```solidity +function getCurve(int24 tickLower, int24 tickUpper, int24 tickSpacing) internal pure returns (string memory curve); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tickLower`|`int24`|The lower tick| +|`tickUpper`|`int24`|The upper tick| +|`tickSpacing`|`int24`|The tick spacing| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`curve`|`string`|The curve path| + + +### generateSVGCurveCircle + +Generate the SVG for the circles on the curve + + +```solidity +function generateSVGCurveCircle(int8 overRange) internal pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`overRange`|`int8`|0 if the current tick is in range, 1 if the current tick is over range, -1 if the current tick is under range| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG for the circles| + + +### generateSVGPositionDataAndLocationCurve + +If the position is over or under range, generate one circle at the end of the curve on the side of the range it is on with a larger circle around it +If the position is in range, generate two circles at the ends of the curve + +Generate the SVG for the position data (token ID, hooks address, min tick, max tick) and the location curve (where your position falls on the curve) + + +```solidity +function generateSVGPositionDataAndLocationCurve(string memory tokenId, address hook, int24 tickLower, int24 tickUpper) + private + pure + returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tokenId`|`string`|The token ID| +|`hook`|`address`|The hooks address| +|`tickLower`|`int24`|The lower tick| +|`tickUpper`|`int24`|The upper tick| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG for the position data and location curve| + + +### substring + + +```solidity +function substring(string memory str, uint256 startIndex, uint256 endIndex) internal pure returns (string memory); +``` + +### tickToString + + +```solidity +function tickToString(int24 tick) private pure returns (string memory); +``` + +### rangeLocation + +Get the location of where your position falls on the curve + + +```solidity +function rangeLocation(int24 tickLower, int24 tickUpper) internal pure returns (string memory, string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tickLower`|`int24`|The lower tick| +|`tickUpper`|`int24`|The upper tick| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The x and y coordinates of the location of the liquidity| +|``|`string`|| + + +### generateSVGRareSparkle + +Generates the SVG for a rare sparkle if the NFT is rare. Else, returns an empty string + + +```solidity +function generateSVGRareSparkle(uint256 tokenId, address hooks) private pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tokenId`|`uint256`|The token ID| +|`hooks`|`address`|The hooks address| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG for the rare sparkle| + + +### isRare + +Determines if an NFT is rare based on the token ID and hooks address + + +```solidity +function isRare(uint256 tokenId, address hooks) internal pure returns (bool); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tokenId`|`uint256`|The token ID| +|`hooks`|`address`|The hooks address| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bool`|Whether the NFT is rare or not| + + +## Structs +### SVGParams + +```solidity +struct SVGParams { + string quoteCurrency; + string baseCurrency; + address hooks; + string quoteCurrencySymbol; + string baseCurrencySymbol; + string feeTier; + int24 tickLower; + int24 tickUpper; + int24 tickSpacing; + int8 overRange; + uint256 tokenId; + string color0; + string color1; + string color2; + string color3; + string x1; + string y1; + string x2; + string y2; + string x3; + string y3; +} +``` + diff --git a/docs/contracts/v4/reference/periphery/libraries/SafeCurrencyMetadata.md b/docs/contracts/v4/reference/periphery/libraries/SafeCurrencyMetadata.md new file mode 100644 index 000000000..7defdd5f1 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/SafeCurrencyMetadata.md @@ -0,0 +1,133 @@ +# SafeCurrencyMetadata +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/SafeCurrencyMetadata.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +can produce symbols and decimals from inconsistent or absent ERC20 implementations + +*Reference: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/SafeERC20Namer.sol* + + +## State Variables +### MAX_SYMBOL_LENGTH + +```solidity +uint8 constant MAX_SYMBOL_LENGTH = 12; +``` + + +## Functions +### currencySymbol + +attempts to extract the currency symbol. if it does not implement symbol, returns a symbol derived from the address + + +```solidity +function currencySymbol(address currency, string memory nativeLabel) internal view returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currency`|`address`|The currency address| +|`nativeLabel`|`string`|The native label| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|the currency symbol| + + +### currencyDecimals + +attempts to extract the token decimals, returns 0 if not implemented or not a uint8 + + +```solidity +function currencyDecimals(address currency) internal view returns (uint8); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currency`|`address`|The currency address| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`uint8`|the currency decimals| + + +### bytes32ToString + + +```solidity +function bytes32ToString(bytes32 x) private pure returns (string memory); +``` + +### addressToSymbol + +produces a symbol from the address - the first 6 hex of the address string in upper case + + +```solidity +function addressToSymbol(address currencyAddress) private pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currencyAddress`|`address`|the address of the currency| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|the symbol| + + +### callAndParseStringReturn + +calls an external view contract method that returns a symbol, and parses the output into a string + + +```solidity +function callAndParseStringReturn(address currencyAddress, bytes4 selector) private view returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currencyAddress`|`address`|the address of the currency| +|`selector`|`bytes4`|the selector of the symbol method| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|the symbol| + + +### truncateSymbol + +truncates the symbol to the MAX_SYMBOL_LENGTH + +*assumes the string is already longer than MAX_SYMBOL_LENGTH (or the same)* + + +```solidity +function truncateSymbol(string memory str) internal pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`str`|`string`|the symbol| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|the truncated symbol| + + diff --git a/docs/contracts/v4/reference/periphery/libraries/SlippageCheck.md b/docs/contracts/v4/reference/periphery/libraries/SlippageCheck.md index fd99a8c10..8ee35bfe7 100644 --- a/docs/contracts/v4/reference/periphery/libraries/SlippageCheck.md +++ b/docs/contracts/v4/reference/periphery/libraries/SlippageCheck.md @@ -1,6 +1,5 @@ # SlippageCheck -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/SlippageCheck.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/SlippageCheck.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) a library for checking if a delta exceeds a maximum ceiling or fails to meet a minimum floor diff --git a/docs/contracts/v4/reference/periphery/libraries/VanityAddressLib.md b/docs/contracts/v4/reference/periphery/libraries/VanityAddressLib.md new file mode 100644 index 000000000..ed2e5f813 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/VanityAddressLib.md @@ -0,0 +1,94 @@ +# VanityAddressLib +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/VanityAddressLib.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +A library to score addresses based on their vanity + + +## Functions +### betterThan + +Compares two addresses and returns true if the first address has a better vanity score + + +```solidity +function betterThan(address first, address second) internal pure returns (bool better); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`first`|`address`|The first address to compare| +|`second`|`address`|The second address to compare| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`better`|`bool`|True if the first address has a better vanity score| + + +### score + +Scores an address based on its vanity + +*Scoring rules: +Requirement: The first nonzero nibble must be 4 +10 points for every leading 0 nibble +40 points if the first 4 is followed by 3 more 4s +20 points if the first nibble after the 4 4s is NOT a 4 +20 points if the last 4 nibbles are 4s +1 point for every 4* + + +```solidity +function score(address addr) internal pure returns (uint256 calculatedScore); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`addr`|`address`|The address to score| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`calculatedScore`|`uint256`|The vanity score of the address| + + +### getLeadingNibbleCount + +Returns the number of leading nibbles in an address that match a given value + + +```solidity +function getLeadingNibbleCount(bytes20 addrBytes, uint256 startIndex, uint8 comparison) + internal + pure + returns (uint256 count); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`addrBytes`|`bytes20`|The address to count the leading zero nibbles in| +|`startIndex`|`uint256`|| +|`comparison`|`uint8`|| + + +### getNibble + +Returns the nibble at a given index in an address + + +```solidity +function getNibble(bytes20 input, uint256 nibbleIndex) internal pure returns (uint8 currentNibble); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`input`|`bytes20`|The address to get the nibble from| +|`nibbleIndex`|`uint256`|The index of the nibble to get| + + diff --git a/scripts/v4-forge-doc.sh b/scripts/v4-forge-doc.sh index 3f0dcecd0..bb77ec5d3 100755 --- a/scripts/v4-forge-doc.sh +++ b/scripts/v4-forge-doc.sh @@ -33,21 +33,24 @@ copy_docs() { # Fix the Git source link # replace `https://github.com/Uniswap/docs/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IPositionManager.sol` # with `https://github.com/Uniswap/v4-{component}/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IPositionManager.sol` - sed -i "s|Uniswap/docs/|Uniswap/v4-${component}/|g" "$new_file" + sed -i '' -e "s|uniswap/docs/|uniswap/v4-${component}/|g" "$new_file" # Add note: - sed -i '3i | Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc)' "$new_file" + # sed -i '' '3i\ + sed -i '' '2s|$| - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc)|' "$new_file" + # Replace relative path links within the file with full paths - sed -i "s|/src/\([^/]\+\)/\([^/]\+\)\.sol/\([^/]\+\)\.\([^/]\+\)\.md|contracts/v4/reference/${component}/\1/\2.md|g" "$new_file" + # sed -i '' -e "s|/src/\([^/]\+\)/\([^/]\+\)\.sol/\([^/]\+\)\.\([^/]\+\)\.md|contracts/v4/reference/${component}/\1/\2.md|g" "$new_file" + sed -i '' -e "s|/src/\([^/]\{1,\}\)/\([^/]\{1,\}\)\.sol/\([^/]\{1,\}\)\.\([^/]\{1,\}\)\.md|contracts/v4/reference/${component}/\1/\2.md|g" "$new_file" # specially handle core paths if [ "$component" == "core" ]; then # replaces: /src/ProtocolFees.sol/abstract.ProtocolFees.md to contracts/v4/reference/core/ProtocolFees.md - sed -i -E 's|/src/([^/]+)\.sol/abstract\.[^/]+\.md|contracts/v4/reference/core/\1.md|g' "$new_file" + sed -i '' -E 's|/src/([^/]+)\.sol/abstract\.[^/]+\.md|contracts/v4/reference/core/\1.md|g' "$new_file" # replaces: /src/interfaces/external/IERC6909Claims.sol/interface.IERC6909Claims.md to contracts/v4/reference/core/interfaces/IERC6909Claims.md - sed -i -E 's|/src/interfaces/external/([^/]+)\.sol/interface\.[^/]+\.md|contracts/v4/reference/core/interfaces/\1.md|g' "$new_file" + sed -i '' -E 's|/src/interfaces/external/([^/]+)\.sol/interface\.[^/]+\.md|contracts/v4/reference/core/interfaces/\1.md|g' "$new_file" fi echo "Copied: $file -> $new_file" diff --git a/submodules/v4-core b/submodules/v4-core index 1141642f8..b619b6718 160000 --- a/submodules/v4-core +++ b/submodules/v4-core @@ -1 +1 @@ -Subproject commit 1141642f8ba4665a50660886a8a8401526677045 +Subproject commit b619b6718e31aa5b4fa0286520c455ceb950276d diff --git a/submodules/v4-periphery b/submodules/v4-periphery index 47e3c30ae..3f295d843 160000 --- a/submodules/v4-periphery +++ b/submodules/v4-periphery @@ -1 +1 @@ -Subproject commit 47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b +Subproject commit 3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7 From c0f48abf3963b48ea28c38ec113d9811032a53d4 Mon Sep 17 00:00:00 2001 From: Sohee_Lim <30321742+limsohee1002@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:13:37 -0500 Subject: [PATCH 19/19] feat: add navigation (#30) * feat: add navigation * feat: add footer * fix: update types * fix: attempt to fix font issue * fix: lint * fix: font * fix: coderabbit comments * fix: add button hover state * fix: remove padding --- .eslintrc.json | 4 +- docusaurus.config.js | 162 +------------- package.json | 4 + src/components/Icons/index.tsx | 205 ++++++++++++++++++ src/components/ThemeSwitch/index.tsx | 57 +++++ src/components/base/Button/index.tsx | 80 +++++++ src/css/custom.css | 9 +- src/css/font.css | 84 ++++--- src/css/infima-overrides.css | 104 +++++++++ src/css/types.css | 162 +++++++++----- src/theme/Footer.tsx | 157 ++++++++++++++ src/theme/Navbar.tsx | 42 ++++ src/theme/NavbarItem.tsx | 64 ------ src/theme/Root.tsx | 4 +- src/utils/storage.ts | 33 +++ .../Basel-Grotesk-Book-Italic.otf | Bin .../Basel-Grotesk-Book-Italic.woff | Bin .../Basel-Grotesk-Book-Italic.woff2 | Bin .../baselGrotesk/Basel-Grotesk-Book.otf | Bin .../baselGrotesk/Basel-Grotesk-Book.woff | Bin .../baselGrotesk/Basel-Grotesk-Book.woff2 | Bin .../Basel-Grotesk-Medium-Italic.otf | Bin .../Basel-Grotesk-Medium-Italic.woff | Bin .../Basel-Grotesk-Medium-Italic.woff2 | Bin .../baselGrotesk/Basel-Grotesk-Medium.otf | Bin .../baselGrotesk/Basel-Grotesk-Medium.woff | Bin .../baselGrotesk/Basel-Grotesk-Medium.woff2 | Bin .../Basel-Grotesk-Regular-Italic.otf | Bin .../Basel-Grotesk-Regular-Italic.woff | Bin .../Basel-Grotesk-Regular-Italic.woff2 | Bin .../baselGrotesk/Basel-Grotesk-Regular.otf | Bin .../baselGrotesk/Basel-Grotesk-Regular.woff | Bin .../baselGrotesk/Basel-Grotesk-Regular.woff2 | Bin .../{fonts => font}/riegraf/Riegraf-Bold.otf | Bin .../{fonts => font}/riegraf/Riegraf-Light.otf | Bin .../riegraf/Riegraf-Medium.otf | Bin .../riegraf/Riegraf-Regular-Italic.otf | Bin .../riegraf/Riegraf-Regular.otf | Bin tailwind.config.js | 3 +- yarn.lock | 146 +++++++++++++ 40 files changed, 1000 insertions(+), 320 deletions(-) create mode 100644 src/components/Icons/index.tsx create mode 100644 src/components/ThemeSwitch/index.tsx create mode 100644 src/components/base/Button/index.tsx create mode 100644 src/css/infima-overrides.css create mode 100644 src/theme/Footer.tsx create mode 100644 src/theme/Navbar.tsx delete mode 100644 src/theme/NavbarItem.tsx create mode 100644 src/utils/storage.ts rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Book-Italic.otf (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Book-Italic.woff (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Book-Italic.woff2 (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Book.otf (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Book.woff (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Book.woff2 (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Medium-Italic.otf (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Medium-Italic.woff (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Medium-Italic.woff2 (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Medium.otf (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Medium.woff (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Medium.woff2 (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Regular-Italic.otf (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Regular-Italic.woff (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Regular-Italic.woff2 (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Regular.otf (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Regular.woff (100%) rename static/{fonts => font}/baselGrotesk/Basel-Grotesk-Regular.woff2 (100%) rename static/{fonts => font}/riegraf/Riegraf-Bold.otf (100%) rename static/{fonts => font}/riegraf/Riegraf-Light.otf (100%) rename static/{fonts => font}/riegraf/Riegraf-Medium.otf (100%) rename static/{fonts => font}/riegraf/Riegraf-Regular-Italic.otf (100%) rename static/{fonts => font}/riegraf/Riegraf-Regular.otf (100%) diff --git a/.eslintrc.json b/.eslintrc.json index 95d4e3a9a..860093d7a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,10 +17,8 @@ "ecmaVersion": "latest", "sourceType": "module" }, - "plugins": ["typescript-sort-keys", "simple-import-sort", "unused-imports"], + "plugins": ["typescript-sort-keys", "unused-imports"], "rules": { - "simple-import-sort/imports": "error", - "simple-import-sort/exports": "error", "typescript-sort-keys/string-enum": [ "error", "asc", diff --git a/docusaurus.config.js b/docusaurus.config.js index 7cabdd47b..2a4387f48 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -4,6 +4,7 @@ const tailwindPlugin = require('./plugins/tailwind-config.cjs') require('dotenv').config() module.exports = { + staticDirectories: ['static'], customFields: { // Analytics proxy URL analyticsProxyUrl: process.env.REACT_APP_AMPLITUDE_PROXY_URL, @@ -32,164 +33,14 @@ module.exports = { appId: 'S0IDD0YGLZ', }, navbar: { - title: 'Uniswap Docs', - logo: { - alt: 'Uniswap Unicorn', - src: 'img/uni_dark_icon.svg', - }, - items: [ - { - to: '/concepts/overview', - label: 'Concepts', - position: 'left', - className: 'V3_active', - }, - { - to: '/contracts/v4/overview', - label: 'Contracts', - position: 'left', - className: 'V3_active', - }, - { - to: '/sdk/v3/overview', - label: 'SDKs', - position: 'left', - className: 'V3_active', - }, - { - to: '/api/subgraph/overview', - label: 'APIs', - position: 'left', - className: 'V3_active', - }, - { - label: 'Give Feedback', - to: 'https://forms.gle/13XtjmkwdXQ2jMn26', - position: 'right', - className: 'persistent', - }, - { - label: 'Whitepaper', - to: 'https://uniswap.org/whitepaper-v3.pdf', - position: 'right', - className: 'persistent', - }, - { - href: 'https://github.com/uniswap/uniswap-docs', - label: 'GitHub', - position: 'right', - className: 'persistent', - }, - { - href: 'https://unigrants.org/', - label: 'Grants', - position: 'right', - className: 'persistent', - }, - ], + /* using custom navigation */ }, footer: { - // style: "dark", - links: [ - { - title: 'Developers', - items: [ - { - label: 'Feedback', - href: 'https://forms.gle/13XtjmkwdXQ2jMn26', - }, - { - label: 'Bug Bounty', - href: 'https://github.com/Uniswap/uniswap-v3-periphery/blob/main/bug-bounty.md', - }, - { - label: '#dev-chat', - href: 'https://discord.com/invite/uniswap', - }, - { - label: 'Whitepaper', - href: 'https://uniswap.org/whitepaper-v3.pdf', - }, - ], - }, - { - title: 'Github', - items: [ - { - label: 'uniswap-v3-core', - href: 'https://github.com/Uniswap/uniswap-v3-core', - }, - { - label: 'uniswap-v3-sdk', - href: 'https://github.com/Uniswap/uniswap-v3-sdk', - }, - { - label: 'uniswap-v3-periphery', - href: 'https://github.com/Uniswap/uniswap-v3-periphery', - }, - { - label: 'Deployment addresses', - href: 'https://github.com/Uniswap/uniswap-v3-periphery/blob/main/deploys.md', - }, - ], - }, - { - title: 'Ecosystem', - items: [ - { - label: 'Home', - href: 'https://uniswap.org/', - }, - { - label: 'App', - href: 'https://app.uniswap.org/', - }, - { - label: 'Analytics', - href: 'https://info.uniswap.org/home', - }, - { - label: 'Token Lists', - href: 'https://tokenlists.org/', - }, - { - label: 'Brand Assets', - href: 'https://uniswap.org/Uniswap_brand_assets.zip', - }, - ], - }, - { - title: 'Community', - items: [ - { - label: 'Governance', - href: 'https://gov.uniswap.org/', - }, - { - label: 'Discord', - href: 'https://discord.com/invite/uniswap', - }, - { - label: 'Twitter', - href: 'https://twitter.com/Uniswap', - }, - { - label: 'Blog', - href: 'https://uniswap.org/blog/', - }, - ], - }, - ], - // copyright: `unlicensed`, + /* using custom footer */ }, colorMode: { // "light" | "dark" defaultMode: 'dark', - - // Hides the switch in the navbar - // Useful if you want to support a single color mode - disableSwitch: false, - // Should we use the prefers-color-scheme media-query, // using user system preferences, instead of the hardcoded defaultMode respectPrefersColorScheme: true, @@ -215,15 +66,12 @@ module.exports = { blogSidebarCount: 0, }, theme: { - customCss: [ - require.resolve('./src/css/custom.css'), - require.resolve('./src/css/font.css'), - require.resolve('./src/css/types.css'), - ], + customCss: [require.resolve('./src/css/custom.css')], }, }, ], ], + stylesheets: [ { href: 'https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css', diff --git a/package.json b/package.json index 7425841e1..e08ba6c54 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "@docusaurus/preset-classic": "2.4.3", "@docusaurus/remark-plugin-npm2yarn": "2.4.3", "@docusaurus/theme-search-algolia": "2.4.3", + "@headlessui/react": "^2.2.0", "@mdx-js/react": "^1.6.21", "@saucelabs/theme-github-codeblock": "https://github.com/Uniswap/docusaurus-theme-github-codeblock.git#f55fe4caed9fce974c9b82bf2164f76cc5509eef", "@types/react": "^17.0.11", @@ -33,9 +34,11 @@ "@uniswap/analytics-events": "2.0.0", "algoliasearch": "^4.9.1", "caniuse-lite": "^1.0.30001519", + "classnames": "^2.5.1", "clsx": "^1.1.1", "hast-util-is-element": "1.1.0", "intl-locales-supported": "^1.8.12", + "js-cookie": "^3.0.5", "license-checker": "^25.0.1", "react": "18", "react-dom": "18", @@ -60,6 +63,7 @@ "devDependencies": { "@docusaurus/module-type-aliases": "2.4.3", "@tsconfig/docusaurus": "^1.0.6", + "@types/js-cookie": "^3.0.6", "@typescript-eslint/eslint-plugin": "^4", "@typescript-eslint/parser": "^4", "autoprefixer": "^10.4.20", diff --git a/src/components/Icons/index.tsx b/src/components/Icons/index.tsx new file mode 100644 index 000000000..a41b8eb10 --- /dev/null +++ b/src/components/Icons/index.tsx @@ -0,0 +1,205 @@ +import React, { FC } from 'react' + +import cn from 'classnames' + +export const MiniUnicon: FC<{ + className?: string + color?: 'accent-1' | 'neutral-1' +}> = ({ className, color = 'accent-1' }) => { + return ( + + + + + + + + + + + + ) +} + +export const Github: FC<{ + className?: string + color?: 'neutral-2' +}> = ({ className, color = 'neutral-2' }) => { + return ( + + + + ) +} + +export const X: FC<{ + className?: string + color?: 'neutral-2' +}> = ({ className, color = 'neutral-2' }) => { + return ( + + + + ) +} + +export const Discord: FC<{ + className?: string + color?: 'neutral-2' +}> = ({ className, color = 'neutral-2' }) => { + return ( + + + + ) +} + +export const Sun: FC<{ + className?: string + color?: 'neutral-2' +}> = ({ className, color = 'neutral-2' }) => { + return ( + + + + ) +} + +export const Menu: FC<{ + className?: string + color?: 'neutral-2' +}> = ({ className, color = 'neutral-2' }) => { + return ( + + + + ) +} +export const Moon: FC<{ + className?: string + color?: 'neutral-2' +}> = ({ className, color = 'neutral-2' }) => { + return ( + + + + ) +} + +export type Icon = 'sun' | 'moon' + +export const IconMap: FC<{ + icon: Icon + className?: string + color?: 'neutral-2' +}> = ({ icon, color, className }) => { + switch (icon) { + case 'sun': + return + case 'moon': + return + default: + console.warn(`Icon ${icon} not found`) + return null + } +} diff --git a/src/components/ThemeSwitch/index.tsx b/src/components/ThemeSwitch/index.tsx new file mode 100644 index 000000000..7f12fe5aa --- /dev/null +++ b/src/components/ThemeSwitch/index.tsx @@ -0,0 +1,57 @@ +import React, { FC, useState, useEffect } from 'react' + +import { Switch } from '@headlessui/react' +import { IconMap, Sun, Moon } from '../Icons' + +import { ThemeManager } from '../../utils/storage' + +import cn from 'classnames' + +const ThemeSwitch: FC<{ className?: string }> = ({ className }) => { + const [theme, setTheme] = useState<'light' | 'dark'>('light') + + useEffect(() => { + if (typeof window !== 'undefined') { + const currentTheme = ThemeManager.get() + + if (!currentTheme) { + ThemeManager.set('light') + } else { + setTheme(currentTheme) + } + } + }, []) + + const toggleTheme = () => { + setTheme((prev) => { + const newTheme = prev === 'dark' ? 'light' : 'dark' + ThemeManager.set(newTheme) + return newTheme + }) + } + + useEffect(() => { + document.documentElement.setAttribute('data-theme', theme) + document.documentElement.setAttribute('class', theme) + }, [theme]) + + return ( + + + + + + + + ) +} + +export default ThemeSwitch diff --git a/src/components/base/Button/index.tsx b/src/components/base/Button/index.tsx new file mode 100644 index 000000000..213c618bf --- /dev/null +++ b/src/components/base/Button/index.tsx @@ -0,0 +1,80 @@ +import React, { FC, PropsWithChildren } from 'react' +import cn from 'classnames' + +const OPEN_IN_NEW_TAB_PROPS = { target: '_blank', rel: 'noreferrer noopener' } +const OPEN_IN_CURRENT_TAB_PROPS = { target: '_self' } + +interface TextButtonProps extends ButtonBaseProps { + label: string + textClassName?: string +} + +interface TextLinkProps extends LinkBaseProps { + label: string + textClassName?: string +} + +export const TextButton: FC = (props) => { + const containerStyle = 'TextButton group' + const textStyle = 'decoration-inherit' + const textClassName = props.textClassName + + if ('href' in props) { + const { label, href, ariaLabel, className, onClick } = props + + return ( + + {label} + + ) + } + + const { label, onClick, ariaLabel, role, className } = props + + return ( + + {label} + + ) +} + +type ButtonBaseProps = { + className?: string + onClick?: () => void + ariaLabel?: string + role?: string + type?: 'button' | 'submit' | 'reset' +} + +export const ButtonBase: FC> = ({ + className, + onClick, + children, + ariaLabel, + role, + type = 'button', +}) => { + return ( + + ) +} + +type LinkBaseProps = { + className?: string + href: string + ariaLabel?: string + onClick?: () => void +} + +export const LinkBase: FC> = ({ className, href, children, ariaLabel, onClick }) => { + const isInternalLink = href.startsWith('/') || href.startsWith('#') + const targetProps = isInternalLink ? OPEN_IN_CURRENT_TAB_PROPS : OPEN_IN_NEW_TAB_PROPS + + return ( + + {children} + + ) +} diff --git a/src/css/custom.css b/src/css/custom.css index 1ad2d6461..07c844b12 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -6,6 +6,7 @@ */ /* You can override the default Infima variables here. */ +@import './infima-overrides.css'; @import 'tailwindcss/base'; @import 'tailwindcss/components'; @@ -14,6 +15,10 @@ @import './font.css'; @import './types.css'; -:root { - /* add override here */ +.site-max-width { + max-width: 1440px; +} + +.default-grid { + @apply grid grid-cols-4 gap-gap-large sm:grid-cols-8; } diff --git a/src/css/font.css b/src/css/font.css index b5f1af37e..b4ca30920 100644 --- a/src/css/font.css +++ b/src/css/font.css @@ -2,77 +2,95 @@ @font-face { font-family: 'Basel Grotesk'; - src: url('/fonts/baselGrotesk/Basel-Grotesk-Regular.woff2'); - font-weight: '400'; - font-style: 'normal'; + src: + url('/font/baselGrotesk/Basel-Grotesk-Regular.woff2') format('woff2'), + url('/font/baselGrotesk/Basel-Grotesk-Regular.woff') format('woff'), + url('/font/baselGrotesk/Basel-Grotesk-Regular.otf') format('opentype'); + font-weight: 400; + font-style: normal; } @font-face { font-family: 'Basel Grotesk'; - src: url('/fonts/baselGrotesk/Basel-Grotesk-Regular-Italic.woff2'); - font-weight: '400'; - font-style: 'italic'; + src: + url('/font/baselGrotesk/Basel-Grotesk-Regular-Italic.woff2') format('woff2'), + url('/font/baselGrotesk/Basel-Grotesk-Regular-Italic.woff') format('woff'), + url('/font/baselGrotesk/Basel-Grotesk-Regular-Italic.otf') format('opentype'); + font-weight: 400; + font-style: italic; } @font-face { font-family: 'Basel Grotesk'; - src: url('/fonts/baselGrotesk/Basel-Grotesk-Book.woff2'); - font-weight: '500'; - font-style: 'normal'; + src: + url('/font/baselGrotesk/Basel-Grotesk-Book.woff2') format('woff2'), + url('/font/baselGrotesk/Basel-Grotesk-Book.woff') format('woff'), + url('/font/baselGrotesk/Basel-Grotesk-Book.otf') format('opentype'); + font-weight: 500; + font-style: normal; } @font-face { font-family: 'Basel Grotesk'; - src: url('/fonts/baselGrotesk/Basel-Grotesk-Book-Italic.woff2'); - font-weight: '500'; - font-style: 'italic'; + src: + url('/font/baselGrotesk/Basel-Grotesk-Book-Italic.woff2') format('woff2'), + url('/font/baselGrotesk/Basel-Grotesk-Book-Italic.woff') format('woff'), + url('/font/baselGrotesk/Basel-Grotesk-Book-Italic.otf') format('opentype'); + font-weight: 500; + font-style: italic; } @font-face { font-family: 'Basel Grotesk'; - src: url('/fonts/baselGrotesk/Basel-Grotesk-Medium.woff2'); - font-weight: '600'; - font-style: 'normal'; + src: + url('/font/baselGrotesk/Basel-Grotesk-Medium.woff2') format('woff2'), + url('/font/baselGrotesk/Basel-Grotesk-Medium.woff') format('woff'), + url('/font/baselGrotesk/Basel-Grotesk-Medium.otf') format('opentype'); + font-weight: 600; + font-style: normal; } @font-face { font-family: 'Basel Grotesk'; - src: url('/fonts/baselGrotesk/Basel-Grotesk-Medium-Italic.woff2'); - font-weight: '600'; - font-style: 'italic'; + src: + url('/font/baselGrotesk/Basel-Grotesk-Medium-Italic.woff2') format('woff2'), + url('/font/baselGrotesk/Basel-Grotesk-Medium-Italic.woff') format('woff'), + url('/font/baselGrotesk/Basel-Grotesk-Medium-Italic.otf') format('opentype'); + font-weight: 600; + font-style: italic; } @font-face { font-family: 'Riegraf'; - src: url('/fonts/riegraf/Riegraf-Light.otf'); - font-weight: '300'; - font-style: 'normal'; + src: url('/font/riegraf/Riegraf-Light.otf') format('opentype'); + font-weight: 300; + font-style: normal; } @font-face { font-family: 'Riegraf'; - src: url('/fonts/riegraf/Riegraf-Regular.otf'); - font-weight: '400'; - font-style: 'normal'; + src: url('/font/riegraf/Riegraf-Regular.otf') format('opentype'); + font-weight: 400; + font-style: normal; } @font-face { font-family: 'Riegraf'; - src: url('/fonts/riegraf/Riegraf-Regular-Italic.otf'); - font-weight: '400'; - font-style: 'italic'; + src: url('/font/riegraf/Riegraf-Regular-Italic.otf') format('opentype'); + font-weight: 400; + font-style: italic; } @font-face { font-family: 'Riegraf'; - src: url('/fonts/riegraf/Riegraf-Medium.otf'); - font-weight: '500'; - font-style: 'normal'; + src: url('/font/riegraf/Riegraf-Medium.otf') format('opentype'); + font-weight: 500; + font-style: normal; } @font-face { font-family: 'Riegraf'; - src: url('/fonts/riegraf/Riegraf-Bold.otf'); - font-weight: '600'; - font-style: 'normal'; + src: url('/font/riegraf/Riegraf-Bold.otf') format('opentype'); + font-weight: 600; + font-style: normal; } diff --git a/src/css/infima-overrides.css b/src/css/infima-overrides.css new file mode 100644 index 000000000..dfaed7356 --- /dev/null +++ b/src/css/infima-overrides.css @@ -0,0 +1,104 @@ +button, +a { + all: initial; +} + +button:hover, +a:hover { + text-decoration: none; + color: inherit; + cursor: pointer; +} + +ul { + all: initial; + display: block; + list-style-type: none; +} + +* { + font-weight: unset; + border-style: solid; + border-width: 0; + border-color: unset; + font-style: unset; +} + +/* Box sizing rules */ +*, +*::before, +*::after { + box-sizing: border-box; +} + +/* Remove default padding */ +ul, +ol { + padding: 0; +} + +/* Remove default margin */ +body, +h1, +h2, +h3, +h4, +p, +ul, +ol, +li, +figure, +figcaption, +blockquote, +dl, +dd { + margin: 0; +} + +/* Set core body defaults */ +body { + min-height: 100vh; + scroll-behavior: smooth; + text-rendering: optimizeSpeed; + line-height: 1.5; +} + +/* Remove list styles on ul, ol elements with a class attribute */ +ul, +ol { + list-style: none; +} + +/* A elements that don't have a class get default styles */ +a:not([class]) { + text-decoration-skip-ink: auto; +} + +/* Make images easier to work with */ +img { + max-width: 100%; + display: block; +} + +/* Natural flow and rhythm in articles by default */ +article > * + * { + margin-top: 1em; +} + +/* Inherit fonts for inputs and buttons */ +input, +button, +textarea, +select { + font: inherit; +} + +/* Remove all animations and transitions for people that prefer not to see them */ +@media (prefers-reduced-motion: reduce) { + * { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + scroll-behavior: auto !important; + } +} diff --git a/src/css/types.css b/src/css/types.css index c96aafc95..39cc94de4 100644 --- a/src/css/types.css +++ b/src/css/types.css @@ -6,39 +6,81 @@ font-size: 4rem; font-style: normal; font-weight: 300; - line-height: 4rem; + line-height: 3.84rem; letter-spacing: -0.08rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } + .serif-heading-0-mobile { + @apply font-riegraf; + font-size: 3rem; + font-style: normal; + font-weight: 300; + line-height: 2.88rem; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } + .heading-0 { @apply font-basel-grotesk; font-size: 4rem; - font-style: normal; - font-weight: 485; - line-height: 4rem; + font-weight: 500; + line-height: 3.84rem; letter-spacing: -0.08rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } - .heading-1 { + .heading-0-mobile { + @apply font-basel-grotesk; + font-size: 3rem; + font-weight: 500; + line-height: 2.88rem; + letter-spacing: -0.06rem; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } + + .serif-heading-1 { @apply font-basel-grotesk; font-size: 3.25rem; font-style: normal; - font-weight: 485; - line-height: 3.75rem; + font-weight: 300; + line-height: 3.12rem; + letter-spacing: -0.065rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } - .serif-heading-2 { - @apply font-riegraf; - font-size: 2.25rem; + .serif-heading-1-mobile { + @apply font-basel-grotesk; + font-size: 2.4375rem; font-style: normal; font-weight: 300; - line-height: 2.75rem; + line-height: 2.34rem; + letter-spacing: -0.04875rem; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } + + .heading-1 { + @apply font-basel-grotesk; + font-size: 3.25rem; + font-weight: 500; + line-height: 3.12rem; + letter-spacing: -0.065rem; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } + + .heading-1-mobile { + @apply font-basel-grotesk; + font-size: 2.4375rem; + font-style: normal; + font-weight: 500; + line-height: 2.34rem; + letter-spacing: -0.04875rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } @@ -46,9 +88,20 @@ .heading-2 { @apply font-basel-grotesk; font-size: 2.25rem; + font-weight: 500; + line-height: 2.52rem; + letter-spacing: -0.0225rem; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } + + .heading-2-mobile { + @apply font-basel-grotesk; + font-size: 1.6875rem; font-style: normal; - font-weight: 485; - line-height: 2.75rem; + font-weight: 500; + line-height: 2.025rem; + letter-spacing: -0.01688rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } @@ -57,8 +110,9 @@ @apply font-basel-grotesk; font-size: 1.5rem; font-style: normal; - font-weight: 485; - line-height: 2rem; + font-weight: 500; + line-height: 1.8rem; + letter-spacing: -0.0075rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } @@ -67,8 +121,9 @@ @apply font-basel-grotesk; font-size: 1.25rem; font-style: normal; - font-weight: 485; - line-height: 1.625rem; + font-weight: 500; + line-height: 1.5rem; + letter-spacing: -0.00625rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } @@ -76,7 +131,7 @@ .serif-subheading-1 { @apply font-riegraf; font-size: 1.125rem; - font-style: normal; + font-style: italic; font-weight: 400; line-height: 1.25rem; -webkit-font-smoothing: antialiased; @@ -87,8 +142,8 @@ @apply font-basel-grotesk; font-size: 1.125rem; font-style: normal; - font-weight: 485; - line-height: 1.5rem; + font-weight: 500; + line-height: 133.333%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } @@ -97,8 +152,18 @@ @apply font-basel-grotesk; font-size: 1rem; font-style: normal; - font-weight: 485; - line-height: 1.5rem; + font-weight: 500; + line-height: 150%; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } + + .serif-subheading-3 { + @apply font-riegraf; + font-size: 0.8125rem; + font-style: normal; + font-weight: 400; + line-height: 1.25rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } @@ -107,8 +172,8 @@ @apply font-basel-grotesk; font-size: 1.125rem; font-style: normal; - font-weight: 485; - line-height: 1.5rem; + font-weight: 500; + line-height: 1.4625rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } @@ -117,8 +182,8 @@ @apply font-basel-grotesk; font-size: 1rem; font-style: normal; - font-weight: 485; - line-height: 1/5rem; + font-weight: 500; + line-height: 1.4rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } @@ -127,8 +192,8 @@ @apply font-basel-grotesk; font-size: 0.875rem; font-style: normal; - font-weight: 485; - line-height: 1/25rem; + font-weight: 500; + line-height: 1.09375rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } @@ -137,48 +202,29 @@ @apply font-basel-grotesk; font-size: 0.75rem; font-style: normal; - font-weight: 485; - line-height: 1rem; + font-weight: 500; + line-height: 133.333%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } - .serif-caption-1 { + .serif-body-5 { @apply font-riegraf; font-size: 0.875rem; font-style: normal; font-weight: 400; - line-height: 1.25rem; + line-height: 1.05rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } - .caption-1 { + .mono-body-5 { @apply font-fragment-mono; font-size: 0.8125rem; font-style: normal; font-weight: 400; - line-height: 1.25rem; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - } - - .pullquote-1 { - @apply font-riegraf; - font-size: 2.5rem; - font-style: italic; - font-weight: 400; - line-height: 3rem; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - } - - .pullquote-2 { - @apply font-riegraf; - font-size: 1.5rem; - font-style: italic; - font-weight: 400; - line-height: 1.8rem; + line-height: 1.05625rem; + letter-spacing: -0.00813rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } @@ -187,7 +233,7 @@ @apply font-basel-grotesk; font-size: 1.125rem; font-style: normal; - font-weight: 600; + font-weight: 535; line-height: 1.5rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -197,7 +243,7 @@ @apply font-basel-grotesk; font-size: 1rem; font-style: normal; - font-weight: 600; + font-weight: 535; line-height: 1.5rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -207,7 +253,7 @@ @apply font-basel-grotesk; font-size: 0.875rem; font-style: normal; - font-weight: 600; + font-weight: 535; line-height: 1.25rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -217,7 +263,7 @@ @apply font-basel-grotesk; font-size: 0.75rem; font-style: normal; - font-weight: 600; + font-weight: 535; line-height: 1rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; diff --git a/src/theme/Footer.tsx b/src/theme/Footer.tsx new file mode 100644 index 000000000..5394f215c --- /dev/null +++ b/src/theme/Footer.tsx @@ -0,0 +1,157 @@ +import React, { FC } from 'react' + +import { MiniUnicon, Github, X, Discord } from '../components/Icons' + +import { LinkBase, TextButton } from '../components/base/Button' + +const footerData = { + footerLinks: [ + { + title: 'Developers', + links: [ + { + label: 'Concepts', + href: '/concepts/overview', + }, + { + label: 'Contracts', + href: '/contracts/v4/overview', + }, + { + label: 'SDKs', + href: '/sdk/v3/overview', + }, + { + label: 'APIs', + href: '/api/subgraph/overview', + }, + { + label: 'Whitepaper', + href: 'https://uniswap.org/whitepaper-v3.pdf', + }, + ], + }, + { + title: 'Ecosystem', + links: [ + { + label: 'Uniswap App', + href: 'https://app.uniswap.org/', + }, + { + label: 'Governance', + href: 'https://www.uniswapfoundation.org/governance', + }, + { + label: 'Blog', + href: 'https://blog.uniswap.org/', + }, + ], + }, + { + title: 'Company', + links: [ + { + label: 'Careers', + href: 'https://boards.greenhouse.io/uniswaplabs', + }, + { + label: 'Brand Assets', + href: 'https://github.com/Uniswap/brand-assets/raw/main/Uniswap%20Brand%20Assets.zip', + }, + { + label: 'Terms of Service', + href: 'https://support.uniswap.org/hc/en-us/articles/30935100859661-Uniswap-Labs-Terms-of-Service', + }, + { + label: 'Privacy Policy', + href: 'https://support.uniswap.org/hc/en-us/articles/30934457771405-Uniswap-Labs-Privacy-Policy', + }, + { + label: 'Trademark Policy', + href: 'https://support.uniswap.org/hc/en-us/articles/30934762216973-Uniswap-Labs-Trademark-Guidelines', + }, + ], + }, + { + title: 'Need Help?', + links: [ + { + label: 'Help Center', + href: 'https://support.uniswap.org/', + }, + { + label: 'Contact Us', + href: 'https://support.uniswap.org/hc/en-us/requests/new', + }, + ], + }, + ], + footerGithubLink: 'https://github.com/uniswap/uniswap-docs', + footerXLink: 'https://twitter.com/Uniswap', + footerDiscordLink: 'https://discord.com/invite/uniswap', +} + +const Footer: FC = () => { + return ( +
+

Footer

+
+
+ + +

Uniswap Labs

+
+
+
+ +
+
+
+

+ @{new Date().getFullYear()} Uniswap Labs +

+
+ {footerData?.footerGithubLink ? ( + + + + ) : null} + {footerData?.footerXLink ? ( + + + + ) : null} + {footerData?.footerDiscordLink ? ( + + + + ) : null} +
+
+
+ ) +} + +export default Footer diff --git a/src/theme/Navbar.tsx b/src/theme/Navbar.tsx new file mode 100644 index 000000000..9c0ae4a89 --- /dev/null +++ b/src/theme/Navbar.tsx @@ -0,0 +1,42 @@ +import React, { FC } from 'react' + +import OriginalSearchbar from '@theme-original/SearchBar' +import { MiniUnicon, Menu } from '../components/Icons' +import ThemeSwitch from '../components/ThemeSwitch' + +const Navbar: FC = () => { + return ( + + ) +} + +export default Navbar diff --git a/src/theme/NavbarItem.tsx b/src/theme/NavbarItem.tsx deleted file mode 100644 index be213947a..000000000 --- a/src/theme/NavbarItem.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { useLocation } from '@docusaurus/router' -import OriginalNavBarItem from '@theme-original/NavbarItem' -import { TraceEvent } from '@uniswap/analytics' -import { BrowserEvent, DocsProtocolVersion, SharedEventName } from '@uniswap/analytics-events' -import React from 'react' - -enum ProtocolVersion { - V1 = 'V1', - V2 = 'V2', - V3 = 'V3', -} - -const UNKNOWN_PROTOCOL_VERSION = 'UNKNOWN_PROTOCOL_VERSION' - -const getSection = (version: string) => { - switch (version) { - case ProtocolVersion.V1: - return DocsProtocolVersion.V1 - case ProtocolVersion.V2: - return DocsProtocolVersion.V2 - case ProtocolVersion.V3: - return DocsProtocolVersion.V3 - default: - return UNKNOWN_PROTOCOL_VERSION - } -} - -const getSelectedDocVersion = (docVersion: string) => { - switch (docVersion) { - case ProtocolVersion.V1: - case '1.0.0': - return ProtocolVersion.V1 - case ProtocolVersion.V2: - case '2.0.0': - return ProtocolVersion.V2 - // Default to the current doc version - default: - return ProtocolVersion.V3 - } -} - -const getClassName = (className: string, version: string) => { - return className + ' ' + version -} - -export default function NavbarItem(props: { className: string; label: string }) { - const { pathname } = useLocation() - - const docVersionFromPath = pathname.split('/') - const selectedDocVersion = getSelectedDocVersion(docVersionFromPath[2]) - - return ( - <> - - - - - ) -} diff --git a/src/theme/Root.tsx b/src/theme/Root.tsx index 051bd78cf..001014f86 100644 --- a/src/theme/Root.tsx +++ b/src/theme/Root.tsx @@ -28,7 +28,9 @@ export default function Root({ children }: React.PropsWithChildren<{ open: boole proxyUrl: analyticsProxyUrl, isProductionEnv, }) - } catch {} + } catch { + // Ignore error + } // Fires on initial render of the page useEffect(() => { diff --git a/src/utils/storage.ts b/src/utils/storage.ts new file mode 100644 index 000000000..cd7c54c65 --- /dev/null +++ b/src/utils/storage.ts @@ -0,0 +1,33 @@ +import Cookies from 'js-cookie' + +export class StorageManager { + key: string + + constructor(key: string) { + this.key = key + } + + set(value: T): void { + const valueToSet = JSON.stringify(value) + Cookies.set(this.key, valueToSet, { expires: 365 }) + } + + get(): T | undefined { + const value = Cookies.get(this.key) + + if (value) { + return JSON.parse(value) + } + + return undefined + } + + remove(): void { + Cookies.remove(this.key) + } +} + +export type Theme = 'dark' | 'light' + +const THEME_STORAGE_NAME = 'uniswap-ui-theme' +export const ThemeManager = new StorageManager(THEME_STORAGE_NAME) diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Book-Italic.otf b/static/font/baselGrotesk/Basel-Grotesk-Book-Italic.otf similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Book-Italic.otf rename to static/font/baselGrotesk/Basel-Grotesk-Book-Italic.otf diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Book-Italic.woff b/static/font/baselGrotesk/Basel-Grotesk-Book-Italic.woff similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Book-Italic.woff rename to static/font/baselGrotesk/Basel-Grotesk-Book-Italic.woff diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Book-Italic.woff2 b/static/font/baselGrotesk/Basel-Grotesk-Book-Italic.woff2 similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Book-Italic.woff2 rename to static/font/baselGrotesk/Basel-Grotesk-Book-Italic.woff2 diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Book.otf b/static/font/baselGrotesk/Basel-Grotesk-Book.otf similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Book.otf rename to static/font/baselGrotesk/Basel-Grotesk-Book.otf diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Book.woff b/static/font/baselGrotesk/Basel-Grotesk-Book.woff similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Book.woff rename to static/font/baselGrotesk/Basel-Grotesk-Book.woff diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Book.woff2 b/static/font/baselGrotesk/Basel-Grotesk-Book.woff2 similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Book.woff2 rename to static/font/baselGrotesk/Basel-Grotesk-Book.woff2 diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Medium-Italic.otf b/static/font/baselGrotesk/Basel-Grotesk-Medium-Italic.otf similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Medium-Italic.otf rename to static/font/baselGrotesk/Basel-Grotesk-Medium-Italic.otf diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Medium-Italic.woff b/static/font/baselGrotesk/Basel-Grotesk-Medium-Italic.woff similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Medium-Italic.woff rename to static/font/baselGrotesk/Basel-Grotesk-Medium-Italic.woff diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Medium-Italic.woff2 b/static/font/baselGrotesk/Basel-Grotesk-Medium-Italic.woff2 similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Medium-Italic.woff2 rename to static/font/baselGrotesk/Basel-Grotesk-Medium-Italic.woff2 diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Medium.otf b/static/font/baselGrotesk/Basel-Grotesk-Medium.otf similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Medium.otf rename to static/font/baselGrotesk/Basel-Grotesk-Medium.otf diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Medium.woff b/static/font/baselGrotesk/Basel-Grotesk-Medium.woff similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Medium.woff rename to static/font/baselGrotesk/Basel-Grotesk-Medium.woff diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Medium.woff2 b/static/font/baselGrotesk/Basel-Grotesk-Medium.woff2 similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Medium.woff2 rename to static/font/baselGrotesk/Basel-Grotesk-Medium.woff2 diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Regular-Italic.otf b/static/font/baselGrotesk/Basel-Grotesk-Regular-Italic.otf similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Regular-Italic.otf rename to static/font/baselGrotesk/Basel-Grotesk-Regular-Italic.otf diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Regular-Italic.woff b/static/font/baselGrotesk/Basel-Grotesk-Regular-Italic.woff similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Regular-Italic.woff rename to static/font/baselGrotesk/Basel-Grotesk-Regular-Italic.woff diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Regular-Italic.woff2 b/static/font/baselGrotesk/Basel-Grotesk-Regular-Italic.woff2 similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Regular-Italic.woff2 rename to static/font/baselGrotesk/Basel-Grotesk-Regular-Italic.woff2 diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Regular.otf b/static/font/baselGrotesk/Basel-Grotesk-Regular.otf similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Regular.otf rename to static/font/baselGrotesk/Basel-Grotesk-Regular.otf diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Regular.woff b/static/font/baselGrotesk/Basel-Grotesk-Regular.woff similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Regular.woff rename to static/font/baselGrotesk/Basel-Grotesk-Regular.woff diff --git a/static/fonts/baselGrotesk/Basel-Grotesk-Regular.woff2 b/static/font/baselGrotesk/Basel-Grotesk-Regular.woff2 similarity index 100% rename from static/fonts/baselGrotesk/Basel-Grotesk-Regular.woff2 rename to static/font/baselGrotesk/Basel-Grotesk-Regular.woff2 diff --git a/static/fonts/riegraf/Riegraf-Bold.otf b/static/font/riegraf/Riegraf-Bold.otf similarity index 100% rename from static/fonts/riegraf/Riegraf-Bold.otf rename to static/font/riegraf/Riegraf-Bold.otf diff --git a/static/fonts/riegraf/Riegraf-Light.otf b/static/font/riegraf/Riegraf-Light.otf similarity index 100% rename from static/fonts/riegraf/Riegraf-Light.otf rename to static/font/riegraf/Riegraf-Light.otf diff --git a/static/fonts/riegraf/Riegraf-Medium.otf b/static/font/riegraf/Riegraf-Medium.otf similarity index 100% rename from static/fonts/riegraf/Riegraf-Medium.otf rename to static/font/riegraf/Riegraf-Medium.otf diff --git a/static/fonts/riegraf/Riegraf-Regular-Italic.otf b/static/font/riegraf/Riegraf-Regular-Italic.otf similarity index 100% rename from static/fonts/riegraf/Riegraf-Regular-Italic.otf rename to static/font/riegraf/Riegraf-Regular-Italic.otf diff --git a/static/fonts/riegraf/Riegraf-Regular.otf b/static/font/riegraf/Riegraf-Regular.otf similarity index 100% rename from static/fonts/riegraf/Riegraf-Regular.otf rename to static/font/riegraf/Riegraf-Regular.otf diff --git a/tailwind.config.js b/tailwind.config.js index 202747446..c02a64054 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -72,8 +72,7 @@ module.exports = { 'gap-medium': rem(12), 'gap-small': rem(8), 'gap-x-small': rem(4), - 'mobile-nav-h': rem(72), - 'nav-h': rem(59), + 'nav-h': rem(72), }, boxShadow: { 'light-short': '0px 1px 6px 2px rgba(0, 0, 0, 0.03), 0px 1px 2px 0px rgba(0, 0, 0, 0.02)', diff --git a/yarn.lock b/yarn.lock index 7b4f24464..5c47bb09a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1691,6 +1691,42 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" +"@floating-ui/core@^1.6.0": + version "1.6.8" + resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.6.8.tgz#aa43561be075815879305965020f492cdb43da12" + integrity sha512-7XJ9cPU+yI2QeLS+FCSlqNFZJq8arvswefkZrYI1yQBbftw6FyrZOxYSh+9S7z7TpeWlRt9zJ5IhM1WIL334jA== + dependencies: + "@floating-ui/utils" "^0.2.8" + +"@floating-ui/dom@^1.0.0": + version "1.6.12" + resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.6.12.tgz#6333dcb5a8ead3b2bf82f33d6bc410e95f54e556" + integrity sha512-NP83c0HjokcGVEMeoStg317VD9W7eDlGK7457dMBANbKA6GJZdc7rjujdgqzTaz93jkGgc5P/jeWbaCHnMNc+w== + dependencies: + "@floating-ui/core" "^1.6.0" + "@floating-ui/utils" "^0.2.8" + +"@floating-ui/react-dom@^2.1.2": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@floating-ui/react-dom/-/react-dom-2.1.2.tgz#a1349bbf6a0e5cb5ded55d023766f20a4d439a31" + integrity sha512-06okr5cgPzMNBy+Ycse2A6udMi4bqwW/zgBF/rwjcNqWkyr82Mcg8b0vjX8OJpZFy/FKjJmw6wV7t44kK6kW7A== + dependencies: + "@floating-ui/dom" "^1.0.0" + +"@floating-ui/react@^0.26.16": + version "0.26.27" + resolved "https://registry.yarnpkg.com/@floating-ui/react/-/react-0.26.27.tgz#402f7b4b2702650662705fe9cbe0f1d5607846a1" + integrity sha512-jLP72x0Kr2CgY6eTYi/ra3VA9LOkTo4C+DUTrbFgFOExKy3omYVmwMjNKqxAHdsnyLS96BIDLcO2SlnsNf8KUQ== + dependencies: + "@floating-ui/react-dom" "^2.1.2" + "@floating-ui/utils" "^0.2.8" + tabbable "^6.0.0" + +"@floating-ui/utils@^0.2.8": + version "0.2.8" + resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.8.tgz#21a907684723bbbaa5f0974cf7730bd797eb8e62" + integrity sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig== + "@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0": version "9.3.0" resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" @@ -1703,6 +1739,16 @@ dependencies: "@hapi/hoek" "^9.0.0" +"@headlessui/react@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@headlessui/react/-/react-2.2.0.tgz#a8e32f0899862849a1ce1615fa280e7891431ab7" + integrity sha512-RzCEg+LXsuI7mHiSomsu/gBJSjpupm6A1qIZ5sWjd7JhARNlMiSA4kKfJpCKwU9tE+zMRterhhrP74PvfJrpXQ== + dependencies: + "@floating-ui/react" "^0.26.16" + "@react-aria/focus" "^3.17.1" + "@react-aria/interactions" "^3.21.3" + "@tanstack/react-virtual" "^3.8.1" + "@humanwhocodes/config-array@^0.5.0": version "0.5.0" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9" @@ -1859,6 +1905,57 @@ resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.28.tgz#d45e01c4a56f143ee69c54dd6b12eade9e270a73" integrity sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw== +"@react-aria/focus@^3.17.1": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@react-aria/focus/-/focus-3.18.4.tgz#a6e95896bc8680d1b5bcd855e983fc2c195a1a55" + integrity sha512-91J35077w9UNaMK1cpMUEFRkNNz0uZjnSwiyBCFuRdaVuivO53wNC9XtWSDNDdcO5cGy87vfJRVAiyoCn/mjqA== + dependencies: + "@react-aria/interactions" "^3.22.4" + "@react-aria/utils" "^3.25.3" + "@react-types/shared" "^3.25.0" + "@swc/helpers" "^0.5.0" + clsx "^2.0.0" + +"@react-aria/interactions@^3.21.3", "@react-aria/interactions@^3.22.4": + version "3.22.4" + resolved "https://registry.yarnpkg.com/@react-aria/interactions/-/interactions-3.22.4.tgz#88ed61ab6a485f869bc1f65ae6688d48ca96064b" + integrity sha512-E0vsgtpItmknq/MJELqYJwib+YN18Qag8nroqwjk1qOnBa9ROIkUhWJerLi1qs5diXq9LHKehZDXRlwPvdEFww== + dependencies: + "@react-aria/ssr" "^3.9.6" + "@react-aria/utils" "^3.25.3" + "@react-types/shared" "^3.25.0" + "@swc/helpers" "^0.5.0" + +"@react-aria/ssr@^3.9.6": + version "3.9.6" + resolved "https://registry.yarnpkg.com/@react-aria/ssr/-/ssr-3.9.6.tgz#a9e8b351acdc8238f2b5215b0ce904636c6ea690" + integrity sha512-iLo82l82ilMiVGy342SELjshuWottlb5+VefO3jOQqQRNYnJBFpUSadswDPbRimSgJUZuFwIEYs6AabkP038fA== + dependencies: + "@swc/helpers" "^0.5.0" + +"@react-aria/utils@^3.25.3": + version "3.25.3" + resolved "https://registry.yarnpkg.com/@react-aria/utils/-/utils-3.25.3.tgz#cad9bffc07b045cdc283df2cb65c18747acbf76d" + integrity sha512-PR5H/2vaD8fSq0H/UB9inNbc8KDcVmW6fYAfSWkkn+OAdhTTMVKqXXrZuZBWyFfSD5Ze7VN6acr4hrOQm2bmrA== + dependencies: + "@react-aria/ssr" "^3.9.6" + "@react-stately/utils" "^3.10.4" + "@react-types/shared" "^3.25.0" + "@swc/helpers" "^0.5.0" + clsx "^2.0.0" + +"@react-stately/utils@^3.10.4": + version "3.10.4" + resolved "https://registry.yarnpkg.com/@react-stately/utils/-/utils-3.10.4.tgz#310663a834b67048d305e1680ed258130092fe51" + integrity sha512-gBEQEIMRh5f60KCm7QKQ2WfvhB2gLUr9b72sqUdIZ2EG+xuPgaIlCBeSicvjmjBvYZwOjoOEnmIkcx2GHp/HWw== + dependencies: + "@swc/helpers" "^0.5.0" + +"@react-types/shared@^3.25.0": + version "3.25.0" + resolved "https://registry.yarnpkg.com/@react-types/shared/-/shared-3.25.0.tgz#7223baf72256e918a3c29081bb1ecc6fad4fbf58" + integrity sha512-OZSyhzU6vTdW3eV/mz5i6hQwQUhkRs7xwY2d1aqPvTdMe0+2cY7Fwp45PAiwYLEj73i9ro2FxF9qC4DvHGSCgQ== + "@saucelabs/theme-github-codeblock@https://github.com/Uniswap/docusaurus-theme-github-codeblock.git#f55fe4caed9fce974c9b82bf2164f76cc5509eef": version "0.2.0" resolved "https://github.com/Uniswap/docusaurus-theme-github-codeblock.git#f55fe4caed9fce974c9b82bf2164f76cc5509eef" @@ -2005,6 +2102,13 @@ "@svgr/plugin-jsx" "^6.5.1" "@svgr/plugin-svgo" "^6.5.1" +"@swc/helpers@^0.5.0": + version "0.5.15" + resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.15.tgz#79efab344c5819ecf83a43f3f9f811fc84b516d7" + integrity sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g== + dependencies: + tslib "^2.8.0" + "@szmarczak/http-timer@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421" @@ -2012,6 +2116,18 @@ dependencies: defer-to-connect "^1.0.1" +"@tanstack/react-virtual@^3.8.1": + version "3.10.9" + resolved "https://registry.yarnpkg.com/@tanstack/react-virtual/-/react-virtual-3.10.9.tgz#40606b6dd8aba8e977f576d8f7df07f69ca63eea" + integrity sha512-OXO2uBjFqA4Ibr2O3y0YMnkrRWGVNqcvHQXmGvMu6IK8chZl3PrDxFXdGZ2iZkSrKh3/qUYoFqYe+Rx23RoU0g== + dependencies: + "@tanstack/virtual-core" "3.10.9" + +"@tanstack/virtual-core@3.10.9": + version "3.10.9" + resolved "https://registry.yarnpkg.com/@tanstack/virtual-core/-/virtual-core-3.10.9.tgz#55710c92b311fdaa8d8c66682a0dbdd684bc77c4" + integrity sha512-kBknKOKzmeR7lN+vSadaKWXaLS0SZZG+oqpQ/k80Q6g9REn6zRHS/ZYdrIzHnpHgy/eWs00SujveUN/GJT2qTw== + "@trysound/sax@0.2.0": version "0.2.0" resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad" @@ -2145,6 +2261,11 @@ dependencies: "@types/istanbul-lib-report" "*" +"@types/js-cookie@^3.0.6": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@types/js-cookie/-/js-cookie-3.0.6.tgz#a04ca19e877687bd449f5ad37d33b104b71fdf95" + integrity sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ== + "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.7", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" @@ -3280,6 +3401,11 @@ ci-info@^3.2.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== +classnames@^2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.5.1.tgz#ba774c614be0f016da105c858e7159eae8e7687b" + integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow== + clean-css@^5.2.2, clean-css@^5.3.0: version "5.3.3" resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-5.3.3.tgz#b330653cd3bd6b75009cc25c714cae7b93351ccd" @@ -3332,6 +3458,11 @@ clsx@^1.1.1, clsx@^1.2.1: resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12" integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg== +clsx@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.1.tgz#eed397c9fd8bd882bfb18deab7102049a2f32999" + integrity sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA== + collapse-white-space@^1.0.2: version "1.0.6" resolved "https://registry.yarnpkg.com/collapse-white-space/-/collapse-white-space-1.0.6.tgz#e63629c0016665792060dbbeb79c42239d2c5287" @@ -5940,6 +6071,11 @@ joi@^17.6.0: "@sideway/formula" "^3.0.1" "@sideway/pinpoint" "^2.0.0" +js-cookie@^3.0.5: + version "3.0.5" + resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-3.0.5.tgz#0b7e2fd0c01552c58ba86e0841f94dc2557dcdbc" + integrity sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw== + "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -8721,6 +8857,11 @@ svgo@^2.7.0, svgo@^2.8.0: picocolors "^1.0.0" stable "^0.1.8" +tabbable@^6.0.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/tabbable/-/tabbable-6.2.0.tgz#732fb62bc0175cfcec257330be187dcfba1f3b97" + integrity sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew== + table@^6.0.9: version "6.8.2" resolved "https://registry.yarnpkg.com/table/-/table-6.8.2.tgz#c5504ccf201213fa227248bdc8c5569716ac6c58" @@ -8892,6 +9033,11 @@ tslib@^2.0.3, tslib@^2.1.0, tslib@^2.4.0, tslib@^2.4.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== +tslib@^2.8.0: + version "2.8.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" + integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== + tsutils@^3.21.0: version "3.21.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"