Uniswap / v4-core

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

sb14: use isAddressZero #834

Closed snreynolds closed 3 months ago

snreynolds commented 3 months ago

fixes spearbit informational issue 14

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% (22/22) 96.67% (29/30) 100.00% (8/8) 100.00% (6/6)
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.68% (1675/1978) 83.81% (2132/2544) 51.95% (333/641) 81.36% (384/472)
snreynolds commented 3 months ago

If you want a different name let me know but I don't think we should have two functions that do the same thing called different things

snreynolds commented 3 months ago

Also I very much think that since C01 this makes it way easier to know that you are really dealing with an address that is addr0 and all other addresses will follow the other path. some native tokens are not the zero address