Panoptic - jasonxiale's results

Permissionless, perpetual options trading on any token, any strike, any size.

General Information

Platform: Code4rena

Start Date: 01/04/2024

Pot Size: $120,000 USDC

Total HM: 11

Participants: 55

Period: 21 days

Judge: Picodes

Total Solo HM: 6

Id: 354

League: ETH

Panoptic

Findings Distribution

Researcher Performance

Rank: 39/55

Findings: 1

Award: $32.96

🌟 Selected for report: 0

🚀 Solo Findings: 0

[L-01]CollateralTracker.totalAssets doesn't follow the documents

File: https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/CollateralTracker.sol#L370-L374

function CollateralTracker.totalAssets is defined in CollateralTracker.sol#L370-L374

 370     function totalAssets() public view returns (uint256 totalManagedAssets) {
 371         unchecked {
 372             return s_poolAssets + s_inAMM;
 373         }
 374     }

But quoting from API documents:

the amount of funds moved from the PanopticPool to Uniswap (_inAMM()), and the amount of fees that have been collected but are currently locked (_lockedFees()).

[L-02]CollateralTracker.maxMint's implementation isn't correct

File: https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/CollateralTracker.sol#L444-L448

While containing COMMISSION_FEE, in CollateralTracker.maxMint, the function is implementation as:

    function maxMint(address) external view returns (uint256 maxShares) {
        unchecked {
            return (convertToShares(type(uint104).max) * DECIMALS) / (DECIMALS + COMMISSION_FEE);
        }
    }

which means:

maxShares = Math.mulDiv(assets, totalSupply, totalAssets()) * DECIMALS / (DECIMALS + COMMISSION_FEE);

But all others functions calculates shares as

shares = Math.mulDiv(assets * (DECIMALS - COMMISSION_FEE), totalSupply,totalAssets() * DECIMALS);

[L-03] SemiFungiblePositionManager.swapInAMM uses constant as slippage protection

File: https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/SemiFungiblePositionManager.sol#L837-L845

In SemiFungiblePositionManager.sol#L837-L845, Constants.MIN_V3POOL_SQRT_RATIO and Constants.MAX_V3POOL_SQRT_RATIO is used as slippage protection, which might cause sandwich attack

[L-04] PanopticFactory.minePoolAddress might return wrong results.

File: https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/PanopticFactory.sol#L299-L301

In PanopticFactory.minePoolAddress,while calculates maxSalt, unchecked is used to wrap maxSalt = uint256(salt) + loops; The issue is that if uint256(salt) + loops > type(uint).max, the function will not revert because of unchecked, instead, it'll overwrite the slot. In such case, the function will not fall into the for loop

#0 - c4-judge

2024-04-26T17:16:40Z

Picodes marked the issue as grade-b

#1 - crazy4linux

2024-05-07T14:52:51Z

Hi, @Picodes I think [L-02]CollateralTracker.maxMint's implementation isn't correct is dup of https://github.com/code-423n4/2024-04-panoptic-findings/issues/501

#2 - Picodes

2024-05-09T23:13:42Z

Indeed - but #501 was downgraded to QA in the meantime

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter