DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: low
Invalid

Misleading Variable Naming in getPositionInfo

VaultReader.sol

In the getPositionInfo function the code does this:

uint256 sizeInTokens = getPositionSizeInUsd(key); if (sizeInTokens == 0) { … }

Here the variable is named “sizeInTokens” even though it’s actually reading the USD value (using the SIZE_IN_USD constant). This misnaming risks confusion in future modifications or integrations—if developers assume it represents the token amount, they might make incorrect calculations.
Recommendation: Rename the variable (for example, to “sizeInUsd”) so that its purpose is clear and aligns with the underlying datastore key.

Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality
Assigned finding tags:

invalid_getPosition_sizeInTokens_value_in_USD

Only check if there are no tokens. Checking if USD is 0 is equivalent. There is no problem here, even if the variable has an incorrect name: Informational.

Support

FAQs

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

Give us feedback!