Omniscia Arcade XYZ Audit

OriginationController Code Style Findings

OriginationController Code Style Findings

OCR-01C: Ineffectual Usage of Safe Arithmetics

Description:

The linked mathematical operations are guaranteed to be performed safely by surrounding conditionals evaluated in either require checks or if-else constructs.

Example:

contracts/OriginationController.sol
974if (repayAmount > borrowerOwedForNewLoan) {
975 // amount to collect from borrower
976 // new loan principal is less than old loan repayment amount
977 amounts.needFromBorrower = repayAmount - borrowerOwedForNewLoan;
978} else {
979 // amount to collect from lender (either old or new)
980 amounts.leftoverPrincipal = amounts.amountFromLender - repayAmount;
981
982 // amount to send to borrower
983 amounts.amountToBorrower = borrowerOwedForNewLoan - repayAmount;
984}

Recommendation:

Given that safe arithmetics are toggled on by default in pragma versions of 0.8.X, we advise the linked statements to be wrapped in unchecked code blocks thereby optimizing their execution cost.

Alleviation (0a7551b095ee0dc4fb2a56d2267e05472128cf0e):

The unchecked code blocks have been introduced to all referenced calculations, addressing this exhibit in full.

OCR-02C: Loop Iterator Optimizations

Description:

The linked for loops increment / decrement their iterator "safely" due to Solidity's built - in safe arithmetics (post-0.8.X).

Example:

contracts/OriginationController.sol
583for (uint256 i = 0; i < tokens.length; ++i) {

Recommendation:

We advise the increment / decrement operations to be performed in an unchecked code block as the last statement within each for loop to optimize their execution cost.

Alleviation (7a4e1dc948e94ded7385dbb74818bcf93ecc207c):

All referenced iterator optimizations have been applied, addressing this exhibit in full.