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: 35/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
return price * 1e18 / decimals;
Best practice would be:
return (price * 1e18) / decimals;
Add comments for function:
/** @notice Returns the underlying price of the assets as a mantissa (scaled by 1e18) @param cToken the underlying asset whose value in Canto or stable terms, or part of a canto and note pool will be returned. @dev only comptroller approved cTokens can be returned. **/
Do multiplication before division - best practice would be to wrap division in parentheses.
return getPriceCanto(underlying) * getPriceNote(address(wcanto), false) / 1e18;
Best practice:
return (getPriceCanto(underlying) * getPriceNote(address(wcanto), false)) / 1e18;
/** @notice Gets the price for asset in terms of Canto. @param token_ the token to be priced in Canto. @return price the scaled price of token_ in Canto. **/
/** @notice Gets the price for asset in terms of Note. @param token_ the token to be priced in Note. @param stable whether the token is a stable asset (i.e. 1 token_ = 1 Note). @return price the scaled price of the asset in Note. **/
/** @notice Updates reserves and, on the first call per block, price accumulators. @param balance0 the current balance to be added to reserve. @param balance1 the current balance to be added to reserve. @param reserve0 the current reserve. @param reserve1 the current reserve. @param totalSupply the current total supply.
**/
/** @notice Gets the total sum of reserves for each pair. @param granularity the size of the _reserves arrays when taking a sample of the reserves using sampleReserves(uint, uint). @return (reserveAverageCumulative0 / granularity, reserveAverageCumulative1 / granularity) the mean average for the reserve, given a granularity. **/
/** @notice Gets the time-weighted value for each reserve for a point and window specified by the user. @param points the point to take the window from @param window the size of the time-window to average prices over. @return the time-weighted value for _reserve0 and _reserve1 **/
/** @notice Gets the total supply over granularity. @param granularity the grain to measure the total supply with. @return (totalSupplyCumulativeAvg / granularity) the total supply divided by the sample supply dictated by granularity. **/
/** @notice Gets the time-weighted value for reserves between observation points. @param points the point to start observation at. @param window the size to observe from point. @return _totalSupply the time-weighted average of the total supply from point over a window. **/