Distributes the market's unrealized and realized debt to the connected vaults is implementation of Zaros. The debt distribution to vaults calculation is incorrect.
Debt is the amount taken from the liquidity pool used by traders for leverage.
Simple Elaboration of what debt is:
Consider a market maker who deposits $10,000 worth of Ethereum into a liquidity pool:
Liquidity Provision: The market maker receives LP tokens representing their share of the pool.
Trader Borrowing: A trader uses $2,000 of their own funds as collateral and borrows $8,000 from the liquidity pool to open a leveraged position worth $10,000.
Debt for Trader: The trader's debt is $8,000, which they must repay regardless of the outcome of their trade.
Market Maker's Exposure: If the trader's position incurs losses, the market maker's liquidity may be impacted, and they must be prepared for potential losses due to the volatility of the assets in the pool.
The problem with the calculation is looking at unrealized PNL e.g is -10e18 divided by the 100e18 of credit delegated. It will lead to truncated value of 0, which will affect unrealizedDebtUsdPerVaultShare
.
This affects the credit delegation as we can see below, incorrectly calculating the correct conversion rate between assets and shares.
Scale up the debts per vault share by 1e18.
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.