Platform: Code4rena
Start Date: 11/01/2023
Pot Size: $60,500 USDC
Total HM: 6
Participants: 69
Period: 6 days
Judge: Trust
Total Solo HM: 2
Id: 204
League: ETH
Rank: 46/69
Findings: 1
Award: $36.24
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: CodingNameKiki
Also found by: 0x1f8b, 0x52, 0x5rings, 0xAgro, 0xSmartContract, 0xcm, 0xkato, 2997ms, Aymen0909, BClabs, BPZ, BRONZEDISC, Bauer, Bnke0x0, Deekshith99, IllIllI, Josiah, Kaysoft, RaymondFam, Rolezn, SaeedAlipoor01988, Tajobin, Udsen, Viktor_Cortess, adriro, arialblack14, betweenETHlines, btk, chaduke, chrisdior4, cryptphi, csanuragjain, cygaar, defsec, descharre, erictee, gzeon, hansfriese, horsefacts, joestakey, koxuan, lukris02, luxartvinsec, nicobevi, oyc_109, pavankv, peanuts, rbserver, scokaf, shark, tnevler, tsvetanovv, zaskoh
36.2377 USDC - $36.24
In the following contract, int answer
is required to be >= 0
. However, this allows int answer
to be zero, meaning a pointlessly scaled zero value could be returned.
File: OndoPriceOracleV2.sol
Line 297
require(answer >= 0, "Price cannot be negative");
Instead of the above, consider refactoring to:
require(answer > 0, "Price must be greater than zero");
See this: docs.soliditylang.org/en/v0.8.14/units-and-global-variables.html#time-units
With that in mind, the following declaration may be refactored:
File: OndoPriceOracleV2.sol
Line 77
uint256 public maxChainlinkOracleTimeDelay = 90000; // 25 hours
From the above to, this:
uint256 public maxChainlinkOracleTimeDelay = 25 hours;
Using the delete
keyword more clearly states your intention.
For example:
File: CashManager.sol
Line 259
mintRequestsPerEpoch[epochToClaim][user] = 0;
The above instance could be refactored to use the delete
keyword:
delete mintRequestsPerEpoch[epochToClaim][user];
It is not recommended to spell words incorrectly as this will decreases readability. However, this is issue is present in many contracts. Consider fixing the following typos to increase readability:
File: KYCRegistry.sol
(Line 62, Line 205, Line 236)
/// @audit sucessfully -> successfully vvvvvvvvvvv 62: * `kycRequirementGroup`. In order to sucessfully call this function, /// @audit elligible -> eligible vvvvvvvvv 205: * @param addresses Array of addresses being added as elligible /// @audit same typo above.. 236: * @param addresses Array of addresses being added as elligible
File: CCash.sol
Line 117, Line 165
File: CErc20.sol
Line 117, Line 165
/// @audit payed -> paid vvvvv 117: * @param borrower the account with the debt being payed off /// @audit fo --> of vv 165: * @param addAmount The amount fo underlying token to add as reserves
File: OndoPriceOracleV2.sol
Line 26
/// @audit comnmon -> common vvvvvvv 26: /// @notice Helper interface for standardizing comnmon calls to
File: CashManager.sol
(Line 121, Line 333)
/// @audit "Role Based" -> "Role-Based" 121: /// @dev Role Based Access control members /// @audit "front running" --> "front-running" 333: * @dev `oldBalance` is provided to prevent front running attacks where a
Using import declarations will speed up compilation, and avoids polluting the namespace making flattened files smaller.
Here are some instances of this issue:
Cash.sol
Line 18CashKYCSender.sol
Line 18CashKYCSender.sol
Line 19CashKYCSenderReceiver.sol
Line 18CashKYCSenderReceiver.sol
Line 19I
Interfaces names should be prefixed with I
. However, some interfaces are not following this rule. This can lead to confusion due to inconsistency with some being prefixed and some not.
CCash.sol
Line 6cErc20ModifiedDelegator.sol
Line 9IOndoPriceOracle.sol
Line 18OndoPriceOracle.sol
Line 21OndoPriceOracle.sol
Line 27uint
instead of uint256
uint
is just a shorthand of uint256
. As such, consider replacing any instances of uint
with uint256
. This will improve explicitness.
JumpRateModelV2.sol
(entire contract)IOndoPriceOracle.sol
Line 24IOndoPriceOracleV2.sol
Line 24#0 - c4-judge
2023-01-23T10:57:07Z
trust1995 marked the issue as grade-b