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: 56/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
Currently, a lot of contracts are missing a non-zero validation like in the following example:
https://github.com/code-423n4/2023-01-ondo/blob/main/contracts/lending/OndoPriceOracle.sol#L106
Consider adding a non-zero validation in order to reduce the risk of DoS for several functions.
In order to keep the contract size reasonable, I simply raised this issue once.
Currently, the guardian variable is internal. This might make it hard for average users to retrieve this important variable
https://github.com/code-423n4/2023-01-ondo/blob/main/contracts/cash/factory/CashFactory.sol#L48
Consider marking it as public.
*The same issue applies to all factories.
JumpRateModelV2
uses an outdated solidity versionContrary to Compounds JumpRateBaseModelV2
, the aforementioned contract uses an older solidity version with safemath.
https://github.com/code-423n4/2023-01-ondo/blob/main/contracts/lending/JumpRateModelV2.sol#L1
Consider updating the solidity version to >= 0.8.0 and remove safemath.
JumpRateModelV2
uses magic numbers instead of constantshttps://github.com/code-423n4/2023-01-ondo/blob/main/contracts/lending/JumpRateModelV2.sol#L116
Consider implementing a constant variable and use this instead of magic numbers.
https://github.com/code-423n4/2023-01-ondo/blob/main/contracts/cash/CashManager.sol#L128
Consider casting the corresponding types to variables directly in the constructor
https://github.com/code-423n4/2023-01-ondo/blob/main/contracts/cash/CashManager.sol#L215
Currently, the external call is executed before the increase in mintRequestsPerEpoch
. While this doesn't lead to any issues at this point, it is still considered best practice to adhere to CEI. Please note that in terms of the before-after pattern (transfer-tax compatibility) the checks-effects-interactions pattern will be violated.
setMintFee
has no reasonable limitsThe setMintFee
function allows the MANAGER_ADMIN
to set an arbitrary mintFee
which can result in an almost total loss of funds if setted to 9999
. Therefore we suggest a reasonable upper limit for this function. A further escalation point is when a user calls claimMint
and the MANAGER_ADMIN
frontruns the function call, setting mintLimit
to 9999
. However, this is just rated as low since centralization risks are out of scope and we do not expect such behaviour from a trustworthy team like the Flux team. Anyways, an upper bound should still be added.
_processRefund
function doesn't decrease redemptionInfoPerEpoch[epoch].totalBurned
Currently, the _processRefund
function resets redemptionInfoPerEpoch[epochToService].addressToBurnAmt[refundee]
. However, it doesnt decrease redemptionInfoPerEpoch[epoch].totalBurned
.
While this issue doesn't expose a security threat, it might still become a future issue if another smart contract relies on this variable. Due to that fact, one could even raise this as medium issue. However, I will leave this decision by the judge.
Consider decreasing it for each loop step accordingly.
setMintLimit
should at least validate mintLimit >= currentMintAmount
If thats not the case, the requestMintFunction
will underflow without an explicit revert string.
Consider validating mintLimit
to be at least currentMintAmount
. Moreover, if that is ever the case it should be ensured this setting does not get frontrunned, otherwise the same issue will appear.
#0 - c4-judge
2023-01-23T14:45:30Z
trust1995 marked the issue as grade-b