Platform: Code4rena
Start Date: 27/11/2023
Pot Size: $60,500 USDC
Total HM: 7
Participants: 72
Period: 7 days
Judge: Picodes
Total Solo HM: 2
Id: 309
League: ETH
Rank: 36/72
Findings: 1
Award: $54.88
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Sathish9098
Also found by: 0xAadi, 0xHelium, 0xSmartContract, Bulletprime, K42, Raihan, ZanyBonzy, catellatech, fouzantanveer, foxb868, tala7985
The Panoptic protocol facilitates the creation of option contracts for UniswapV3 positions. It enables option sellers to create option contracts with up to four legs, such as covered PUT/CALL options. This is achieved by substituting the UniswapV3 FungiblePositionManager
(ERC721) contract with Panoptic's SemiFungiblePositionManager
(ERC1155). The protocol empowers users to trade their liquidity positions seamlessly as option positions.
The pivotal contracts in this Audit for the protocol are:
SemiFungiblePositionManager.sol
, provides a function to execute multiple calls in a single transaction. The purpose of this contract is to provide flexibility to SemiFungiblePositionManager
to create multiple positions and cover positions in a single transaction.ERC1155
token standard without metadata, adapted from Solmate's minimalist implementation of the ERC1155
token. This contract is inherited by SemiFungiblePositionManager.sol
to facilitate the implementation of option positions. It is specifically employed in SemiFungiblePositionManager to handle positions, effectively replacing the ERC721
implementation in the UniswapV3’s FungiblePositionManager
contract.tickLower
, tickUpper
, and liquidity
.ERC1155
tokenIds, accommodating a pool identifier and supporting up to four complete position legs.In the process of auditing the smart contracts, I delved into comprehending the details of both the FungiblePositionManager
contract in UniswapV3 and the SemiFungiblePositionManager
contract in Panoptic, which are pivotal in creating option positions. My approach involved a meticulous understanding of the code base, conducting a thorough code review to ensure solidity and security. To validate the functionality and robustness of the contracts, I actively engaged in compiling the code and experimenting with various test cases. This comprehensive examination allowed me to assess the contracts' resilience and functionality under different scenarios, contributing to a holistic evaluation of their performance and security measures.
The codebase under scrutiny demonstrates exceptional quality, boasting both high readability and thorough documentation through well-placed comments. Despite grappling with intricate concepts, the code remains explanatory, ensuring auditors and developers can easily comprehend its functionality.
The codebase exhibits a high degree of modularity, effectively segregating complex additional logics into libraries, particularly for mathematics and fee calculations. Additionally, distinct contract types are utilized for data encoding, streamlining the storage of option details. Notably, the SemiFungiblePositionManager
contract enhances readability by segregating business logics for minting and burning options into separate functions.
All contracts are meticulously commented, offering valuable insights into functionality. This proves invaluable for auditors and developers, aiding in visualizing how options behave within specific tick ranges. Comments also elucidate the fee distribution or collection processes, contributing to a comprehensive understanding of this complex protocol.
The protocol's contracts have a minimal number of external libraries, with well-coded and commented implementations. All the contracts used named imports of libraries, which enhance the overall quality of the contracts.
A noteworthy feature is the absence of access controls on any protocol functions, promoting a high degree of decentralization, transparency, and simplicity.
User-interacting functions exposed by the SemiFungiblePositionManager
contract emit necessary events, all appropriately indexed. Notable events include PoolInitialized
, TokenizedPositionBurnt
, TokenizedPositionMinted
, TransferSingle
, and TransferBatch
.
The contracts excel in error handling, particularly the SemiFungiblePositionManager
contract, which benefits from the dedicated contracts/libraries/Errors.sol
.
However, one defined error, NoLegsExercisable()
, is unused and can be safely removed to reduce contract size. Additionally, it is advisable to implement error handling in safeTransferFrom()
, safeBatchTransferFrom()
, and _burn()
for scenarios where the from address lacks sufficient tokens for the operation.
The Panoptic protocol is implemented as a purely decentralized application without any elements of centralization. The contracts within its scope do not contain any functions that require exclusive access or governance. Furthermore, the protocol interacts with Uniswap V3, which is also a decentralized application, thereby minimizing the risk of centralization within Panoptic.
Due to the lack of centralization risks, Governance, oracles, major Smart Contract Vulnerabilities or Protocol Interdependencies(except uniswapV3) The panoptic protocols seem to have a high degree of protection against systemic risks. However any future attacks on uniswapv3 will affect the Panoptic protocol.
unchecked
block.safeTransferFrom()
, safeBatchTransferFrom()
, and _burn()
methods in contracts/tokens/ERC1155Minima.sol
.safeTransferFrom()
and safeBatchTransferFrom()
methods in contracts/tokens/ERC1155Minima.sol
.36 hours
#0 - c4-judge
2023-12-14T17:15:20Z
Picodes marked the issue as grade-b