From 4d5d063a15a8cb180ef609fbdc193ca403019f76 Mon Sep 17 00:00:00 2001 From: See Yi Jie <36152992+seeyijie@users.noreply.github.com> Date: Thu, 10 Oct 2024 00:12:24 +0800 Subject: [PATCH] Add custom error selector (#794) Co-authored-by: saucepoint <98790946+saucepoint@users.noreply.github.com> --- .../v4/reference/errors/_category_.json | 5 + docs/contracts/v4/reference/errors/errors.mdx | 93 +++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 docs/contracts/v4/reference/errors/_category_.json create mode 100644 docs/contracts/v4/reference/errors/errors.mdx diff --git a/docs/contracts/v4/reference/errors/_category_.json b/docs/contracts/v4/reference/errors/_category_.json new file mode 100644 index 000000000..7b00c0be1 --- /dev/null +++ b/docs/contracts/v4/reference/errors/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "Errors", + "position": 0, + "collapsed": false +} diff --git a/docs/contracts/v4/reference/errors/errors.mdx b/docs/contracts/v4/reference/errors/errors.mdx new file mode 100644 index 000000000..c044678f5 --- /dev/null +++ b/docs/contracts/v4/reference/errors/errors.mdx @@ -0,0 +1,93 @@ +--- +title: Custom Error Selectors +--- +# Custom Error Selectors +These are custom error selectors for Uniswap v4 contracts. + +## IPoolManager.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `IPoolManager.CurrencyNotSettled.selector` | `0x5212cba1` | +| `IPoolManager.PoolNotInitialized.selector` | `0x486aa307` | +| `IPoolManager.AlreadyUnlocked.selector` | `0x5090d6c6` | +| `IPoolManager.ManagerLocked.selector` | `0x54e3ca0d` | +| `IPoolManager.TickSpacingTooLarge.selector` | `0xb02b5dc2` | +| `IPoolManager.TickSpacingTooSmall.selector` | `0x16fe7696` | +| `IPoolManager.CurrenciesOutOfOrderOrEqual.selector` | `0xeaa6c6eb` | +| `IPoolManager.UnauthorizedDynamicLPFeeUpdate.selector` | `0x30d21641` | +| `IPoolManager.SwapAmountCannotBeZero.selector` | `0xbe8b8507` | +| `IPoolManager.NonZeroNativeValue.selector` | `0x19d245cf` | + +## Hooks.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `Hooks.HookAddressNotValid.selector` | `0xe65af6a0` | +| `Hooks.InvalidHookResponse.selector` | `0x1e048e1d` | +| `Hooks.FailedHookCall.selector` | `0x36bc48c5` | +| `Hooks.HookDeltaExceedsSwapAmount.selector` | `0xfa0b71d6` | + +## Pool.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `Pool.TicksMisordered.selector` | `0xc4433ed5` | +| `Pool.TickLowerOutOfBounds.selector` | `0xd5e2f7ab` | +| `Pool.TickUpperOutOfBounds.selector` | `0x1ad777f8` | +| `Pool.TickLiquidityOverflow.selector` | `0xb8e3c385` | +| `Pool.TickNotInitialized.selector` | `0x82a774d3` | +| `Pool.PoolAlreadyInitialized.selector` | `0x7983c051` | +| `Pool.PoolNotInitialized.selector` | `0x486aa307` | +| `Pool.PriceLimitAlreadyExceeded.selector` | `0x7c9c6e8f` | +| `Pool.PriceLimitOutOfBounds.selector` | `0x9e4d7cc7` | +| `Pool.NoLiquidityToReceiveFees.selector` | `0xa74f97ab` | +| `Pool.InvalidFeeForExactOut.selector` | `0x96206246` | + +## IProtocolFees.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `IProtocolFees.ProtocolFeeCannotBeFetched.selector` | `0x1ee49702` | +| `IProtocolFees.InvalidProtocolFee.selector` | `0xba97f838` | +| `IProtocolFees.InvalidCaller.selector` | `0x48f5c3ed` | + +## LPFeeLibrary.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `LPFeeLibrary.FeeTooLarge.selector` | `0xfc5bee12` | + +## Position.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|----------------| +| `Position.CannotUpdateEmptyPosition.selector` | `0xaefeb924` | + +## Reserves.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|----------------| +| `Reserves.ReservesMustBeSynced.selector` | `0x8774be48` | + +## SqrtPriceMath.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `SqrtPriceMath.InvalidPriceOrLiquidity.selector` | `0x4f2461b8` | +| `SqrtPriceMath.InvalidPrice.selector` | `0x00bfc921` | +| `SqrtPriceMath.NotEnoughLiquidity.selector` | `0x4323a555` | +| `SqrtPriceMath.PriceOverflow.selector` | `0xf5c787f1` | + +## TickBitmap.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `TickBitmap.TickMisaligned.selector` | `0xd4d8f3e6` | + +## TickMath.sol + +| Error Selector | Hex Value | +|-----------------------------------------------------|--------------| +| `TickMath.InvalidTick.selector` | `0xce8ef7fc` | +| `TickMath.InvalidSqrtPrice.selector` | `0x31efafe8` | \ No newline at end of file