Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: low

Avoid double casting

Summary

[L-01] Avoid double casting

Consider refactoring the following code, as double casting may introduce unexpected truncations and/or rounding issues.

Furthermore, double type casting can make the code less readable and harder to maintain, increasing the likelihood of errors and misunderstandings during development and debugging.

file: /src/ProxyFactory.sol
///@audit uint256(uint160
226 bytes memory code = abi.encodePacked(type(Proxy).creationCode, uint256(uint160(implementation)));
///@audit (uint160(uint256
228 proxy = address(uint160(uint256(hash)));

https://github.com/Cyfrin/2023-08-sparkn/blob/main/src/ProxyFactory.sol#L228

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.