If a user wants to deposit LP tokens, the maximum ratio of (PnL / value of tokens in the pool) was established with the withdrawal limit and not for deposits accordingly.
The price of a market token depends on the value of the assets in the pool and net pending PnL of traders open positions. This limit is the PnL factor that calculates the price of the market token.
The caps used to calculate the market token price may differ depending on activity, deposits or withdrawals (in our implementation).
But, when this function is called in deposit()
:
The PnL factor limit when calculating the market token price for deposits, is used with the MAX_PNL_FACTOR_FOR_WITHDRAWALS
, which would be used when calculating the market token price of the market token for withdrawals.
Deposits above MAX_PNL_FACTOR_FOR_DEPOSITS are not allowed but the function is called with MAX_PNL_FACTOR_FOR_WITHDRAWALS.
Manual Code Review
Update to correct state when user wants to deposit with LP tokens:
Impact: Medium Likelihood: High The impact of using a wrong price (conservative vs optimistic) is limited, especially given the users specify the slippage.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.