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

Uninitialized MarketPrices Variable in Deposit Flow

Summary

In the deposit function, a MarketPrices variable is declared and passed to the _mint function without being assigned any actual price data. Since MarketPrices is later used in functions like _totalAmount, this uninitialized variable could lead to incorrect computations or unintended behavior when price-dependent logic is executed.

Vulnerability Details

  • Issue Explanation:

  • The MarketPrices variable (prices) is declared as a memory variable but is never assigned any concrete price values.

  • This uninitialized prices is passed to the _mint function, which may in turn use it for computations involving current token prices.

  • The _totalAmount function uses the prices parameter to calculate values based on market prices:

If prices remains uninitialized (i.e., contains default zero values), any calculations based on its fields (e.g., prices.indexTokenPrice.min or prices.shortTokenPrice.min) may result in division by zero errors, invalid totals, or other unintended behavior.

Impact

  • Incorrect Calculations:
    The reliance on an uninitialized MarketPrices variable can result in erroneous minting amounts or inaccurate valuation of the protocol’s total assets. This may adversely affect share token issuance and overall system accounting.

Tools Used

manual review

Recommendations

Initialize MarketPrices Properly:
Modify the deposit function to retrieve and assign correct market price data to the MarketPrices variable before passing it to _mint. For example:

Updates

Lead Judging Commences

n0kto Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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