From cf18ccd96604ee259fb1470b3f6d924bae4946f4 Mon Sep 17 00:00:00 2001 From: saucepoint Date: Thu, 14 Nov 2024 13:12:59 +0700 Subject: [PATCH] fix script for macos; updated tech reference --- docs/contracts/v4/reference/core/ERC6909.md | 3 +- .../v4/reference/core/ERC6909Claims.md | 3 +- docs/contracts/v4/reference/core/Extsload.md | 3 +- docs/contracts/v4/reference/core/Exttload.md | 3 +- .../v4/reference/core/NoDelegateCall.md | 3 +- .../v4/reference/core/PoolManager.md | 20 +- .../v4/reference/core/ProtocolFees.md | 32 +- .../core/interfaces/IERC20Minimal.md | 3 +- .../core/interfaces/IERC6909Claims.md | 3 +- .../v4/reference/core/interfaces/IExtsload.md | 3 +- .../v4/reference/core/interfaces/IExttload.md | 3 +- .../v4/reference/core/interfaces/IHooks.md | 21 +- .../reference/core/interfaces/IPoolManager.md | 12 +- .../core/interfaces/IProtocolFees.md | 31 +- .../core/interfaces/IUnlockCallback.md | 3 +- .../v4/reference/core/libraries/BitMath.md | 3 +- .../reference/core/libraries/CurrencyDelta.md | 3 +- .../core/libraries/CurrencyReserves.md | 3 +- .../reference/core/libraries/CustomRevert.md | 20 +- .../reference/core/libraries/FixedPoint128.md | 3 +- .../reference/core/libraries/FixedPoint96.md | 3 +- .../v4/reference/core/libraries/FullMath.md | 3 +- .../v4/reference/core/libraries/Hooks.md | 26 +- .../reference/core/libraries/LPFeeLibrary.md | 5 +- .../reference/core/libraries/LiquidityMath.md | 3 +- .../v4/reference/core/libraries/Lock.md | 3 +- .../core/libraries/NonzeroDeltaCount.md | 3 +- .../v4/reference/core/libraries/ParseBytes.md | 3 +- .../v4/reference/core/libraries/Pool.md | 7 +- .../v4/reference/core/libraries/Position.md | 3 +- .../core/libraries/ProtocolFeeLibrary.md | 3 +- .../v4/reference/core/libraries/SafeCast.md | 3 +- .../reference/core/libraries/SqrtPriceMath.md | 3 +- .../reference/core/libraries/StateLibrary.md | 3 +- .../v4/reference/core/libraries/SwapMath.md | 3 +- .../v4/reference/core/libraries/TickBitmap.md | 3 +- .../v4/reference/core/libraries/TickMath.md | 3 +- .../core/libraries/TransientStateLibrary.md | 3 +- .../v4/reference/core/libraries/UnsafeMath.md | 7 +- .../v4/reference/core/test/ActionsRouter.md | 164 +------- .../v4/reference/core/test/BaseTestHooks.md | 7 +- .../v4/reference/core/test/CurrencyTest.md | 3 +- .../v4/reference/core/test/CustomCurveHook.md | 3 +- .../reference/core/test/DeltaReturningHook.md | 3 +- .../core/test/DynamicFeesTestHook.md | 8 +- .../core/test/DynamicReturnFeeTestHook.md | 3 +- .../core/test/EmptyRevertContract.md | 3 +- .../v4/reference/core/test/EmptyTestHooks.md | 11 +- .../v4/reference/core/test/FeeTakingHook.md | 3 +- .../v4/reference/core/test/Fuzzers.md | 3 +- .../v4/reference/core/test/HooksTest.md | 3 +- .../v4/reference/core/test/LPFeeTakingHook.md | 3 +- .../reference/core/test/LiquidityMathTest.md | 3 +- .../v4/reference/core/test/MockContract.md | 3 +- .../reference/core/test/MockERC6909Claims.md | 3 +- .../v4/reference/core/test/MockHooks.md | 13 +- .../v4/reference/core/test/NativeERC20.md | 3 +- .../reference/core/test/NoDelegateCallTest.md | 3 +- .../v4/reference/core/test/PoolClaimsTest.md | 3 +- .../v4/reference/core/test/PoolDonateTest.md | 3 +- .../core/test/PoolEmptyUnlockTest.md | 3 +- .../core/test/PoolModifyLiquidityTest.md | 3 +- .../test/PoolModifyLiquidityTestNoChecks.md | 3 +- .../core/test/PoolNestedActionsTest.md | 3 +- .../v4/reference/core/test/PoolSwapTest.md | 3 +- .../v4/reference/core/test/PoolTakeTest.md | 3 +- .../v4/reference/core/test/PoolTestBase.md | 3 +- .../core/test/ProtocolFeesImplementation.md | 17 +- .../reference/core/test/ProxyPoolManager.md | 13 +- .../reference/core/test/SkipCallsTestHook.md | 12 +- .../core/test/SqrtPriceMathEchidnaTest.md | 3 +- .../reference/core/test/SwapRouterNoChecks.md | 3 +- .../v4/reference/core/test/TestERC20.md | 3 +- .../reference/core/test/TestInvalidERC20.md | 3 +- .../core/test/TickMathEchidnaTest.md | 3 +- .../v4/reference/core/test/TickMathTest.md | 3 +- .../test/TickOverflowSafetyEchidnaTest.md | 3 +- .../v4/reference/core/types/PoolId.md | 3 +- .../v4/reference/core/types/Slot0.md | 3 +- .../reference/periphery/PositionDescriptor.md | 149 +++++++ .../v4/reference/periphery/PositionManager.md | 45 +- .../periphery/UniswapV4DeployerCompetition.md | 122 ++++++ .../v4/reference/periphery/V4Router.md | 15 +- .../periphery/base/BaseActionsRouter.md | 3 +- .../v4/reference/periphery/base/BaseHook.md | 9 +- .../reference/periphery/base/BaseV4Quoter.md | 3 +- .../reference/periphery/base/DeltaResolver.md | 35 +- .../v4/reference/periphery/base/EIP712_v4.md | 3 +- .../periphery/base/ERC721Permit_v4.md | 10 +- .../periphery/base/ImmutableState.md | 6 +- .../reference/periphery/base/Multicall_v4.md | 3 +- .../reference/periphery/base/NativeWrapper.md | 61 +++ .../v4/reference/periphery/base/Notifier.md | 15 +- .../periphery/base/Permit2Forwarder.md | 3 +- .../periphery/base/PoolInitializer.md | 9 +- .../periphery/base/ReentrancyLock.md | 3 +- .../reference/periphery/base/SafeCallback.md | 3 +- .../periphery/base/UnorderedNonce.md | 3 +- .../periphery/interfaces/IEIP712_v4.md | 3 +- .../periphery/interfaces/IERC721Permit_v4.md | 3 +- .../periphery/interfaces/IImmutableState.md | 14 + .../periphery/interfaces/IMulticall_v4.md | 3 +- .../periphery/interfaces/INotifier.md | 19 +- .../interfaces/IPositionDescriptor.md | 29 ++ .../periphery/interfaces/IPositionManager.md | 15 +- .../reference/periphery/interfaces/IQuoter.md | 3 +- .../periphery/interfaces/ISubscriber.md | 3 +- .../IUniswapV4DeployerCompetition.md | 85 ++++ .../periphery/interfaces/IV4Router.md | 8 +- .../reference/periphery/interfaces/IWETH9.md | 26 ++ .../v4/reference/periphery/lens/Quoter.md | 3 +- .../v4/reference/periphery/lens/StateView.md | 3 +- .../periphery/libraries/ActionConstants.md | 3 +- .../reference/periphery/libraries/Actions.md | 21 +- .../periphery/libraries/AddressStringUtil.md | 59 +++ .../periphery/libraries/BipsLibrary.md | 36 ++ .../periphery/libraries/CalldataDecoder.md | 12 +- .../libraries/CurrencyRatioSortOrder.md | 52 +++ .../periphery/libraries/Descriptor.md | 383 ++++++++++++++++++ .../periphery/libraries/ERC721PermitHash.md | 3 +- .../periphery/libraries/HexStrings.md | 39 ++ .../reference/periphery/libraries/Locker.md | 3 +- .../reference/periphery/libraries/PathKey.md | 3 +- .../periphery/libraries/PositionConfig.md | 3 +- .../periphery/libraries/PositionConfigId.md | 62 ++- .../libraries/PositionInfoLibrary.md | 150 +------ .../periphery/libraries/QuoterRevert.md | 3 +- .../v4/reference/periphery/libraries/SVG.md | 377 +++++++++++++++++ .../libraries/SafeCurrencyMetadata.md | 133 ++++++ .../periphery/libraries/SlippageCheck.md | 3 +- .../periphery/libraries/VanityAddressLib.md | 94 +++++ scripts/v4-forge-doc.sh | 13 +- 132 files changed, 2088 insertions(+), 690 deletions(-) create mode 100644 docs/contracts/v4/reference/periphery/PositionDescriptor.md create mode 100644 docs/contracts/v4/reference/periphery/UniswapV4DeployerCompetition.md create mode 100644 docs/contracts/v4/reference/periphery/base/NativeWrapper.md create mode 100644 docs/contracts/v4/reference/periphery/interfaces/IImmutableState.md create mode 100644 docs/contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md create mode 100644 docs/contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md create mode 100644 docs/contracts/v4/reference/periphery/interfaces/IWETH9.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/AddressStringUtil.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/BipsLibrary.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/CurrencyRatioSortOrder.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/Descriptor.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/HexStrings.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/SVG.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/SafeCurrencyMetadata.md create mode 100644 docs/contracts/v4/reference/periphery/libraries/VanityAddressLib.md diff --git a/docs/contracts/v4/reference/core/ERC6909.md b/docs/contracts/v4/reference/core/ERC6909.md index c78872297..546b47212 100644 --- a/docs/contracts/v4/reference/core/ERC6909.md +++ b/docs/contracts/v4/reference/core/ERC6909.md @@ -1,6 +1,5 @@ # ERC6909 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/ERC6909.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/ERC6909.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IERC6909Claims](contracts/v4/reference/core/interfaces/IERC6909Claims.md) diff --git a/docs/contracts/v4/reference/core/ERC6909Claims.md b/docs/contracts/v4/reference/core/ERC6909Claims.md index 9f9000dc8..861421777 100644 --- a/docs/contracts/v4/reference/core/ERC6909Claims.md +++ b/docs/contracts/v4/reference/core/ERC6909Claims.md @@ -1,6 +1,5 @@ # ERC6909Claims -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/ERC6909Claims.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/ERC6909Claims.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ERC6909](contracts/v4/reference/core/ERC6909.md) diff --git a/docs/contracts/v4/reference/core/Extsload.md b/docs/contracts/v4/reference/core/Extsload.md index 5a002ea92..e57d84f6a 100644 --- a/docs/contracts/v4/reference/core/Extsload.md +++ b/docs/contracts/v4/reference/core/Extsload.md @@ -1,6 +1,5 @@ # Extsload -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/Extsload.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/Extsload.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IExtsload](contracts/v4/reference/core/interfaces/IExtsload.md) diff --git a/docs/contracts/v4/reference/core/Exttload.md b/docs/contracts/v4/reference/core/Exttload.md index ec8ad2254..4c376946b 100644 --- a/docs/contracts/v4/reference/core/Exttload.md +++ b/docs/contracts/v4/reference/core/Exttload.md @@ -1,6 +1,5 @@ # Exttload -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/Exttload.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/Exttload.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IExttload](contracts/v4/reference/core/interfaces/IExttload.md) diff --git a/docs/contracts/v4/reference/core/NoDelegateCall.md b/docs/contracts/v4/reference/core/NoDelegateCall.md index 605f10922..cf7cfd3f7 100644 --- a/docs/contracts/v4/reference/core/NoDelegateCall.md +++ b/docs/contracts/v4/reference/core/NoDelegateCall.md @@ -1,6 +1,5 @@ # NoDelegateCall -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/NoDelegateCall.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/NoDelegateCall.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Base contract that provides a modifier for preventing delegatecall to methods in a child contract diff --git a/docs/contracts/v4/reference/core/PoolManager.md b/docs/contracts/v4/reference/core/PoolManager.md index 47b80f1d6..52cb440bd 100644 --- a/docs/contracts/v4/reference/core/PoolManager.md +++ b/docs/contracts/v4/reference/core/PoolManager.md @@ -1,6 +1,5 @@ # PoolManager -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/PoolManager.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/PoolManager.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IPoolManager](contracts/v4/reference/core/interfaces/IPoolManager.md), [ProtocolFees](contracts/v4/reference/core/ProtocolFees.md), [NoDelegateCall](contracts/v4/reference/core/NoDelegateCall.md), [ERC6909Claims](contracts/v4/reference/core/ERC6909Claims.md), [Extsload](contracts/v4/reference/core/Extsload.md), [Exttload](contracts/v4/reference/core/Exttload.md) @@ -40,6 +39,13 @@ This will revert if the contract is locked modifier onlyWhenUnlocked(); ``` +### constructor + + +```solidity +constructor(address initialOwner) ProtocolFees(initialOwner); +``` + ### unlock All interactions on the contract that account deltas require unlocking. A caller that calls `unlock` must implement @@ -72,10 +78,7 @@ Initialize the state for a given pool ID ```solidity -function initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hookData) - external - noDelegateCall - returns (int24 tick); +function initialize(PoolKey memory key, uint160 sqrtPriceX96) external noDelegateCall returns (int24 tick); ``` **Parameters** @@ -83,7 +86,6 @@ function initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hoo |----|----|-----------| |`key`|`PoolKey`|The pool key for the pool to initialize| |`sqrtPriceX96`|`uint160`|The initial square root price| -|`hookData`|`bytes`|The data to pass through to the initialize hooks| **Returns** @@ -207,14 +209,14 @@ native funds, this function can be called with the native currency to then be ab ```solidity -function sync(Currency currency) external onlyWhenUnlocked; +function sync(Currency currency) external; ``` ### take Called by the user to net out some value owed to the user -*Can also be used as a mechanism for _free_ flash loans* +*Will revert if the requested amount is not available, consider using `mint` instead* ```solidity diff --git a/docs/contracts/v4/reference/core/ProtocolFees.md b/docs/contracts/v4/reference/core/ProtocolFees.md index ce63a3b0b..7b3b069e4 100644 --- a/docs/contracts/v4/reference/core/ProtocolFees.md +++ b/docs/contracts/v4/reference/core/ProtocolFees.md @@ -1,6 +1,5 @@ # ProtocolFees -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/ProtocolFees.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/ProtocolFees.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IProtocolFees](contracts/v4/reference/core/interfaces/IProtocolFees.md), Owned @@ -23,14 +22,7 @@ Returns the current protocol fee controller address ```solidity -IProtocolFeeController public protocolFeeController; -``` - - -### BLOCK_LIMIT_BPS - -```solidity -uint256 private constant BLOCK_LIMIT_BPS = 100; +address public protocolFeeController; ``` @@ -39,7 +31,7 @@ uint256 private constant BLOCK_LIMIT_BPS = 100; ```solidity -constructor() Owned(msg.sender); +constructor(address initialOwner) Owned(initialOwner); ``` ### setProtocolFeeController @@ -48,13 +40,13 @@ Sets the protocol fee controller ```solidity -function setProtocolFeeController(IProtocolFeeController controller) external onlyOwner; +function setProtocolFeeController(address controller) external onlyOwner; ``` **Parameters** |Name|Type|Description| |----|----|-----------| -|`controller`|`IProtocolFeeController`|The new protocol fee controller| +|`controller`|`address`|The new protocol fee controller| ### setProtocolFee @@ -120,20 +112,6 @@ function _isUnlocked() internal virtual returns (bool); function _getPool(PoolId id) internal virtual returns (Pool.State storage); ``` -### _fetchProtocolFee - -Fetch the protocol fees for a given pool - -*the success of this function is false if the call fails or the returned fees are invalid* - -*to prevent an invalid protocol fee controller from blocking pools from being initialized -the success of this function is NOT checked on initialize and if the call fails, the protocol fees are set to 0.* - - -```solidity -function _fetchProtocolFee(PoolKey memory key) internal returns (uint24 protocolFee); -``` - ### _updateProtocolFees diff --git a/docs/contracts/v4/reference/core/interfaces/IERC20Minimal.md b/docs/contracts/v4/reference/core/interfaces/IERC20Minimal.md index 37700680b..ccf622088 100644 --- a/docs/contracts/v4/reference/core/interfaces/IERC20Minimal.md +++ b/docs/contracts/v4/reference/core/interfaces/IERC20Minimal.md @@ -1,6 +1,5 @@ # IERC20Minimal -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/external/IERC20Minimal.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/external/IERC20Minimal.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contains a subset of the full ERC20 interface that is used in Uniswap V3 diff --git a/docs/contracts/v4/reference/core/interfaces/IERC6909Claims.md b/docs/contracts/v4/reference/core/interfaces/IERC6909Claims.md index 48c33b0f2..4c6596707 100644 --- a/docs/contracts/v4/reference/core/interfaces/IERC6909Claims.md +++ b/docs/contracts/v4/reference/core/interfaces/IERC6909Claims.md @@ -1,6 +1,5 @@ # IERC6909Claims -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/external/IERC6909Claims.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/external/IERC6909Claims.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Interface for claims over a contract balance, wrapped as a ERC6909 diff --git a/docs/contracts/v4/reference/core/interfaces/IExtsload.md b/docs/contracts/v4/reference/core/interfaces/IExtsload.md index d7e7aaf31..0d561f591 100644 --- a/docs/contracts/v4/reference/core/interfaces/IExtsload.md +++ b/docs/contracts/v4/reference/core/interfaces/IExtsload.md @@ -1,6 +1,5 @@ # IExtsload -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/IExtsload.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/IExtsload.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Interface for functions to access any storage slot in a contract diff --git a/docs/contracts/v4/reference/core/interfaces/IExttload.md b/docs/contracts/v4/reference/core/interfaces/IExttload.md index 37275893b..bfc72755c 100644 --- a/docs/contracts/v4/reference/core/interfaces/IExttload.md +++ b/docs/contracts/v4/reference/core/interfaces/IExttload.md @@ -1,6 +1,5 @@ # IExttload -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/IExttload.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/IExttload.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Interface for functions to access any transient storage slot in a contract diff --git a/docs/contracts/v4/reference/core/interfaces/IHooks.md b/docs/contracts/v4/reference/core/interfaces/IHooks.md index 3f567d0dd..4e287403f 100644 --- a/docs/contracts/v4/reference/core/interfaces/IHooks.md +++ b/docs/contracts/v4/reference/core/interfaces/IHooks.md @@ -1,6 +1,5 @@ # IHooks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/IHooks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/IHooks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) V4 decides whether to invoke specific hooks by inspecting the least significant bits of the address that the hooks contract is deployed to. @@ -18,9 +17,7 @@ The hook called before the state of a pool is initialized ```solidity -function beforeInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96, bytes calldata hookData) - external - returns (bytes4); +function beforeInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96) external returns (bytes4); ``` **Parameters** @@ -29,7 +26,6 @@ function beforeInitialize(address sender, PoolKey calldata key, uint160 sqrtPric |`sender`|`address`|The initial msg.sender for the initialize call| |`key`|`PoolKey`|The key for the pool being initialized| |`sqrtPriceX96`|`uint160`|The sqrt(price) of the pool as a Q64.96| -|`hookData`|`bytes`|Arbitrary data handed into the PoolManager by the initializer to be be passed on to the hook| **Returns** @@ -44,13 +40,9 @@ The hook called after the state of a pool is initialized ```solidity -function afterInitialize( - address sender, - PoolKey calldata key, - uint160 sqrtPriceX96, - int24 tick, - bytes calldata hookData -) external returns (bytes4); +function afterInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96, int24 tick) + external + returns (bytes4); ``` **Parameters** @@ -60,7 +52,6 @@ function afterInitialize( |`key`|`PoolKey`|The key for the pool being initialized| |`sqrtPriceX96`|`uint160`|The sqrt(price) of the pool as a Q64.96| |`tick`|`int24`|The current tick after the state of a pool is initialized| -|`hookData`|`bytes`|Arbitrary data handed into the PoolManager by the initializer to be be passed on to the hook| **Returns** @@ -183,7 +174,7 @@ function afterRemoveLiquidity( |`sender`|`address`|The initial msg.sender for the remove liquidity call| |`key`|`PoolKey`|The key for the pool| |`params`|`IPoolManager.ModifyLiquidityParams`|The parameters for removing liquidity| -|`delta`|`BalanceDelta`|The caller's balance delta after adding liquidity; the sum of principal delta, fees accrued, and hook delta| +|`delta`|`BalanceDelta`|The caller's balance delta after removing liquidity; the sum of principal delta, fees accrued, and hook delta| |`feesAccrued`|`BalanceDelta`|The fees accrued since the last time fees were collected from this position| |`hookData`|`bytes`|Arbitrary data handed into the PoolManager by the liquidity provider to be be passed on to the hook| diff --git a/docs/contracts/v4/reference/core/interfaces/IPoolManager.md b/docs/contracts/v4/reference/core/interfaces/IPoolManager.md index 5e031e1b2..b0266b131 100644 --- a/docs/contracts/v4/reference/core/interfaces/IPoolManager.md +++ b/docs/contracts/v4/reference/core/interfaces/IPoolManager.md @@ -1,6 +1,5 @@ # IPoolManager -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/IPoolManager.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/IPoolManager.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IProtocolFees](contracts/v4/reference/core/interfaces/IProtocolFees.md), [IERC6909Claims](contracts/v4/reference/core/interfaces/IERC6909Claims.md), [IExtsload](contracts/v4/reference/core/interfaces/IExtsload.md), [IExttload](contracts/v4/reference/core/interfaces/IExttload.md) @@ -41,7 +40,7 @@ Initialize the state for a given pool ID ```solidity -function initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hookData) external returns (int24 tick); +function initialize(PoolKey memory key, uint160 sqrtPriceX96) external returns (int24 tick); ``` **Parameters** @@ -49,7 +48,6 @@ function initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hoo |----|----|-----------| |`key`|`PoolKey`|The pool key for the pool to initialize| |`sqrtPriceX96`|`uint160`|The initial square root price| -|`hookData`|`bytes`|The data to pass through to the initialize hooks| **Returns** @@ -168,7 +166,9 @@ function sync(Currency currency) external; Called by the user to net out some value owed to the user -*Can also be used as a mechanism for _free_ flash loans* +*Will revert if the requested amount is not available, consider using `mint` instead* + +*Can also be used as a mechanism for free flash loans* ```solidity @@ -319,7 +319,7 @@ event Initialize( |`tickSpacing`|`int24`|The minimum number of ticks between initialized ticks| |`hooks`|`IHooks`|The hooks contract address for the pool, or address(0) if none| |`sqrtPriceX96`|`uint160`|The price of the pool on initialization| -|`tick`|`int24`|The initial tick of the pool corresponding to the intialized price| +|`tick`|`int24`|The initial tick of the pool corresponding to the initialized price| ### ModifyLiquidity Emitted when a liquidity position is modified diff --git a/docs/contracts/v4/reference/core/interfaces/IProtocolFees.md b/docs/contracts/v4/reference/core/interfaces/IProtocolFees.md index d33660f52..147919d5b 100644 --- a/docs/contracts/v4/reference/core/interfaces/IProtocolFees.md +++ b/docs/contracts/v4/reference/core/interfaces/IProtocolFees.md @@ -1,6 +1,5 @@ # IProtocolFees -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/IProtocolFees.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/IProtocolFees.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Interface for all protocol-fee related functions in the pool manager @@ -49,13 +48,13 @@ Sets the protocol fee controller ```solidity -function setProtocolFeeController(IProtocolFeeController controller) external; +function setProtocolFeeController(address controller) external; ``` **Parameters** |Name|Type|Description| |----|----|-----------| -|`controller`|`IProtocolFeeController`|The new protocol fee controller| +|`controller`|`address`|The new protocol fee controller| ### collectProtocolFees @@ -91,13 +90,13 @@ Returns the current protocol fee controller address ```solidity -function protocolFeeController() external view returns (IProtocolFeeController); +function protocolFeeController() external view returns (address); ``` **Returns** |Name|Type|Description| |----|----|-----------| -|``|`IProtocolFeeController`|IProtocolFeeController The currency protocol fee controller| +|``|`address`|address The current protocol fee controller address| ## Events @@ -118,14 +117,6 @@ event ProtocolFeeUpdated(PoolId indexed id, uint24 protocolFee); ``` ## Errors -### ProtocolFeeCannotBeFetched -Thrown when not enough gas is provided to look up the protocol fee - - -```solidity -error ProtocolFeeCannotBeFetched(); -``` - ### ProtocolFeeTooLarge Thrown when protocol fee is set too high @@ -134,19 +125,19 @@ Thrown when protocol fee is set too high error ProtocolFeeTooLarge(uint24 fee); ``` -### ContractUnlocked -Thrown when the contract is unlocked +### InvalidCaller +Thrown when collectProtocolFees or setProtocolFee is not called by the controller. ```solidity -error ContractUnlocked(); +error InvalidCaller(); ``` -### InvalidCaller -Thrown when collectProtocolFees or setProtocolFee is not called by the controller. +### ProtocolFeeCurrencySynced +Thrown when collectProtocolFees is attempted on a token that is synced. ```solidity -error InvalidCaller(); +error ProtocolFeeCurrencySynced(); ``` diff --git a/docs/contracts/v4/reference/core/interfaces/IUnlockCallback.md b/docs/contracts/v4/reference/core/interfaces/IUnlockCallback.md index 694cd96c8..b957d272c 100644 --- a/docs/contracts/v4/reference/core/interfaces/IUnlockCallback.md +++ b/docs/contracts/v4/reference/core/interfaces/IUnlockCallback.md @@ -1,6 +1,5 @@ # IUnlockCallback -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/interfaces/callback/IUnlockCallback.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/interfaces/callback/IUnlockCallback.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Interface for the callback executed when an address unlocks the pool manager diff --git a/docs/contracts/v4/reference/core/libraries/BitMath.md b/docs/contracts/v4/reference/core/libraries/BitMath.md index 4c883ff37..6c5312714 100644 --- a/docs/contracts/v4/reference/core/libraries/BitMath.md +++ b/docs/contracts/v4/reference/core/libraries/BitMath.md @@ -1,6 +1,5 @@ # BitMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/BitMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/BitMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Author:** Solady (https://github.com/Vectorized/solady/blob/8200a70e8dc2a77ecb074fc2e99a2a0d36547522/src/utils/LibBit.sol) diff --git a/docs/contracts/v4/reference/core/libraries/CurrencyDelta.md b/docs/contracts/v4/reference/core/libraries/CurrencyDelta.md index 8f5773d74..b54cb3b5e 100644 --- a/docs/contracts/v4/reference/core/libraries/CurrencyDelta.md +++ b/docs/contracts/v4/reference/core/libraries/CurrencyDelta.md @@ -1,6 +1,5 @@ # CurrencyDelta -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/CurrencyDelta.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/CurrencyDelta.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) *this library implements the equivalent of a mapping, as transient storage can only be accessed in assembly* diff --git a/docs/contracts/v4/reference/core/libraries/CurrencyReserves.md b/docs/contracts/v4/reference/core/libraries/CurrencyReserves.md index efcf3b9c4..17b49bd67 100644 --- a/docs/contracts/v4/reference/core/libraries/CurrencyReserves.md +++ b/docs/contracts/v4/reference/core/libraries/CurrencyReserves.md @@ -1,6 +1,5 @@ # CurrencyReserves -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/CurrencyReserves.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/CurrencyReserves.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## State Variables diff --git a/docs/contracts/v4/reference/core/libraries/CustomRevert.md b/docs/contracts/v4/reference/core/libraries/CustomRevert.md index bac7499bd..89652ce6a 100644 --- a/docs/contracts/v4/reference/core/libraries/CustomRevert.md +++ b/docs/contracts/v4/reference/core/libraries/CustomRevert.md @@ -1,6 +1,5 @@ # CustomRevert -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/CustomRevert.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/CustomRevert.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contains functions for reverting with custom errors with different argument types efficiently @@ -76,12 +75,23 @@ function revertWith(bytes4 selector, address value1, address value2) internal pu ### bubbleUpAndRevertWith -bubble up the revert message returned by a call and revert with the selector provided +bubble up the revert message returned by a call and revert with a wrapped ERC-7751 error -*this function should only be used with custom errors of the type `CustomError(address target, bytes revertReason)`* +*this method can be vulnerable to revert data bombs* ```solidity -function bubbleUpAndRevertWith(bytes4 selector, address addr) internal pure; +function bubbleUpAndRevertWith(address revertingContract, bytes4 revertingFunctionSelector, bytes4 additionalContext) + internal + pure; +``` + +## Errors +### WrappedError +*ERC-7751 error for wrapping bubbled up reverts* + + +```solidity +error WrappedError(address target, bytes4 selector, bytes reason, bytes details); ``` diff --git a/docs/contracts/v4/reference/core/libraries/FixedPoint128.md b/docs/contracts/v4/reference/core/libraries/FixedPoint128.md index 1697cd59b..c92cc7621 100644 --- a/docs/contracts/v4/reference/core/libraries/FixedPoint128.md +++ b/docs/contracts/v4/reference/core/libraries/FixedPoint128.md @@ -1,6 +1,5 @@ # FixedPoint128 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/FixedPoint128.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/FixedPoint128.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) diff --git a/docs/contracts/v4/reference/core/libraries/FixedPoint96.md b/docs/contracts/v4/reference/core/libraries/FixedPoint96.md index 0e1ba21f7..7d098dacd 100644 --- a/docs/contracts/v4/reference/core/libraries/FixedPoint96.md +++ b/docs/contracts/v4/reference/core/libraries/FixedPoint96.md @@ -1,6 +1,5 @@ # FixedPoint96 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/FixedPoint96.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/FixedPoint96.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) diff --git a/docs/contracts/v4/reference/core/libraries/FullMath.md b/docs/contracts/v4/reference/core/libraries/FullMath.md index 5228571ae..3fa739f7e 100644 --- a/docs/contracts/v4/reference/core/libraries/FullMath.md +++ b/docs/contracts/v4/reference/core/libraries/FullMath.md @@ -1,6 +1,5 @@ # FullMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/FullMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/FullMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision diff --git a/docs/contracts/v4/reference/core/libraries/Hooks.md b/docs/contracts/v4/reference/core/libraries/Hooks.md index 10b8f7cf4..2988766c9 100644 --- a/docs/contracts/v4/reference/core/libraries/Hooks.md +++ b/docs/contracts/v4/reference/core/libraries/Hooks.md @@ -1,6 +1,5 @@ # Hooks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/Hooks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/Hooks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) V4 decides whether to invoke specific hooks by inspecting the least significant bits of the address that the hooks contract is deployed to. @@ -158,7 +157,7 @@ function isValidHookAddress(IHooks self, uint24 fee) internal pure returns (bool ### callHook -performs a hook call using the given calldata on the given hook that doesnt return a delta +performs a hook call using the given calldata on the given hook that doesn't return a delta ```solidity @@ -201,9 +200,7 @@ calls beforeInitialize hook if permissioned and validates return value ```solidity -function beforeInitialize(IHooks self, PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hookData) - internal - noSelfCall(self); +function beforeInitialize(IHooks self, PoolKey memory key, uint160 sqrtPriceX96) internal noSelfCall(self); ``` ### afterInitialize @@ -212,9 +209,7 @@ calls afterInitialize hook if permissioned and validates return value ```solidity -function afterInitialize(IHooks self, PoolKey memory key, uint160 sqrtPriceX96, int24 tick, bytes calldata hookData) - internal - noSelfCall(self); +function afterInitialize(IHooks self, PoolKey memory key, uint160 sqrtPriceX96, int24 tick) internal noSelfCall(self); ``` ### beforeModifyLiquidity @@ -326,21 +321,14 @@ Hook did not return its selector error InvalidHookResponse(); ``` -### Wrap__FailedHookCall -thrown when a hook call fails +### HookCallFailed +Additional context for ERC-7751 wrapped error when a hook call fails ```solidity -error Wrap__FailedHookCall(address hook, bytes revertReason); +error HookCallFailed(); ``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`hook`|`address`|| -|`revertReason`|`bytes`|bubbled up revert reason| - ### HookDeltaExceedsSwapAmount The hook's delta changed the swap from exactIn to exactOut or vice versa diff --git a/docs/contracts/v4/reference/core/libraries/LPFeeLibrary.md b/docs/contracts/v4/reference/core/libraries/LPFeeLibrary.md index a9fcddb3f..d09280aeb 100644 --- a/docs/contracts/v4/reference/core/libraries/LPFeeLibrary.md +++ b/docs/contracts/v4/reference/core/libraries/LPFeeLibrary.md @@ -1,13 +1,12 @@ # LPFeeLibrary -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/LPFeeLibrary.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/LPFeeLibrary.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Library of helper functions for a pools LP fee ## State Variables ### DYNAMIC_FEE_FLAG -An lp fee of exactly 0b1000000... signals a dynamic fee pool. This isnt a valid static fee as it is > MAX_LP_FEE +An lp fee of exactly 0b1000000... signals a dynamic fee pool. This isn't a valid static fee as it is > MAX_LP_FEE ```solidity diff --git a/docs/contracts/v4/reference/core/libraries/LiquidityMath.md b/docs/contracts/v4/reference/core/libraries/LiquidityMath.md index 03c1136b8..3f5de6eba 100644 --- a/docs/contracts/v4/reference/core/libraries/LiquidityMath.md +++ b/docs/contracts/v4/reference/core/libraries/LiquidityMath.md @@ -1,6 +1,5 @@ # LiquidityMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/LiquidityMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/LiquidityMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/libraries/Lock.md b/docs/contracts/v4/reference/core/libraries/Lock.md index b578a70d9..f64208181 100644 --- a/docs/contracts/v4/reference/core/libraries/Lock.md +++ b/docs/contracts/v4/reference/core/libraries/Lock.md @@ -1,6 +1,5 @@ # Lock -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/Lock.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/Lock.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) This is a temporary library that allows us to use transient storage (tstore/tload) TODO: This library can be deleted when we have the transient keyword support in solidity. diff --git a/docs/contracts/v4/reference/core/libraries/NonzeroDeltaCount.md b/docs/contracts/v4/reference/core/libraries/NonzeroDeltaCount.md index bff21999c..8a04de784 100644 --- a/docs/contracts/v4/reference/core/libraries/NonzeroDeltaCount.md +++ b/docs/contracts/v4/reference/core/libraries/NonzeroDeltaCount.md @@ -1,6 +1,5 @@ # NonzeroDeltaCount -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/NonzeroDeltaCount.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/NonzeroDeltaCount.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) This is a temporary library that allows us to use transient storage (tstore/tload) for the nonzero delta count. diff --git a/docs/contracts/v4/reference/core/libraries/ParseBytes.md b/docs/contracts/v4/reference/core/libraries/ParseBytes.md index a5e153249..682a92878 100644 --- a/docs/contracts/v4/reference/core/libraries/ParseBytes.md +++ b/docs/contracts/v4/reference/core/libraries/ParseBytes.md @@ -1,6 +1,5 @@ # ParseBytes -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/ParseBytes.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/ParseBytes.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Parses bytes returned from hooks and the byte selector used to check return selectors from hooks. diff --git a/docs/contracts/v4/reference/core/libraries/Pool.md b/docs/contracts/v4/reference/core/libraries/Pool.md index d5c0fd413..8e0d37c16 100644 --- a/docs/contracts/v4/reference/core/libraries/Pool.md +++ b/docs/contracts/v4/reference/core/libraries/Pool.md @@ -1,6 +1,5 @@ # Pool -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/Pool.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/Pool.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) a library with all actions that can be performed on a pool @@ -19,9 +18,7 @@ function checkTicks(int24 tickLower, int24 tickUpper) private pure; ```solidity -function initialize(State storage self, uint160 sqrtPriceX96, uint24 protocolFee, uint24 lpFee) - internal - returns (int24 tick); +function initialize(State storage self, uint160 sqrtPriceX96, uint24 lpFee) internal returns (int24 tick); ``` ### setProtocolFee diff --git a/docs/contracts/v4/reference/core/libraries/Position.md b/docs/contracts/v4/reference/core/libraries/Position.md index 221ec3a00..d7b9c8670 100644 --- a/docs/contracts/v4/reference/core/libraries/Position.md +++ b/docs/contracts/v4/reference/core/libraries/Position.md @@ -1,6 +1,5 @@ # Position -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/Position.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/Position.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Positions represent an owner address' liquidity between a lower and upper tick boundary diff --git a/docs/contracts/v4/reference/core/libraries/ProtocolFeeLibrary.md b/docs/contracts/v4/reference/core/libraries/ProtocolFeeLibrary.md index 52e5bd26c..0c71798c5 100644 --- a/docs/contracts/v4/reference/core/libraries/ProtocolFeeLibrary.md +++ b/docs/contracts/v4/reference/core/libraries/ProtocolFeeLibrary.md @@ -1,6 +1,5 @@ # ProtocolFeeLibrary -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/ProtocolFeeLibrary.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/ProtocolFeeLibrary.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) library of functions related to protocol fees diff --git a/docs/contracts/v4/reference/core/libraries/SafeCast.md b/docs/contracts/v4/reference/core/libraries/SafeCast.md index 8865bf34a..3edb69a61 100644 --- a/docs/contracts/v4/reference/core/libraries/SafeCast.md +++ b/docs/contracts/v4/reference/core/libraries/SafeCast.md @@ -1,6 +1,5 @@ # SafeCast -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/SafeCast.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/SafeCast.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contains methods for safely casting between types diff --git a/docs/contracts/v4/reference/core/libraries/SqrtPriceMath.md b/docs/contracts/v4/reference/core/libraries/SqrtPriceMath.md index a6ca55748..8154eed72 100644 --- a/docs/contracts/v4/reference/core/libraries/SqrtPriceMath.md +++ b/docs/contracts/v4/reference/core/libraries/SqrtPriceMath.md @@ -1,6 +1,5 @@ # SqrtPriceMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/SqrtPriceMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/SqrtPriceMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contains the math that uses square root of price as a Q64.96 and liquidity to compute deltas diff --git a/docs/contracts/v4/reference/core/libraries/StateLibrary.md b/docs/contracts/v4/reference/core/libraries/StateLibrary.md index bdec514ac..e3a7e141a 100644 --- a/docs/contracts/v4/reference/core/libraries/StateLibrary.md +++ b/docs/contracts/v4/reference/core/libraries/StateLibrary.md @@ -1,6 +1,5 @@ # StateLibrary -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/StateLibrary.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/StateLibrary.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) A helper library to provide state getters that use extsload diff --git a/docs/contracts/v4/reference/core/libraries/SwapMath.md b/docs/contracts/v4/reference/core/libraries/SwapMath.md index 3a3ccd4a2..72c4cb9fb 100644 --- a/docs/contracts/v4/reference/core/libraries/SwapMath.md +++ b/docs/contracts/v4/reference/core/libraries/SwapMath.md @@ -1,6 +1,5 @@ # SwapMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/SwapMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/SwapMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contains methods for computing the result of a swap within a single tick price range, i.e., a single tick. diff --git a/docs/contracts/v4/reference/core/libraries/TickBitmap.md b/docs/contracts/v4/reference/core/libraries/TickBitmap.md index 975119714..43aa6f80d 100644 --- a/docs/contracts/v4/reference/core/libraries/TickBitmap.md +++ b/docs/contracts/v4/reference/core/libraries/TickBitmap.md @@ -1,6 +1,5 @@ # TickBitmap -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/TickBitmap.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/TickBitmap.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Stores a packed mapping of tick index to its initialized state diff --git a/docs/contracts/v4/reference/core/libraries/TickMath.md b/docs/contracts/v4/reference/core/libraries/TickMath.md index f1c7e664d..99e490a4d 100644 --- a/docs/contracts/v4/reference/core/libraries/TickMath.md +++ b/docs/contracts/v4/reference/core/libraries/TickMath.md @@ -1,6 +1,5 @@ # TickMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/TickMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/TickMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports prices between 2**-128 and 2**128 diff --git a/docs/contracts/v4/reference/core/libraries/TransientStateLibrary.md b/docs/contracts/v4/reference/core/libraries/TransientStateLibrary.md index bd9be0025..85b115065 100644 --- a/docs/contracts/v4/reference/core/libraries/TransientStateLibrary.md +++ b/docs/contracts/v4/reference/core/libraries/TransientStateLibrary.md @@ -1,6 +1,5 @@ # TransientStateLibrary -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/TransientStateLibrary.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/TransientStateLibrary.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) A helper library to provide state getters that use exttload diff --git a/docs/contracts/v4/reference/core/libraries/UnsafeMath.md b/docs/contracts/v4/reference/core/libraries/UnsafeMath.md index 0b6423831..dc23f66fa 100644 --- a/docs/contracts/v4/reference/core/libraries/UnsafeMath.md +++ b/docs/contracts/v4/reference/core/libraries/UnsafeMath.md @@ -1,6 +1,5 @@ # UnsafeMath -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/libraries/UnsafeMath.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/libraries/UnsafeMath.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contains methods that perform common math functions but do not do any overflow or underflow checks @@ -10,7 +9,7 @@ Contains methods that perform common math functions but do not do any overflow o Returns ceil(x / y) -*division by 0 has unspecified behavior, and must be checked externally* +*division by 0 will return 0, and should be checked externally* ```solidity @@ -34,7 +33,7 @@ function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z); Calculates floor(a×b÷denominator) -*division by 0 has unspecified behavior, and must be checked externally* +*division by 0 will return 0, and should be checked externally* ```solidity diff --git a/docs/contracts/v4/reference/core/test/ActionsRouter.md b/docs/contracts/v4/reference/core/test/ActionsRouter.md index a4d256f30..710e50229 100644 --- a/docs/contracts/v4/reference/core/test/ActionsRouter.md +++ b/docs/contracts/v4/reference/core/test/ActionsRouter.md @@ -1,145 +1,23 @@ -# ActionsRouter -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/ActionsRouter.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) - -**Inherits:** -[IUnlockCallback](/src/interfaces/callback/IUnlockCallback.sol/interface.IUnlockCallback.md), Test, GasSnapshot - -A router that handles an arbitrary input of actions. -TODO: Can continue to add functions per action. - - -## State Variables -### manager - -```solidity -IPoolManager manager; -``` - - -## Functions -### constructor - - -```solidity -constructor(IPoolManager _manager); -``` - -### unlockCallback - - -```solidity -function unlockCallback(bytes calldata data) external returns (bytes memory); -``` - -### executeActions - - -```solidity -function executeActions(Actions[] memory actions, bytes[] memory params) external payable; -``` - -### _settle - - -```solidity -function _settle() internal; -``` - -### _settleNative - - -```solidity -function _settleNative(bytes memory params) internal; -``` - -### _settleFor - - -```solidity -function _settleFor(bytes memory params) internal; -``` - -### _take - - -```solidity -function _take(bytes memory params) internal; -``` - -### _prankTakeFrom - - -```solidity -function _prankTakeFrom(bytes memory params) internal; -``` - -### _sync - - -```solidity -function _sync(bytes memory params) internal; -``` - -### _mint - - -```solidity -function _mint(bytes memory params) internal; -``` - -### _clear - - -```solidity -function _clear(bytes memory params) internal; -``` - -### _assertBalanceEquals - - -```solidity -function _assertBalanceEquals(bytes memory params) internal view; -``` - -### _assertReservesEquals - - -```solidity -function _assertReservesEquals(bytes memory params) internal view; -``` - -### _assertDeltaEquals - - -```solidity -function _assertDeltaEquals(bytes memory params) internal view; -``` - -### _assertNonzeroDeltaCountEquals - - -```solidity -function _assertNonzeroDeltaCountEquals(bytes memory params) internal view; -``` - -### _transferFrom - - -```solidity -function _transferFrom(bytes memory params) internal; -``` - -## Errors -### ActionNotSupported - -```solidity -error ActionNotSupported(); -``` - -### CheckParameters - -```solidity -error CheckParameters(); +# Actions +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/ActionsRouter.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + + +```solidity +enum Actions { + SETTLE, + SETTLE_NATIVE, + SETTLE_FOR, + TAKE, + PRANK_TAKE_FROM, + SYNC, + MINT, + CLEAR, + ASSERT_BALANCE_EQUALS, + ASSERT_RESERVES_EQUALS, + ASSERT_DELTA_EQUALS, + ASSERT_NONZERO_DELTA_COUNT_EQUALS, + TRANSFER_FROM, + COLLECT_PROTOCOL_FEES +} ``` diff --git a/docs/contracts/v4/reference/core/test/BaseTestHooks.md b/docs/contracts/v4/reference/core/test/BaseTestHooks.md index 2e8e924e0..5e48fe74c 100644 --- a/docs/contracts/v4/reference/core/test/BaseTestHooks.md +++ b/docs/contracts/v4/reference/core/test/BaseTestHooks.md @@ -1,6 +1,5 @@ # BaseTestHooks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/BaseTestHooks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/BaseTestHooks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IHooks](contracts/v4/reference/core/interfaces/IHooks.md) @@ -11,14 +10,14 @@ ```solidity -function beforeInitialize(address, PoolKey calldata, uint160, bytes calldata) external virtual returns (bytes4); +function beforeInitialize(address, PoolKey calldata, uint160) external virtual returns (bytes4); ``` ### afterInitialize ```solidity -function afterInitialize(address, PoolKey calldata, uint160, int24, bytes calldata) external virtual returns (bytes4); +function afterInitialize(address, PoolKey calldata, uint160, int24) external virtual returns (bytes4); ``` ### beforeAddLiquidity diff --git a/docs/contracts/v4/reference/core/test/CurrencyTest.md b/docs/contracts/v4/reference/core/test/CurrencyTest.md index c3119de34..7e9daa498 100644 --- a/docs/contracts/v4/reference/core/test/CurrencyTest.md +++ b/docs/contracts/v4/reference/core/test/CurrencyTest.md @@ -1,6 +1,5 @@ # CurrencyTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/CurrencyTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/CurrencyTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/CustomCurveHook.md b/docs/contracts/v4/reference/core/test/CustomCurveHook.md index 873aee153..6cd49cac6 100644 --- a/docs/contracts/v4/reference/core/test/CustomCurveHook.md +++ b/docs/contracts/v4/reference/core/test/CustomCurveHook.md @@ -1,6 +1,5 @@ # CustomCurveHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/CustomCurveHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/CustomCurveHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md) diff --git a/docs/contracts/v4/reference/core/test/DeltaReturningHook.md b/docs/contracts/v4/reference/core/test/DeltaReturningHook.md index 683df0a79..199613a9c 100644 --- a/docs/contracts/v4/reference/core/test/DeltaReturningHook.md +++ b/docs/contracts/v4/reference/core/test/DeltaReturningHook.md @@ -1,6 +1,5 @@ # DeltaReturningHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/DeltaReturningHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/DeltaReturningHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md) diff --git a/docs/contracts/v4/reference/core/test/DynamicFeesTestHook.md b/docs/contracts/v4/reference/core/test/DynamicFeesTestHook.md index 0396f4846..99103f98d 100644 --- a/docs/contracts/v4/reference/core/test/DynamicFeesTestHook.md +++ b/docs/contracts/v4/reference/core/test/DynamicFeesTestHook.md @@ -1,6 +1,5 @@ # DynamicFeesTestHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/DynamicFeesTestHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/DynamicFeesTestHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md) @@ -40,10 +39,7 @@ function setFee(uint24 _fee) external; ```solidity -function afterInitialize(address, PoolKey calldata key, uint160, int24, bytes calldata) - external - override - returns (bytes4); +function afterInitialize(address, PoolKey calldata key, uint160, int24) external override returns (bytes4); ``` ### beforeSwap diff --git a/docs/contracts/v4/reference/core/test/DynamicReturnFeeTestHook.md b/docs/contracts/v4/reference/core/test/DynamicReturnFeeTestHook.md index 54175aeda..e6c75c018 100644 --- a/docs/contracts/v4/reference/core/test/DynamicReturnFeeTestHook.md +++ b/docs/contracts/v4/reference/core/test/DynamicReturnFeeTestHook.md @@ -1,6 +1,5 @@ # DynamicReturnFeeTestHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/DynamicReturnFeeTestHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/DynamicReturnFeeTestHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md) diff --git a/docs/contracts/v4/reference/core/test/EmptyRevertContract.md b/docs/contracts/v4/reference/core/test/EmptyRevertContract.md index 4debb6afe..433eda3c0 100644 --- a/docs/contracts/v4/reference/core/test/EmptyRevertContract.md +++ b/docs/contracts/v4/reference/core/test/EmptyRevertContract.md @@ -1,6 +1,5 @@ # EmptyRevertContract -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/EmptyRevertContract.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/EmptyRevertContract.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/EmptyTestHooks.md b/docs/contracts/v4/reference/core/test/EmptyTestHooks.md index 45d387d19..1009622a1 100644 --- a/docs/contracts/v4/reference/core/test/EmptyTestHooks.md +++ b/docs/contracts/v4/reference/core/test/EmptyTestHooks.md @@ -1,6 +1,5 @@ # EmptyTestHooks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/EmptyTestHooks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/EmptyTestHooks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IHooks](contracts/v4/reference/core/interfaces/IHooks.md) @@ -18,18 +17,14 @@ constructor(); ```solidity -function beforeInitialize(address, PoolKey calldata, uint160, bytes calldata) external pure override returns (bytes4); +function beforeInitialize(address, PoolKey calldata, uint160) external pure override returns (bytes4); ``` ### afterInitialize ```solidity -function afterInitialize(address, PoolKey calldata, uint160, int24, bytes calldata) - external - pure - override - returns (bytes4); +function afterInitialize(address, PoolKey calldata, uint160, int24) external pure override returns (bytes4); ``` ### beforeAddLiquidity diff --git a/docs/contracts/v4/reference/core/test/FeeTakingHook.md b/docs/contracts/v4/reference/core/test/FeeTakingHook.md index 14753a00c..0b7b64e71 100644 --- a/docs/contracts/v4/reference/core/test/FeeTakingHook.md +++ b/docs/contracts/v4/reference/core/test/FeeTakingHook.md @@ -1,6 +1,5 @@ # FeeTakingHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/FeeTakingHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/FeeTakingHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md) diff --git a/docs/contracts/v4/reference/core/test/Fuzzers.md b/docs/contracts/v4/reference/core/test/Fuzzers.md index cd688d408..3efe7fe1b 100644 --- a/docs/contracts/v4/reference/core/test/Fuzzers.md +++ b/docs/contracts/v4/reference/core/test/Fuzzers.md @@ -1,6 +1,5 @@ # Fuzzers -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/Fuzzers.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/Fuzzers.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** StdUtils diff --git a/docs/contracts/v4/reference/core/test/HooksTest.md b/docs/contracts/v4/reference/core/test/HooksTest.md index b2ad68fa2..7b31b70a8 100644 --- a/docs/contracts/v4/reference/core/test/HooksTest.md +++ b/docs/contracts/v4/reference/core/test/HooksTest.md @@ -1,6 +1,5 @@ # HooksTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/HooksTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/HooksTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/LPFeeTakingHook.md b/docs/contracts/v4/reference/core/test/LPFeeTakingHook.md index 3fb4560dc..e238227eb 100644 --- a/docs/contracts/v4/reference/core/test/LPFeeTakingHook.md +++ b/docs/contracts/v4/reference/core/test/LPFeeTakingHook.md @@ -1,6 +1,5 @@ # LPFeeTakingHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/LPFeeTakingHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/LPFeeTakingHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md) diff --git a/docs/contracts/v4/reference/core/test/LiquidityMathTest.md b/docs/contracts/v4/reference/core/test/LiquidityMathTest.md index 9b1233578..2f1def5ca 100644 --- a/docs/contracts/v4/reference/core/test/LiquidityMathTest.md +++ b/docs/contracts/v4/reference/core/test/LiquidityMathTest.md @@ -1,6 +1,5 @@ # LiquidityMathTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/LiquidityMathTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/LiquidityMathTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/MockContract.md b/docs/contracts/v4/reference/core/test/MockContract.md index f71b022b0..e3fde7523 100644 --- a/docs/contracts/v4/reference/core/test/MockContract.md +++ b/docs/contracts/v4/reference/core/test/MockContract.md @@ -1,6 +1,5 @@ # MockContract -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/MockContract.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/MockContract.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** Proxy diff --git a/docs/contracts/v4/reference/core/test/MockERC6909Claims.md b/docs/contracts/v4/reference/core/test/MockERC6909Claims.md index 189fc85bc..da1a5b0b4 100644 --- a/docs/contracts/v4/reference/core/test/MockERC6909Claims.md +++ b/docs/contracts/v4/reference/core/test/MockERC6909Claims.md @@ -1,6 +1,5 @@ # MockERC6909Claims -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/MockERC6909Claims.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/MockERC6909Claims.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ERC6909Claims](contracts/v4/reference/core/ERC6909Claims.md) diff --git a/docs/contracts/v4/reference/core/test/MockHooks.md b/docs/contracts/v4/reference/core/test/MockHooks.md index 544b7e7f5..12552e7e0 100644 --- a/docs/contracts/v4/reference/core/test/MockHooks.md +++ b/docs/contracts/v4/reference/core/test/MockHooks.md @@ -1,6 +1,5 @@ # MockHooks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/MockHooks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/MockHooks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IHooks](contracts/v4/reference/core/interfaces/IHooks.md) @@ -96,20 +95,14 @@ mapping(PoolId => uint16) public lpFees; ```solidity -function beforeInitialize(address, PoolKey calldata, uint160, bytes calldata hookData) - external - override - returns (bytes4); +function beforeInitialize(address, PoolKey calldata, uint160) external override returns (bytes4); ``` ### afterInitialize ```solidity -function afterInitialize(address, PoolKey calldata, uint160, int24, bytes calldata hookData) - external - override - returns (bytes4); +function afterInitialize(address, PoolKey calldata, uint160, int24) external override returns (bytes4); ``` ### beforeAddLiquidity diff --git a/docs/contracts/v4/reference/core/test/NativeERC20.md b/docs/contracts/v4/reference/core/test/NativeERC20.md index 2a7bf1d3f..d58ae4255 100644 --- a/docs/contracts/v4/reference/core/test/NativeERC20.md +++ b/docs/contracts/v4/reference/core/test/NativeERC20.md @@ -1,6 +1,5 @@ # NativeERC20 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/NativeERC20.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/NativeERC20.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** Test diff --git a/docs/contracts/v4/reference/core/test/NoDelegateCallTest.md b/docs/contracts/v4/reference/core/test/NoDelegateCallTest.md index 2113d21f6..32eca69a3 100644 --- a/docs/contracts/v4/reference/core/test/NoDelegateCallTest.md +++ b/docs/contracts/v4/reference/core/test/NoDelegateCallTest.md @@ -1,6 +1,5 @@ # NoDelegateCallTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/NoDelegateCallTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/NoDelegateCallTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [NoDelegateCall](contracts/v4/reference/core/NoDelegateCall.md) diff --git a/docs/contracts/v4/reference/core/test/PoolClaimsTest.md b/docs/contracts/v4/reference/core/test/PoolClaimsTest.md index 814b573d4..d2da97fa1 100644 --- a/docs/contracts/v4/reference/core/test/PoolClaimsTest.md +++ b/docs/contracts/v4/reference/core/test/PoolClaimsTest.md @@ -1,6 +1,5 @@ # PoolClaimsTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolClaimsTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolClaimsTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolDonateTest.md b/docs/contracts/v4/reference/core/test/PoolDonateTest.md index 6711be4fd..b3ae0bee3 100644 --- a/docs/contracts/v4/reference/core/test/PoolDonateTest.md +++ b/docs/contracts/v4/reference/core/test/PoolDonateTest.md @@ -1,6 +1,5 @@ # PoolDonateTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolDonateTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolDonateTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolEmptyUnlockTest.md b/docs/contracts/v4/reference/core/test/PoolEmptyUnlockTest.md index 77b16f1d4..685fd4475 100644 --- a/docs/contracts/v4/reference/core/test/PoolEmptyUnlockTest.md +++ b/docs/contracts/v4/reference/core/test/PoolEmptyUnlockTest.md @@ -1,6 +1,5 @@ # PoolEmptyUnlockTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolEmptyUnlockTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolEmptyUnlockTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IUnlockCallback](/src/interfaces/callback/IUnlockCallback.sol/interface.IUnlockCallback.md) diff --git a/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTest.md b/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTest.md index fed6cc3a5..cc7ee5792 100644 --- a/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTest.md +++ b/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTest.md @@ -1,6 +1,5 @@ # PoolModifyLiquidityTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolModifyLiquidityTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolModifyLiquidityTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTestNoChecks.md b/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTestNoChecks.md index 0dfe79578..eb56c1405 100644 --- a/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTestNoChecks.md +++ b/docs/contracts/v4/reference/core/test/PoolModifyLiquidityTestNoChecks.md @@ -1,6 +1,5 @@ # PoolModifyLiquidityTestNoChecks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolModifyLiquidityTestNoChecks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolModifyLiquidityTestNoChecks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolNestedActionsTest.md b/docs/contracts/v4/reference/core/test/PoolNestedActionsTest.md index 5e905eea8..49ead8a86 100644 --- a/docs/contracts/v4/reference/core/test/PoolNestedActionsTest.md +++ b/docs/contracts/v4/reference/core/test/PoolNestedActionsTest.md @@ -1,6 +1,5 @@ # NestedActionExecutor -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolNestedActionsTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolNestedActionsTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** Test, [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolSwapTest.md b/docs/contracts/v4/reference/core/test/PoolSwapTest.md index 79dbc23c9..eeb9fbb65 100644 --- a/docs/contracts/v4/reference/core/test/PoolSwapTest.md +++ b/docs/contracts/v4/reference/core/test/PoolSwapTest.md @@ -1,6 +1,5 @@ # PoolSwapTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolSwapTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolSwapTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolTakeTest.md b/docs/contracts/v4/reference/core/test/PoolTakeTest.md index c1fc3522b..f98d96956 100644 --- a/docs/contracts/v4/reference/core/test/PoolTakeTest.md +++ b/docs/contracts/v4/reference/core/test/PoolTakeTest.md @@ -1,6 +1,5 @@ # PoolTakeTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolTakeTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolTakeTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/PoolTestBase.md b/docs/contracts/v4/reference/core/test/PoolTestBase.md index d08f9b757..cd9114f0e 100644 --- a/docs/contracts/v4/reference/core/test/PoolTestBase.md +++ b/docs/contracts/v4/reference/core/test/PoolTestBase.md @@ -1,6 +1,5 @@ # PoolTestBase -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/PoolTestBase.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/PoolTestBase.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IUnlockCallback](/src/interfaces/callback/IUnlockCallback.sol/interface.IUnlockCallback.md) diff --git a/docs/contracts/v4/reference/core/test/ProtocolFeesImplementation.md b/docs/contracts/v4/reference/core/test/ProtocolFeesImplementation.md index 9b6fe3366..2b1da1a8f 100644 --- a/docs/contracts/v4/reference/core/test/ProtocolFeesImplementation.md +++ b/docs/contracts/v4/reference/core/test/ProtocolFeesImplementation.md @@ -1,6 +1,5 @@ # ProtocolFeesImplementation -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/ProtocolFeesImplementation.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/ProtocolFeesImplementation.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ProtocolFees](contracts/v4/reference/core/ProtocolFees.md) @@ -22,6 +21,13 @@ bool internal isUnlocked; ## Functions +### constructor + + +```solidity +constructor() ProtocolFees(msg.sender); +``` + ### setPrice @@ -50,13 +56,6 @@ function setIsUnlocked(bool newValue) public; function _isUnlocked() internal view override returns (bool); ``` -### fetchProtocolFee - - -```solidity -function fetchProtocolFee(PoolKey memory key) public returns (uint24); -``` - ### updateProtocolFees diff --git a/docs/contracts/v4/reference/core/test/ProxyPoolManager.md b/docs/contracts/v4/reference/core/test/ProxyPoolManager.md index 89e430fa3..cf0365e99 100644 --- a/docs/contracts/v4/reference/core/test/ProxyPoolManager.md +++ b/docs/contracts/v4/reference/core/test/ProxyPoolManager.md @@ -1,6 +1,5 @@ # ProxyPoolManager -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/ProxyPoolManager.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/ProxyPoolManager.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IPoolManager](contracts/v4/reference/core/interfaces/IPoolManager.md), [ProtocolFees](contracts/v4/reference/core/ProtocolFees.md), [NoDelegateCall](contracts/v4/reference/core/NoDelegateCall.md), [ERC6909Claims](contracts/v4/reference/core/ERC6909Claims.md), [Extsload](contracts/v4/reference/core/Extsload.md), [Exttload](contracts/v4/reference/core/Exttload.md) @@ -42,7 +41,7 @@ address internal immutable _delegateManager; ```solidity -constructor(address delegateManager); +constructor(address delegateManager) ProtocolFees(msg.sender); ``` ### onlyWhenUnlocked @@ -86,10 +85,7 @@ Initialize the state for a given pool ID ```solidity -function initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hookData) - external - noDelegateCall - returns (int24 tick); +function initialize(PoolKey memory key, uint160 sqrtPriceX96) external noDelegateCall returns (int24 tick); ``` **Parameters** @@ -97,7 +93,6 @@ function initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hoo |----|----|-----------| |`key`|`PoolKey`|The pool key for the pool to initialize| |`sqrtPriceX96`|`uint160`|The initial square root price| -|`hookData`|`bytes`|The data to pass through to the initialize hooks| **Returns** @@ -217,7 +212,7 @@ function sync(Currency currency) public; Called by the user to net out some value owed to the user -*Can also be used as a mechanism for _free_ flash loans* +*Will revert if the requested amount is not available, consider using `mint` instead* ```solidity diff --git a/docs/contracts/v4/reference/core/test/SkipCallsTestHook.md b/docs/contracts/v4/reference/core/test/SkipCallsTestHook.md index 7bc7eb18c..25f641476 100644 --- a/docs/contracts/v4/reference/core/test/SkipCallsTestHook.md +++ b/docs/contracts/v4/reference/core/test/SkipCallsTestHook.md @@ -1,6 +1,5 @@ # SkipCallsTestHook -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/SkipCallsTestHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/SkipCallsTestHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [BaseTestHooks](contracts/v4/reference/core/test/BaseTestHooks.md), Test @@ -33,17 +32,14 @@ function setManager(IPoolManager _manager) external; ```solidity -function beforeInitialize(address, PoolKey calldata key, uint160 sqrtPriceX96, bytes calldata hookData) - external - override - returns (bytes4); +function beforeInitialize(address, PoolKey calldata key, uint160 sqrtPriceX96) external override returns (bytes4); ``` ### afterInitialize ```solidity -function afterInitialize(address, PoolKey calldata key, uint160 sqrtPriceX96, int24, bytes calldata hookData) +function afterInitialize(address, PoolKey calldata key, uint160 sqrtPriceX96, int24) external override returns (bytes4); @@ -148,7 +144,7 @@ function afterDonate(address, PoolKey calldata key, uint256 amt0, uint256 amt1, ```solidity -function _initialize(PoolKey memory key, uint160 sqrtPriceX96, bytes calldata hookData) public; +function _initialize(PoolKey memory key, uint160 sqrtPriceX96) public; ``` ### _swap diff --git a/docs/contracts/v4/reference/core/test/SqrtPriceMathEchidnaTest.md b/docs/contracts/v4/reference/core/test/SqrtPriceMathEchidnaTest.md index 2cfe2cc5d..43ade74ce 100644 --- a/docs/contracts/v4/reference/core/test/SqrtPriceMathEchidnaTest.md +++ b/docs/contracts/v4/reference/core/test/SqrtPriceMathEchidnaTest.md @@ -1,6 +1,5 @@ # SqrtPriceMathEchidnaTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/SqrtPriceMathEchidnaTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/SqrtPriceMathEchidnaTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/SwapRouterNoChecks.md b/docs/contracts/v4/reference/core/test/SwapRouterNoChecks.md index 71492fe1d..d15f52e68 100644 --- a/docs/contracts/v4/reference/core/test/SwapRouterNoChecks.md +++ b/docs/contracts/v4/reference/core/test/SwapRouterNoChecks.md @@ -1,6 +1,5 @@ # SwapRouterNoChecks -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/SwapRouterNoChecks.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/SwapRouterNoChecks.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [PoolTestBase](contracts/v4/reference/core/test/PoolTestBase.md) diff --git a/docs/contracts/v4/reference/core/test/TestERC20.md b/docs/contracts/v4/reference/core/test/TestERC20.md index ab11fad9b..1c923ea38 100644 --- a/docs/contracts/v4/reference/core/test/TestERC20.md +++ b/docs/contracts/v4/reference/core/test/TestERC20.md @@ -1,6 +1,5 @@ # TestERC20 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/TestERC20.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/TestERC20.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IERC20Minimal](contracts/v4/reference/core/interfaces/IERC20Minimal.md) diff --git a/docs/contracts/v4/reference/core/test/TestInvalidERC20.md b/docs/contracts/v4/reference/core/test/TestInvalidERC20.md index 2806696ee..7961429ad 100644 --- a/docs/contracts/v4/reference/core/test/TestInvalidERC20.md +++ b/docs/contracts/v4/reference/core/test/TestInvalidERC20.md @@ -1,6 +1,5 @@ # TestInvalidERC20 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/TestInvalidERC20.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/TestInvalidERC20.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IERC20Minimal](contracts/v4/reference/core/interfaces/IERC20Minimal.md) diff --git a/docs/contracts/v4/reference/core/test/TickMathEchidnaTest.md b/docs/contracts/v4/reference/core/test/TickMathEchidnaTest.md index c8a82b170..c711f44ad 100644 --- a/docs/contracts/v4/reference/core/test/TickMathEchidnaTest.md +++ b/docs/contracts/v4/reference/core/test/TickMathEchidnaTest.md @@ -1,6 +1,5 @@ # TickMathEchidnaTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/TickMathEchidnaTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/TickMathEchidnaTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/TickMathTest.md b/docs/contracts/v4/reference/core/test/TickMathTest.md index 125d626fa..3fea9bc35 100644 --- a/docs/contracts/v4/reference/core/test/TickMathTest.md +++ b/docs/contracts/v4/reference/core/test/TickMathTest.md @@ -1,6 +1,5 @@ # TickMathTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/TickMathTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/TickMathTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/core/test/TickOverflowSafetyEchidnaTest.md b/docs/contracts/v4/reference/core/test/TickOverflowSafetyEchidnaTest.md index 94994b341..14bef07ef 100644 --- a/docs/contracts/v4/reference/core/test/TickOverflowSafetyEchidnaTest.md +++ b/docs/contracts/v4/reference/core/test/TickOverflowSafetyEchidnaTest.md @@ -1,6 +1,5 @@ # TickOverflowSafetyEchidnaTest -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/test/TickOverflowSafetyEchidnaTest.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/test/TickOverflowSafetyEchidnaTest.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## State Variables diff --git a/docs/contracts/v4/reference/core/types/PoolId.md b/docs/contracts/v4/reference/core/types/PoolId.md index 75802b558..844f1586e 100644 --- a/docs/contracts/v4/reference/core/types/PoolId.md +++ b/docs/contracts/v4/reference/core/types/PoolId.md @@ -1,6 +1,5 @@ # PoolId -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/types/PoolId.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/types/PoolId.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ```solidity diff --git a/docs/contracts/v4/reference/core/types/Slot0.md b/docs/contracts/v4/reference/core/types/Slot0.md index 0ad18c3b8..383f019b3 100644 --- a/docs/contracts/v4/reference/core/types/Slot0.md +++ b/docs/contracts/v4/reference/core/types/Slot0.md @@ -1,6 +1,5 @@ # Slot0 -[Git Source](https://github.com/Uniswap/v4-core/blob/1141642f8ba4665a50660886a8a8401526677045/src/types/Slot0.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-core/blob/b619b6718e31aa5b4fa0286520c455ceb950276d/src/types/Slot0.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) *Slot0 is a packed version of solidity structure. Using the packaged version saves gas by not storing the structure fields in memory slots. diff --git a/docs/contracts/v4/reference/periphery/PositionDescriptor.md b/docs/contracts/v4/reference/periphery/PositionDescriptor.md new file mode 100644 index 000000000..e41a18eed --- /dev/null +++ b/docs/contracts/v4/reference/periphery/PositionDescriptor.md @@ -0,0 +1,149 @@ +# PositionDescriptor +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/PositionDescriptor.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +[IPositionDescriptor](contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md) + +Produces a string containing the data URI for a JSON metadata string + + +## State Variables +### DAI + +```solidity +address private constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F; +``` + + +### USDC + +```solidity +address private constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; +``` + + +### USDT + +```solidity +address private constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7; +``` + + +### TBTC + +```solidity +address private constant TBTC = 0x8dAEBADE922dF735c38C80C7eBD708Af50815fAa; +``` + + +### WBTC + +```solidity +address private constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599; +``` + + +### wrappedNative + +```solidity +address public immutable wrappedNative; +``` + + +### nativeCurrencyLabel + +```solidity +string public nativeCurrencyLabel; +``` + + +### poolManager + +```solidity +IPoolManager public immutable poolManager; +``` + + +## Functions +### constructor + + +```solidity +constructor(IPoolManager _poolManager, address _wrappedNative, string memory _nativeCurrencyLabel); +``` + +### tokenURI + +Produces the URI describing a particular token ID + +*Note this URI may be a data: URI with the JSON contents directly inlined* + + +```solidity +function tokenURI(IPositionManager positionManager, uint256 tokenId) external view override returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`positionManager`|`IPositionManager`|The position manager for which to describe the token| +|`tokenId`|`uint256`|The ID of the token for which to produce a description, which may not be valid| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The URI of the ERC721-compliant metadata| + + +### flipRatio + +Returns true if currency0 has higher priority than currency1 + + +```solidity +function flipRatio(address currency0, address currency1) public view returns (bool); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currency0`|`address`|The first currency address| +|`currency1`|`address`|The second currency address| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bool`|flipRatio True if currency0 has higher priority than currency1| + + +### currencyRatioPriority + +Returns the priority of a currency. +For certain currencies on mainnet, the smaller the currency, the higher the priority + + +```solidity +function currencyRatioPriority(address currency) public view returns (int256); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currency`|`address`|The currency address| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`int256`|priority The priority of the currency| + + +## Errors +### InvalidTokenId + +```solidity +error InvalidTokenId(uint256 tokenId); +``` + diff --git a/docs/contracts/v4/reference/periphery/PositionManager.md b/docs/contracts/v4/reference/periphery/PositionManager.md index 930bb5413..85cc0372c 100644 --- a/docs/contracts/v4/reference/periphery/PositionManager.md +++ b/docs/contracts/v4/reference/periphery/PositionManager.md @@ -1,9 +1,8 @@ # PositionManager -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/PositionManager.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/PositionManager.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** -[IPositionManager](contracts/v4/reference/periphery/interfaces/IPositionManager.md), [ERC721Permit_v4](contracts/v4/reference/periphery/base/ERC721Permit_v4.md), [PoolInitializer](contracts/v4/reference/periphery/base/PoolInitializer.md), [Multicall_v4](contracts/v4/reference/periphery/base/Multicall_v4.md), [DeltaResolver](contracts/v4/reference/periphery/base/DeltaResolver.md), [ReentrancyLock](contracts/v4/reference/periphery/base/ReentrancyLock.md), [BaseActionsRouter](contracts/v4/reference/periphery/base/BaseActionsRouter.md), [Notifier](contracts/v4/reference/periphery/base/Notifier.md), [Permit2Forwarder](contracts/v4/reference/periphery/base/Permit2Forwarder.md) +[IPositionManager](contracts/v4/reference/periphery/interfaces/IPositionManager.md), [ERC721Permit_v4](contracts/v4/reference/periphery/base/ERC721Permit_v4.md), [PoolInitializer](contracts/v4/reference/periphery/base/PoolInitializer.md), [Multicall_v4](contracts/v4/reference/periphery/base/Multicall_v4.md), [DeltaResolver](contracts/v4/reference/periphery/base/DeltaResolver.md), [ReentrancyLock](contracts/v4/reference/periphery/base/ReentrancyLock.md), [BaseActionsRouter](contracts/v4/reference/periphery/base/BaseActionsRouter.md), [Notifier](contracts/v4/reference/periphery/base/Notifier.md), [Permit2Forwarder](contracts/v4/reference/periphery/base/Permit2Forwarder.md), [NativeWrapper](contracts/v4/reference/periphery/base/NativeWrapper.md) The PositionManager (PosM) contract is responsible for creating liquidity positions on v4. PosM mints and manages ERC721 tokens associated with each position. @@ -21,6 +20,13 @@ uint256 public nextTokenId = 1; ``` +### tokenDescriptor + +```solidity +IPositionDescriptor public immutable tokenDescriptor; +``` + + ### positionInfo ```solidity @@ -40,11 +46,18 @@ mapping(bytes25 poolId => PoolKey poolKey) public poolKeys; ```solidity -constructor(IPoolManager _poolManager, IAllowanceTransfer _permit2, uint256 _unsubscribeGasLimit) +constructor( + IPoolManager _poolManager, + IAllowanceTransfer _permit2, + uint256 _unsubscribeGasLimit, + IPositionDescriptor _tokenDescriptor, + IWETH9 _weth9 +) BaseActionsRouter(_poolManager) Permit2Forwarder(_permit2) - ERC721Permit_v4("Uniswap V4 Positions NFT", "UNI-V4-POSM") - Notifier(_unsubscribeGasLimit); + ERC721Permit_v4("Uniswap v4 Positions NFT", "UNI-V4-POSM") + Notifier(_unsubscribeGasLimit) + NativeWrapper(_weth9); ``` ### checkDeadline @@ -81,6 +94,22 @@ modifier onlyIfApproved(address caller, uint256 tokenId) override; |`tokenId`|`uint256`|the unique identifier of the ERC721 token| +### onlyIfPoolManagerLocked + +Enforces that the PoolManager is locked. + + +```solidity +modifier onlyIfPoolManagerLocked() override; +``` + +### tokenURI + + +```solidity +function tokenURI(uint256 tokenId) public view override returns (string memory); +``` + ### modifyLiquidities Unlocks Uniswap v4 PoolManager and batches actions for modifying liquidity @@ -273,9 +302,11 @@ function _setUnsubscribed(uint256 tokenId) internal override; *overrides solmate transferFrom in case a notification to subscribers is needed* +*will revert if pool manager is locked* + ```solidity -function transferFrom(address from, address to, uint256 id) public virtual override; +function transferFrom(address from, address to, uint256 id) public virtual override onlyIfPoolManagerLocked; ``` ### getPoolAndPositionInfo diff --git a/docs/contracts/v4/reference/periphery/UniswapV4DeployerCompetition.md b/docs/contracts/v4/reference/periphery/UniswapV4DeployerCompetition.md new file mode 100644 index 000000000..b3f60bdad --- /dev/null +++ b/docs/contracts/v4/reference/periphery/UniswapV4DeployerCompetition.md @@ -0,0 +1,122 @@ +# UniswapV4DeployerCompetition +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/UniswapV4DeployerCompetition.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +[IUniswapV4DeployerCompetition](contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md) + +A contract to crowdsource a salt for the best Uniswap V4 address + + +## State Variables +### bestAddressSalt +*The salt for the best address found so far* + + +```solidity +bytes32 public bestAddressSalt; +``` + + +### bestAddressSubmitter +*The submitter of the best address found so far* + + +```solidity +address public bestAddressSubmitter; +``` + + +### competitionDeadline +*The deadline for the competition* + + +```solidity +uint256 public immutable competitionDeadline; +``` + + +### initCodeHash +*The init code hash of the V4 contract* + + +```solidity +bytes32 public immutable initCodeHash; +``` + + +### deployer +*The deployer who can initiate the deployment of the v4 PoolManager, until the exclusive deploy deadline.* + +*After this deadline anyone can deploy.* + + +```solidity +address public immutable deployer; +``` + + +### exclusiveDeployDeadline +*The deadline for exclusive deployment by deployer after deadline* + + +```solidity +uint256 public immutable exclusiveDeployDeadline; +``` + + +## Functions +### constructor + + +```solidity +constructor( + bytes32 _initCodeHash, + uint256 _competitionDeadline, + address _exclusiveDeployer, + uint256 _exclusiveDeployLength +); +``` + +### updateBestAddress + +Updates the best address if the new address has a better vanity score + +*The first 20 bytes of the salt must be either address(0) or msg.sender* + + +```solidity +function updateBestAddress(bytes32 salt) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`salt`|`bytes32`|The salt to use to compute the new address with CREATE2| + + +### deploy + +deploys the Uniswap v4 PoolManager contract + +*The bytecode must match the initCodeHash* + + +```solidity +function deploy(bytes memory bytecode) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`bytecode`|`bytes`|The bytecode of the Uniswap v4 PoolManager contract| + + +### bestAddress + +*returns the best address found so far* + + +```solidity +function bestAddress() public view returns (address); +``` + diff --git a/docs/contracts/v4/reference/periphery/V4Router.md b/docs/contracts/v4/reference/periphery/V4Router.md index 6f660622f..16d1464e5 100644 --- a/docs/contracts/v4/reference/periphery/V4Router.md +++ b/docs/contracts/v4/reference/periphery/V4Router.md @@ -1,11 +1,10 @@ # V4Router -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/V4Router.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/V4Router.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IV4Router](contracts/v4/reference/periphery/interfaces/IV4Router.md), [BaseActionsRouter](contracts/v4/reference/periphery/base/BaseActionsRouter.md), [DeltaResolver](contracts/v4/reference/periphery/base/DeltaResolver.md) -Abstract contract that contains all internal logic needed for routing through Uniswap V4 pools +Abstract contract that contains all internal logic needed for routing through Uniswap v4 pools *the entry point to executing actions in this contract is calling `BaseActionsRouter._executeActions` An inheriting contract should call _executeActions at the point that they wish actions to be executed* @@ -58,12 +57,8 @@ function _swapExactOutput(IV4Router.ExactOutputParams calldata params) private; ```solidity -function _swap( - PoolKey memory poolKey, - bool zeroForOne, - int256 amountSpecified, - uint160 sqrtPriceLimitX96, - bytes calldata hookData -) private returns (int128 reciprocalAmount); +function _swap(PoolKey memory poolKey, bool zeroForOne, int256 amountSpecified, bytes calldata hookData) + private + returns (int128 reciprocalAmount); ``` diff --git a/docs/contracts/v4/reference/periphery/base/BaseActionsRouter.md b/docs/contracts/v4/reference/periphery/base/BaseActionsRouter.md index b62d9e0d0..8e2e220f9 100644 --- a/docs/contracts/v4/reference/periphery/base/BaseActionsRouter.md +++ b/docs/contracts/v4/reference/periphery/base/BaseActionsRouter.md @@ -1,6 +1,5 @@ # BaseActionsRouter -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/BaseActionsRouter.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/BaseActionsRouter.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [SafeCallback](contracts/v4/reference/periphery/base/SafeCallback.md) diff --git a/docs/contracts/v4/reference/periphery/base/BaseHook.md b/docs/contracts/v4/reference/periphery/base/BaseHook.md index 807a727d6..cee0f211c 100644 --- a/docs/contracts/v4/reference/periphery/base/BaseHook.md +++ b/docs/contracts/v4/reference/periphery/base/BaseHook.md @@ -1,6 +1,5 @@ # BaseHook -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/hooks/BaseHook.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/hooks/BaseHook.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** IHooks, [SafeCallback](contracts/v4/reference/periphery/base/SafeCallback.md) @@ -71,7 +70,7 @@ The hook called before the state of a pool is initialized ```solidity -function beforeInitialize(address, PoolKey calldata, uint160, bytes calldata) external virtual returns (bytes4); +function beforeInitialize(address, PoolKey calldata, uint160) external virtual returns (bytes4); ``` **Parameters** @@ -80,7 +79,6 @@ function beforeInitialize(address, PoolKey calldata, uint160, bytes calldata) ex |``|`address`|| |``|`PoolKey`|| |``|`uint160`|| -|``|`bytes`|| **Returns** @@ -95,7 +93,7 @@ The hook called after the state of a pool is initialized ```solidity -function afterInitialize(address, PoolKey calldata, uint160, int24, bytes calldata) external virtual returns (bytes4); +function afterInitialize(address, PoolKey calldata, uint160, int24) external virtual returns (bytes4); ``` **Parameters** @@ -105,7 +103,6 @@ function afterInitialize(address, PoolKey calldata, uint160, int24, bytes callda |``|`PoolKey`|| |``|`uint160`|| |``|`int24`|| -|``|`bytes`|| **Returns** diff --git a/docs/contracts/v4/reference/periphery/base/BaseV4Quoter.md b/docs/contracts/v4/reference/periphery/base/BaseV4Quoter.md index 19fc5ab59..5f209f8a6 100644 --- a/docs/contracts/v4/reference/periphery/base/BaseV4Quoter.md +++ b/docs/contracts/v4/reference/periphery/base/BaseV4Quoter.md @@ -1,6 +1,5 @@ # BaseV4Quoter -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/BaseV4Quoter.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/BaseV4Quoter.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [SafeCallback](contracts/v4/reference/periphery/base/SafeCallback.md) diff --git a/docs/contracts/v4/reference/periphery/base/DeltaResolver.md b/docs/contracts/v4/reference/periphery/base/DeltaResolver.md index 13f3a80ff..6138f6d54 100644 --- a/docs/contracts/v4/reference/periphery/base/DeltaResolver.md +++ b/docs/contracts/v4/reference/periphery/base/DeltaResolver.md @@ -1,6 +1,5 @@ # DeltaResolver -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/DeltaResolver.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/DeltaResolver.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ImmutableState](contracts/v4/reference/periphery/base/ImmutableState.md) @@ -15,6 +14,8 @@ Abstract contract used to sync, send, and settle funds to the pool manager Take an amount of currency out of the PoolManager +*Returns early if the amount is 0* + ```solidity function _take(Currency currency, address recipient, uint256 amount) internal; @@ -34,6 +35,8 @@ Pay and settle a currency to the PoolManager *The implementing contract must ensure that the `payer` is a secure address* +*Returns early if the amount is 0* + ```solidity function _settle(Currency currency, address payer, uint256 amount) internal; @@ -126,6 +129,26 @@ Calculates the amount for a take action function _mapTakeAmount(uint256 amount, Currency currency) internal view returns (uint256); ``` +### _mapWrapUnwrapAmount + +Calculates the sanitized amount before wrapping/unwrapping. + + +```solidity +function _mapWrapUnwrapAmount(Currency inputCurrency, uint256 amount, Currency outputCurrency) + internal + view + returns (uint256); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`inputCurrency`|`Currency`|The currency, either native or wrapped native, that this contract holds| +|`amount`|`uint256`|The amount to wrap or unwrap. Can be CONTRACT_BALANCE, OPEN_DELTA or a specific amount| +|`outputCurrency`|`Currency`|The currency after the wrap/unwrap that the user may owe a balance in on the poolManager| + + ## Errors ### DeltaNotPositive Emitted trying to settle a positive delta. @@ -143,3 +166,11 @@ Emitted trying to take a negative delta. error DeltaNotNegative(Currency currency); ``` +### InsufficientBalance +Emitted when the contract does not have enough balance to wrap or unwrap. + + +```solidity +error InsufficientBalance(); +``` + diff --git a/docs/contracts/v4/reference/periphery/base/EIP712_v4.md b/docs/contracts/v4/reference/periphery/base/EIP712_v4.md index c6e7d86cc..6e6748bf1 100644 --- a/docs/contracts/v4/reference/periphery/base/EIP712_v4.md +++ b/docs/contracts/v4/reference/periphery/base/EIP712_v4.md @@ -1,6 +1,5 @@ # EIP712_v4 -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/EIP712_v4.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/EIP712_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IEIP712_v4](contracts/v4/reference/periphery/interfaces/IEIP712_v4.md) diff --git a/docs/contracts/v4/reference/periphery/base/ERC721Permit_v4.md b/docs/contracts/v4/reference/periphery/base/ERC721Permit_v4.md index f164a7986..d82aa5e8a 100644 --- a/docs/contracts/v4/reference/periphery/base/ERC721Permit_v4.md +++ b/docs/contracts/v4/reference/periphery/base/ERC721Permit_v4.md @@ -1,6 +1,5 @@ # ERC721Permit_v4 -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/ERC721Permit_v4.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/ERC721Permit_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** ERC721, [IERC721Permit_v4](contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md), [EIP712_v4](contracts/v4/reference/periphery/base/EIP712_v4.md), [UnorderedNonce](contracts/v4/reference/periphery/base/UnorderedNonce.md) @@ -144,10 +143,3 @@ function _approve(address owner, address spender, uint256 id) internal; function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool); ``` -### tokenURI - - -```solidity -function tokenURI(uint256) public pure override returns (string memory); -``` - diff --git a/docs/contracts/v4/reference/periphery/base/ImmutableState.md b/docs/contracts/v4/reference/periphery/base/ImmutableState.md index 237bf3816..00f002714 100644 --- a/docs/contracts/v4/reference/periphery/base/ImmutableState.md +++ b/docs/contracts/v4/reference/periphery/base/ImmutableState.md @@ -1,6 +1,8 @@ # ImmutableState -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/ImmutableState.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/ImmutableState.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +[IImmutableState](contracts/v4/reference/periphery/interfaces/IImmutableState.md) A collection of immutable state variables, commonly used across multiple contracts diff --git a/docs/contracts/v4/reference/periphery/base/Multicall_v4.md b/docs/contracts/v4/reference/periphery/base/Multicall_v4.md index b271c7c01..61625ecdc 100644 --- a/docs/contracts/v4/reference/periphery/base/Multicall_v4.md +++ b/docs/contracts/v4/reference/periphery/base/Multicall_v4.md @@ -1,6 +1,5 @@ # Multicall_v4 -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/Multicall_v4.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/Multicall_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IMulticall_v4](contracts/v4/reference/periphery/interfaces/IMulticall_v4.md) diff --git a/docs/contracts/v4/reference/periphery/base/NativeWrapper.md b/docs/contracts/v4/reference/periphery/base/NativeWrapper.md new file mode 100644 index 000000000..c97b5c7df --- /dev/null +++ b/docs/contracts/v4/reference/periphery/base/NativeWrapper.md @@ -0,0 +1,61 @@ +# NativeWrapper +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/NativeWrapper.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +[ImmutableState](contracts/v4/reference/periphery/base/ImmutableState.md) + +Used for wrapping and unwrapping native + + +## State Variables +### WETH9 +The address for WETH9 + + +```solidity +IWETH9 public immutable WETH9; +``` + + +## Functions +### constructor + + +```solidity +constructor(IWETH9 _weth9); +``` + +### _wrap + +*The amount should already be <= the current balance in this contract.* + + +```solidity +function _wrap(uint256 amount) internal; +``` + +### _unwrap + +*The amount should already be <= the current balance in this contract.* + + +```solidity +function _unwrap(uint256 amount) internal; +``` + +### receive + + +```solidity +receive() external payable; +``` + +## Errors +### InvalidEthSender +Thrown when an unexpected address sends ETH to this contract + + +```solidity +error InvalidEthSender(); +``` + diff --git a/docs/contracts/v4/reference/periphery/base/Notifier.md b/docs/contracts/v4/reference/periphery/base/Notifier.md index 4ae9c0e0d..787b9a04e 100644 --- a/docs/contracts/v4/reference/periphery/base/Notifier.md +++ b/docs/contracts/v4/reference/periphery/base/Notifier.md @@ -1,6 +1,5 @@ # Notifier -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/Notifier.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/Notifier.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [INotifier](contracts/v4/reference/periphery/interfaces/INotifier.md) @@ -60,6 +59,15 @@ modifier onlyIfApproved(address caller, uint256 tokenId) virtual; |`tokenId`|`uint256`|the tokenId of the position| +### onlyIfPoolManagerLocked + +Enforces that the PoolManager is locked. + + +```solidity +modifier onlyIfPoolManagerLocked() virtual; +``` + ### _setUnsubscribed @@ -85,6 +93,7 @@ Enables the subscriber to receive notifications for a respective position function subscribe(uint256 tokenId, address newSubscriber, bytes calldata data) external payable + onlyIfPoolManagerLocked onlyIfApproved(msg.sender, tokenId); ``` **Parameters** @@ -104,7 +113,7 @@ Removes the subscriber from receiving notifications for a respective position ```solidity -function unsubscribe(uint256 tokenId) external payable onlyIfApproved(msg.sender, tokenId); +function unsubscribe(uint256 tokenId) external payable onlyIfPoolManagerLocked onlyIfApproved(msg.sender, tokenId); ``` **Parameters** diff --git a/docs/contracts/v4/reference/periphery/base/Permit2Forwarder.md b/docs/contracts/v4/reference/periphery/base/Permit2Forwarder.md index 4f6619e6e..2be890f00 100644 --- a/docs/contracts/v4/reference/periphery/base/Permit2Forwarder.md +++ b/docs/contracts/v4/reference/periphery/base/Permit2Forwarder.md @@ -1,6 +1,5 @@ # Permit2Forwarder -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/Permit2Forwarder.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/Permit2Forwarder.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) PermitForwarder allows permitting this contract as a spender on permit2 diff --git a/docs/contracts/v4/reference/periphery/base/PoolInitializer.md b/docs/contracts/v4/reference/periphery/base/PoolInitializer.md index 8539df017..9a28f5fa4 100644 --- a/docs/contracts/v4/reference/periphery/base/PoolInitializer.md +++ b/docs/contracts/v4/reference/periphery/base/PoolInitializer.md @@ -1,6 +1,5 @@ # PoolInitializer -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/PoolInitializer.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/PoolInitializer.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ImmutableState](contracts/v4/reference/periphery/base/ImmutableState.md) @@ -17,10 +16,7 @@ Initialize a Uniswap v4 Pool ```solidity -function initializePool(PoolKey calldata key, uint160 sqrtPriceX96, bytes calldata hookData) - external - payable - returns (int24); +function initializePool(PoolKey calldata key, uint160 sqrtPriceX96) external payable returns (int24); ``` **Parameters** @@ -28,6 +24,5 @@ function initializePool(PoolKey calldata key, uint160 sqrtPriceX96, bytes callda |----|----|-----------| |`key`|`PoolKey`|the PoolKey of the pool to initialize| |`sqrtPriceX96`|`uint160`|the initial sqrtPriceX96 of the pool| -|`hookData`|`bytes`|the optional data passed to the hook's initialize functions| diff --git a/docs/contracts/v4/reference/periphery/base/ReentrancyLock.md b/docs/contracts/v4/reference/periphery/base/ReentrancyLock.md index f482528dd..ce94a6051 100644 --- a/docs/contracts/v4/reference/periphery/base/ReentrancyLock.md +++ b/docs/contracts/v4/reference/periphery/base/ReentrancyLock.md @@ -1,6 +1,5 @@ # ReentrancyLock -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/ReentrancyLock.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/ReentrancyLock.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) A transient reentrancy lock, that stores the caller's address as the lock diff --git a/docs/contracts/v4/reference/periphery/base/SafeCallback.md b/docs/contracts/v4/reference/periphery/base/SafeCallback.md index b43628eb8..744a26874 100644 --- a/docs/contracts/v4/reference/periphery/base/SafeCallback.md +++ b/docs/contracts/v4/reference/periphery/base/SafeCallback.md @@ -1,6 +1,5 @@ # SafeCallback -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/SafeCallback.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/SafeCallback.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ImmutableState](contracts/v4/reference/periphery/base/ImmutableState.md), IUnlockCallback diff --git a/docs/contracts/v4/reference/periphery/base/UnorderedNonce.md b/docs/contracts/v4/reference/periphery/base/UnorderedNonce.md index 29065b666..6c3ef1e39 100644 --- a/docs/contracts/v4/reference/periphery/base/UnorderedNonce.md +++ b/docs/contracts/v4/reference/periphery/base/UnorderedNonce.md @@ -1,6 +1,5 @@ # UnorderedNonce -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/base/UnorderedNonce.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/base/UnorderedNonce.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Contract state and methods for using unordered nonces in signatures diff --git a/docs/contracts/v4/reference/periphery/interfaces/IEIP712_v4.md b/docs/contracts/v4/reference/periphery/interfaces/IEIP712_v4.md index d4ced84bc..a952f9023 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IEIP712_v4.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IEIP712_v4.md @@ -1,6 +1,5 @@ # IEIP712_v4 -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IEIP712_v4.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IEIP712_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) This interface is used for an EIP712 implementation diff --git a/docs/contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md b/docs/contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md index c2a7ac4e8..daf245ea2 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IERC721Permit_v4.md @@ -1,6 +1,5 @@ # IERC721Permit_v4 -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IERC721Permit_v4.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IERC721Permit_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Extension to ERC721 that includes a permit function for signature based approvals diff --git a/docs/contracts/v4/reference/periphery/interfaces/IImmutableState.md b/docs/contracts/v4/reference/periphery/interfaces/IImmutableState.md new file mode 100644 index 000000000..1bf4160bb --- /dev/null +++ b/docs/contracts/v4/reference/periphery/interfaces/IImmutableState.md @@ -0,0 +1,14 @@ +# IImmutableState +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IImmutableState.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + + +## Functions +### poolManager + +The Uniswap v4 PoolManager contract + + +```solidity +function poolManager() external view returns (IPoolManager); +``` + diff --git a/docs/contracts/v4/reference/periphery/interfaces/IMulticall_v4.md b/docs/contracts/v4/reference/periphery/interfaces/IMulticall_v4.md index d29f0ea54..cc7151a03 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IMulticall_v4.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IMulticall_v4.md @@ -1,6 +1,5 @@ # IMulticall_v4 -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IMulticall_v4.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IMulticall_v4.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Enables calling multiple methods in a single call to the contract diff --git a/docs/contracts/v4/reference/periphery/interfaces/INotifier.md b/docs/contracts/v4/reference/periphery/interfaces/INotifier.md index a0d0617c4..334987594 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/INotifier.md +++ b/docs/contracts/v4/reference/periphery/interfaces/INotifier.md @@ -1,6 +1,5 @@ # INotifier -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/INotifier.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/INotifier.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) This interface is used to opt in to sending updates to external contracts about position modifications or transfers @@ -35,6 +34,8 @@ Enables the subscriber to receive notifications for a respective position *payable so it can be multicalled with NATIVE related actions* +*will revert if pool manager is locked* + ```solidity function subscribe(uint256 tokenId, address newSubscriber, bytes calldata data) external payable; @@ -58,6 +59,8 @@ Removes the subscriber from receiving notifications for a respective position *Must always allow a user to unsubscribe. In the case of a malicious subscriber, a user can always unsubscribe safely, ensuring liquidity is always modifiable.* +*will revert if pool manager is locked* + ```solidity function unsubscribe(uint256 tokenId) external payable; @@ -126,28 +129,28 @@ Thrown when a user specifies a gas limit too low to avoid valid unsubscribe noti error GasLimitTooLow(); ``` -### Wrap__SubscriptionReverted +### SubscriptionReverted Wraps the revert message of the subscriber contract on a reverting subscription ```solidity -error Wrap__SubscriptionReverted(address subscriber, bytes reason); +error SubscriptionReverted(address subscriber, bytes reason); ``` -### Wrap__ModifyLiquidityNotificationReverted +### ModifyLiquidityNotificationReverted Wraps the revert message of the subscriber contract on a reverting modify liquidity notification ```solidity -error Wrap__ModifyLiquidityNotificationReverted(address subscriber, bytes reason); +error ModifyLiquidityNotificationReverted(address subscriber, bytes reason); ``` -### Wrap__TransferNotificationReverted +### TransferNotificationReverted Wraps the revert message of the subscriber contract on a reverting transfer notification ```solidity -error Wrap__TransferNotificationReverted(address subscriber, bytes reason); +error TransferNotificationReverted(address subscriber, bytes reason); ``` ### AlreadySubscribed diff --git a/docs/contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md b/docs/contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md new file mode 100644 index 000000000..c4a0f83c4 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/interfaces/IPositionDescriptor.md @@ -0,0 +1,29 @@ +# IPositionDescriptor +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IPositionDescriptor.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + + +## Functions +### tokenURI + +Produces the URI describing a particular token ID + +*Note this URI may be a data: URI with the JSON contents directly inlined* + + +```solidity +function tokenURI(IPositionManager positionManager, uint256 tokenId) external view returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`positionManager`|`IPositionManager`|The position manager for which to describe the token| +|`tokenId`|`uint256`|The ID of the token for which to produce a description, which may not be valid| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The URI of the ERC721-compliant metadata| + + diff --git a/docs/contracts/v4/reference/periphery/interfaces/IPositionManager.md b/docs/contracts/v4/reference/periphery/interfaces/IPositionManager.md index 03643f6b5..a57a35296 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IPositionManager.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IPositionManager.md @@ -1,9 +1,8 @@ # IPositionManager -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IPositionManager.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IPositionManager.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** -[INotifier](contracts/v4/reference/periphery/interfaces/INotifier.md) +[INotifier](contracts/v4/reference/periphery/interfaces/INotifier.md), [IImmutableState](contracts/v4/reference/periphery/interfaces/IImmutableState.md) Interface for the PositionManager contract @@ -118,3 +117,13 @@ Thrown when the block.timestamp exceeds the user-provided deadline error DeadlinePassed(uint256 deadline); ``` +### PoolManagerMustBeLocked +Thrown when calling transfer, subscribe, or unsubscribe when the PoolManager is unlocked. + +*This is to prevent hooks from being able to trigger notifications at the same time the position is being modified.* + + +```solidity +error PoolManagerMustBeLocked(); +``` + diff --git a/docs/contracts/v4/reference/periphery/interfaces/IQuoter.md b/docs/contracts/v4/reference/periphery/interfaces/IQuoter.md index 0de91e2b2..b824955d1 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IQuoter.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IQuoter.md @@ -1,6 +1,5 @@ # IQuoter -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IQuoter.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IQuoter.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Supports quoting the delta amounts for exact input or exact output swaps. diff --git a/docs/contracts/v4/reference/periphery/interfaces/ISubscriber.md b/docs/contracts/v4/reference/periphery/interfaces/ISubscriber.md index fd0ca8e00..1e1168a3f 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/ISubscriber.md +++ b/docs/contracts/v4/reference/periphery/interfaces/ISubscriber.md @@ -1,6 +1,5 @@ # ISubscriber -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/ISubscriber.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/ISubscriber.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Interface that a Subscriber contract should implement to receive updates from the v4 position manager diff --git a/docs/contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md b/docs/contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md new file mode 100644 index 000000000..5d028c7d3 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/interfaces/IUniswapV4DeployerCompetition.md @@ -0,0 +1,85 @@ +# IUniswapV4DeployerCompetition +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IUniswapV4DeployerCompetition.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +A competition to deploy the UniswapV4 contract with the best address + + +## Functions +### updateBestAddress + +Updates the best address if the new address has a better vanity score + +*The first 20 bytes of the salt must be either address(0) or msg.sender* + + +```solidity +function updateBestAddress(bytes32 salt) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`salt`|`bytes32`|The salt to use to compute the new address with CREATE2| + + +### deploy + +deploys the Uniswap v4 PoolManager contract + +*The bytecode must match the initCodeHash* + + +```solidity +function deploy(bytes memory bytecode) external; +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`bytecode`|`bytes`|The bytecode of the Uniswap v4 PoolManager contract| + + +## Events +### NewAddressFound + +```solidity +event NewAddressFound(address indexed bestAddress, address indexed submitter, uint256 score); +``` + +## Errors +### InvalidBytecode + +```solidity +error InvalidBytecode(); +``` + +### CompetitionNotOver + +```solidity +error CompetitionNotOver(uint256 currentTime, uint256 deadline); +``` + +### CompetitionOver + +```solidity +error CompetitionOver(uint256 currentTime, uint256 deadline); +``` + +### NotAllowedToDeploy + +```solidity +error NotAllowedToDeploy(address sender, address deployer); +``` + +### WorseAddress + +```solidity +error WorseAddress(address newAddress, address bestAddress, uint256 newScore, uint256 bestScore); +``` + +### InvalidSender + +```solidity +error InvalidSender(bytes32 salt, address sender); +``` + diff --git a/docs/contracts/v4/reference/periphery/interfaces/IV4Router.md b/docs/contracts/v4/reference/periphery/interfaces/IV4Router.md index a28a11ef0..26413f4e6 100644 --- a/docs/contracts/v4/reference/periphery/interfaces/IV4Router.md +++ b/docs/contracts/v4/reference/periphery/interfaces/IV4Router.md @@ -1,6 +1,8 @@ # IV4Router -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IV4Router.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/IV4Router.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +[IImmutableState](contracts/v4/reference/periphery/interfaces/IImmutableState.md) Interface containing all the structs and errors for different v4 swap types @@ -33,7 +35,6 @@ struct ExactInputSingleParams { bool zeroForOne; uint128 amountIn; uint128 amountOutMinimum; - uint160 sqrtPriceLimitX96; bytes hookData; } ``` @@ -61,7 +62,6 @@ struct ExactOutputSingleParams { bool zeroForOne; uint128 amountOut; uint128 amountInMaximum; - uint160 sqrtPriceLimitX96; bytes hookData; } ``` diff --git a/docs/contracts/v4/reference/periphery/interfaces/IWETH9.md b/docs/contracts/v4/reference/periphery/interfaces/IWETH9.md new file mode 100644 index 000000000..4687b897a --- /dev/null +++ b/docs/contracts/v4/reference/periphery/interfaces/IWETH9.md @@ -0,0 +1,26 @@ +# IWETH9 +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/interfaces/external/IWETH9.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +**Inherits:** +IERC20 + + +## Functions +### deposit + +Deposit ether to get wrapped ether + + +```solidity +function deposit() external payable; +``` + +### withdraw + +Withdraw wrapped ether to get ether + + +```solidity +function withdraw(uint256) external; +``` + diff --git a/docs/contracts/v4/reference/periphery/lens/Quoter.md b/docs/contracts/v4/reference/periphery/lens/Quoter.md index 878442a4a..e2c2ea943 100644 --- a/docs/contracts/v4/reference/periphery/lens/Quoter.md +++ b/docs/contracts/v4/reference/periphery/lens/Quoter.md @@ -1,6 +1,5 @@ # Quoter -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/lens/Quoter.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/lens/Quoter.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [IQuoter](contracts/v4/reference/periphery/interfaces/IQuoter.md), [BaseV4Quoter](contracts/v4/reference/periphery/base/BaseV4Quoter.md) diff --git a/docs/contracts/v4/reference/periphery/lens/StateView.md b/docs/contracts/v4/reference/periphery/lens/StateView.md index a3d1ba952..c6cf2163e 100644 --- a/docs/contracts/v4/reference/periphery/lens/StateView.md +++ b/docs/contracts/v4/reference/periphery/lens/StateView.md @@ -1,6 +1,5 @@ # StateView -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/lens/StateView.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/lens/StateView.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) **Inherits:** [ImmutableState](contracts/v4/reference/periphery/base/ImmutableState.md) diff --git a/docs/contracts/v4/reference/periphery/libraries/ActionConstants.md b/docs/contracts/v4/reference/periphery/libraries/ActionConstants.md index a48587bf9..488d67cd3 100644 --- a/docs/contracts/v4/reference/periphery/libraries/ActionConstants.md +++ b/docs/contracts/v4/reference/periphery/libraries/ActionConstants.md @@ -1,6 +1,5 @@ # ActionConstants -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/ActionConstants.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/ActionConstants.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Common constants used in actions diff --git a/docs/contracts/v4/reference/periphery/libraries/Actions.md b/docs/contracts/v4/reference/periphery/libraries/Actions.md index 1cb6d48ff..201ec9490 100644 --- a/docs/contracts/v4/reference/periphery/libraries/Actions.md +++ b/docs/contracts/v4/reference/periphery/libraries/Actions.md @@ -1,6 +1,5 @@ # Actions -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/Actions.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/Actions.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) Library to define different pool actions. @@ -148,17 +147,31 @@ uint256 constant SWEEP = 0x19; ``` +### WRAP + +```solidity +uint256 constant WRAP = 0x20; +``` + + +### UNWRAP + +```solidity +uint256 constant UNWRAP = 0x21; +``` + + ### MINT_6909 ```solidity -uint256 constant MINT_6909 = 0x20; +uint256 constant MINT_6909 = 0x22; ``` ### BURN_6909 ```solidity -uint256 constant BURN_6909 = 0x21; +uint256 constant BURN_6909 = 0x23; ``` diff --git a/docs/contracts/v4/reference/periphery/libraries/AddressStringUtil.md b/docs/contracts/v4/reference/periphery/libraries/AddressStringUtil.md new file mode 100644 index 000000000..c3579398c --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/AddressStringUtil.md @@ -0,0 +1,59 @@ +# AddressStringUtil +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/AddressStringUtil.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +provides utility functions for converting addresses to strings + +*Reference: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/AddressStringUtil.sol* + + +## Functions +### toAsciiString + +Converts an address to the uppercase hex string, extracting only len bytes (up to 20, multiple of 2) + + +```solidity +function toAsciiString(address addr, uint256 len) internal pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`addr`|`address`|the address to convert| +|`len`|`uint256`|the number of bytes to extract| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|the hex string| + + +### char + +Converts a value into is corresponding ASCII character for the hex representation + + +```solidity +function char(uint8 b) private pure returns (bytes1 c); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`b`|`uint8`|the value to convert| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`c`|`bytes1`|the ASCII character| + + +## Errors +### InvalidAddressLength + +```solidity +error InvalidAddressLength(uint256 len); +``` + diff --git a/docs/contracts/v4/reference/periphery/libraries/BipsLibrary.md b/docs/contracts/v4/reference/periphery/libraries/BipsLibrary.md new file mode 100644 index 000000000..15c898068 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/BipsLibrary.md @@ -0,0 +1,36 @@ +# BipsLibrary +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/BipsLibrary.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + + +## State Variables +### BPS_DENOMINATOR + +```solidity +uint256 internal constant BPS_DENOMINATOR = 10_000; +``` + + +## Functions +### calculatePortion + + +```solidity +function calculatePortion(uint256 amount, uint256 bips) internal pure returns (uint256); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`amount`|`uint256`|The total amount to calculate a percentage of| +|`bips`|`uint256`|The percentage to calculate, in bips| + + +## Errors +### InvalidBips +emitted when an invalid percentage is provided + + +```solidity +error InvalidBips(); +``` + diff --git a/docs/contracts/v4/reference/periphery/libraries/CalldataDecoder.md b/docs/contracts/v4/reference/periphery/libraries/CalldataDecoder.md index 4bba1d718..7dcd1eae9 100644 --- a/docs/contracts/v4/reference/periphery/libraries/CalldataDecoder.md +++ b/docs/contracts/v4/reference/periphery/libraries/CalldataDecoder.md @@ -1,6 +1,5 @@ # CalldataDecoder -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/CalldataDecoder.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/CalldataDecoder.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## State Variables @@ -199,6 +198,15 @@ function decodeCurrencyAddressAndUint256(bytes calldata params) function decodeCurrencyAndUint256(bytes calldata params) internal pure returns (Currency currency, uint256 amount); ``` +### decodeUint256 + +*equivalent to: abi.decode(params, (uint256)) in calldata* + + +```solidity +function decodeUint256(bytes calldata params) internal pure returns (uint256 amount); +``` + ### decodeCurrencyUint256AndBool *equivalent to: abi.decode(params, (Currency, uint256, bool)) in calldata* diff --git a/docs/contracts/v4/reference/periphery/libraries/CurrencyRatioSortOrder.md b/docs/contracts/v4/reference/periphery/libraries/CurrencyRatioSortOrder.md new file mode 100644 index 000000000..090d83c4c --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/CurrencyRatioSortOrder.md @@ -0,0 +1,52 @@ +# CurrencyRatioSortOrder +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/CurrencyRatioSortOrder.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Provides constants for sorting currencies when displaying price ratios +Currencies given larger values will be in the numerator of the price ratio + +*Reference: https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/TokenRatioSortOrder.sol* + + +## State Variables +### NUMERATOR_MOST + +```solidity +int256 constant NUMERATOR_MOST = 300; +``` + + +### NUMERATOR_MORE + +```solidity +int256 constant NUMERATOR_MORE = 200; +``` + + +### NUMERATOR + +```solidity +int256 constant NUMERATOR = 100; +``` + + +### DENOMINATOR_MOST + +```solidity +int256 constant DENOMINATOR_MOST = -300; +``` + + +### DENOMINATOR_MORE + +```solidity +int256 constant DENOMINATOR_MORE = -200; +``` + + +### DENOMINATOR + +```solidity +int256 constant DENOMINATOR = -100; +``` + + diff --git a/docs/contracts/v4/reference/periphery/libraries/Descriptor.md b/docs/contracts/v4/reference/periphery/libraries/Descriptor.md new file mode 100644 index 000000000..00c26fbac --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/Descriptor.md @@ -0,0 +1,383 @@ +# Descriptor +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/Descriptor.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Describes NFT token positions + +*Reference: https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/NFTDescriptor.sol* + + +## State Variables +### sqrt10X128 + +```solidity +uint256 constant sqrt10X128 = 1076067327063303206878105757264492625226; +``` + + +## Functions +### constructTokenURI + +Constructs the token URI for a Uniswap v4 NFT + + +```solidity +function constructTokenURI(ConstructTokenURIParams memory params) internal pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`params`|`ConstructTokenURIParams`|Parameters needed to construct the token URI| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The token URI as a string| + + +### escapeSpecialCharacters + +Escapes special characters in a string if they are present + + +```solidity +function escapeSpecialCharacters(string memory symbol) internal pure returns (string memory); +``` + +### generateDescriptionPartOne + +Generates the first part of the description for a Uniswap v4 NFT + + +```solidity +function generateDescriptionPartOne( + string memory quoteCurrencySymbol, + string memory baseCurrencySymbol, + string memory poolManager +) private pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`quoteCurrencySymbol`|`string`|The symbol of the quote currency| +|`baseCurrencySymbol`|`string`|The symbol of the base currency| +|`poolManager`|`string`|The address of the pool manager| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The first part of the description| + + +### generateDescriptionPartTwo + +Generates the second part of the description for a Uniswap v4 NFTs + + +```solidity +function generateDescriptionPartTwo( + string memory tokenId, + string memory baseCurrencySymbol, + string memory quoteCurrency, + string memory baseCurrency, + string memory hooks, + string memory feeTier +) private pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tokenId`|`string`|The token ID| +|`baseCurrencySymbol`|`string`|The symbol of the base currency| +|`quoteCurrency`|`string`|The address of the quote currency| +|`baseCurrency`|`string`|The address of the base currency| +|`hooks`|`string`|The address of the hooks contract| +|`feeTier`|`string`|The fee tier of the pool| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The second part of the description| + + +### generateName + +Generates the name for a Uniswap v4 NFT + + +```solidity +function generateName(ConstructTokenURIParams memory params, string memory feeTier) + private + pure + returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`params`|`ConstructTokenURIParams`|Parameters needed to generate the name| +|`feeTier`|`string`|The fee tier of the pool| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The name of the NFT| + + +### generateDecimalString + + +```solidity +function generateDecimalString(DecimalStringParams memory params) private pure returns (string memory); +``` + +### tickToDecimalString + +Gets the price (quote/base) at a specific tick in decimal form +MIN or MAX are returned if tick is at the bottom or top of the price curve + + +```solidity +function tickToDecimalString( + int24 tick, + int24 tickSpacing, + uint8 baseCurrencyDecimals, + uint8 quoteCurrencyDecimals, + bool flipRatio +) internal pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tick`|`int24`|The tick (either tickLower or tickUpper)| +|`tickSpacing`|`int24`|The tick spacing of the pool| +|`baseCurrencyDecimals`|`uint8`|The decimals of the base currency| +|`quoteCurrencyDecimals`|`uint8`|The decimals of the quote currency| +|`flipRatio`|`bool`|True if the ratio was flipped| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The ratio value as a string| + + +### sigfigsRounded + + +```solidity +function sigfigsRounded(uint256 value, uint8 digits) private pure returns (uint256, bool); +``` + +### adjustForDecimalPrecision + +Adjusts the sqrt price for different currencies with different decimals + + +```solidity +function adjustForDecimalPrecision(uint160 sqrtRatioX96, uint8 baseCurrencyDecimals, uint8 quoteCurrencyDecimals) + private + pure + returns (uint256 adjustedSqrtRatioX96); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`sqrtRatioX96`|`uint160`|The sqrt price at a specific tick| +|`baseCurrencyDecimals`|`uint8`|The decimals of the base currency| +|`quoteCurrencyDecimals`|`uint8`|The decimals of the quote currency| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`adjustedSqrtRatioX96`|`uint256`|The adjusted sqrt price| + + +### abs + +Absolute value of a signed integer + + +```solidity +function abs(int256 x) private pure returns (uint256); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`x`|`int256`|The signed integer| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`uint256`|The absolute value of x| + + +### fixedPointToDecimalString + + +```solidity +function fixedPointToDecimalString(uint160 sqrtRatioX96, uint8 baseCurrencyDecimals, uint8 quoteCurrencyDecimals) + internal + pure + returns (string memory); +``` + +### feeToPercentString + +Converts fee amount in pips to decimal string with percent sign + + +```solidity +function feeToPercentString(uint24 fee) internal pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`fee`|`uint24`|fee amount| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|fee as a decimal string with percent sign| + + +### addressToString + + +```solidity +function addressToString(address addr) internal pure returns (string memory); +``` + +### generateSVGImage + +Generates the SVG image for a Uniswap v4 NFT + + +```solidity +function generateSVGImage(ConstructTokenURIParams memory params) internal pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`params`|`ConstructTokenURIParams`|Parameters needed to generate the SVG image| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG image as a string| + + +### overRange + +Checks if the current price is within your position range, above, or below + + +```solidity +function overRange(int24 tickLower, int24 tickUpper, int24 tickCurrent) private pure returns (int8); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tickLower`|`int24`|The lower tick| +|`tickUpper`|`int24`|The upper tick| +|`tickCurrent`|`int24`|The current tick| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`int8`|0 if the current price is within the position range, -1 if below, 1 if above| + + +### isSpecialCharacter + + +```solidity +function isSpecialCharacter(bytes1 b) private pure returns (bool); +``` + +### scale + + +```solidity +function scale(uint256 n, uint256 inMn, uint256 inMx, uint256 outMn, uint256 outMx) + private + pure + returns (string memory); +``` + +### currencyToColorHex + + +```solidity +function currencyToColorHex(uint256 currency, uint256 offset) internal pure returns (string memory str); +``` + +### getCircleCoord + + +```solidity +function getCircleCoord(uint256 currency, uint256 offset, uint256 tokenId) internal pure returns (uint256); +``` + +### sliceCurrencyHex + + +```solidity +function sliceCurrencyHex(uint256 currency, uint256 offset) internal pure returns (uint256); +``` + +## Structs +### ConstructTokenURIParams + +```solidity +struct ConstructTokenURIParams { + uint256 tokenId; + address quoteCurrency; + address baseCurrency; + string quoteCurrencySymbol; + string baseCurrencySymbol; + uint8 quoteCurrencyDecimals; + uint8 baseCurrencyDecimals; + bool flipRatio; + int24 tickLower; + int24 tickUpper; + int24 tickCurrent; + int24 tickSpacing; + uint24 fee; + address poolManager; + address hooks; +} +``` + +### DecimalStringParams + +```solidity +struct DecimalStringParams { + uint256 sigfigs; + uint8 bufferLength; + uint8 sigfigIndex; + uint8 decimalIndex; + uint8 zerosStartIndex; + uint8 zerosEndIndex; + bool isLessThanOne; + bool isPercent; +} +``` + diff --git a/docs/contracts/v4/reference/periphery/libraries/ERC721PermitHash.md b/docs/contracts/v4/reference/periphery/libraries/ERC721PermitHash.md index 7a85b7ece..db4f3475d 100644 --- a/docs/contracts/v4/reference/periphery/libraries/ERC721PermitHash.md +++ b/docs/contracts/v4/reference/periphery/libraries/ERC721PermitHash.md @@ -1,6 +1,5 @@ # ERC721PermitHash -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/ERC721PermitHash.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/ERC721PermitHash.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## State Variables diff --git a/docs/contracts/v4/reference/periphery/libraries/HexStrings.md b/docs/contracts/v4/reference/periphery/libraries/HexStrings.md new file mode 100644 index 000000000..e27d914ae --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/HexStrings.md @@ -0,0 +1,39 @@ +# HexStrings +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/HexStrings.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Provides function for converting numbers to hexadecimal strings + +*Reference: https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/HexStrings.sol* + + +## State Variables +### ALPHABET + +```solidity +bytes16 internal constant ALPHABET = "0123456789abcdef"; +``` + + +## Functions +### toHexStringNoPrefix + +Convert a number to a hex string without the '0x' prefix with a fixed length + + +```solidity +function toHexStringNoPrefix(uint256 value, uint256 length) internal pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`value`|`uint256`|The number to convert| +|`length`|`uint256`|The length of the output string, starting from the last character of the string| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The hex string| + + diff --git a/docs/contracts/v4/reference/periphery/libraries/Locker.md b/docs/contracts/v4/reference/periphery/libraries/Locker.md index a1b62cf3d..7bd349240 100644 --- a/docs/contracts/v4/reference/periphery/libraries/Locker.md +++ b/docs/contracts/v4/reference/periphery/libraries/Locker.md @@ -1,6 +1,5 @@ # Locker -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/Locker.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/Locker.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) This is a temporary library that allows us to use transient storage (tstore/tload) TODO: This library can be deleted when we have the transient keyword support in solidity. diff --git a/docs/contracts/v4/reference/periphery/libraries/PathKey.md b/docs/contracts/v4/reference/periphery/libraries/PathKey.md index c45203b92..bc6cc572e 100644 --- a/docs/contracts/v4/reference/periphery/libraries/PathKey.md +++ b/docs/contracts/v4/reference/periphery/libraries/PathKey.md @@ -1,6 +1,5 @@ # PathKey -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/PathKey.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/PathKey.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ```solidity diff --git a/docs/contracts/v4/reference/periphery/libraries/PositionConfig.md b/docs/contracts/v4/reference/periphery/libraries/PositionConfig.md index d337c1a39..aad00a0e5 100644 --- a/docs/contracts/v4/reference/periphery/libraries/PositionConfig.md +++ b/docs/contracts/v4/reference/periphery/libraries/PositionConfig.md @@ -1,6 +1,5 @@ # PositionConfig -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/PositionConfig.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/PositionConfig.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ```solidity diff --git a/docs/contracts/v4/reference/periphery/libraries/PositionConfigId.md b/docs/contracts/v4/reference/periphery/libraries/PositionConfigId.md index 42fd8b161..5ab31e8f1 100644 --- a/docs/contracts/v4/reference/periphery/libraries/PositionConfigId.md +++ b/docs/contracts/v4/reference/periphery/libraries/PositionConfigId.md @@ -1,15 +1,59 @@ -# PositionConfigId -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/PositionConfigId.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +# PositionConfigIdLibrary +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/PositionConfigId.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) -A configId is set per tokenId -The lower 255 bits are used to store the truncated hash of the corresponding PositionConfig -The upper bit is used to signal if the tokenId has a subscriber +## State Variables +### MASK_UPPER_BIT ```solidity -struct PositionConfigId { - bytes32 id; -} +bytes32 constant MASK_UPPER_BIT = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; +``` + + +### DIRTY_UPPER_BIT + +```solidity +bytes32 constant DIRTY_UPPER_BIT = 0x8000000000000000000000000000000000000000000000000000000000000000; +``` + + +## Functions +### getConfigId + +returns the truncated hash of the PositionConfig for a given tokenId + + +```solidity +function getConfigId(PositionConfigId storage _configId) internal view returns (bytes32 configId); +``` + +### setConfigId + +*We only set the config on mint, guaranteeing that the most significant bit is unset, so we can just assign the entire 32 bytes to the id.* + + +```solidity +function setConfigId(PositionConfigId storage _configId, bytes32 configId) internal; +``` + +### setSubscribe + + +```solidity +function setSubscribe(PositionConfigId storage configId) internal; +``` + +### setUnsubscribe + + +```solidity +function setUnsubscribe(PositionConfigId storage configId) internal; +``` + +### hasSubscriber + + +```solidity +function hasSubscriber(PositionConfigId storage configId) internal view returns (bool subscribed); ``` diff --git a/docs/contracts/v4/reference/periphery/libraries/PositionInfoLibrary.md b/docs/contracts/v4/reference/periphery/libraries/PositionInfoLibrary.md index bce95c32a..7fb825589 100644 --- a/docs/contracts/v4/reference/periphery/libraries/PositionInfoLibrary.md +++ b/docs/contracts/v4/reference/periphery/libraries/PositionInfoLibrary.md @@ -1,139 +1,23 @@ -# PositionInfoLibrary -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/PositionInfoLibrary.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +# PositionInfo +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/PositionInfoLibrary.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +*PositionInfo is a packed version of solidity structure. +Using the packaged version saves gas and memory by not storing the structure fields in memory slots. +Layout: +200 bits poolId | 24 bits tickUpper | 24 bits tickLower | 8 bits hasSubscriber +Fields in the direction from the least significant bit: +A flag to know if the tokenId is subscribed to an address +uint8 hasSubscriber; +The tickUpper of the position +int24 tickUpper; +The tickLower of the position +int24 tickLower; +The truncated poolId. Truncates a bytes32 value so the most signifcant (highest) 200 bits are used. +bytes25 poolId; +Note: If more bits are needed, hasSubscriber can be a single bit.* -## State Variables -### EMPTY_POSITION_INFO ```solidity -PositionInfo internal constant EMPTY_POSITION_INFO = PositionInfo.wrap(0); +type PositionInfo is uint256; ``` - -### MASK_UPPER_200_BITS - -```solidity -uint256 internal constant MASK_UPPER_200_BITS = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000; -``` - - -### MASK_8_BITS - -```solidity -uint256 internal constant MASK_8_BITS = 0xFF; -``` - - -### MASK_24_BITS - -```solidity -uint24 internal constant MASK_24_BITS = 0xFFFFFF; -``` - - -### SET_UNSUBSCRIBE - -```solidity -uint256 internal constant SET_UNSUBSCRIBE = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00; -``` - - -### SET_SUBSCRIBE - -```solidity -uint256 internal constant SET_SUBSCRIBE = 0x01; -``` - - -### TICK_LOWER_OFFSET - -```solidity -uint8 internal constant TICK_LOWER_OFFSET = 8; -``` - - -### TICK_UPPER_OFFSET - -```solidity -uint8 internal constant TICK_UPPER_OFFSET = 32; -``` - - -## Functions -### poolId - -*This poolId is NOT compatible with the poolId used in UniswapV4 core. It is truncated to 25 bytes, and just used to lookup PoolKey in the poolKeys mapping.* - - -```solidity -function poolId(PositionInfo info) internal pure returns (bytes25 _poolId); -``` - -### tickLower - - -```solidity -function tickLower(PositionInfo info) internal pure returns (int24 _tickLower); -``` - -### tickUpper - - -```solidity -function tickUpper(PositionInfo info) internal pure returns (int24 _tickUpper); -``` - -### hasSubscriber - - -```solidity -function hasSubscriber(PositionInfo info) internal pure returns (bool _hasSubscriber); -``` - -### setSubscribe - -*this does not actually set any storage* - - -```solidity -function setSubscribe(PositionInfo info) internal pure returns (PositionInfo _info); -``` - -### setUnsubscribe - -*this does not actually set any storage* - - -```solidity -function setUnsubscribe(PositionInfo info) internal pure returns (PositionInfo _info); -``` - -### initialize - -Creates the default PositionInfo struct - -*Called when minting a new position* - - -```solidity -function initialize(PoolKey memory _poolKey, int24 _tickLower, int24 _tickUpper) - internal - pure - returns (PositionInfo info); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_poolKey`|`PoolKey`|the pool key of the position| -|`_tickLower`|`int24`|the lower tick of the position| -|`_tickUpper`|`int24`|the upper tick of the position| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|`info`|`PositionInfo`|packed position info, with the truncated poolId and the hasSubscriber flag set to false| - - diff --git a/docs/contracts/v4/reference/periphery/libraries/QuoterRevert.md b/docs/contracts/v4/reference/periphery/libraries/QuoterRevert.md index 0560e94de..07c67fdc0 100644 --- a/docs/contracts/v4/reference/periphery/libraries/QuoterRevert.md +++ b/docs/contracts/v4/reference/periphery/libraries/QuoterRevert.md @@ -1,6 +1,5 @@ # QuoterRevert -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/QuoterRevert.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/QuoterRevert.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) ## Functions diff --git a/docs/contracts/v4/reference/periphery/libraries/SVG.md b/docs/contracts/v4/reference/periphery/libraries/SVG.md new file mode 100644 index 000000000..1b9b12214 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/SVG.md @@ -0,0 +1,377 @@ +# SVG +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/SVG.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +Provides a function for generating an SVG associated with a Uniswap NFT + +*Reference: https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/NFTSVG.sol* + + +## State Variables +### curve1 + +```solidity +string constant curve1 = "M1 1C41 41 105 105 145 145"; +``` + + +### curve2 + +```solidity +string constant curve2 = "M1 1C33 49 97 113 145 145"; +``` + + +### curve3 + +```solidity +string constant curve3 = "M1 1C33 57 89 113 145 145"; +``` + + +### curve4 + +```solidity +string constant curve4 = "M1 1C25 65 81 121 145 145"; +``` + + +### curve5 + +```solidity +string constant curve5 = "M1 1C17 73 73 129 145 145"; +``` + + +### curve6 + +```solidity +string constant curve6 = "M1 1C9 81 65 137 145 145"; +``` + + +### curve7 + +```solidity +string constant curve7 = "M1 1C1 89 57.5 145 145 145"; +``` + + +### curve8 + +```solidity +string constant curve8 = "M1 1C1 97 49 145 145 145"; +``` + + +## Functions +### generateSVG + +Generate the SVG associated with a Uniswap v4 NFT + + +```solidity +function generateSVG(SVGParams memory params) internal pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`params`|`SVGParams`|The SVGParams struct containing the parameters for the SVG| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG string associated with the NFT| + + +### generateSVGDefs + +Generate the SVG defs that create the color scheme for the SVG + + +```solidity +function generateSVGDefs(SVGParams memory params) private pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`params`|`SVGParams`|The SVGParams struct containing the parameters to generate the SVG defs| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG defs string| + + +### generateSVGBorderText + +Generate the SVG for the moving border text displaying the quote and base currency addresses with their symbols + + +```solidity +function generateSVGBorderText( + string memory quoteCurrency, + string memory baseCurrency, + string memory quoteCurrencySymbol, + string memory baseCurrencySymbol +) private pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`quoteCurrency`|`string`|The quote currency| +|`baseCurrency`|`string`|The base currency| +|`quoteCurrencySymbol`|`string`|The quote currency symbol| +|`baseCurrencySymbol`|`string`|The base currency symbol| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG for the border NFT's border text| + + +### generateSVGCardMantle + +Generate the SVG for the card mantle displaying the quote and base currency symbols and fee tier + + +```solidity +function generateSVGCardMantle( + string memory quoteCurrencySymbol, + string memory baseCurrencySymbol, + string memory feeTier +) private pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`quoteCurrencySymbol`|`string`|The quote currency symbol| +|`baseCurrencySymbol`|`string`|The base currency symbol| +|`feeTier`|`string`|The fee tier| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG for the card mantle| + + +### generageSvgCurve + +Generate the SVG for the curve that represents the position. Fade up (top is faded) if current price is above your position range, fade down (bottom is faded) if current price is below your position range +Circles are generated at the ends of the curve if the position is in range, or at one end of the curve it is on if not in range + + +```solidity +function generageSvgCurve(int24 tickLower, int24 tickUpper, int24 tickSpacing, int8 overRange) + private + pure + returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tickLower`|`int24`|The lower tick| +|`tickUpper`|`int24`|The upper tick| +|`tickSpacing`|`int24`|The tick spacing| +|`overRange`|`int8`|Whether the current tick is in range, over range, or under range| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG for the curve| + + +### getCurve + +Get the curve based on the tick range +The smaller the tick range, the smaller/more linear the curve + + +```solidity +function getCurve(int24 tickLower, int24 tickUpper, int24 tickSpacing) internal pure returns (string memory curve); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tickLower`|`int24`|The lower tick| +|`tickUpper`|`int24`|The upper tick| +|`tickSpacing`|`int24`|The tick spacing| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`curve`|`string`|The curve path| + + +### generateSVGCurveCircle + +Generate the SVG for the circles on the curve + + +```solidity +function generateSVGCurveCircle(int8 overRange) internal pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`overRange`|`int8`|0 if the current tick is in range, 1 if the current tick is over range, -1 if the current tick is under range| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG for the circles| + + +### generateSVGPositionDataAndLocationCurve + +If the position is over or under range, generate one circle at the end of the curve on the side of the range it is on with a larger circle around it +If the position is in range, generate two circles at the ends of the curve + +Generate the SVG for the position data (token ID, hooks address, min tick, max tick) and the location curve (where your position falls on the curve) + + +```solidity +function generateSVGPositionDataAndLocationCurve(string memory tokenId, address hook, int24 tickLower, int24 tickUpper) + private + pure + returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tokenId`|`string`|The token ID| +|`hook`|`address`|The hooks address| +|`tickLower`|`int24`|The lower tick| +|`tickUpper`|`int24`|The upper tick| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG for the position data and location curve| + + +### substring + + +```solidity +function substring(string memory str, uint256 startIndex, uint256 endIndex) internal pure returns (string memory); +``` + +### tickToString + + +```solidity +function tickToString(int24 tick) private pure returns (string memory); +``` + +### rangeLocation + +Get the location of where your position falls on the curve + + +```solidity +function rangeLocation(int24 tickLower, int24 tickUpper) internal pure returns (string memory, string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tickLower`|`int24`|The lower tick| +|`tickUpper`|`int24`|The upper tick| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|The x and y coordinates of the location of the liquidity| +|``|`string`|| + + +### generateSVGRareSparkle + +Generates the SVG for a rare sparkle if the NFT is rare. Else, returns an empty string + + +```solidity +function generateSVGRareSparkle(uint256 tokenId, address hooks) private pure returns (string memory svg); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tokenId`|`uint256`|The token ID| +|`hooks`|`address`|The hooks address| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`svg`|`string`|The SVG for the rare sparkle| + + +### isRare + +Determines if an NFT is rare based on the token ID and hooks address + + +```solidity +function isRare(uint256 tokenId, address hooks) internal pure returns (bool); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`tokenId`|`uint256`|The token ID| +|`hooks`|`address`|The hooks address| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bool`|Whether the NFT is rare or not| + + +## Structs +### SVGParams + +```solidity +struct SVGParams { + string quoteCurrency; + string baseCurrency; + address hooks; + string quoteCurrencySymbol; + string baseCurrencySymbol; + string feeTier; + int24 tickLower; + int24 tickUpper; + int24 tickSpacing; + int8 overRange; + uint256 tokenId; + string color0; + string color1; + string color2; + string color3; + string x1; + string y1; + string x2; + string y2; + string x3; + string y3; +} +``` + diff --git a/docs/contracts/v4/reference/periphery/libraries/SafeCurrencyMetadata.md b/docs/contracts/v4/reference/periphery/libraries/SafeCurrencyMetadata.md new file mode 100644 index 000000000..7defdd5f1 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/SafeCurrencyMetadata.md @@ -0,0 +1,133 @@ +# SafeCurrencyMetadata +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/SafeCurrencyMetadata.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +can produce symbols and decimals from inconsistent or absent ERC20 implementations + +*Reference: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/SafeERC20Namer.sol* + + +## State Variables +### MAX_SYMBOL_LENGTH + +```solidity +uint8 constant MAX_SYMBOL_LENGTH = 12; +``` + + +## Functions +### currencySymbol + +attempts to extract the currency symbol. if it does not implement symbol, returns a symbol derived from the address + + +```solidity +function currencySymbol(address currency, string memory nativeLabel) internal view returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currency`|`address`|The currency address| +|`nativeLabel`|`string`|The native label| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|the currency symbol| + + +### currencyDecimals + +attempts to extract the token decimals, returns 0 if not implemented or not a uint8 + + +```solidity +function currencyDecimals(address currency) internal view returns (uint8); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currency`|`address`|The currency address| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`uint8`|the currency decimals| + + +### bytes32ToString + + +```solidity +function bytes32ToString(bytes32 x) private pure returns (string memory); +``` + +### addressToSymbol + +produces a symbol from the address - the first 6 hex of the address string in upper case + + +```solidity +function addressToSymbol(address currencyAddress) private pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currencyAddress`|`address`|the address of the currency| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|the symbol| + + +### callAndParseStringReturn + +calls an external view contract method that returns a symbol, and parses the output into a string + + +```solidity +function callAndParseStringReturn(address currencyAddress, bytes4 selector) private view returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`currencyAddress`|`address`|the address of the currency| +|`selector`|`bytes4`|the selector of the symbol method| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|the symbol| + + +### truncateSymbol + +truncates the symbol to the MAX_SYMBOL_LENGTH + +*assumes the string is already longer than MAX_SYMBOL_LENGTH (or the same)* + + +```solidity +function truncateSymbol(string memory str) internal pure returns (string memory); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`str`|`string`|the symbol| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`string`|the truncated symbol| + + diff --git a/docs/contracts/v4/reference/periphery/libraries/SlippageCheck.md b/docs/contracts/v4/reference/periphery/libraries/SlippageCheck.md index fd99a8c10..8ee35bfe7 100644 --- a/docs/contracts/v4/reference/periphery/libraries/SlippageCheck.md +++ b/docs/contracts/v4/reference/periphery/libraries/SlippageCheck.md @@ -1,6 +1,5 @@ # SlippageCheck -[Git Source](https://github.com/Uniswap/v4-periphery/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/libraries/SlippageCheck.sol) -| Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/SlippageCheck.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) a library for checking if a delta exceeds a maximum ceiling or fails to meet a minimum floor diff --git a/docs/contracts/v4/reference/periphery/libraries/VanityAddressLib.md b/docs/contracts/v4/reference/periphery/libraries/VanityAddressLib.md new file mode 100644 index 000000000..ed2e5f813 --- /dev/null +++ b/docs/contracts/v4/reference/periphery/libraries/VanityAddressLib.md @@ -0,0 +1,94 @@ +# VanityAddressLib +[Git Source](https://github.com/uniswap/v4-periphery/blob/3f295d8435e4f776ea2daeb96ce1bc6d63f33fc7/src/libraries/VanityAddressLib.sol) - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc) + +A library to score addresses based on their vanity + + +## Functions +### betterThan + +Compares two addresses and returns true if the first address has a better vanity score + + +```solidity +function betterThan(address first, address second) internal pure returns (bool better); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`first`|`address`|The first address to compare| +|`second`|`address`|The second address to compare| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`better`|`bool`|True if the first address has a better vanity score| + + +### score + +Scores an address based on its vanity + +*Scoring rules: +Requirement: The first nonzero nibble must be 4 +10 points for every leading 0 nibble +40 points if the first 4 is followed by 3 more 4s +20 points if the first nibble after the 4 4s is NOT a 4 +20 points if the last 4 nibbles are 4s +1 point for every 4* + + +```solidity +function score(address addr) internal pure returns (uint256 calculatedScore); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`addr`|`address`|The address to score| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`calculatedScore`|`uint256`|The vanity score of the address| + + +### getLeadingNibbleCount + +Returns the number of leading nibbles in an address that match a given value + + +```solidity +function getLeadingNibbleCount(bytes20 addrBytes, uint256 startIndex, uint8 comparison) + internal + pure + returns (uint256 count); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`addrBytes`|`bytes20`|The address to count the leading zero nibbles in| +|`startIndex`|`uint256`|| +|`comparison`|`uint8`|| + + +### getNibble + +Returns the nibble at a given index in an address + + +```solidity +function getNibble(bytes20 input, uint256 nibbleIndex) internal pure returns (uint8 currentNibble); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`input`|`bytes20`|The address to get the nibble from| +|`nibbleIndex`|`uint256`|The index of the nibble to get| + + diff --git a/scripts/v4-forge-doc.sh b/scripts/v4-forge-doc.sh index 3f0dcecd0..bb77ec5d3 100755 --- a/scripts/v4-forge-doc.sh +++ b/scripts/v4-forge-doc.sh @@ -33,21 +33,24 @@ copy_docs() { # Fix the Git source link # replace `https://github.com/Uniswap/docs/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IPositionManager.sol` # with `https://github.com/Uniswap/v4-{component}/blob/47e3c30ae8a0d7c086bf3e41bd0e7e3a854e280b/src/interfaces/IPositionManager.sol` - sed -i "s|Uniswap/docs/|Uniswap/v4-${component}/|g" "$new_file" + sed -i '' -e "s|uniswap/docs/|uniswap/v4-${component}/|g" "$new_file" # Add note: - sed -i '3i | Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc)' "$new_file" + # sed -i '' '3i\ + sed -i '' '2s|$| - Generated with [forge doc](https://book.getfoundry.sh/reference/forge/forge-doc)|' "$new_file" + # Replace relative path links within the file with full paths - sed -i "s|/src/\([^/]\+\)/\([^/]\+\)\.sol/\([^/]\+\)\.\([^/]\+\)\.md|contracts/v4/reference/${component}/\1/\2.md|g" "$new_file" + # sed -i '' -e "s|/src/\([^/]\+\)/\([^/]\+\)\.sol/\([^/]\+\)\.\([^/]\+\)\.md|contracts/v4/reference/${component}/\1/\2.md|g" "$new_file" + sed -i '' -e "s|/src/\([^/]\{1,\}\)/\([^/]\{1,\}\)\.sol/\([^/]\{1,\}\)\.\([^/]\{1,\}\)\.md|contracts/v4/reference/${component}/\1/\2.md|g" "$new_file" # specially handle core paths if [ "$component" == "core" ]; then # replaces: /src/ProtocolFees.sol/abstract.ProtocolFees.md to contracts/v4/reference/core/ProtocolFees.md - sed -i -E 's|/src/([^/]+)\.sol/abstract\.[^/]+\.md|contracts/v4/reference/core/\1.md|g' "$new_file" + sed -i '' -E 's|/src/([^/]+)\.sol/abstract\.[^/]+\.md|contracts/v4/reference/core/\1.md|g' "$new_file" # replaces: /src/interfaces/external/IERC6909Claims.sol/interface.IERC6909Claims.md to contracts/v4/reference/core/interfaces/IERC6909Claims.md - sed -i -E 's|/src/interfaces/external/([^/]+)\.sol/interface\.[^/]+\.md|contracts/v4/reference/core/interfaces/\1.md|g' "$new_file" + sed -i '' -E 's|/src/interfaces/external/([^/]+)\.sol/interface\.[^/]+\.md|contracts/v4/reference/core/interfaces/\1.md|g' "$new_file" fi echo "Copied: $file -> $new_file"