Platform: Code4rena
Start Date: 07/09/2022
Pot Size: $20,000 CANTO
Total HM: 7
Participants: 65
Period: 1 day
Judge: 0xean
Total Solo HM: 3
Id: 159
League: ETH
Rank: 39/65
Findings: 1
Award: $39.22
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: lukris02
Also found by: 0x040, 0x1f8b, 0x52, 0xA5DF, 0xNazgul, 0xSky, Bnke0x0, Bronicle, CertoraInc, Chom, CodingNameKiki, Deivitto, Diraco, Dravee, EthLedger, IgnacioB, JC, JansenC, Jeiwan, R2, RaymondFam, ReyAdmirado, Rolezn, SinceJuly, TomJ, Tomo, Yiko, a12jmx, ajtra, ak1, codexploder, cryptphi, csanuragjain, erictee, fatherOfBlocks, gogo, hake, hansfriese, hickuphh3, ignacio, ontofractal, oyc_109, p_crypt0, pashov, peritoflores, rajatbeladiya, rbserver, rokinot, rvierdiiev, tnevler
242.8216 CANTO - $39.22
Solidity integer division might truncate. As a result, performing multiplication before division can sometimes avoid loss of precision. Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#divide-before-multiply
uint token0TVL = assetReserves[i] * (prices[i] / decimals);
Consider ordering multiplication before division.
 
It is best practice to define magic numbers to constant rather than just using as a magic number. This improves code readability and maintainability.
./BaseV1-periphery.sol:18: return 1e18 * 1e18 / (10 ** decimals); //Scale Price as a mantissa to maintain precision in comptroller ./BaseV1-periphery.sol:22: return 1e18 * 1e18 / (10 ** decimals); //Scale Price as a mantissa to maintain precision in comptroller ./BaseV1-periphery.sol:46: uint decimals = 10 ** token.decimals(); // get decimals of token ./BaseV1-periphery.sol:58: uint decimals = 10 ** token.decimals(); ./BaseV1-periphery.sol:75: decimals = 10 ** (erc20(token1).decimals()); // we must normalize the price of token1 to 18 decimals ./BaseV1-periphery.sol:79: decimals = 10 ** (erc20(token0).decimals()); ./BaseV1-periphery.sol:85: decimals = 10 ** (erc20(token1).decimals()); ./BaseV1-periphery.sol:89: decimals = 10 ** (erc20(token0)).decimals();
./BaseV1-periphery.sol:18: return 1e18 * 1e18 / (10 ** decimals); //Scale Price as a mantissa to maintain precision in comptroller ./BaseV1-periphery.sol:22: return 1e18 * 1e18 / (10 ** decimals); //Scale Price as a mantissa to maintain precision in comptroller
Define magic numbers to constant.