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
Rank: 8/55
Findings: 1
Award: $3,656.84
🌟 Selected for report: 1
🚀 Solo Findings: 0
🌟 Selected for report: petro_1912
Also found by: Joshuajee
3656.842 USDC - $3,656.84
https://github.com/code-423n4/2024-04-panoptic/blob/main/contracts/CollateralTracker.sol#L247-L251 https://github.com/code-423n4/2024-04-panoptic/blob/main/contracts/CollateralTracker.sol#L261-L263
Swap commission is paid on the intrinsic value based on s_ITMSpreadFee
in CollateralTracker
contract.
If s_ITMSpreadFee
is zero, then swap commission can not be paid.
function startToken( bool underlyingIsToken0, address token0, address token1, uint24 fee, PanopticPool panopticPool ) external { __SNIP__ // cache the pool fee in basis points uint24 _poolFee; unchecked { _poolFee = fee / 100; // @audit below fee 0.01%, then _poolFee = 0 } s_poolFee = _poolFee; ... __SNIP__ // Additional risk premium charged on intrinsic value of ITM positions unchecked { s_ITMSpreadFee = uint128((ITM_SPREAD_MULTIPLIER * _poolFee) / DECIMALS); } }
As you can see above code snippet, If fee(Uniswap fee) is below 100, then _poolFee and s_ITMSpreadFee can be zero.
Currently, there are no such pools that have below 0.01% fee on the UniswapV3.
But Uniswap fee level can be adjusted by the governance proposal like November 2021.
Here is the mention about it in Uniswap Protocol.
Uniswap v3 introduces multiple pools for each token pair, each with a different swapping fee. Liquidity providers may initially create pools at three fee levels: 0.05%, 0.30%, and 1%. More fee levels may be added by UNI governance, e.g. the 0.01% fee level added by this governance proposal in November 2021, as executed here.
https://dune.com/jcarnes/The-StableSwap-Wars
Competitions between Protocols like Uniswap and Carbon, more fee levels can be added in the future.
Indeed, there are several discussions on the less fee levels in stable coins pair. https://gov.bancor.network/t/custom-taker-fee-on-stable-to-stable-trades/4370
If protocol fee is less than 100 (i.e fee < 0.01 %), then PanopticPool's swap commission can not be taken.
Manual review
Use Uniswap's DECIMALS (1e6) instead 10_000 and update all code related to DECIMALS.
Uniswap
#0 - c4-judge
2024-04-26T09:51:37Z
Picodes marked the issue as primary issue
#1 - Picodes
2024-04-29T21:44:07Z
This report shows how the current version of the protocol may not support all Uniswap V3 pools whereas the sponsor's label suggests it was there intention, so Medium severity seems appropriate under "broken functionality"
#2 - c4-judge
2024-04-29T21:44:20Z
Picodes marked the issue as satisfactory
#3 - c4-judge
2024-04-29T21:44:23Z
Picodes marked the issue as selected for report