-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathErrors.sol
94 lines (67 loc) · 4.44 KB
/
Errors.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.24;
/// @title Custom Errors library.
/// @author Axicon Labs Limited
/// @notice Contains all custom error messages used in Panoptic.
library Errors {
/// @notice PanopticPool: The account is not solvent enough to perform the desired action
error AccountInsolvent();
/// @notice Casting error
/// @dev e.g. uint128(uint256(a)) fails
error CastingError();
/// @notice CollateralTracker: Collateral token has already been initialized
error CollateralTokenAlreadyInitialized();
/// @notice CollateralTracker: The amount of shares (or assets) deposited is larger than the maximum permitted
error DepositTooLarge();
/// @notice PanopticPool: The effective liquidity (X32) is greater than min(`MAX_SPREAD`, `USER_PROVIDED_THRESHOLD`) during a long mint or short burn
/// @dev Effective liquidity measures how much new liquidity is minted relative to how much is already in the pool
error EffectiveLiquidityAboveThreshold();
/// @notice CollateralTracker: Attempted to withdraw/redeem more than available liquidity, owned shares, or open positions would allow for
error ExceedsMaximumRedemption();
/// @notice PanopticPool: The provided list of option positions is incorrect or invalid
error InputListFail();
/// @notice Tick is not between `MIN_TICK` and `MAX_TICK`
error InvalidTick();
/// @notice The TokenId provided by the user is malformed or invalid
/// @param parameterType poolId=0, ratio=1, tokenType=2, risk_partner=3, strike=4, width=5, two identical strike/width/tokenType chunks=6
error InvalidTokenIdParameter(uint256 parameterType);
/// @notice A mint or swap callback was attempted from an address that did not match the canonical Uniswap V3 pool with the claimed features
error InvalidUniswapCallback();
/// @notice PanopticPool: None of the legs in a position are force-exercisable (they are all either short or ATM long)
error NoLegsExercisable();
/// @notice PanopticPool: The leg is not long, so premium cannot be settled through `settleLongPremium`
error NotALongLeg();
/// @notice PanopticPool: There is not enough available liquidity in the chunk for one of the long legs to be created (or for one of the short legs to be closed)
error NotEnoughLiquidity();
/// @notice PanopticPool: Position is still solvent and cannot be liquidated
error NotMarginCalled();
/// @notice CollateralTracker: The caller for a permissioned function is not the Panoptic Pool
error NotPanopticPool();
/// @notice Uniswap pool has already been initialized in the SFPM or created in the factory
error PoolAlreadyInitialized();
/// @notice PanopticPool: A position with the given token ID has already been minted by the caller and is still open
error PositionAlreadyMinted();
/// @notice CollateralTracker: The user has open/active option positions, so they cannot transfer collateral shares
error PositionCountNotZero();
/// @notice SFPM: The maximum token deltas (excluding swaps) for a position exceed (2^127 - 5) at some valid price
error PositionTooLarge();
/// @notice The current tick in the pool (post-ITM-swap) has fallen outside a user-defined open interval slippage range
error PriceBoundFail();
/// @notice An oracle price is too far away from another oracle price or the current tick
/// @dev This is a safeguard against price manipulation during option mints, burns, and liquidations
error StaleTWAP();
/// @notice PanopticPool: The position being minted would increase the total amount of legs open for the account above the maximum
error TooManyLegsOpen();
/// @notice ERC20 or SFPM (ERC1155) token transfer did not complete successfully
error TransferFailed();
/// @notice The tick range given by the strike price and width is invalid
/// because the upper and lower ticks are not initializable multiples of `tickSpacing`
/// or one of the ticks exceeds the `MIN_TICK` or `MAX_TICK` bounds
error InvalidTickBound();
/// @notice An operation in a library has failed due to an underflow or overflow
error UnderOverFlow();
/// @notice The Uniswap Pool has not been created, so it cannot be used in the SFPM or have a PanopticPool created for it by the factory
error UniswapPoolNotInitialized();
/// @notice SFPM: Mints/burns of zero-liquidity chunks in Uniswap are not supported
error ZeroLiquidity();
}