The function CreditDelegationBranch::withdrawUsdTokenFromMarket mints USD tokens based on the requested amount but does not verify whether this action maintains the market’s debt ratio after minting. The function only ensures that the credit capacity is greater than zero before proceeding but does not re-evaluate the debt ratio after minting the tokens. This oversight may lead to unintended deleveraging, potentially undermining the market's stability. This can change the debt to credit ratio significantly after minting. But there are no checks after usd mint to ensure good health of the market
The function verifies that the creditCapacityUsdX18 is greater than zero before proceeding. It then mints USD tokens based on the requested amount without re-evaluating whether the minting causes a significant change in the market’s debt ratio. The check for creditCapacityUsdX18 is performed before minting, meaning that once tokens are minted, the updated debt ratio is not validated.
If the minting process increases the market’s debt significantly, it could lead to undesirable deleveraging, which might cause a market imbalance. In bull season, when there's too many positive PnL, the debt will continue to increase due to unrest
Since the function does not ensure that the new debt ratio remains within acceptable limits after minting, the system may allow excessive debt accumulation.
If the market unintentionally enters a deleverage state, it may force unnecessary liquidations or lead to a shortfall in collateral backing
Manual code review
Introduce a maxDebtRatio threshold beyond which minting is disallowed.
Before finalizing the minting process, verify that the debt ratio remains within permissible bounds.
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.