diff --git a/docs/contracts/v4/reference/core/ERC6909.md b/docs/contracts/v4/reference/core/ERC6909.md index 546b47212..c98b9403c 100644 --- a/docs/contracts/v4/reference/core/ERC6909.md +++ b/docs/contracts/v4/reference/core/ERC6909.md @@ -1,5 +1,5 @@ # ERC6909 -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 861421777..39f16ac48 100644 --- a/docs/contracts/v4/reference/core/ERC6909Claims.md +++ b/docs/contracts/v4/reference/core/ERC6909Claims.md @@ -1,5 +1,5 @@ # ERC6909Claims -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 e57d84f6a..89092849e 100644 --- a/docs/contracts/v4/reference/core/Extsload.md +++ b/docs/contracts/v4/reference/core/Extsload.md @@ -1,5 +1,5 @@ # Extsload -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 4c376946b..ebd6b3731 100644 --- a/docs/contracts/v4/reference/core/Exttload.md +++ b/docs/contracts/v4/reference/core/Exttload.md @@ -1,5 +1,5 @@ # Exttload -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 cf7cfd3f7..fe66dad50 100644 --- a/docs/contracts/v4/reference/core/NoDelegateCall.md +++ b/docs/contracts/v4/reference/core/NoDelegateCall.md @@ -1,5 +1,5 @@ # NoDelegateCall -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 52cb440bd..a16de7e1c 100644 --- a/docs/contracts/v4/reference/core/PoolManager.md +++ b/docs/contracts/v4/reference/core/PoolManager.md @@ -1,5 +1,5 @@ # PoolManager -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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) diff --git a/docs/contracts/v4/reference/core/ProtocolFees.md b/docs/contracts/v4/reference/core/ProtocolFees.md index 7b3b069e4..e255050f5 100644 --- a/docs/contracts/v4/reference/core/ProtocolFees.md +++ b/docs/contracts/v4/reference/core/ProtocolFees.md @@ -1,5 +1,5 @@ # ProtocolFees -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 diff --git a/docs/contracts/v4/reference/core/interfaces/IERC20Minimal.md b/docs/contracts/v4/reference/core/interfaces/IERC20Minimal.md index ccf622088..530158163 100644 --- a/docs/contracts/v4/reference/core/interfaces/IERC20Minimal.md +++ b/docs/contracts/v4/reference/core/interfaces/IERC20Minimal.md @@ -1,5 +1,5 @@ # IERC20Minimal -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 4c6596707..97572cd96 100644 --- a/docs/contracts/v4/reference/core/interfaces/IERC6909Claims.md +++ b/docs/contracts/v4/reference/core/interfaces/IERC6909Claims.md @@ -1,5 +1,5 @@ # IERC6909Claims -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 0d561f591..fcad01005 100644 --- a/docs/contracts/v4/reference/core/interfaces/IExtsload.md +++ b/docs/contracts/v4/reference/core/interfaces/IExtsload.md @@ -1,5 +1,5 @@ # IExtsload -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 bfc72755c..6d8311c57 100644 --- a/docs/contracts/v4/reference/core/interfaces/IExttload.md +++ b/docs/contracts/v4/reference/core/interfaces/IExttload.md @@ -1,5 +1,5 @@ # IExttload -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 4e287403f..85c0071c8 100644 --- a/docs/contracts/v4/reference/core/interfaces/IHooks.md +++ b/docs/contracts/v4/reference/core/interfaces/IHooks.md @@ -1,5 +1,5 @@ # IHooks -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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. diff --git a/docs/contracts/v4/reference/core/interfaces/IPoolManager.md b/docs/contracts/v4/reference/core/interfaces/IPoolManager.md index b0266b131..5ec6c8d28 100644 --- a/docs/contracts/v4/reference/core/interfaces/IPoolManager.md +++ b/docs/contracts/v4/reference/core/interfaces/IPoolManager.md @@ -1,5 +1,5 @@ # IPoolManager -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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) @@ -62,6 +62,10 @@ Modify the liquidity for the given pool *Poke by calling with a zero liquidityDelta* +*Note that feesAccrued can be artificially inflated by a malicious actor and integrators should be careful using the value +For pools with a single liquidity position, actors can donate to themselves to inflate feeGrowthGlobal (and consequently feesAccrued) +atomically donating and collecting fees in the same unlockCallback may make the inflated value more extreme* + ```solidity function modifyLiquidity(PoolKey memory key, ModifyLiquidityParams memory params, bytes calldata hookData) diff --git a/docs/contracts/v4/reference/core/interfaces/IProtocolFeeController.md b/docs/contracts/v4/reference/core/interfaces/IProtocolFeeController.md deleted file mode 100644 index a4bff3399..000000000 --- a/docs/contracts/v4/reference/core/interfaces/IProtocolFeeController.md +++ /dev/null @@ -1,29 +0,0 @@ -# IProtocolFeeController -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/IProtocolFeeController.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) - -Interface to fetch the protocol fees for a pool from the protocol fee controller - - -## Functions -### protocolFeeForPool - -Returns the protocol fees for a pool given the conditions of this contract - - -```solidity -function protocolFeeForPool(PoolKey memory poolKey) external view returns (uint24 protocolFee); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`poolKey`|`PoolKey`|The pool key to identify the pool. The controller may want to use attributes on the pool to determine the protocol fee, hence the entire key is needed.| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|`protocolFee`|`uint24`|The pool's protocol fee, expressed in hundredths of a bip. The upper 12 bits are for 1->0 and the lower 12 are for 0->1. The maximum is 1000 - meaning the maximum protocol fee is 0.1%. the protocolFee is taken from the input first, then the lpFee is taken from the remaining input| - - diff --git a/docs/contracts/v4/reference/core/interfaces/IProtocolFees.md b/docs/contracts/v4/reference/core/interfaces/IProtocolFees.md index 147919d5b..e49be4f7b 100644 --- a/docs/contracts/v4/reference/core/interfaces/IProtocolFees.md +++ b/docs/contracts/v4/reference/core/interfaces/IProtocolFees.md @@ -1,5 +1,5 @@ # IProtocolFees -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 diff --git a/docs/contracts/v4/reference/core/interfaces/IUnlockCallback.md b/docs/contracts/v4/reference/core/interfaces/IUnlockCallback.md index b957d272c..54d222409 100644 --- a/docs/contracts/v4/reference/core/interfaces/IUnlockCallback.md +++ b/docs/contracts/v4/reference/core/interfaces/IUnlockCallback.md @@ -1,5 +1,5 @@ # IUnlockCallback -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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/BipsLibrary.md b/docs/contracts/v4/reference/core/libraries/BipsLibrary.md deleted file mode 100644 index 3dc5321f3..000000000 --- a/docs/contracts/v4/reference/core/libraries/BipsLibrary.md +++ /dev/null @@ -1,37 +0,0 @@ -# BipsLibrary -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/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/core/libraries/BitMath.md b/docs/contracts/v4/reference/core/libraries/BitMath.md index 6c5312714..b23e55b55 100644 --- a/docs/contracts/v4/reference/core/libraries/BitMath.md +++ b/docs/contracts/v4/reference/core/libraries/BitMath.md @@ -1,5 +1,5 @@ # BitMath -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 b54cb3b5e..2b4a1dc65 100644 --- a/docs/contracts/v4/reference/core/libraries/CurrencyDelta.md +++ b/docs/contracts/v4/reference/core/libraries/CurrencyDelta.md @@ -1,5 +1,5 @@ # CurrencyDelta -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 17b49bd67..0806cd6bc 100644 --- a/docs/contracts/v4/reference/core/libraries/CurrencyReserves.md +++ b/docs/contracts/v4/reference/core/libraries/CurrencyReserves.md @@ -1,5 +1,5 @@ # CurrencyReserves -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 89652ce6a..1153ac223 100644 --- a/docs/contracts/v4/reference/core/libraries/CustomRevert.md +++ b/docs/contracts/v4/reference/core/libraries/CustomRevert.md @@ -1,5 +1,5 @@ # CustomRevert -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 diff --git a/docs/contracts/v4/reference/core/libraries/FixedPoint128.md b/docs/contracts/v4/reference/core/libraries/FixedPoint128.md index c92cc7621..e41015a6c 100644 --- a/docs/contracts/v4/reference/core/libraries/FixedPoint128.md +++ b/docs/contracts/v4/reference/core/libraries/FixedPoint128.md @@ -1,5 +1,5 @@ # FixedPoint128 -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 7d098dacd..fa21f86cf 100644 --- a/docs/contracts/v4/reference/core/libraries/FixedPoint96.md +++ b/docs/contracts/v4/reference/core/libraries/FixedPoint96.md @@ -1,5 +1,5 @@ # FixedPoint96 -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 3fa739f7e..424f42807 100644 --- a/docs/contracts/v4/reference/core/libraries/FullMath.md +++ b/docs/contracts/v4/reference/core/libraries/FullMath.md @@ -1,5 +1,5 @@ # FullMath -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 2988766c9..e971d5c13 100644 --- a/docs/contracts/v4/reference/core/libraries/Hooks.md +++ b/docs/contracts/v4/reference/core/libraries/Hooks.md @@ -1,5 +1,5 @@ # Hooks -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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. diff --git a/docs/contracts/v4/reference/core/libraries/LPFeeLibrary.md b/docs/contracts/v4/reference/core/libraries/LPFeeLibrary.md index d09280aeb..0e3dfa209 100644 --- a/docs/contracts/v4/reference/core/libraries/LPFeeLibrary.md +++ b/docs/contracts/v4/reference/core/libraries/LPFeeLibrary.md @@ -1,5 +1,5 @@ # LPFeeLibrary -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 diff --git a/docs/contracts/v4/reference/core/libraries/LiquidityMath.md b/docs/contracts/v4/reference/core/libraries/LiquidityMath.md index 3f5de6eba..f7441035f 100644 --- a/docs/contracts/v4/reference/core/libraries/LiquidityMath.md +++ b/docs/contracts/v4/reference/core/libraries/LiquidityMath.md @@ -1,5 +1,5 @@ # LiquidityMath -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 f64208181..e4405c459 100644 --- a/docs/contracts/v4/reference/core/libraries/Lock.md +++ b/docs/contracts/v4/reference/core/libraries/Lock.md @@ -1,5 +1,5 @@ # Lock -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 8a04de784..1b04e1dea 100644 --- a/docs/contracts/v4/reference/core/libraries/NonzeroDeltaCount.md +++ b/docs/contracts/v4/reference/core/libraries/NonzeroDeltaCount.md @@ -1,5 +1,5 @@ # NonzeroDeltaCount -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 682a92878..efb1217f0 100644 --- a/docs/contracts/v4/reference/core/libraries/ParseBytes.md +++ b/docs/contracts/v4/reference/core/libraries/ParseBytes.md @@ -1,5 +1,5 @@ # ParseBytes -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 8e0d37c16..475d88321 100644 --- a/docs/contracts/v4/reference/core/libraries/Pool.md +++ b/docs/contracts/v4/reference/core/libraries/Pool.md @@ -1,5 +1,5 @@ # Pool -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 @@ -340,7 +340,11 @@ struct TickInfo { ``` ### State -*The state of a pool* +The state of a pool + +*Note that feeGrowthGlobal can be artificially inflated +For pools with a single liquidity position, actors can donate to themselves to freely inflate feeGrowthGlobal +atomically donating and collecting fees in the same unlockCallback may make the inflated value more extreme* ```solidity diff --git a/docs/contracts/v4/reference/core/libraries/Position.md b/docs/contracts/v4/reference/core/libraries/Position.md index d7b9c8670..617d33f5a 100644 --- a/docs/contracts/v4/reference/core/libraries/Position.md +++ b/docs/contracts/v4/reference/core/libraries/Position.md @@ -1,5 +1,5 @@ # Position -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 0c71798c5..adf99229d 100644 --- a/docs/contracts/v4/reference/core/libraries/ProtocolFeeLibrary.md +++ b/docs/contracts/v4/reference/core/libraries/ProtocolFeeLibrary.md @@ -1,5 +1,5 @@ # ProtocolFeeLibrary -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 3edb69a61..3ae234483 100644 --- a/docs/contracts/v4/reference/core/libraries/SafeCast.md +++ b/docs/contracts/v4/reference/core/libraries/SafeCast.md @@ -1,5 +1,5 @@ # SafeCast -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 8154eed72..6847d9970 100644 --- a/docs/contracts/v4/reference/core/libraries/SqrtPriceMath.md +++ b/docs/contracts/v4/reference/core/libraries/SqrtPriceMath.md @@ -1,5 +1,5 @@ # SqrtPriceMath -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 e3a7e141a..93cf0f048 100644 --- a/docs/contracts/v4/reference/core/libraries/StateLibrary.md +++ b/docs/contracts/v4/reference/core/libraries/StateLibrary.md @@ -1,5 +1,5 @@ # StateLibrary -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 @@ -185,6 +185,10 @@ Retrieves the global fee growth of a pool. *Corresponds to pools[poolId].feeGrowthGlobal0X128 and pools[poolId].feeGrowthGlobal1X128* +*Note that feeGrowthGlobal can be artificially inflated +For pools with a single liquidity position, actors can donate to themselves to freely inflate feeGrowthGlobal +atomically donating and collecting fees in the same unlockCallback may make the inflated value more extreme* + ```solidity function getFeeGrowthGlobals(IPoolManager manager, PoolId poolId) diff --git a/docs/contracts/v4/reference/core/libraries/SwapMath.md b/docs/contracts/v4/reference/core/libraries/SwapMath.md index 72c4cb9fb..709aa18f7 100644 --- a/docs/contracts/v4/reference/core/libraries/SwapMath.md +++ b/docs/contracts/v4/reference/core/libraries/SwapMath.md @@ -1,5 +1,5 @@ # SwapMath -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 43aa6f80d..bc15bb9e3 100644 --- a/docs/contracts/v4/reference/core/libraries/TickBitmap.md +++ b/docs/contracts/v4/reference/core/libraries/TickBitmap.md @@ -1,5 +1,5 @@ # TickBitmap -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 99e490a4d..f8316b43f 100644 --- a/docs/contracts/v4/reference/core/libraries/TickMath.md +++ b/docs/contracts/v4/reference/core/libraries/TickMath.md @@ -1,5 +1,5 @@ # TickMath -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 85b115065..088185610 100644 --- a/docs/contracts/v4/reference/core/libraries/TransientStateLibrary.md +++ b/docs/contracts/v4/reference/core/libraries/TransientStateLibrary.md @@ -1,5 +1,5 @@ # TransientStateLibrary -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 dc23f66fa..580cb40cf 100644 --- a/docs/contracts/v4/reference/core/libraries/UnsafeMath.md +++ b/docs/contracts/v4/reference/core/libraries/UnsafeMath.md @@ -1,5 +1,5 @@ # UnsafeMath -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 diff --git a/docs/contracts/v4/reference/core/test/ActionsRouter.md b/docs/contracts/v4/reference/core/test/ActionsRouter.md index 710e50229..e875e774a 100644 --- a/docs/contracts/v4/reference/core/test/ActionsRouter.md +++ b/docs/contracts/v4/reference/core/test/ActionsRouter.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/test/ActionsRouter.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ```solidity @@ -21,3 +21,154 @@ enum Actions { } ``` +# ActionsRouter +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/test/ActionsRouter.sol) + +**Inherits:** +[IUnlockCallback](/src/interfaces/callback/IUnlockCallback.sol/interface.IUnlockCallback.md), Test + +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; +``` + +### _collectProtocolFees + + +```solidity +function _collectProtocolFees(bytes memory params) internal; +``` + +## Errors +### ActionNotSupported + +```solidity +error ActionNotSupported(); +``` + +### CheckParameters + +```solidity +error CheckParameters(); +``` + diff --git a/docs/contracts/v4/reference/core/test/BaseTestHooks.md b/docs/contracts/v4/reference/core/test/BaseTestHooks.md index 5e48fe74c..2485158c9 100644 --- a/docs/contracts/v4/reference/core/test/BaseTestHooks.md +++ b/docs/contracts/v4/reference/core/test/BaseTestHooks.md @@ -1,5 +1,5 @@ # BaseTestHooks -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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) diff --git a/docs/contracts/v4/reference/core/test/CurrencyTest.md b/docs/contracts/v4/reference/core/test/CurrencyTest.md index 7e9daa498..0a3cc6865 100644 --- a/docs/contracts/v4/reference/core/test/CurrencyTest.md +++ b/docs/contracts/v4/reference/core/test/CurrencyTest.md @@ -1,5 +1,5 @@ # CurrencyTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 6cd49cac6..f498edb03 100644 --- a/docs/contracts/v4/reference/core/test/CustomCurveHook.md +++ b/docs/contracts/v4/reference/core/test/CustomCurveHook.md @@ -1,5 +1,5 @@ # CustomCurveHook -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 199613a9c..e25e65157 100644 --- a/docs/contracts/v4/reference/core/test/DeltaReturningHook.md +++ b/docs/contracts/v4/reference/core/test/DeltaReturningHook.md @@ -1,5 +1,5 @@ # DeltaReturningHook -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 99103f98d..9aa96c49a 100644 --- a/docs/contracts/v4/reference/core/test/DynamicFeesTestHook.md +++ b/docs/contracts/v4/reference/core/test/DynamicFeesTestHook.md @@ -1,5 +1,5 @@ # DynamicFeesTestHook -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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) diff --git a/docs/contracts/v4/reference/core/test/DynamicReturnFeeTestHook.md b/docs/contracts/v4/reference/core/test/DynamicReturnFeeTestHook.md index e6c75c018..bbea0796f 100644 --- a/docs/contracts/v4/reference/core/test/DynamicReturnFeeTestHook.md +++ b/docs/contracts/v4/reference/core/test/DynamicReturnFeeTestHook.md @@ -1,5 +1,5 @@ # DynamicReturnFeeTestHook -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 433eda3c0..5a89c838e 100644 --- a/docs/contracts/v4/reference/core/test/EmptyRevertContract.md +++ b/docs/contracts/v4/reference/core/test/EmptyRevertContract.md @@ -1,5 +1,5 @@ # EmptyRevertContract -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 1009622a1..eba098b0d 100644 --- a/docs/contracts/v4/reference/core/test/EmptyTestHooks.md +++ b/docs/contracts/v4/reference/core/test/EmptyTestHooks.md @@ -1,5 +1,5 @@ # EmptyTestHooks -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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) diff --git a/docs/contracts/v4/reference/core/test/FeeTakingHook.md b/docs/contracts/v4/reference/core/test/FeeTakingHook.md index 0b7b64e71..bcfc818cd 100644 --- a/docs/contracts/v4/reference/core/test/FeeTakingHook.md +++ b/docs/contracts/v4/reference/core/test/FeeTakingHook.md @@ -1,5 +1,5 @@ # FeeTakingHook -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 3efe7fe1b..dfa412f37 100644 --- a/docs/contracts/v4/reference/core/test/Fuzzers.md +++ b/docs/contracts/v4/reference/core/test/Fuzzers.md @@ -1,5 +1,5 @@ # Fuzzers -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 7b31b70a8..5a506ab6b 100644 --- a/docs/contracts/v4/reference/core/test/HooksTest.md +++ b/docs/contracts/v4/reference/core/test/HooksTest.md @@ -1,5 +1,5 @@ # HooksTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 e238227eb..2fbb169a1 100644 --- a/docs/contracts/v4/reference/core/test/LPFeeTakingHook.md +++ b/docs/contracts/v4/reference/core/test/LPFeeTakingHook.md @@ -1,5 +1,5 @@ # LPFeeTakingHook -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 2f1def5ca..87676ed4c 100644 --- a/docs/contracts/v4/reference/core/test/LiquidityMathTest.md +++ b/docs/contracts/v4/reference/core/test/LiquidityMathTest.md @@ -1,5 +1,5 @@ # LiquidityMathTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 e3fde7523..ae0d73fef 100644 --- a/docs/contracts/v4/reference/core/test/MockContract.md +++ b/docs/contracts/v4/reference/core/test/MockContract.md @@ -1,5 +1,5 @@ # MockContract -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 da1a5b0b4..d65e33708 100644 --- a/docs/contracts/v4/reference/core/test/MockERC6909Claims.md +++ b/docs/contracts/v4/reference/core/test/MockERC6909Claims.md @@ -1,5 +1,5 @@ # MockERC6909Claims -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 12552e7e0..3a06d63ce 100644 --- a/docs/contracts/v4/reference/core/test/MockHooks.md +++ b/docs/contracts/v4/reference/core/test/MockHooks.md @@ -1,5 +1,5 @@ # MockHooks -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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) diff --git a/docs/contracts/v4/reference/core/test/NativeERC20.md b/docs/contracts/v4/reference/core/test/NativeERC20.md index d58ae4255..b05fe1b9a 100644 --- a/docs/contracts/v4/reference/core/test/NativeERC20.md +++ b/docs/contracts/v4/reference/core/test/NativeERC20.md @@ -1,5 +1,5 @@ # NativeERC20 -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 32eca69a3..9cfc7e0b5 100644 --- a/docs/contracts/v4/reference/core/test/NoDelegateCallTest.md +++ b/docs/contracts/v4/reference/core/test/NoDelegateCallTest.md @@ -1,5 +1,5 @@ # NoDelegateCallTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 d2da97fa1..954ecff4f 100644 --- a/docs/contracts/v4/reference/core/test/PoolClaimsTest.md +++ b/docs/contracts/v4/reference/core/test/PoolClaimsTest.md @@ -1,5 +1,5 @@ # PoolClaimsTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 b3ae0bee3..a04cd37e5 100644 --- a/docs/contracts/v4/reference/core/test/PoolDonateTest.md +++ b/docs/contracts/v4/reference/core/test/PoolDonateTest.md @@ -1,5 +1,5 @@ # PoolDonateTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 685fd4475..64fbbe945 100644 --- a/docs/contracts/v4/reference/core/test/PoolEmptyUnlockTest.md +++ b/docs/contracts/v4/reference/core/test/PoolEmptyUnlockTest.md @@ -1,5 +1,5 @@ # PoolEmptyUnlockTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 cc7ee5792..9310cc500 100644 --- a/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTest.md +++ b/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTest.md @@ -1,5 +1,5 @@ # PoolModifyLiquidityTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 eb56c1405..2dbd06149 100644 --- a/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTestNoChecks.md +++ b/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTestNoChecks.md @@ -1,5 +1,5 @@ # PoolModifyLiquidityTestNoChecks -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 49ead8a86..7319fef8f 100644 --- a/docs/contracts/v4/reference/core/test/PoolNestedActionsTest.md +++ b/docs/contracts/v4/reference/core/test/PoolNestedActionsTest.md @@ -1,5 +1,81 @@ +# Action +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/test/PoolNestedActionsTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + + +```solidity +enum Action { + NESTED_SELF_UNLOCK, + NESTED_EXECUTOR_UNLOCK, + SWAP_AND_SETTLE, + DONATE_AND_SETTLE, + ADD_LIQUIDITY_AND_SETTLE, + REMOVE_LIQUIDITY_AND_SETTLE, + INITIALIZE +} +``` + +# PoolNestedActionsTest +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/test/PoolNestedActionsTest.sol) + +**Inherits:** +Test, [IUnlockCallback](/src/interfaces/callback/IUnlockCallback.sol/interface.IUnlockCallback.md) + + +## State Variables +### manager + +```solidity +IPoolManager manager; +``` + + +### executor + +```solidity +NestedActionExecutor public executor; +``` + + +### user + +```solidity +address user; +``` + + +## Functions +### constructor + + +```solidity +constructor(IPoolManager _manager); +``` + +### unlock + + +```solidity +function unlock(bytes calldata data) external; +``` + +### unlockCallback + +Called by the pool manager on `msg.sender` when the manager is unlocked + + +```solidity +function unlockCallback(bytes calldata data) external override returns (bytes memory); +``` + +### _nestedUnlock + + +```solidity +function _nestedUnlock() internal; +``` + # NestedActionExecutor -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/test/PoolNestedActionsTest.sol) **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 eeb9fbb65..167188b19 100644 --- a/docs/contracts/v4/reference/core/test/PoolSwapTest.md +++ b/docs/contracts/v4/reference/core/test/PoolSwapTest.md @@ -1,5 +1,5 @@ # PoolSwapTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 f98d96956..fdec156b3 100644 --- a/docs/contracts/v4/reference/core/test/PoolTakeTest.md +++ b/docs/contracts/v4/reference/core/test/PoolTakeTest.md @@ -1,5 +1,5 @@ # PoolTakeTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 cd9114f0e..c954fa196 100644 --- a/docs/contracts/v4/reference/core/test/PoolTestBase.md +++ b/docs/contracts/v4/reference/core/test/PoolTestBase.md @@ -1,5 +1,5 @@ # PoolTestBase -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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/ProtocolFeeControllerTest.md b/docs/contracts/v4/reference/core/test/ProtocolFeeControllerTest.md deleted file mode 100644 index ca6c6cab0..000000000 --- a/docs/contracts/v4/reference/core/test/ProtocolFeeControllerTest.md +++ /dev/null @@ -1,18 +0,0 @@ -# RevertingProtocolFeeControllerTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/ProtocolFeeControllerTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) - -**Inherits:** -[IProtocolFeeController](contracts/v4/reference/core/interfaces/IProtocolFeeController.md) - -Reverts on call - - -## Functions -### protocolFeeForPool - - -```solidity -function protocolFeeForPool(PoolKey memory) external pure returns (uint24); -``` - diff --git a/docs/contracts/v4/reference/core/test/ProtocolFeesImplementation.md b/docs/contracts/v4/reference/core/test/ProtocolFeesImplementation.md index 2b1da1a8f..243d2d59e 100644 --- a/docs/contracts/v4/reference/core/test/ProtocolFeesImplementation.md +++ b/docs/contracts/v4/reference/core/test/ProtocolFeesImplementation.md @@ -1,5 +1,5 @@ # ProtocolFeesImplementation -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/test/ProtocolFeesImplementation.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ProtocolFees](contracts/v4/reference/core/ProtocolFees.md) diff --git a/docs/contracts/v4/reference/core/test/ProxyPoolManager.md b/docs/contracts/v4/reference/core/test/ProxyPoolManager.md index cf0365e99..875d46ef7 100644 --- a/docs/contracts/v4/reference/core/test/ProxyPoolManager.md +++ b/docs/contracts/v4/reference/core/test/ProxyPoolManager.md @@ -1,5 +1,5 @@ # ProxyPoolManager -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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) diff --git a/docs/contracts/v4/reference/core/test/SkipCallsTestHook.md b/docs/contracts/v4/reference/core/test/SkipCallsTestHook.md index 25f641476..ccd550a8f 100644 --- a/docs/contracts/v4/reference/core/test/SkipCallsTestHook.md +++ b/docs/contracts/v4/reference/core/test/SkipCallsTestHook.md @@ -1,5 +1,5 @@ # SkipCallsTestHook -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 diff --git a/docs/contracts/v4/reference/core/test/SqrtPriceMathEchidnaTest.md b/docs/contracts/v4/reference/core/test/SqrtPriceMathEchidnaTest.md index 43ade74ce..f41488080 100644 --- a/docs/contracts/v4/reference/core/test/SqrtPriceMathEchidnaTest.md +++ b/docs/contracts/v4/reference/core/test/SqrtPriceMathEchidnaTest.md @@ -1,5 +1,5 @@ # SqrtPriceMathEchidnaTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 d15f52e68..87dd842b2 100644 --- a/docs/contracts/v4/reference/core/test/SwapRouterNoChecks.md +++ b/docs/contracts/v4/reference/core/test/SwapRouterNoChecks.md @@ -1,5 +1,5 @@ # SwapRouterNoChecks -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 1c923ea38..c5fa78f6f 100644 --- a/docs/contracts/v4/reference/core/test/TestERC20.md +++ b/docs/contracts/v4/reference/core/test/TestERC20.md @@ -1,5 +1,5 @@ # TestERC20 -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 7961429ad..aae407ce9 100644 --- a/docs/contracts/v4/reference/core/test/TestInvalidERC20.md +++ b/docs/contracts/v4/reference/core/test/TestInvalidERC20.md @@ -1,5 +1,5 @@ # TestInvalidERC20 -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 c711f44ad..dbc565e43 100644 --- a/docs/contracts/v4/reference/core/test/TickMathEchidnaTest.md +++ b/docs/contracts/v4/reference/core/test/TickMathEchidnaTest.md @@ -1,5 +1,5 @@ # TickMathEchidnaTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 3fea9bc35..b4d52db87 100644 --- a/docs/contracts/v4/reference/core/test/TickMathTest.md +++ b/docs/contracts/v4/reference/core/test/TickMathTest.md @@ -1,5 +1,5 @@ # TickMathTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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 14bef07ef..bd902d830 100644 --- a/docs/contracts/v4/reference/core/test/TickOverflowSafetyEchidnaTest.md +++ b/docs/contracts/v4/reference/core/test/TickOverflowSafetyEchidnaTest.md @@ -1,5 +1,5 @@ # TickOverflowSafetyEchidnaTest -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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/BalanceDelta.md b/docs/contracts/v4/reference/core/types/BalanceDelta.md new file mode 100644 index 000000000..8d941860c --- /dev/null +++ b/docs/contracts/v4/reference/core/types/BalanceDelta.md @@ -0,0 +1,82 @@ +# BalanceDelta +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/BalanceDelta.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +*Two `int128` values packed into a single `int256` where the upper 128 bits represent the amount0 +and the lower 128 bits represent the amount1.* + + +```solidity +type BalanceDelta is int256; +``` + +# BalanceDeltaLibrary +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/BalanceDelta.sol) + +Library for getting the amount0 and amount1 deltas from the BalanceDelta type + + +## State Variables +### ZERO_DELTA +A BalanceDelta of 0 + + +```solidity +BalanceDelta public constant ZERO_DELTA = BalanceDelta.wrap(0); +``` + + +## Functions +### amount0 + + +```solidity +function amount0(BalanceDelta balanceDelta) internal pure returns (int128 _amount0); +``` + +### amount1 + + +```solidity +function amount1(BalanceDelta balanceDelta) internal pure returns (int128 _amount1); +``` + +# sub +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/BalanceDelta.sol) + + +```solidity +function sub(BalanceDelta a, BalanceDelta b) pure returns (BalanceDelta); +``` + +# toBalanceDelta +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/BalanceDelta.sol) + + +```solidity +function toBalanceDelta(int128 _amount0, int128 _amount1) pure returns (BalanceDelta balanceDelta); +``` + +# eq +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/BalanceDelta.sol) + + +```solidity +function eq(BalanceDelta a, BalanceDelta b) pure returns (bool); +``` + +# add +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/BalanceDelta.sol) + + +```solidity +function add(BalanceDelta a, BalanceDelta b) pure returns (BalanceDelta); +``` + +# neq +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/BalanceDelta.sol) + + +```solidity +function neq(BalanceDelta a, BalanceDelta b) pure returns (bool); +``` + diff --git a/docs/contracts/v4/reference/core/types/BeforeSwapDelta.md b/docs/contracts/v4/reference/core/types/BeforeSwapDelta.md new file mode 100644 index 000000000..092819829 --- /dev/null +++ b/docs/contracts/v4/reference/core/types/BeforeSwapDelta.md @@ -0,0 +1,55 @@ +# BeforeSwapDelta +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/BeforeSwapDelta.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + + +```solidity +type BeforeSwapDelta is int256; +``` + +# BeforeSwapDeltaLibrary +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/BeforeSwapDelta.sol) + +Library for getting the specified and unspecified deltas from the BeforeSwapDelta type + + +## State Variables +### ZERO_DELTA +A BeforeSwapDelta of 0 + + +```solidity +BeforeSwapDelta public constant ZERO_DELTA = BeforeSwapDelta.wrap(0); +``` + + +## Functions +### getSpecifiedDelta + +extracts int128 from the upper 128 bits of the BeforeSwapDelta +returned by beforeSwap + + +```solidity +function getSpecifiedDelta(BeforeSwapDelta delta) internal pure returns (int128 deltaSpecified); +``` + +### getUnspecifiedDelta + +extracts int128 from the lower 128 bits of the BeforeSwapDelta +returned by beforeSwap and afterSwap + + +```solidity +function getUnspecifiedDelta(BeforeSwapDelta delta) internal pure returns (int128 deltaUnspecified); +``` + +# toBeforeSwapDelta +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/BeforeSwapDelta.sol) + + +```solidity +function toBeforeSwapDelta(int128 deltaSpecified, int128 deltaUnspecified) + pure + returns (BeforeSwapDelta beforeSwapDelta); +``` + diff --git a/docs/contracts/v4/reference/core/types/Currency.md b/docs/contracts/v4/reference/core/types/Currency.md new file mode 100644 index 000000000..316b2acdf --- /dev/null +++ b/docs/contracts/v4/reference/core/types/Currency.md @@ -0,0 +1,116 @@ +# Currency +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/Currency.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + + +```solidity +type Currency is address; +``` + +# CurrencyLibrary +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/Currency.sol) + +*This library allows for transferring and holding native tokens and ERC20 tokens* + + +## State Variables +### ADDRESS_ZERO +A constant to represent the native currency + + +```solidity +Currency public constant ADDRESS_ZERO = Currency.wrap(address(0)); +``` + + +## Functions +### transfer + + +```solidity +function transfer(Currency currency, address to, uint256 amount) internal; +``` + +### balanceOfSelf + + +```solidity +function balanceOfSelf(Currency currency) internal view returns (uint256); +``` + +### balanceOf + + +```solidity +function balanceOf(Currency currency, address owner) internal view returns (uint256); +``` + +### isAddressZero + + +```solidity +function isAddressZero(Currency currency) internal pure returns (bool); +``` + +### toId + + +```solidity +function toId(Currency currency) internal pure returns (uint256); +``` + +### fromId + + +```solidity +function fromId(uint256 id) internal pure returns (Currency); +``` + +## Errors +### NativeTransferFailed +Additional context for ERC-7751 wrapped error when a native transfer fails + + +```solidity +error NativeTransferFailed(); +``` + +### ERC20TransferFailed +Additional context for ERC-7751 wrapped error when an ERC20 transfer fails + + +```solidity +error ERC20TransferFailed(); +``` + +# greaterThanOrEqualTo +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/Currency.sol) + + +```solidity +function greaterThanOrEqualTo(Currency currency, Currency other) pure returns (bool); +``` + +# lessThan +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/Currency.sol) + + +```solidity +function lessThan(Currency currency, Currency other) pure returns (bool); +``` + +# equals +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/Currency.sol) + + +```solidity +function equals(Currency currency, Currency other) pure returns (bool); +``` + +# greaterThan +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/Currency.sol) + + +```solidity +function greaterThan(Currency currency, Currency other) pure returns (bool); +``` + diff --git a/docs/contracts/v4/reference/core/types/PoolId.md b/docs/contracts/v4/reference/core/types/PoolId.md index 844f1586e..ca2473e92 100644 --- a/docs/contracts/v4/reference/core/types/PoolId.md +++ b/docs/contracts/v4/reference/core/types/PoolId.md @@ -1,8 +1,24 @@ # PoolId -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/PoolId.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ```solidity type PoolId is bytes32; ``` +# PoolIdLibrary +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/PoolId.sol) + +Library for computing the ID of a pool + + +## Functions +### toId + +Returns value equal to keccak256(abi.encode(poolKey)) + + +```solidity +function toId(PoolKey memory poolKey) internal pure returns (PoolId poolId); +``` + diff --git a/docs/contracts/v4/reference/core/types/PoolKey.md b/docs/contracts/v4/reference/core/types/PoolKey.md new file mode 100644 index 000000000..eaba24515 --- /dev/null +++ b/docs/contracts/v4/reference/core/types/PoolKey.md @@ -0,0 +1,16 @@ +# PoolKey +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/PoolKey.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Returns the key for identifying a pool + + +```solidity +struct PoolKey { + Currency currency0; + Currency currency1; + uint24 fee; + int24 tickSpacing; + IHooks hooks; +} +``` + diff --git a/docs/contracts/v4/reference/core/types/Slot0.md b/docs/contracts/v4/reference/core/types/Slot0.md index 383f019b3..6e783dde1 100644 --- a/docs/contracts/v4/reference/core/types/Slot0.md +++ b/docs/contracts/v4/reference/core/types/Slot0.md @@ -1,5 +1,5 @@ # Slot0 -[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) +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/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. @@ -22,3 +22,102 @@ uint24 lpFee;* type Slot0 is bytes32; ``` +# Slot0Library +[Git Source](https://github.com/uniswap/v4-core/blob/80311e34080fee64b6fc6c916e9a51a437d0e482/src/types/Slot0.sol) + +Library for getting and setting values in the Slot0 type + + +## State Variables +### MASK_160_BITS + +```solidity +uint160 internal constant MASK_160_BITS = 0x00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; +``` + + +### MASK_24_BITS + +```solidity +uint24 internal constant MASK_24_BITS = 0xFFFFFF; +``` + + +### TICK_OFFSET + +```solidity +uint8 internal constant TICK_OFFSET = 160; +``` + + +### PROTOCOL_FEE_OFFSET + +```solidity +uint8 internal constant PROTOCOL_FEE_OFFSET = 184; +``` + + +### LP_FEE_OFFSET + +```solidity +uint8 internal constant LP_FEE_OFFSET = 208; +``` + + +## Functions +### sqrtPriceX96 + + +```solidity +function sqrtPriceX96(Slot0 _packed) internal pure returns (uint160 _sqrtPriceX96); +``` + +### tick + + +```solidity +function tick(Slot0 _packed) internal pure returns (int24 _tick); +``` + +### protocolFee + + +```solidity +function protocolFee(Slot0 _packed) internal pure returns (uint24 _protocolFee); +``` + +### lpFee + + +```solidity +function lpFee(Slot0 _packed) internal pure returns (uint24 _lpFee); +``` + +### setSqrtPriceX96 + + +```solidity +function setSqrtPriceX96(Slot0 _packed, uint160 _sqrtPriceX96) internal pure returns (Slot0 _result); +``` + +### setTick + + +```solidity +function setTick(Slot0 _packed, int24 _tick) internal pure returns (Slot0 _result); +``` + +### setProtocolFee + + +```solidity +function setProtocolFee(Slot0 _packed, uint24 _protocolFee) internal pure returns (Slot0 _result); +``` + +### setLpFee + + +```solidity +function setLpFee(Slot0 _packed, uint24 _lpFee) internal pure returns (Slot0 _result); +``` + diff --git a/docs/contracts/v4/reference/core/types/balancedelta.mdx b/docs/contracts/v4/reference/core/types/balancedelta-guide.mdx similarity index 99% rename from docs/contracts/v4/reference/core/types/balancedelta.mdx rename to docs/contracts/v4/reference/core/types/balancedelta-guide.mdx index aff5be7f6..abe93db13 100644 --- a/docs/contracts/v4/reference/core/types/balancedelta.mdx +++ b/docs/contracts/v4/reference/core/types/balancedelta-guide.mdx @@ -1,5 +1,5 @@ --- -title: BalanceDelta +title: BalanceDelta Guide --- `BalanceDelta` is a type used in Uniswap V4 to represent the balance changes of two tokens (token0 and token1). It tightly packs the two values in a single 256 bits. It is designed to efficiently store and manipulate these balance deltas, with the upper 128 bits representing the change in token0 (`amount0`) and the lower 128 bits representing the change in token1 (`amount1`). diff --git a/docs/contracts/v4/reference/core/types/beforeswapdelta.mdx b/docs/contracts/v4/reference/core/types/beforeswapdelta-guide.mdx similarity index 99% rename from docs/contracts/v4/reference/core/types/beforeswapdelta.mdx rename to docs/contracts/v4/reference/core/types/beforeswapdelta-guide.mdx index db7a6e8f7..4e4718557 100644 --- a/docs/contracts/v4/reference/core/types/beforeswapdelta.mdx +++ b/docs/contracts/v4/reference/core/types/beforeswapdelta-guide.mdx @@ -1,5 +1,5 @@ --- -title: BeforeSwapDelta +title: BeforeSwapDelta Guide --- `BeforeSwapDelta` is a custom type used in Uniswap V4 hook contracts to represent balance changes during swap operations. It is specifically designed to handle the return value of the `beforeSwap` hook and to be compatible with the `afterSwap` hook. diff --git a/docs/contracts/v4/reference/core/types/currency.mdx b/docs/contracts/v4/reference/core/types/currency-guide.mdx similarity index 99% rename from docs/contracts/v4/reference/core/types/currency.mdx rename to docs/contracts/v4/reference/core/types/currency-guide.mdx index 376499b90..83925a655 100644 --- a/docs/contracts/v4/reference/core/types/currency.mdx +++ b/docs/contracts/v4/reference/core/types/currency-guide.mdx @@ -1,5 +1,5 @@ --- -title: Currency and CurrencyLibrary +title: Currency Guide --- `Currency` is a custom type that represents either native currency (ETH) or ERC20 tokens. diff --git a/docs/contracts/v4/reference/core/types/poolkey.mdx b/docs/contracts/v4/reference/core/types/poolkey-guide.mdx similarity index 98% rename from docs/contracts/v4/reference/core/types/poolkey.mdx rename to docs/contracts/v4/reference/core/types/poolkey-guide.mdx index 765b33f31..58c177ede 100644 --- a/docs/contracts/v4/reference/core/types/poolkey.mdx +++ b/docs/contracts/v4/reference/core/types/poolkey-guide.mdx @@ -1,5 +1,5 @@ --- -title: PoolKey +title: PoolKey Guide --- `PoolKey` is a crucial struct in Uniswap V4 that uniquely identifies a liquidity pool. It encapsulates all the essential parameters that define a pool's characteristics. diff --git a/docs/contracts/v4/reference/periphery/PositionDescriptor.md b/docs/contracts/v4/reference/periphery/PositionDescriptor.md index e41a18eed..b45c6621f 100644 --- a/docs/contracts/v4/reference/periphery/PositionDescriptor.md +++ b/docs/contracts/v4/reference/periphery/PositionDescriptor.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/PositionDescriptor.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IPositionDescriptor](contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md) @@ -50,10 +50,10 @@ address public immutable wrappedNative; ``` -### nativeCurrencyLabel +### nativeCurrencyLabelBytes ```solidity -string public nativeCurrencyLabel; +bytes32 private immutable nativeCurrencyLabelBytes; ``` @@ -69,7 +69,16 @@ IPoolManager public immutable poolManager; ```solidity -constructor(IPoolManager _poolManager, address _wrappedNative, string memory _nativeCurrencyLabel); +constructor(IPoolManager _poolManager, address _wrappedNative, bytes32 _nativeCurrencyLabelBytes); +``` + +### nativeCurrencyLabel + +Returns the native currency label as a string + + +```solidity +function nativeCurrencyLabel() public view returns (string memory); ``` ### tokenURI @@ -115,13 +124,14 @@ function flipRatio(address currency0, address currency1) public view returns (bo |Name|Type|Description| |----|----|-----------| -|``|`bool`|flipRatio True if currency0 has higher priority than currency1| +|``|`bool`|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 +And those with the higher priority values (more positive values) will be in the numerator of the price ratio ```solidity @@ -137,13 +147,6 @@ function currencyRatioPriority(address currency) public view returns (int256); |Name|Type|Description| |----|----|-----------| -|``|`int256`|priority The priority of the currency| - +|``|`int256`|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 85cc0372c..65e11514f 100644 --- a/docs/contracts/v4/reference/periphery/PositionManager.md +++ b/docs/contracts/v4/reference/periphery/PositionManager.md @@ -1,8 +1,8 @@ # PositionManager -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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), [NativeWrapper](contracts/v4/reference/periphery/base/NativeWrapper.md) +[IPositionManager](contracts/v4/reference/periphery/interfaces/IPositionManager.md), [ERC721Permit_v4](contracts/v4/reference/periphery/base/ERC721Permit_v4.md), [PoolInitializer_v4](contracts/v4/reference/periphery/base/PoolInitializer_v4.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. @@ -182,6 +182,17 @@ function _increase(uint256 tokenId, uint256 liquidity, uint128 amount0Max, uint1 onlyIfApproved(msgSender(), tokenId); ``` +### _increaseFromDeltas + +*The liquidity delta is derived from open deltas in the pool manager.* + + +```solidity +function _increaseFromDeltas(uint256 tokenId, uint128 amount0Max, uint128 amount1Max, bytes calldata hookData) + internal + onlyIfApproved(msgSender(), tokenId); +``` + ### _decrease *Calling decrease with 0 liquidity will credit the caller with any underlying fees of the position* @@ -209,6 +220,21 @@ function _mint( ) internal; ``` +### _mintFromDeltas + + +```solidity +function _mintFromDeltas( + PoolKey calldata poolKey, + int24 tickLower, + int24 tickUpper, + uint128 amount0Max, + uint128 amount1Max, + address owner, + bytes calldata hookData +) internal; +``` + ### _burn *this is overloaded with ERC721Permit_v4._burn* @@ -244,7 +270,8 @@ function _close(Currency currency) internal; ### _clearOrTake *integrators may elect to forfeit positive deltas with clear -if the forfeit amount exceeds the user-specified max, the amount is taken instead* +if the forfeit amount exceeds the user-specified max, the amount is taken instead +if there is no credit, no call is made.* ```solidity @@ -262,6 +289,8 @@ function _sweep(Currency currency, address to) internal; ### _modifyLiquidity +*if there is a subscriber attached to the position, this function will notify the subscriber* + ```solidity function _modifyLiquidity( @@ -311,6 +340,8 @@ function transferFrom(address from, address to, uint256 id) public virtual overr ### getPoolAndPositionInfo +Returns the pool key and position info of a position + ```solidity function getPoolAndPositionInfo(uint256 tokenId) public view returns (PoolKey memory poolKey, PositionInfo info); @@ -326,11 +357,13 @@ function getPoolAndPositionInfo(uint256 tokenId) public view returns (PoolKey me |Name|Type|Description| |----|----|-----------| |`poolKey`|`PoolKey`|the pool key of the position| -|`info`|`PositionInfo`|poolKey the pool key of the position| +|`info`|`PositionInfo`|PositionInfo a uint256 packed value holding information about the position including the range (tickLower, tickUpper)| ### getPositionLiquidity +Returns the liquidity of a position + *this value can be processed as an amount0 and amount1 by using the LiquidityAmounts library* diff --git a/docs/contracts/v4/reference/periphery/UniswapV4DeployerCompetition.md b/docs/contracts/v4/reference/periphery/UniswapV4DeployerCompetition.md index b3f60bdad..40b00dd91 100644 --- a/docs/contracts/v4/reference/periphery/UniswapV4DeployerCompetition.md +++ b/docs/contracts/v4/reference/periphery/UniswapV4DeployerCompetition.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/UniswapV4DeployerCompetition.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IUniswapV4DeployerCompetition](contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md) diff --git a/docs/contracts/v4/reference/periphery/V4Router.md b/docs/contracts/v4/reference/periphery/V4Router.md index 16d1464e5..53cda3d79 100644 --- a/docs/contracts/v4/reference/periphery/V4Router.md +++ b/docs/contracts/v4/reference/periphery/V4Router.md @@ -1,5 +1,5 @@ # V4Router -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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) diff --git a/docs/contracts/v4/reference/periphery/base/BaseActionsRouter.md b/docs/contracts/v4/reference/periphery/base/BaseActionsRouter.md index 8e2e220f9..b95c3cadb 100644 --- a/docs/contracts/v4/reference/periphery/base/BaseActionsRouter.md +++ b/docs/contracts/v4/reference/periphery/base/BaseActionsRouter.md @@ -1,5 +1,5 @@ # BaseActionsRouter -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 deleted file mode 100644 index cee0f211c..000000000 --- a/docs/contracts/v4/reference/periphery/base/BaseHook.md +++ /dev/null @@ -1,368 +0,0 @@ -# BaseHook -[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) - -abstract contract for hook implementations - - -## Functions -### constructor - - -```solidity -constructor(IPoolManager _manager) SafeCallback(_manager); -``` - -### selfOnly - -*Only this address may call this function* - - -```solidity -modifier selfOnly(); -``` - -### onlyValidPools - -*Only pools with hooks set to this contract may call this function* - - -```solidity -modifier onlyValidPools(IHooks hooks); -``` - -### getHookPermissions - -Returns a struct of permissions to signal which hook functions are to be implemented - -*Used at deployment to validate the address correctly represents the expected permissions* - - -```solidity -function getHookPermissions() public pure virtual returns (Hooks.Permissions memory); -``` - -### validateHookAddress - -Validates the deployed hook address agrees with the expected permissions of the hook - -*this function is virtual so that we can override it during testing, -which allows us to deploy an implementation to any address -and then etch the bytecode into the correct address* - - -```solidity -function validateHookAddress(BaseHook _this) internal pure virtual; -``` - -### _unlockCallback - - -```solidity -function _unlockCallback(bytes calldata data) internal virtual override returns (bytes memory); -``` - -### beforeInitialize - -The hook called before the state of a pool is initialized - - -```solidity -function beforeInitialize(address, PoolKey calldata, uint160) external virtual returns (bytes4); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|``|`address`|| -|``|`PoolKey`|| -|``|`uint160`|| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`bytes4`|bytes4 The function selector for the hook| - - -### afterInitialize - -The hook called after the state of a pool is initialized - - -```solidity -function afterInitialize(address, PoolKey calldata, uint160, int24) external virtual returns (bytes4); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|``|`address`|| -|``|`PoolKey`|| -|``|`uint160`|| -|``|`int24`|| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`bytes4`|bytes4 The function selector for the hook| - - -### beforeAddLiquidity - -The hook called before liquidity is added - - -```solidity -function beforeAddLiquidity(address, PoolKey calldata, IPoolManager.ModifyLiquidityParams calldata, bytes calldata) - external - virtual - returns (bytes4); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|``|`address`|| -|``|`PoolKey`|| -|``|`IPoolManager.ModifyLiquidityParams`|| -|``|`bytes`|| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`bytes4`|bytes4 The function selector for the hook| - - -### beforeRemoveLiquidity - -The hook called before liquidity is removed - - -```solidity -function beforeRemoveLiquidity(address, PoolKey calldata, IPoolManager.ModifyLiquidityParams calldata, bytes calldata) - external - virtual - returns (bytes4); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|``|`address`|| -|``|`PoolKey`|| -|``|`IPoolManager.ModifyLiquidityParams`|| -|``|`bytes`|| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`bytes4`|bytes4 The function selector for the hook| - - -### afterAddLiquidity - -The hook called after liquidity is added - - -```solidity -function afterAddLiquidity( - address, - PoolKey calldata, - IPoolManager.ModifyLiquidityParams calldata, - BalanceDelta, - BalanceDelta, - bytes calldata -) external virtual returns (bytes4, BalanceDelta); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|``|`address`|| -|``|`PoolKey`|| -|``|`IPoolManager.ModifyLiquidityParams`|| -|``|`BalanceDelta`|| -|``|`BalanceDelta`|| -|``|`bytes`|| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`bytes4`|bytes4 The function selector for the hook| -|``|`BalanceDelta`|BalanceDelta The hook's delta in token0 and token1. Positive: the hook is owed/took currency, negative: the hook owes/sent currency| - - -### afterRemoveLiquidity - -The hook called after liquidity is removed - - -```solidity -function afterRemoveLiquidity( - address, - PoolKey calldata, - IPoolManager.ModifyLiquidityParams calldata, - BalanceDelta, - BalanceDelta, - bytes calldata -) external virtual returns (bytes4, BalanceDelta); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|``|`address`|| -|``|`PoolKey`|| -|``|`IPoolManager.ModifyLiquidityParams`|| -|``|`BalanceDelta`|| -|``|`BalanceDelta`|| -|``|`bytes`|| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`bytes4`|bytes4 The function selector for the hook| -|``|`BalanceDelta`|BalanceDelta The hook's delta in token0 and token1. Positive: the hook is owed/took currency, negative: the hook owes/sent currency| - - -### beforeSwap - -The hook called before a swap - - -```solidity -function beforeSwap(address, PoolKey calldata, IPoolManager.SwapParams calldata, bytes calldata) - external - virtual - returns (bytes4, BeforeSwapDelta, uint24); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|``|`address`|| -|``|`PoolKey`|| -|``|`IPoolManager.SwapParams`|| -|``|`bytes`|| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`bytes4`|bytes4 The function selector for the hook| -|``|`BeforeSwapDelta`|BeforeSwapDelta The hook's delta in specified and unspecified currencies. Positive: the hook is owed/took currency, negative: the hook owes/sent currency| -|``|`uint24`|uint24 Optionally override the lp fee, only used if three conditions are met: 1. the Pool has a dynamic fee, 2. the value's 2nd highest bit is set (23rd bit, 0x400000), and 3. the value is less than or equal to the maximum fee (1 million)| - - -### afterSwap - -The hook called after a swap - - -```solidity -function afterSwap(address, PoolKey calldata, IPoolManager.SwapParams calldata, BalanceDelta, bytes calldata) - external - virtual - returns (bytes4, int128); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|``|`address`|| -|``|`PoolKey`|| -|``|`IPoolManager.SwapParams`|| -|``|`BalanceDelta`|| -|``|`bytes`|| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`bytes4`|bytes4 The function selector for the hook| -|``|`int128`|int128 The hook's delta in unspecified currency. Positive: the hook is owed/took currency, negative: the hook owes/sent currency| - - -### beforeDonate - -The hook called before donate - - -```solidity -function beforeDonate(address, PoolKey calldata, uint256, uint256, bytes calldata) external virtual returns (bytes4); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|``|`address`|| -|``|`PoolKey`|| -|``|`uint256`|| -|``|`uint256`|| -|``|`bytes`|| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`bytes4`|bytes4 The function selector for the hook| - - -### afterDonate - -The hook called after donate - - -```solidity -function afterDonate(address, PoolKey calldata, uint256, uint256, bytes calldata) external virtual returns (bytes4); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|``|`address`|| -|``|`PoolKey`|| -|``|`uint256`|| -|``|`uint256`|| -|``|`bytes`|| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`bytes4`|bytes4 The function selector for the hook| - - -## Errors -### NotSelf - -```solidity -error NotSelf(); -``` - -### InvalidPool - -```solidity -error InvalidPool(); -``` - -### LockFailure - -```solidity -error LockFailure(); -``` - -### HookNotImplemented - -```solidity -error HookNotImplemented(); -``` - diff --git a/docs/contracts/v4/reference/periphery/base/BaseV4Quoter.md b/docs/contracts/v4/reference/periphery/base/BaseV4Quoter.md index 5f209f8a6..23aae94ed 100644 --- a/docs/contracts/v4/reference/periphery/base/BaseV4Quoter.md +++ b/docs/contracts/v4/reference/periphery/base/BaseV4Quoter.md @@ -1,5 +1,5 @@ # BaseV4Quoter -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 6138f6d54..eec50a7e9 100644 --- a/docs/contracts/v4/reference/periphery/base/DeltaResolver.md +++ b/docs/contracts/v4/reference/periphery/base/DeltaResolver.md @@ -1,5 +1,5 @@ # DeltaResolver -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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) diff --git a/docs/contracts/v4/reference/periphery/base/EIP712_v4.md b/docs/contracts/v4/reference/periphery/base/EIP712_v4.md index 6e6748bf1..17e2ec22d 100644 --- a/docs/contracts/v4/reference/periphery/base/EIP712_v4.md +++ b/docs/contracts/v4/reference/periphery/base/EIP712_v4.md @@ -1,5 +1,5 @@ # EIP712_v4 -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 d82aa5e8a..14d2f2a03 100644 --- a/docs/contracts/v4/reference/periphery/base/ERC721Permit_v4.md +++ b/docs/contracts/v4/reference/periphery/base/ERC721Permit_v4.md @@ -1,5 +1,5 @@ # ERC721Permit_v4 -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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) diff --git a/docs/contracts/v4/reference/periphery/base/ImmutableState.md b/docs/contracts/v4/reference/periphery/base/ImmutableState.md index 00f002714..4bebff1a7 100644 --- a/docs/contracts/v4/reference/periphery/base/ImmutableState.md +++ b/docs/contracts/v4/reference/periphery/base/ImmutableState.md @@ -1,5 +1,5 @@ # ImmutableState -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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) @@ -18,6 +18,15 @@ IPoolManager public immutable poolManager; ## Functions +### onlyPoolManager + +Only allow calls from the PoolManager contract + + +```solidity +modifier onlyPoolManager(); +``` + ### constructor @@ -25,3 +34,12 @@ IPoolManager public immutable poolManager; constructor(IPoolManager _poolManager); ``` +## Errors +### NotPoolManager +Thrown when the caller is not PoolManager + + +```solidity +error NotPoolManager(); +``` + diff --git a/docs/contracts/v4/reference/periphery/base/Multicall_v4.md b/docs/contracts/v4/reference/periphery/base/Multicall_v4.md index 61625ecdc..079c86fb7 100644 --- a/docs/contracts/v4/reference/periphery/base/Multicall_v4.md +++ b/docs/contracts/v4/reference/periphery/base/Multicall_v4.md @@ -1,5 +1,5 @@ # Multicall_v4 -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 index c97b5c7df..c4b359a81 100644 --- a/docs/contracts/v4/reference/periphery/base/NativeWrapper.md +++ b/docs/contracts/v4/reference/periphery/base/NativeWrapper.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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) diff --git a/docs/contracts/v4/reference/periphery/base/Notifier.md b/docs/contracts/v4/reference/periphery/base/Notifier.md index 787b9a04e..ff9ee0256 100644 --- a/docs/contracts/v4/reference/periphery/base/Notifier.md +++ b/docs/contracts/v4/reference/periphery/base/Notifier.md @@ -1,5 +1,5 @@ # Notifier -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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) @@ -129,18 +129,26 @@ function unsubscribe(uint256 tokenId) external payable onlyIfPoolManagerLocked o function _unsubscribe(uint256 tokenId) internal; ``` -### _notifyModifyLiquidity +### _removeSubscriberAndNotifyBurn + +*note this function also deletes the subscriber address from the mapping* ```solidity -function _notifyModifyLiquidity(uint256 tokenId, int256 liquidityChange, BalanceDelta feesAccrued) internal; +function _removeSubscriberAndNotifyBurn( + uint256 tokenId, + address owner, + PositionInfo info, + uint256 liquidity, + BalanceDelta feesAccrued +) internal; ``` -### _notifyTransfer +### _notifyModifyLiquidity ```solidity -function _notifyTransfer(uint256 tokenId, address previousOwner, address newOwner) internal; +function _notifyModifyLiquidity(uint256 tokenId, int256 liquidityChange, BalanceDelta feesAccrued) internal; ``` ### _call diff --git a/docs/contracts/v4/reference/periphery/base/Permit2Forwarder.md b/docs/contracts/v4/reference/periphery/base/Permit2Forwarder.md index 2be890f00..90ef950b4 100644 --- a/docs/contracts/v4/reference/periphery/base/Permit2Forwarder.md +++ b/docs/contracts/v4/reference/periphery/base/Permit2Forwarder.md @@ -1,7 +1,10 @@ # Permit2Forwarder -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 +**Inherits:** +[IPermit2Forwarder](contracts/v4/reference/periphery/interfaces/IPermit2Forwarder.md) + +Permit2Forwarder allows permitting this contract as a spender on permit2 *This contract does not enforce the spender to be this contract, but that is the intended use case* @@ -45,6 +48,12 @@ function permit(address owner, IAllowanceTransfer.PermitSingle calldata permitSi |`permitSingle`|`IAllowanceTransfer.PermitSingle`|the permit data| |`signature`|`bytes`|the signature of the permit; abi.encodePacked(r, s, v)| +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`err`|`bytes`|the error returned by a reverting permit call, empty if successful| + ### permitBatch @@ -67,4 +76,10 @@ function permitBatch(address owner, IAllowanceTransfer.PermitBatch calldata _per |`_permitBatch`|`IAllowanceTransfer.PermitBatch`|a batch of approvals| |`signature`|`bytes`|the signature of the permit; abi.encodePacked(r, s, v)| +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`err`|`bytes`|the error returned by a reverting permit call, empty if successful| + diff --git a/docs/contracts/v4/reference/periphery/base/PoolInitializer.md b/docs/contracts/v4/reference/periphery/base/PoolInitializer.md deleted file mode 100644 index 9a28f5fa4..000000000 --- a/docs/contracts/v4/reference/periphery/base/PoolInitializer.md +++ /dev/null @@ -1,28 +0,0 @@ -# PoolInitializer -[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) - -Initializes a Uniswap v4 Pool - -*Enables create pool + mint liquidity in a single transaction with multicall* - - -## Functions -### initializePool - -Initialize a Uniswap v4 Pool - - -```solidity -function initializePool(PoolKey calldata key, uint160 sqrtPriceX96) external payable returns (int24); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`key`|`PoolKey`|the PoolKey of the pool to initialize| -|`sqrtPriceX96`|`uint160`|the initial sqrtPriceX96 of the pool| - - diff --git a/docs/contracts/v4/reference/periphery/base/PoolInitializer_v4.md b/docs/contracts/v4/reference/periphery/base/PoolInitializer_v4.md new file mode 100644 index 000000000..f499a13a7 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/base/PoolInitializer_v4.md @@ -0,0 +1,36 @@ +# PoolInitializer_v4 +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/base/PoolInitializer_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +[ImmutableState](contracts/v4/reference/periphery/base/ImmutableState.md), [IPoolInitializer_v4](contracts/v4/reference/periphery/interfaces/IPoolInitializer_v4.md) + +Initializes a Uniswap v4 Pool + +*Enables create pool + mint liquidity in a single transaction with multicall* + + +## Functions +### initializePool + +Initialize a Uniswap v4 Pool + +*If the pool is already initialized, this function will not revert and just return type(int24).max* + + +```solidity +function initializePool(PoolKey calldata key, uint160 sqrtPriceX96) external payable returns (int24); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`key`|`PoolKey`|The PoolKey of the pool to initialize| +|`sqrtPriceX96`|`uint160`|The initial starting price of the pool, expressed as a sqrtPriceX96| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`int24`|The current tick of the pool, or type(int24).max if the pool creation failed, or the pool already existed| + + diff --git a/docs/contracts/v4/reference/periphery/base/ReentrancyLock.md b/docs/contracts/v4/reference/periphery/base/ReentrancyLock.md index ce94a6051..a4a715db3 100644 --- a/docs/contracts/v4/reference/periphery/base/ReentrancyLock.md +++ b/docs/contracts/v4/reference/periphery/base/ReentrancyLock.md @@ -1,5 +1,5 @@ # ReentrancyLock -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 744a26874..5d33c1dfd 100644 --- a/docs/contracts/v4/reference/periphery/base/SafeCallback.md +++ b/docs/contracts/v4/reference/periphery/base/SafeCallback.md @@ -1,5 +1,5 @@ # SafeCallback -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 @@ -15,15 +15,6 @@ A contract that only allows the Uniswap v4 PoolManager to call the unlockCallbac constructor(IPoolManager _poolManager) ImmutableState(_poolManager); ``` -### onlyPoolManager - -Only allow calls from the PoolManager contract - - -```solidity -modifier onlyPoolManager(); -``` - ### unlockCallback Called by the pool manager on `msg.sender` when the manager is unlocked @@ -56,12 +47,3 @@ function unlockCallback(bytes calldata data) external onlyPoolManager returns (b function _unlockCallback(bytes calldata data) internal virtual returns (bytes memory); ``` -## Errors -### NotPoolManager -Thrown when calling unlockCallback where the caller is not PoolManager - - -```solidity -error NotPoolManager(); -``` - diff --git a/docs/contracts/v4/reference/periphery/base/UnorderedNonce.md b/docs/contracts/v4/reference/periphery/base/UnorderedNonce.md index 6c3ef1e39..79ad0dda0 100644 --- a/docs/contracts/v4/reference/periphery/base/UnorderedNonce.md +++ b/docs/contracts/v4/reference/periphery/base/UnorderedNonce.md @@ -1,5 +1,8 @@ # UnorderedNonce -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/base/UnorderedNonce.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +[IUnorderedNonce](contracts/v4/reference/periphery/interfaces/IUnorderedNonce.md) Contract state and methods for using unordered nonces in signatures @@ -39,17 +42,8 @@ Revoke a nonce by spending it, preventing it from being used again *Used in cases where a valid nonce has not been broadcasted onchain, and the owner wants to revoke the validity of the nonce* -*payable so it can be multicalled with native-token related actions* - ```solidity function revokeNonce(uint256 nonce) external payable; ``` -## Errors -### NonceAlreadyUsed - -```solidity -error NonceAlreadyUsed(); -``` - diff --git a/docs/contracts/v4/reference/periphery/interfaces/IEIP712_v4.md b/docs/contracts/v4/reference/periphery/interfaces/IEIP712_v4.md index a952f9023..943edb0c3 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IEIP712_v4.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IEIP712_v4.md @@ -1,7 +1,7 @@ # IEIP712_v4 -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 +Interface for the EIP712 contract ## Functions diff --git a/docs/contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md b/docs/contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md index daf245ea2..f21037976 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md @@ -1,7 +1,7 @@ # IERC721Permit_v4 -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 +Interface for the ERC721Permit_v4 contract ## Functions diff --git a/docs/contracts/v4/reference/periphery/interfaces/IImmutableState.md b/docs/contracts/v4/reference/periphery/interfaces/IImmutableState.md index 1bf4160bb..f0fe117d5 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IImmutableState.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IImmutableState.md @@ -1,5 +1,7 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/interfaces/IImmutableState.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Interface for the ImmutableState contract ## Functions diff --git a/docs/contracts/v4/reference/periphery/interfaces/IMulticall_v4.md b/docs/contracts/v4/reference/periphery/interfaces/IMulticall_v4.md index cc7151a03..e3c91c69a 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IMulticall_v4.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IMulticall_v4.md @@ -1,7 +1,7 @@ # IMulticall_v4 -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 +Interface for the Multicall_v4 contract ## Functions diff --git a/docs/contracts/v4/reference/periphery/interfaces/INotifier.md b/docs/contracts/v4/reference/periphery/interfaces/INotifier.md index 334987594..555d77d4e 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/INotifier.md +++ b/docs/contracts/v4/reference/periphery/interfaces/INotifier.md @@ -1,7 +1,7 @@ # INotifier -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 +Interface for the Notifier contract ## Functions @@ -145,12 +145,12 @@ Wraps the revert message of the subscriber contract on a reverting modify liquid error ModifyLiquidityNotificationReverted(address subscriber, bytes reason); ``` -### TransferNotificationReverted -Wraps the revert message of the subscriber contract on a reverting transfer notification +### BurnNotificationReverted +Wraps the revert message of the subscriber contract on a reverting burn notification ```solidity -error TransferNotificationReverted(address subscriber, bytes reason); +error BurnNotificationReverted(address subscriber, bytes reason); ``` ### AlreadySubscribed diff --git a/docs/contracts/v4/reference/periphery/interfaces/IPermit2Forwarder.md b/docs/contracts/v4/reference/periphery/interfaces/IPermit2Forwarder.md new file mode 100644 index 000000000..532675ada --- /dev/null +++ b/docs/contracts/v4/reference/periphery/interfaces/IPermit2Forwarder.md @@ -0,0 +1,63 @@ +# IPermit2Forwarder +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/interfaces/IPermit2Forwarder.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Interface for the Permit2Forwarder contract + + +## Functions +### permit + +allows forwarding a single permit to permit2 + +*this function is payable to allow multicall with NATIVE based actions* + + +```solidity +function permit(address owner, IAllowanceTransfer.PermitSingle calldata permitSingle, bytes calldata signature) + external + payable + returns (bytes memory err); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`owner`|`address`|the owner of the tokens| +|`permitSingle`|`IAllowanceTransfer.PermitSingle`|the permit data| +|`signature`|`bytes`|the signature of the permit; abi.encodePacked(r, s, v)| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`err`|`bytes`|the error returned by a reverting permit call, empty if successful| + + +### permitBatch + +allows forwarding batch permits to permit2 + +*this function is payable to allow multicall with NATIVE based actions* + + +```solidity +function permitBatch(address owner, IAllowanceTransfer.PermitBatch calldata _permitBatch, bytes calldata signature) + external + payable + returns (bytes memory err); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`owner`|`address`|the owner of the tokens| +|`_permitBatch`|`IAllowanceTransfer.PermitBatch`|a batch of approvals| +|`signature`|`bytes`|the signature of the permit; abi.encodePacked(r, s, v)| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`err`|`bytes`|the error returned by a reverting permit call, empty if successful| + + diff --git a/docs/contracts/v4/reference/periphery/interfaces/IPoolInitializer_v4.md b/docs/contracts/v4/reference/periphery/interfaces/IPoolInitializer_v4.md new file mode 100644 index 000000000..95198fe1c --- /dev/null +++ b/docs/contracts/v4/reference/periphery/interfaces/IPoolInitializer_v4.md @@ -0,0 +1,31 @@ +# IPoolInitializer_v4 +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/interfaces/IPoolInitializer_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Interface for the PoolInitializer_v4 contract + + +## Functions +### initializePool + +Initialize a Uniswap v4 Pool + +*If the pool is already initialized, this function will not revert and just return type(int24).max* + + +```solidity +function initializePool(PoolKey calldata key, uint160 sqrtPriceX96) external payable returns (int24); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`key`|`PoolKey`|The PoolKey of the pool to initialize| +|`sqrtPriceX96`|`uint160`|The initial starting price of the pool, expressed as a sqrtPriceX96| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`int24`|The current tick of the pool, or type(int24).max if the pool creation failed, or the pool already existed| + + diff --git a/docs/contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md b/docs/contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md index c4a0f83c4..acc1560d2 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md @@ -1,5 +1,7 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/interfaces/IPositionDescriptor.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Interface for the PositionDescriptor contract ## Functions @@ -27,3 +29,94 @@ function tokenURI(IPositionManager positionManager, uint256 tokenId) external vi |``|`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) external view returns (bool); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currency0`|`address`|The first currency address| +|`currency1`|`address`|The second currency address| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bool`|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 +And those with the higher priority values (more positive values) will be in the numerator of the price ratio + + +```solidity +function currencyRatioPriority(address currency) external view returns (int256); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currency`|`address`|The currency address| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`int256`|The priority of the currency| + + +### wrappedNative + + +```solidity +function wrappedNative() external view returns (address); +``` +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`address`|The wrapped native token for this descriptor| + + +### nativeCurrencyLabel + + +```solidity +function nativeCurrencyLabel() external view returns (string memory); +``` +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The native currency label for this descriptor| + + +### poolManager + + +```solidity +function poolManager() external view returns (IPoolManager); +``` +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`IPoolManager`|The pool manager for this descriptor| + + +## Errors +### InvalidTokenId + +```solidity +error InvalidTokenId(uint256 tokenId); +``` + diff --git a/docs/contracts/v4/reference/periphery/interfaces/IPositionManager.md b/docs/contracts/v4/reference/periphery/interfaces/IPositionManager.md index a57a35296..379273d94 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IPositionManager.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IPositionManager.md @@ -1,8 +1,8 @@ # IPositionManager -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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), [IImmutableState](contracts/v4/reference/periphery/interfaces/IImmutableState.md) +[INotifier](contracts/v4/reference/periphery/interfaces/INotifier.md), [IImmutableState](contracts/v4/reference/periphery/interfaces/IImmutableState.md), [IERC721Permit_v4](contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md), [IEIP712_v4](contracts/v4/reference/periphery/interfaces/IEIP712_v4.md), [IMulticall_v4](contracts/v4/reference/periphery/interfaces/IMulticall_v4.md), [IPoolInitializer_v4](contracts/v4/reference/periphery/interfaces/IPoolInitializer_v4.md), [IUnorderedNonce](contracts/v4/reference/periphery/interfaces/IUnorderedNonce.md), [IPermit2Forwarder](contracts/v4/reference/periphery/interfaces/IPermit2Forwarder.md) Interface for the PositionManager contract @@ -61,6 +61,8 @@ function nextTokenId() external view returns (uint256); ### getPositionLiquidity +Returns the liquidity of a position + *this value can be processed as an amount0 and amount1 by using the LiquidityAmounts library* @@ -82,6 +84,8 @@ function getPositionLiquidity(uint256 tokenId) external view returns (uint128 li ### getPoolAndPositionInfo +Returns the pool key and position info of a position + ```solidity function getPoolAndPositionInfo(uint256 tokenId) external view returns (PoolKey memory, PositionInfo); @@ -96,8 +100,29 @@ function getPoolAndPositionInfo(uint256 tokenId) external view returns (PoolKey |Name|Type|Description| |----|----|-----------| -|``|`PoolKey`|PositionInfo a uint256 packed value holding information about the position including the range (tickLower, tickUpper)| -|``|`PositionInfo`|poolKey the pool key of the position| +|``|`PoolKey`|poolKey the pool key of the position| +|``|`PositionInfo`|PositionInfo a uint256 packed value holding information about the position including the range (tickLower, tickUpper)| + + +### positionInfo + +Returns the position info of a position + + +```solidity +function positionInfo(uint256 tokenId) external view returns (PositionInfo); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tokenId`|`uint256`|the ERC721 tokenId| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`PositionInfo`|a uint256 packed value holding information about the position including the range (tickLower, tickUpper)| ## Errors diff --git a/docs/contracts/v4/reference/periphery/interfaces/IStateView.md b/docs/contracts/v4/reference/periphery/interfaces/IStateView.md new file mode 100644 index 000000000..738a57f02 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/interfaces/IStateView.md @@ -0,0 +1,313 @@ +# IStateView +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/interfaces/IStateView.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +[IImmutableState](contracts/v4/reference/periphery/interfaces/IImmutableState.md) + +Interface for the StateView contract + + +## Functions +### getSlot0 + +Get Slot0 of the pool: sqrtPriceX96, tick, protocolFee, lpFee + +*Corresponds to pools[poolId].slot0* + + +```solidity +function getSlot0(PoolId poolId) + external + view + returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`poolId`|`PoolId`|The ID of the pool.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`sqrtPriceX96`|`uint160`|The square root of the price of the pool, in Q96 precision.| +|`tick`|`int24`|The current tick of the pool.| +|`protocolFee`|`uint24`|The protocol fee of the pool.| +|`lpFee`|`uint24`|The swap fee of the pool.| + + +### getTickInfo + +Retrieves the tick information of a pool at a specific tick. + +*Corresponds to pools[poolId].ticks[tick]* + + +```solidity +function getTickInfo(PoolId poolId, int24 tick) + external + view + returns (uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`poolId`|`PoolId`|The ID of the pool.| +|`tick`|`int24`|The tick to retrieve information for.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`liquidityGross`|`uint128`|The total position liquidity that references this tick| +|`liquidityNet`|`int128`|The amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left)| +|`feeGrowthOutside0X128`|`uint256`|fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick)| +|`feeGrowthOutside1X128`|`uint256`|fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick)| + + +### getTickLiquidity + +Retrieves the liquidity information of a pool at a specific tick. + +*Corresponds to pools[poolId].ticks[tick].liquidityGross and pools[poolId].ticks[tick].liquidityNet. A more gas efficient version of getTickInfo* + + +```solidity +function getTickLiquidity(PoolId poolId, int24 tick) + external + view + returns (uint128 liquidityGross, int128 liquidityNet); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`poolId`|`PoolId`|The ID of the pool.| +|`tick`|`int24`|The tick to retrieve liquidity for.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`liquidityGross`|`uint128`|The total position liquidity that references this tick| +|`liquidityNet`|`int128`|The amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left)| + + +### getTickFeeGrowthOutside + +Retrieves the fee growth outside a tick range of a pool + +*Corresponds to pools[poolId].ticks[tick].feeGrowthOutside0X128 and pools[poolId].ticks[tick].feeGrowthOutside1X128. A more gas efficient version of getTickInfo* + + +```solidity +function getTickFeeGrowthOutside(PoolId poolId, int24 tick) + external + view + returns (uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`poolId`|`PoolId`|The ID of the pool.| +|`tick`|`int24`|The tick to retrieve fee growth for.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`feeGrowthOutside0X128`|`uint256`|fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick)| +|`feeGrowthOutside1X128`|`uint256`|fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick)| + + +### getFeeGrowthGlobals + +Retrieves the global fee growth of a pool. + +*Corresponds to pools[poolId].feeGrowthGlobal0X128 and pools[poolId].feeGrowthGlobal1X128* + + +```solidity +function getFeeGrowthGlobals(PoolId poolId) + external + view + returns (uint256 feeGrowthGlobal0, uint256 feeGrowthGlobal1); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`poolId`|`PoolId`|The ID of the pool.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`feeGrowthGlobal0`|`uint256`|The global fee growth for token0.| +|`feeGrowthGlobal1`|`uint256`|The global fee growth for token1.| + + +### getLiquidity + +Retrieves the total liquidity of a pool. + +*Corresponds to pools[poolId].liquidity* + + +```solidity +function getLiquidity(PoolId poolId) external view returns (uint128 liquidity); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`poolId`|`PoolId`|The ID of the pool.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`liquidity`|`uint128`|The liquidity of the pool.| + + +### getTickBitmap + +Retrieves the tick bitmap of a pool at a specific tick. + +*Corresponds to pools[poolId].tickBitmap[tick]* + + +```solidity +function getTickBitmap(PoolId poolId, int16 tick) external view returns (uint256 tickBitmap); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`poolId`|`PoolId`|The ID of the pool.| +|`tick`|`int16`|The tick to retrieve the bitmap for.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`tickBitmap`|`uint256`|The bitmap of the tick.| + + +### getPositionInfo + +Retrieves the position info without needing to calculate the `positionId`. + +*Corresponds to pools[poolId].positions[positionId]* + + +```solidity +function getPositionInfo(PoolId poolId, address owner, int24 tickLower, int24 tickUpper, bytes32 salt) + external + view + returns (uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`poolId`|`PoolId`|The ID of the pool.| +|`owner`|`address`|The owner of the liquidity position.| +|`tickLower`|`int24`|The lower tick of the liquidity range.| +|`tickUpper`|`int24`|The upper tick of the liquidity range.| +|`salt`|`bytes32`|The bytes32 randomness to further distinguish position state.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`liquidity`|`uint128`|The liquidity of the position.| +|`feeGrowthInside0LastX128`|`uint256`|The fee growth inside the position for token0.| +|`feeGrowthInside1LastX128`|`uint256`|The fee growth inside the position for token1.| + + +### getPositionInfo + +Retrieves the position information of a pool at a specific position ID. + +*Corresponds to pools[poolId].positions[positionId]* + + +```solidity +function getPositionInfo(PoolId poolId, bytes32 positionId) + external + view + returns (uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`poolId`|`PoolId`|The ID of the pool.| +|`positionId`|`bytes32`|The ID of the position.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`liquidity`|`uint128`|The liquidity of the position.| +|`feeGrowthInside0LastX128`|`uint256`|The fee growth inside the position for token0.| +|`feeGrowthInside1LastX128`|`uint256`|The fee growth inside the position for token1.| + + +### getPositionLiquidity + +Retrieves the liquidity of a position. + +*Corresponds to pools[poolId].positions[positionId].liquidity. More gas efficient for just retrieving liquidity as compared to getPositionInfo* + + +```solidity +function getPositionLiquidity(PoolId poolId, bytes32 positionId) external view returns (uint128 liquidity); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`poolId`|`PoolId`|The ID of the pool.| +|`positionId`|`bytes32`|The ID of the position.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`liquidity`|`uint128`|The liquidity of the position.| + + +### getFeeGrowthInside + +Calculate the fee growth inside a tick range of a pool + +*pools[poolId].feeGrowthInside0LastX128 in Position.Info is cached and can become stale. This function will calculate the up to date feeGrowthInside* + + +```solidity +function getFeeGrowthInside(PoolId poolId, int24 tickLower, int24 tickUpper) + external + view + returns (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`poolId`|`PoolId`|The ID of the pool.| +|`tickLower`|`int24`|The lower tick of the range.| +|`tickUpper`|`int24`|The upper tick of the range.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`feeGrowthInside0X128`|`uint256`|The fee growth inside the tick range for token0.| +|`feeGrowthInside1X128`|`uint256`|The fee growth inside the tick range for token1.| + + diff --git a/docs/contracts/v4/reference/periphery/interfaces/ISubscriber.md b/docs/contracts/v4/reference/periphery/interfaces/ISubscriber.md index 1e1168a3f..d8e096cee 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/ISubscriber.md +++ b/docs/contracts/v4/reference/periphery/interfaces/ISubscriber.md @@ -1,5 +1,5 @@ # ISubscriber -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 @@ -7,6 +7,8 @@ Interface that a Subscriber contract should implement to receive updates from th ## Functions ### notifySubscribe +Called when a position subscribes to this subscriber contract + ```solidity function notifySubscribe(uint256 tokenId, bytes memory data) external; @@ -38,33 +40,44 @@ function notifyUnsubscribe(uint256 tokenId) external; |`tokenId`|`uint256`|the token ID of the position| -### notifyModifyLiquidity +### notifyBurn + +Called when a position is burned ```solidity -function notifyModifyLiquidity(uint256 tokenId, int256 liquidityChange, BalanceDelta feesAccrued) external; +function notifyBurn(uint256 tokenId, address owner, PositionInfo info, uint256 liquidity, BalanceDelta feesAccrued) + external; ``` **Parameters** |Name|Type|Description| |----|----|-----------| |`tokenId`|`uint256`|the token ID of the position| -|`liquidityChange`|`int256`|the change in liquidity on the underlying position| -|`feesAccrued`|`BalanceDelta`|the fees to be collected from the position as a result of the modifyLiquidity call| +|`owner`|`address`|the current owner of the tokenId| +|`info`|`PositionInfo`|information about the position| +|`liquidity`|`uint256`|the amount of liquidity decreased in the position, may be 0| +|`feesAccrued`|`BalanceDelta`|the fees accrued by the position if liquidity was decreased| -### notifyTransfer +### notifyModifyLiquidity + +Called when a position modifies its liquidity or collects fees + +*Note that feesAccrued can be artificially inflated by a malicious user +Pools with a single liquidity position can inflate feeGrowthGlobal (and consequently feesAccrued) by donating to themselves; +atomically donating and collecting fees within the same unlockCallback may further inflate feeGrowthGlobal/feesAccrued* ```solidity -function notifyTransfer(uint256 tokenId, address previousOwner, address newOwner) external; +function notifyModifyLiquidity(uint256 tokenId, int256 liquidityChange, BalanceDelta feesAccrued) external; ``` **Parameters** |Name|Type|Description| |----|----|-----------| |`tokenId`|`uint256`|the token ID of the position| -|`previousOwner`|`address`|address of the old owner| -|`newOwner`|`address`|address of the new owner| +|`liquidityChange`|`int256`|the change in liquidity on the underlying position| +|`feesAccrued`|`BalanceDelta`|the fees to be collected from the position as a result of the modifyLiquidity call| diff --git a/docs/contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md b/docs/contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md index 5d028c7d3..c4bd70280 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md @@ -1,7 +1,7 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 +Interface for the UniswapV4DeployerCompetition contract ## Functions diff --git a/docs/contracts/v4/reference/periphery/interfaces/IUnorderedNonce.md b/docs/contracts/v4/reference/periphery/interfaces/IUnorderedNonce.md new file mode 100644 index 000000000..8e2a6edd3 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/interfaces/IUnorderedNonce.md @@ -0,0 +1,38 @@ +# IUnorderedNonce +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/interfaces/IUnorderedNonce.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Interface for the UnorderedNonce contract + + +## Functions +### nonces + +mapping of nonces consumed by each address, where a nonce is a single bit on the 256-bit bitmap + +*word is at most type(uint248).max* + + +```solidity +function nonces(address owner, uint256 word) external view returns (uint256); +``` + +### revokeNonce + +Revoke a nonce by spending it, preventing it from being used again + +*Used in cases where a valid nonce has not been broadcasted onchain, and the owner wants to revoke the validity of the nonce* + +*payable so it can be multicalled with native-token related actions* + + +```solidity +function revokeNonce(uint256 nonce) external payable; +``` + +## Errors +### NonceAlreadyUsed + +```solidity +error NonceAlreadyUsed(); +``` + diff --git a/docs/contracts/v4/reference/periphery/interfaces/IQuoter.md b/docs/contracts/v4/reference/periphery/interfaces/IV4Quoter.md similarity index 86% rename from docs/contracts/v4/reference/periphery/interfaces/IQuoter.md rename to docs/contracts/v4/reference/periphery/interfaces/IV4Quoter.md index b824955d1..2d4b2c04f 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IQuoter.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IV4Quoter.md @@ -1,12 +1,10 @@ -# IQuoter -[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) +# IV4Quoter +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/interfaces/IV4Quoter.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. +**Inherits:** +[IImmutableState](contracts/v4/reference/periphery/interfaces/IImmutableState.md) -For each pool also tells you the sqrt price of the pool after the swap. - -*These functions are not marked view because they rely on calling non-view functions and reverting -to compute the result. They are also not gas efficient and should not be called on-chain.* +Interface for the V4Quoter contract ## Functions diff --git a/docs/contracts/v4/reference/periphery/interfaces/IV4Router.md b/docs/contracts/v4/reference/periphery/interfaces/IV4Router.md index 26413f4e6..93ce02d22 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IV4Router.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IV4Router.md @@ -1,10 +1,10 @@ # IV4Router -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 +Interface for the V4Router contract ## Errors diff --git a/docs/contracts/v4/reference/periphery/interfaces/IWETH9.md b/docs/contracts/v4/reference/periphery/interfaces/IWETH9.md index 4687b897a..0c8821100 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IWETH9.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IWETH9.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/interfaces/external/IWETH9.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** IERC20 diff --git a/docs/contracts/v4/reference/periphery/lens/StateView.md b/docs/contracts/v4/reference/periphery/lens/StateView.md index c6cf2163e..0141875d6 100644 --- a/docs/contracts/v4/reference/periphery/lens/StateView.md +++ b/docs/contracts/v4/reference/periphery/lens/StateView.md @@ -1,11 +1,13 @@ # StateView -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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) +[ImmutableState](contracts/v4/reference/periphery/base/ImmutableState.md), [IStateView](contracts/v4/reference/periphery/interfaces/IStateView.md) A view only contract wrapping the StateLibrary.sol library for reading storage in v4-core. +*The contract is intended for offchain clients. Use StateLibrary.sol directly if reading state onchain.* + ## Functions ### constructor @@ -238,7 +240,7 @@ function getPositionInfo(PoolId poolId, address owner, int24 tickLower, int24 ti ### getPositionInfo -Retrieves the position information of a pool at a specific position ID. +Retrieves the position info without needing to calculate the `positionId`. *Corresponds to pools[poolId].positions[positionId]* @@ -254,7 +256,7 @@ function getPositionInfo(PoolId poolId, bytes32 positionId) |Name|Type|Description| |----|----|-----------| |`poolId`|`PoolId`|The ID of the pool.| -|`positionId`|`bytes32`|The ID of the position.| +|`positionId`|`bytes32`|| **Returns** diff --git a/docs/contracts/v4/reference/periphery/lens/Quoter.md b/docs/contracts/v4/reference/periphery/lens/V4Quoter.md similarity index 87% rename from docs/contracts/v4/reference/periphery/lens/Quoter.md rename to docs/contracts/v4/reference/periphery/lens/V4Quoter.md index e2c2ea943..f17ce23d0 100644 --- a/docs/contracts/v4/reference/periphery/lens/Quoter.md +++ b/docs/contracts/v4/reference/periphery/lens/V4Quoter.md @@ -1,8 +1,13 @@ -# Quoter -[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) +# V4Quoter +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/lens/V4Quoter.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) +[IV4Quoter](contracts/v4/reference/periphery/interfaces/IV4Quoter.md), [BaseV4Quoter](contracts/v4/reference/periphery/base/BaseV4Quoter.md) + +Supports quoting the delta amounts for exact input or exact output swaps. + +*These functions are not marked view because they rely on calling non-view functions and reverting +to compute the result. They are also not gas efficient and should not be called on-chain.* ## Functions diff --git a/docs/contracts/v4/reference/periphery/libraries/ActionConstants.md b/docs/contracts/v4/reference/periphery/libraries/ActionConstants.md index 488d67cd3..81e9680d1 100644 --- a/docs/contracts/v4/reference/periphery/libraries/ActionConstants.md +++ b/docs/contracts/v4/reference/periphery/libraries/ActionConstants.md @@ -1,5 +1,5 @@ # ActionConstants -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 201ec9490..ea6887bac 100644 --- a/docs/contracts/v4/reference/periphery/libraries/Actions.md +++ b/docs/contracts/v4/reference/periphery/libraries/Actions.md @@ -1,177 +1,185 @@ # Actions -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/libraries/Actions.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Library to define different pool actions. -*These are suggested common commands, however additional commands should be defined as required* +*These are suggested common commands, however additional commands should be defined as required +Some of these actions are not supported in the Router contracts or Position Manager contracts, but are left as they may be helpful commands for other peripheral contracts.* ## State Variables ### INCREASE_LIQUIDITY ```solidity -uint256 constant INCREASE_LIQUIDITY = 0x00; +uint256 internal constant INCREASE_LIQUIDITY = 0x00; ``` ### DECREASE_LIQUIDITY ```solidity -uint256 constant DECREASE_LIQUIDITY = 0x01; +uint256 internal constant DECREASE_LIQUIDITY = 0x01; ``` ### MINT_POSITION ```solidity -uint256 constant MINT_POSITION = 0x02; +uint256 internal constant MINT_POSITION = 0x02; ``` ### BURN_POSITION ```solidity -uint256 constant BURN_POSITION = 0x03; +uint256 internal constant BURN_POSITION = 0x03; +``` + + +### INCREASE_LIQUIDITY_FROM_DELTAS + +```solidity +uint256 internal constant INCREASE_LIQUIDITY_FROM_DELTAS = 0x04; +``` + + +### MINT_POSITION_FROM_DELTAS + +```solidity +uint256 internal constant MINT_POSITION_FROM_DELTAS = 0x05; ``` ### SWAP_EXACT_IN_SINGLE ```solidity -uint256 constant SWAP_EXACT_IN_SINGLE = 0x04; +uint256 internal constant SWAP_EXACT_IN_SINGLE = 0x06; ``` ### SWAP_EXACT_IN ```solidity -uint256 constant SWAP_EXACT_IN = 0x05; +uint256 internal constant SWAP_EXACT_IN = 0x07; ``` ### SWAP_EXACT_OUT_SINGLE ```solidity -uint256 constant SWAP_EXACT_OUT_SINGLE = 0x06; +uint256 internal constant SWAP_EXACT_OUT_SINGLE = 0x08; ``` ### SWAP_EXACT_OUT ```solidity -uint256 constant SWAP_EXACT_OUT = 0x07; +uint256 internal constant SWAP_EXACT_OUT = 0x09; ``` ### DONATE ```solidity -uint256 constant DONATE = 0x08; +uint256 internal constant DONATE = 0x0a; ``` ### SETTLE ```solidity -uint256 constant SETTLE = 0x09; +uint256 internal constant SETTLE = 0x0b; ``` ### SETTLE_ALL ```solidity -uint256 constant SETTLE_ALL = 0x10; +uint256 internal constant SETTLE_ALL = 0x0c; ``` ### SETTLE_PAIR ```solidity -uint256 constant SETTLE_PAIR = 0x11; +uint256 internal constant SETTLE_PAIR = 0x0d; ``` ### TAKE ```solidity -uint256 constant TAKE = 0x12; +uint256 internal constant TAKE = 0x0e; ``` ### TAKE_ALL ```solidity -uint256 constant TAKE_ALL = 0x13; +uint256 internal constant TAKE_ALL = 0x0f; ``` ### TAKE_PORTION ```solidity -uint256 constant TAKE_PORTION = 0x14; +uint256 internal constant TAKE_PORTION = 0x10; ``` ### TAKE_PAIR ```solidity -uint256 constant TAKE_PAIR = 0x15; -``` - - -### SETTLE_TAKE_PAIR - -```solidity -uint256 constant SETTLE_TAKE_PAIR = 0x16; +uint256 internal constant TAKE_PAIR = 0x11; ``` ### CLOSE_CURRENCY ```solidity -uint256 constant CLOSE_CURRENCY = 0x17; +uint256 internal constant CLOSE_CURRENCY = 0x12; ``` ### CLEAR_OR_TAKE ```solidity -uint256 constant CLEAR_OR_TAKE = 0x18; +uint256 internal constant CLEAR_OR_TAKE = 0x13; ``` ### SWEEP ```solidity -uint256 constant SWEEP = 0x19; +uint256 internal constant SWEEP = 0x14; ``` ### WRAP ```solidity -uint256 constant WRAP = 0x20; +uint256 internal constant WRAP = 0x15; ``` ### UNWRAP ```solidity -uint256 constant UNWRAP = 0x21; +uint256 internal constant UNWRAP = 0x16; ``` ### MINT_6909 ```solidity -uint256 constant MINT_6909 = 0x22; +uint256 internal constant MINT_6909 = 0x17; ``` ### BURN_6909 ```solidity -uint256 constant BURN_6909 = 0x23; +uint256 internal constant BURN_6909 = 0x18; ``` diff --git a/docs/contracts/v4/reference/periphery/libraries/AddressStringUtil.md b/docs/contracts/v4/reference/periphery/libraries/AddressStringUtil.md index c3579398c..a7b7c798f 100644 --- a/docs/contracts/v4/reference/periphery/libraries/AddressStringUtil.md +++ b/docs/contracts/v4/reference/periphery/libraries/AddressStringUtil.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/libraries/AddressStringUtil.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) provides utility functions for converting addresses to strings diff --git a/docs/contracts/v4/reference/periphery/libraries/BipsLibrary.md b/docs/contracts/v4/reference/periphery/libraries/BipsLibrary.md index 15c898068..cdd533ed1 100644 --- a/docs/contracts/v4/reference/periphery/libraries/BipsLibrary.md +++ b/docs/contracts/v4/reference/periphery/libraries/BipsLibrary.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/libraries/BipsLibrary.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## State Variables diff --git a/docs/contracts/v4/reference/periphery/libraries/CalldataDecoder.md b/docs/contracts/v4/reference/periphery/libraries/CalldataDecoder.md index 7dcd1eae9..1fc7fa346 100644 --- a/docs/contracts/v4/reference/periphery/libraries/CalldataDecoder.md +++ b/docs/contracts/v4/reference/periphery/libraries/CalldataDecoder.md @@ -1,5 +1,5 @@ # CalldataDecoder -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/libraries/CalldataDecoder.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## State Variables @@ -57,6 +57,18 @@ function decodeModifyLiquidityParams(bytes calldata params) returns (uint256 tokenId, uint256 liquidity, uint128 amount0, uint128 amount1, bytes calldata hookData); ``` +### decodeIncreaseLiquidityFromDeltasParams + +*equivalent to: abi.decode(params, (uint256, uint128, uint128, bytes)) in calldata* + + +```solidity +function decodeIncreaseLiquidityFromDeltasParams(bytes calldata params) + internal + pure + returns (uint256 tokenId, uint128 amount0Max, uint128 amount1Max, bytes calldata hookData); +``` + ### decodeMintParams *equivalent to: abi.decode(params, (PoolKey, int24, int24, uint256, uint128, uint128, address, bytes)) in calldata* @@ -78,6 +90,26 @@ function decodeMintParams(bytes calldata params) ); ``` +### decodeMintFromDeltasParams + +*equivalent to: abi.decode(params, (PoolKey, int24, int24, uint128, uint128, address, bytes)) in calldata* + + +```solidity +function decodeMintFromDeltasParams(bytes calldata params) + internal + pure + returns ( + PoolKey calldata poolKey, + int24 tickLower, + int24 tickUpper, + uint128 amount0Max, + uint128 amount1Max, + address owner, + bytes calldata hookData + ); +``` + ### decodeBurnParams *equivalent to: abi.decode(params, (uint256, uint128, uint128, bytes)) in calldata* diff --git a/docs/contracts/v4/reference/periphery/libraries/CurrencyRatioSortOrder.md b/docs/contracts/v4/reference/periphery/libraries/CurrencyRatioSortOrder.md index 090d83c4c..9ced66b79 100644 --- a/docs/contracts/v4/reference/periphery/libraries/CurrencyRatioSortOrder.md +++ b/docs/contracts/v4/reference/periphery/libraries/CurrencyRatioSortOrder.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 diff --git a/docs/contracts/v4/reference/periphery/libraries/Descriptor.md b/docs/contracts/v4/reference/periphery/libraries/Descriptor.md index 00c26fbac..040818b42 100644 --- a/docs/contracts/v4/reference/periphery/libraries/Descriptor.md +++ b/docs/contracts/v4/reference/periphery/libraries/Descriptor.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/libraries/Descriptor.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Describes NFT token positions diff --git a/docs/contracts/v4/reference/periphery/libraries/ERC721PermitHash.md b/docs/contracts/v4/reference/periphery/libraries/ERC721PermitHash.md index db4f3475d..2343b1950 100644 --- a/docs/contracts/v4/reference/periphery/libraries/ERC721PermitHash.md +++ b/docs/contracts/v4/reference/periphery/libraries/ERC721PermitHash.md @@ -1,5 +1,5 @@ # ERC721PermitHash -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 index e27d914ae..9f1445137 100644 --- a/docs/contracts/v4/reference/periphery/libraries/HexStrings.md +++ b/docs/contracts/v4/reference/periphery/libraries/HexStrings.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/libraries/HexStrings.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Provides function for converting numbers to hexadecimal strings diff --git a/docs/contracts/v4/reference/periphery/libraries/LiquidityAmounts.md b/docs/contracts/v4/reference/periphery/libraries/LiquidityAmounts.md new file mode 100644 index 000000000..67e2367fc --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/LiquidityAmounts.md @@ -0,0 +1,95 @@ +# LiquidityAmounts +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/libraries/LiquidityAmounts.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Provides functions for computing liquidity amounts from token amounts and prices + + +## Functions +### getLiquidityForAmount0 + +Computes the amount of liquidity received for a given amount of token0 and price range + +*Calculates amount0 * (sqrt(upper) * sqrt(lower)) / (sqrt(upper) - sqrt(lower))* + + +```solidity +function getLiquidityForAmount0(uint160 sqrtPriceAX96, uint160 sqrtPriceBX96, uint256 amount0) + internal + pure + returns (uint128 liquidity); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`sqrtPriceAX96`|`uint160`|A sqrt price representing the first tick boundary| +|`sqrtPriceBX96`|`uint160`|A sqrt price representing the second tick boundary| +|`amount0`|`uint256`|The amount0 being sent in| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`liquidity`|`uint128`|The amount of returned liquidity| + + +### getLiquidityForAmount1 + +Computes the amount of liquidity received for a given amount of token1 and price range + +*Calculates amount1 / (sqrt(upper) - sqrt(lower)).* + + +```solidity +function getLiquidityForAmount1(uint160 sqrtPriceAX96, uint160 sqrtPriceBX96, uint256 amount1) + internal + pure + returns (uint128 liquidity); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`sqrtPriceAX96`|`uint160`|A sqrt price representing the first tick boundary| +|`sqrtPriceBX96`|`uint160`|A sqrt price representing the second tick boundary| +|`amount1`|`uint256`|The amount1 being sent in| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`liquidity`|`uint128`|The amount of returned liquidity| + + +### getLiquidityForAmounts + +Computes the maximum amount of liquidity received for a given amount of token0, token1, the current +pool prices and the prices at the tick boundaries + + +```solidity +function getLiquidityForAmounts( + uint160 sqrtPriceX96, + uint160 sqrtPriceAX96, + uint160 sqrtPriceBX96, + uint256 amount0, + uint256 amount1 +) internal pure returns (uint128 liquidity); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`sqrtPriceX96`|`uint160`|A sqrt price representing the current pool prices| +|`sqrtPriceAX96`|`uint160`|A sqrt price representing the first tick boundary| +|`sqrtPriceBX96`|`uint160`|A sqrt price representing the second tick boundary| +|`amount0`|`uint256`|The amount of token0 being sent in| +|`amount1`|`uint256`|The amount of token1 being sent in| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`liquidity`|`uint128`|The maximum amount of liquidity received| + + diff --git a/docs/contracts/v4/reference/periphery/libraries/Locker.md b/docs/contracts/v4/reference/periphery/libraries/Locker.md index 7bd349240..02fd279c4 100644 --- a/docs/contracts/v4/reference/periphery/libraries/Locker.md +++ b/docs/contracts/v4/reference/periphery/libraries/Locker.md @@ -1,5 +1,5 @@ # Locker -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 bc6cc572e..8299e9f47 100644 --- a/docs/contracts/v4/reference/periphery/libraries/PathKey.md +++ b/docs/contracts/v4/reference/periphery/libraries/PathKey.md @@ -1,5 +1,5 @@ # PathKey -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/libraries/PathKey.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ```solidity @@ -12,3 +12,36 @@ struct PathKey { } ``` +# PathKeyLibrary +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/libraries/PathKey.sol) + +Functions for working with PathKeys + + +## Functions +### getPoolAndSwapDirection + +Get the pool and swap direction for a given PathKey + + +```solidity +function getPoolAndSwapDirection(PathKey calldata params, Currency currencyIn) + internal + pure + returns (PoolKey memory poolKey, bool zeroForOne); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`params`|`PathKey`|the given PathKey| +|`currencyIn`|`Currency`|the input currency| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`poolKey`|`PoolKey`|the pool key of the swap| +|`zeroForOne`|`bool`|the direction of the swap, true if currency0 is being swapped for currency1| + + diff --git a/docs/contracts/v4/reference/periphery/libraries/PositionConfig.md b/docs/contracts/v4/reference/periphery/libraries/PositionConfig.md index aad00a0e5..e7279b703 100644 --- a/docs/contracts/v4/reference/periphery/libraries/PositionConfig.md +++ b/docs/contracts/v4/reference/periphery/libraries/PositionConfig.md @@ -1,5 +1,5 @@ # PositionConfig -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/libraries/PositionConfig.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ```solidity @@ -10,3 +10,17 @@ struct PositionConfig { } ``` +# PositionConfigLibrary +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/libraries/PositionConfig.sol) + +Library to calculate the PositionConfigId from the PositionConfig struct + + +## Functions +### toId + + +```solidity +function toId(PositionConfig calldata config) internal pure returns (bytes32 id); +``` + diff --git a/docs/contracts/v4/reference/periphery/libraries/PositionConfigId.md b/docs/contracts/v4/reference/periphery/libraries/PositionConfigId.md index 5ab31e8f1..fc51f489a 100644 --- a/docs/contracts/v4/reference/periphery/libraries/PositionConfigId.md +++ b/docs/contracts/v4/reference/periphery/libraries/PositionConfigId.md @@ -1,5 +1,19 @@ +# PositionConfigId +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 + + +```solidity +struct PositionConfigId { + bytes32 id; +} +``` + # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/libraries/PositionConfigId.sol) ## State Variables diff --git a/docs/contracts/v4/reference/periphery/libraries/PositionInfoLibrary.md b/docs/contracts/v4/reference/periphery/libraries/PositionInfoLibrary.md index 7fb825589..198ae19db 100644 --- a/docs/contracts/v4/reference/periphery/libraries/PositionInfoLibrary.md +++ b/docs/contracts/v4/reference/periphery/libraries/PositionInfoLibrary.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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. @@ -21,3 +21,141 @@ Note: If more bits are needed, hasSubscriber can be a single bit.* type PositionInfo is uint256; ``` +# PositionInfoLibrary +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/libraries/PositionInfoLibrary.sol) + + +## State Variables +### EMPTY_POSITION_INFO + +```solidity +PositionInfo internal constant EMPTY_POSITION_INFO = PositionInfo.wrap(0); +``` + + +### 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 07c67fdc0..636affa05 100644 --- a/docs/contracts/v4/reference/periphery/libraries/QuoterRevert.md +++ b/docs/contracts/v4/reference/periphery/libraries/QuoterRevert.md @@ -1,5 +1,5 @@ # QuoterRevert -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 index 1b9b12214..6e8d2105b 100644 --- a/docs/contracts/v4/reference/periphery/libraries/SVG.md +++ b/docs/contracts/v4/reference/periphery/libraries/SVG.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 diff --git a/docs/contracts/v4/reference/periphery/libraries/SafeCurrencyMetadata.md b/docs/contracts/v4/reference/periphery/libraries/SafeCurrencyMetadata.md index 7defdd5f1..dd53105e6 100644 --- a/docs/contracts/v4/reference/periphery/libraries/SafeCurrencyMetadata.md +++ b/docs/contracts/v4/reference/periphery/libraries/SafeCurrencyMetadata.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 diff --git a/docs/contracts/v4/reference/periphery/libraries/SlippageCheck.md b/docs/contracts/v4/reference/periphery/libraries/SlippageCheck.md index 8ee35bfe7..c324011a4 100644 --- a/docs/contracts/v4/reference/periphery/libraries/SlippageCheck.md +++ b/docs/contracts/v4/reference/periphery/libraries/SlippageCheck.md @@ -1,5 +1,5 @@ # SlippageCheck -[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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 index ed2e5f813..a2a26a040 100644 --- a/docs/contracts/v4/reference/periphery/libraries/VanityAddressLib.md +++ b/docs/contracts/v4/reference/periphery/libraries/VanityAddressLib.md @@ -1,5 +1,5 @@ # 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) +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/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 diff --git a/docs/contracts/v4/reference/periphery/utils/BaseHook.md b/docs/contracts/v4/reference/periphery/utils/BaseHook.md new file mode 100644 index 000000000..18e235cb6 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/utils/BaseHook.md @@ -0,0 +1,442 @@ +# BaseHook +[Git Source](https://github.com/uniswap/v4-periphery/blob/ea2bf2e1ba6863bb809fc2ff791744f308c4a26d/src/utils/BaseHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +IHooks, [ImmutableState](contracts/v4/reference/periphery/base/ImmutableState.md) + +abstract contract for hook implementations + + +## Functions +### constructor + + +```solidity +constructor(IPoolManager _manager) ImmutableState(_manager); +``` + +### getHookPermissions + +Returns a struct of permissions to signal which hook functions are to be implemented + +*Used at deployment to validate the address correctly represents the expected permissions* + + +```solidity +function getHookPermissions() public pure virtual returns (Hooks.Permissions memory); +``` + +### validateHookAddress + +Validates the deployed hook address agrees with the expected permissions of the hook + +*this function is virtual so that we can override it during testing, +which allows us to deploy an implementation to any address +and then etch the bytecode into the correct address* + + +```solidity +function validateHookAddress(BaseHook _this) internal pure virtual; +``` + +### beforeInitialize + +The hook called before the state of a pool is initialized + + +```solidity +function beforeInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96) + external + onlyPoolManager + returns (bytes4); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`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| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bytes4`|bytes4 The function selector for the hook| + + +### _beforeInitialize + + +```solidity +function _beforeInitialize(address, PoolKey calldata, uint160) internal virtual returns (bytes4); +``` + +### afterInitialize + +The hook called after the state of a pool is initialized + + +```solidity +function afterInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96, int24 tick) + external + onlyPoolManager + returns (bytes4); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`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| +|`tick`|`int24`|The current tick after the state of a pool is initialized| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bytes4`|bytes4 The function selector for the hook| + + +### _afterInitialize + + +```solidity +function _afterInitialize(address, PoolKey calldata, uint160, int24) internal virtual returns (bytes4); +``` + +### beforeAddLiquidity + +The hook called before liquidity is added + + +```solidity +function beforeAddLiquidity( + address sender, + PoolKey calldata key, + IPoolManager.ModifyLiquidityParams calldata params, + bytes calldata hookData +) external onlyPoolManager returns (bytes4); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`sender`|`address`|The initial msg.sender for the add liquidity call| +|`key`|`PoolKey`|The key for the pool| +|`params`|`IPoolManager.ModifyLiquidityParams`|The parameters for adding liquidity| +|`hookData`|`bytes`|Arbitrary data handed into the PoolManager by the liquidity provider to be passed on to the hook| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bytes4`|bytes4 The function selector for the hook| + + +### _beforeAddLiquidity + + +```solidity +function _beforeAddLiquidity(address, PoolKey calldata, IPoolManager.ModifyLiquidityParams calldata, bytes calldata) + internal + virtual + returns (bytes4); +``` + +### beforeRemoveLiquidity + +The hook called before liquidity is removed + + +```solidity +function beforeRemoveLiquidity( + address sender, + PoolKey calldata key, + IPoolManager.ModifyLiquidityParams calldata params, + bytes calldata hookData +) external onlyPoolManager returns (bytes4); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`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| +|`hookData`|`bytes`|Arbitrary data handed into the PoolManager by the liquidity provider to be be passed on to the hook| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bytes4`|bytes4 The function selector for the hook| + + +### _beforeRemoveLiquidity + + +```solidity +function _beforeRemoveLiquidity(address, PoolKey calldata, IPoolManager.ModifyLiquidityParams calldata, bytes calldata) + internal + virtual + returns (bytes4); +``` + +### afterAddLiquidity + +The hook called after liquidity is added + + +```solidity +function afterAddLiquidity( + address sender, + PoolKey calldata key, + IPoolManager.ModifyLiquidityParams calldata params, + BalanceDelta delta, + BalanceDelta feesAccrued, + bytes calldata hookData +) external onlyPoolManager returns (bytes4, BalanceDelta); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`sender`|`address`|The initial msg.sender for the add liquidity call| +|`key`|`PoolKey`|The key for the pool| +|`params`|`IPoolManager.ModifyLiquidityParams`|The parameters for adding liquidity| +|`delta`|`BalanceDelta`|The caller's balance delta after adding 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 passed on to the hook| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bytes4`|bytes4 The function selector for the hook| +|``|`BalanceDelta`|BalanceDelta The hook's delta in token0 and token1. Positive: the hook is owed/took currency, negative: the hook owes/sent currency| + + +### _afterAddLiquidity + + +```solidity +function _afterAddLiquidity( + address, + PoolKey calldata, + IPoolManager.ModifyLiquidityParams calldata, + BalanceDelta, + BalanceDelta, + bytes calldata +) internal virtual returns (bytes4, BalanceDelta); +``` + +### afterRemoveLiquidity + +The hook called after liquidity is removed + + +```solidity +function afterRemoveLiquidity( + address sender, + PoolKey calldata key, + IPoolManager.ModifyLiquidityParams calldata params, + BalanceDelta delta, + BalanceDelta feesAccrued, + bytes calldata hookData +) external onlyPoolManager returns (bytes4, BalanceDelta); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`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 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| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bytes4`|bytes4 The function selector for the hook| +|``|`BalanceDelta`|BalanceDelta The hook's delta in token0 and token1. Positive: the hook is owed/took currency, negative: the hook owes/sent currency| + + +### _afterRemoveLiquidity + + +```solidity +function _afterRemoveLiquidity( + address, + PoolKey calldata, + IPoolManager.ModifyLiquidityParams calldata, + BalanceDelta, + BalanceDelta, + bytes calldata +) internal virtual returns (bytes4, BalanceDelta); +``` + +### beforeSwap + +The hook called before a swap + + +```solidity +function beforeSwap( + address sender, + PoolKey calldata key, + IPoolManager.SwapParams calldata params, + bytes calldata hookData +) external onlyPoolManager returns (bytes4, BeforeSwapDelta, uint24); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`sender`|`address`|The initial msg.sender for the swap call| +|`key`|`PoolKey`|The key for the pool| +|`params`|`IPoolManager.SwapParams`|The parameters for the swap| +|`hookData`|`bytes`|Arbitrary data handed into the PoolManager by the swapper to be be passed on to the hook| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bytes4`|bytes4 The function selector for the hook| +|``|`BeforeSwapDelta`|BeforeSwapDelta The hook's delta in specified and unspecified currencies. Positive: the hook is owed/took currency, negative: the hook owes/sent currency| +|``|`uint24`|uint24 Optionally override the lp fee, only used if three conditions are met: 1. the Pool has a dynamic fee, 2. the value's 2nd highest bit is set (23rd bit, 0x400000), and 3. the value is less than or equal to the maximum fee (1 million)| + + +### _beforeSwap + + +```solidity +function _beforeSwap(address, PoolKey calldata, IPoolManager.SwapParams calldata, bytes calldata) + internal + virtual + returns (bytes4, BeforeSwapDelta, uint24); +``` + +### afterSwap + +The hook called after a swap + + +```solidity +function afterSwap( + address sender, + PoolKey calldata key, + IPoolManager.SwapParams calldata params, + BalanceDelta delta, + bytes calldata hookData +) external onlyPoolManager returns (bytes4, int128); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`sender`|`address`|The initial msg.sender for the swap call| +|`key`|`PoolKey`|The key for the pool| +|`params`|`IPoolManager.SwapParams`|The parameters for the swap| +|`delta`|`BalanceDelta`|The amount owed to the caller (positive) or owed to the pool (negative)| +|`hookData`|`bytes`|Arbitrary data handed into the PoolManager by the swapper to be be passed on to the hook| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bytes4`|bytes4 The function selector for the hook| +|``|`int128`|int128 The hook's delta in unspecified currency. Positive: the hook is owed/took currency, negative: the hook owes/sent currency| + + +### _afterSwap + + +```solidity +function _afterSwap(address, PoolKey calldata, IPoolManager.SwapParams calldata, BalanceDelta, bytes calldata) + internal + virtual + returns (bytes4, int128); +``` + +### beforeDonate + +The hook called before donate + + +```solidity +function beforeDonate(address sender, PoolKey calldata key, uint256 amount0, uint256 amount1, bytes calldata hookData) + external + onlyPoolManager + returns (bytes4); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`sender`|`address`|The initial msg.sender for the donate call| +|`key`|`PoolKey`|The key for the pool| +|`amount0`|`uint256`|The amount of token0 being donated| +|`amount1`|`uint256`|The amount of token1 being donated| +|`hookData`|`bytes`|Arbitrary data handed into the PoolManager by the donor to be be passed on to the hook| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bytes4`|bytes4 The function selector for the hook| + + +### _beforeDonate + + +```solidity +function _beforeDonate(address, PoolKey calldata, uint256, uint256, bytes calldata) internal virtual returns (bytes4); +``` + +### afterDonate + +The hook called after donate + + +```solidity +function afterDonate(address sender, PoolKey calldata key, uint256 amount0, uint256 amount1, bytes calldata hookData) + external + onlyPoolManager + returns (bytes4); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`sender`|`address`|The initial msg.sender for the donate call| +|`key`|`PoolKey`|The key for the pool| +|`amount0`|`uint256`|The amount of token0 being donated| +|`amount1`|`uint256`|The amount of token1 being donated| +|`hookData`|`bytes`|Arbitrary data handed into the PoolManager by the donor to be be passed on to the hook| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bytes4`|bytes4 The function selector for the hook| + + +### _afterDonate + + +```solidity +function _afterDonate(address, PoolKey calldata, uint256, uint256, bytes calldata) internal virtual returns (bytes4); +``` + +## Errors +### HookNotImplemented + +```solidity +error HookNotImplemented(); +``` + diff --git a/scripts/v4-forge-doc.sh b/scripts/v4-forge-doc.sh index bb77ec5d3..8d3684864 100755 --- a/scripts/v4-forge-doc.sh +++ b/scripts/v4-forge-doc.sh @@ -1,4 +1,6 @@ # Usage: ./scripts/v4-forge-doc.sh, called from the root directory +# NOTE: This script appears to not work with WSL, and is intended to run on MacOS +# NOTE: submodules should be updated outside of the script # regenerate docs forge doc --root submodules/v4-core --out forge-docs/v4-core @@ -6,55 +8,100 @@ rm -rf submodules/v4-core/forge-docs forge doc --root submodules/v4-periphery --out forge-docs/v4-periphery rm -rf submodules/v4-periphery/forge-docs -copy_docs() { - local component=$1 +# recursively remove .md files from /docs/contracts/v4/reference/core and /docs/contracts/v4/reference/periphery +find docs/contracts/v4/reference/core -type f -name "*.md" -delete +find docs/contracts/v4/reference/periphery -type f -name "*.md" -delete + +process_doc() { + local file=$1 - find "forge-docs/v4-$component/src" -type f -regex '.*\.sol/[^.]*\.[^.]*\.md' | while read file; do - # Extract the directory part (e.g., base, base/hooks, libraries) - dir_structure=$(echo "$file" | sed -r 's|.*/src/([^/]+)/.*\.sol/.*|\1|') + # Extract the directory part (e.g., base, base/hooks, libraries) + dir_structure=$(echo "$file" | sed -r 's|.*/src/([^/]+)/.*\.sol/.*|\1|') - # if dir_structure is src, remove it so it appears at the root level - if [ "$dir_structure" == "src" ]; then - dir_structure="" - fi + # if dir_structure is src, remove it so it appears at the root level + if [ "$dir_structure" == "src" ]; then + dir_structure="" + fi - # Extract the base filename without the path and extension (e.g., Multicall_v4, BaseHook, Locker) - base_filename=$(echo "$file" | sed -r 's|.*/([^/]+)\.sol/[^/]*\.(.*)\.md|\1|') + # Extract the base filename without the path and extension (e.g., Multicall_v4, BaseHook, Locker) + base_filename=$(echo "$file" | sed -r 's|.*/([^/]+)\.sol/[^/]*\.(.*)\.md|\1|') - # Construct the new file path - new_file="docs/contracts/v4/reference/${component}/${dir_structure}/${base_filename}.md" + # Construct the new file path + new_file="docs/contracts/v4/reference/${component}/${dir_structure}/${base_filename}.md" - # Create the new directory structure if it doesn't exist - mkdir -p "docs/contracts/v4/reference/${component}/${dir_structure}" + # Create the new directory structure if it doesn't exist + mkdir -p "docs/contracts/v4/reference/${component}/${dir_structure}" - # Copy the file to the new location + first_file=false + # if the file already exists, concatenate the new file to the end of the existing file + if [ -f "$new_file" ]; then + cat "$file" >> "$new_file" + else + first_file=true cp "$file" "$new_file" + fi - # 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 '' -e "s|uniswap/docs/|uniswap/v4-${component}/|g" "$new_file" + # 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 '' -e "s|uniswap/docs/|uniswap/v4-${component}/|g" "$new_file" - # Add note: - # sed -i '' '3i\ + # Add note about forge doc, if its not already added + if $first_file; then sed -i '' '2s|$| - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc)|' "$new_file" + fi + + + # Replace relative path links within the file with full paths + # 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" + + # 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" + fi + + echo "Copied: $file -> $new_file" +} + +copy_docs() { + local component=$1 + + # process type.NAME.md files + find "forge-docs/v4-$component/src" -type f -regex '.*\.sol/type*\.[^.]*\.md' | while read file; do + process_doc "$file" + done + + # process struct.NAME.md files + find "forge-docs/v4-$component/src" -type f -regex '.*\.sol/struct*\.[^.]*\.md' | while read file; do + process_doc "$file" + done + # process enum.NAME.md files + find "forge-docs/v4-$component/src" -type f -regex '.*\.sol/enum*\.[^.]*\.md' | while read file; do + process_doc "$file" + done - # Replace relative path links within the file with full paths - # 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" + # process library.NAME.md files + find "forge-docs/v4-$component/src" -type f -regex '.*\.sol/library*\.[^.]*\.md' | while read file; do + process_doc "$file" + done - # 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" + # process function.NAME.md files + find "forge-docs/v4-$component/src" -type f -regex '.*\.sol/function*\.[^.]*\.md' | while read file; do + process_doc "$file" + done - # 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" - fi + # process the rest, excluding files that are already processed - echo "Copied: $file -> $new_file" + find "forge-docs/v4-$component/src" -type f -regex '.*\.sol/[^.]*\.[^.]*\.md' ! -name 'type.*.md' ! -name 'struct.*.md' ! -name 'enum.*.md' ! -name 'library.*.md' ! -name 'function.*.md' | while read file; do + process_doc "$file" done + } copy_docs "periphery" diff --git a/submodules/v4-core b/submodules/v4-core index b619b6718..80311e340 160000 --- a/submodules/v4-core +++ b/submodules/v4-core @@ -1 +1 @@ -Subproject commit b619b6718e31aa5b4fa0286520c455ceb950276d +Subproject commit 80311e34080fee64b6fc6c916e9a51a437d0e482 diff --git a/submodules/v4-periphery b/submodules/v4-periphery index 26dd14632..ea2bf2e1b 160000 --- a/submodules/v4-periphery +++ b/submodules/v4-periphery @@ -1 +1 @@ -Subproject commit 26dd1463283d171774d7dabb0de00c682333728d +Subproject commit ea2bf2e1ba6863bb809fc2ff791744f308c4a26d