Uniswap / v4-core

🦄 🦄 🦄 🦄 Core smart contracts of Uniswap v4
https://blog.uniswap.org/uniswap-v4
2.04k stars 987 forks source link

spearbit L-04 #840

Closed dianakocsis closed 3 months ago

dianakocsis commented 3 months ago

Related Issue

Spearbit L-04 https://github.com/spearbit-audits/review-uniswap-v4/issues/18

Description of changes

In this previous commit (https://github.com/Uniswap/v4-core/pull/837), I changed the name feeForProtocol to amountToProtocol to make it more clear that it is the actual amount, and to avoid confusion with protocolFee which is in pips. In this commit, I add a comment for more clarity before returning

github-actions[bot] commented 3 months ago
Forge code coverage: File % Lines % Statements % Branches % Funcs
src/ERC6909.sol 91.30% (21/23) 85.71% (24/28) 100.00% (2/2) 85.71% (6/7)
src/ERC6909Claims.sol 100.00% (6/6) 100.00% (8/8) 100.00% (2/2) 100.00% (1/1)
src/Extsload.sol 100.00% (28/28) 93.33% (28/30) 0.00% (0/2) 100.00% (3/3)
src/Exttload.sol 13.33% (2/15) 12.50% (2/16) 0.00% (0/1) 50.00% (1/2)
src/NoDelegateCall.sol 100.00% (3/3) 100.00% (4/4) 100.00% (1/1) 100.00% (3/3)
src/PoolManager.sol 100.00% (96/96) 98.50% (131/133) 89.47% (17/19) 100.00% (20/20)
src/ProtocolFees.sol 100.00% (24/24) 96.77% (30/31) 80.00% (4/5) 100.00% (6/6)
src/libraries/BitMath.sol 100.00% (11/11) 100.00% (11/11) 100.00% (4/4) 100.00% (2/2)
src/libraries/CurrencyDelta.sol 100.00% (9/9) 100.00% (11/11) 100.00% (0/0) 100.00% (3/3)
src/libraries/CurrencyReserves.sol 85.71% (6/7) 85.71% (6/7) 0.00% (0/1) 100.00% (5/5)
src/libraries/CustomRevert.sol 100.00% (35/35) 100.00% (35/35) 100.00% (0/0) 100.00% (8/8)
src/libraries/FullMath.sol 100.00% (29/29) 100.00% (33/33) 100.00% (6/6) 100.00% (2/2)
src/libraries/Hooks.sol 100.00% (85/85) 98.57% (138/140) 88.00% (22/25) 100.00% (14/14)
src/libraries/LPFeeLibrary.sol 100.00% (10/10) 100.00% (16/16) 100.00% (1/1) 100.00% (7/7)
src/libraries/LiquidityMath.sol 100.00% (4/4) 100.00% (4/4) 100.00% (1/1) 100.00% (1/1)
src/libraries/Lock.sol 100.00% (3/3) 100.00% (3/3) 100.00% (0/0) 100.00% (3/3)
src/libraries/NonzeroDeltaCount.sol 100.00% (7/7) 100.00% (7/7) 100.00% (0/0) 100.00% (3/3)
src/libraries/ParseBytes.sol 100.00% (3/3) 100.00% (3/3) 100.00% (0/0) 100.00% (3/3)
src/libraries/Pool.sol 99.36% (155/156) 99.42% (170/171) 98.08% (51/52) 100.00% (13/13)
src/libraries/Position.sol 100.00% (19/19) 100.00% (21/21) 100.00% (3/3) 100.00% (3/3)
src/libraries/ProtocolFeeLibrary.sol 100.00% (10/10) 100.00% (10/10) 100.00% (0/0) 100.00% (4/4)
src/libraries/SafeCast.sol 100.00% (10/10) 100.00% (16/16) 100.00% (5/5) 100.00% (5/5)
src/libraries/SqrtPriceMath.sol 100.00% (49/49) 100.00% (64/64) 100.00% (12/12) 100.00% (9/9)
src/libraries/StateLibrary.sol 100.00% (63/63) 100.00% (87/87) 100.00% (4/4) 100.00% (14/14)
src/libraries/SwapMath.sol 100.00% (26/26) 100.00% (27/27) 100.00% (6/6) 100.00% (2/2)
src/libraries/TickBitmap.sol 100.00% (30/30) 100.00% (36/36) 100.00% (3/3) 100.00% (4/4)
src/libraries/TickMath.sol 100.00% (120/120) 100.00% (166/166) 100.00% (24/24) 100.00% (4/4)
src/libraries/TransientStateLibrary.sol 100.00% (10/10) 100.00% (13/13) 100.00% (0/0) 100.00% (5/5)
src/libraries/UnsafeMath.sol 100.00% (1/1) 100.00% (1/1) 100.00% (0/0) 100.00% (1/1)
src/types/BalanceDelta.sol 100.00% (2/2) 100.00% (2/2) 100.00% (0/0) 100.00% (2/2)
src/types/BeforeSwapDelta.sol 100.00% (2/2) 100.00% (2/2) 100.00% (0/0) 100.00% (2/2)
src/types/Currency.sol 100.00% (23/23) 96.88% (31/32) 100.00% (8/8) 100.00% (7/7)
src/types/PoolId.sol 100.00% (1/1) 100.00% (1/1) 100.00% (0/0) 100.00% (1/1)
src/types/Slot0.sol 100.00% (8/8) 100.00% (8/8) 100.00% (0/0) 100.00% (8/8)
Total 84.69% (1676/1979) 83.78% (2133/2546) 51.79% (332/641) 81.40% (385/473)
dianakocsis commented 3 months ago

we mentioned also changing protocolFee to protocolFeePips, but I kind of like how lpFee, swapFee, and protocolFee are all in pips. If we change it protocolFeePips, I think we should also do lpFeePips and swapFeePips