First Flight #21: KittyFi

First Flight #21
Beginner FriendlyDeFiFoundry
100 EXP
View results
Submission Details
Severity: high
Invalid

lack of retrun in getUserMeowllateralInEuros function

Description

The getUserMeowllateralInEuros function lacks a return statement, which can lead to incorrect calculations of user collateral in Euros. This issue can cause unintended results and affect the accuracy of the protocol's operations.

function getUserMeowllateralInEuros(address _user) public view returns (uint256 totalUserMeowllateral) {
uint256 vault_length = vaults.length;
for (uint256 i; i < vault_length;) {
totalUserMeowllateral += IKittyVault(vaults[i]).getUserVaultMeowllateralInEuros(_user);
unchecked {
++i;
}
}
}

Impact

Without the return statement, the function does not provide the calculated collateral in Euros, leading to incorrect results across the protocol and potentially causing financial discrepancies.

Tools Used

Manual Review

Recommendations

Add the missing return statement at the end of the function to ensure it correctly returns the total user collateral in Euros. Here is the corrected version of the function:

function getUserMeowllateralInEuros(address \_user) public view returns (uint256 totalUserMeowllateral) {\
uint256 vault\_length = vaults.length;
for (uint256 i; i < vault_length;) {
totalUserMeowllateral += IKittyVault(vaults[i]).getUserVaultMeowllateralInEuros(_user);
unchecked {
++i;
}
}
return totalUserMeowllateral; // Add this line to return the calculated value

}

Updates

Lead Judging Commences

shikhar229169 Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.