Whenever a Trader crates an order and it's being settled if the user had a positive Pnl it is credited back to the Trader.The credit to the trader is made in `USD`, `Usd` already deposited into the contract from a previous traders profit.
This can lead to most profitable traders not recieving the credit they deserve. This is because when the amount `usd ` in the exact amount from a previous traders profit.
For example; first trader `ctx.marginToAddX18` is 100 usd and there's 120 USD in the contract the first trader will get 100usd deposited to their collateral margin and that same exact 100usd is minted back to the contract.
If the second trader comes trying to claim a profit of 200usd this will fail ass there's only 120 USD left in the contract.
Note:: If `USD` will be sent directly to the contract it might get too much than needed for credit getting them stuck in the contract as there's now way to recover such tokens. Adviced way to credit users is stated in the recommendation.
Profitable users who profit than the previous trader won't be able to claim profits when adjusting their positions .
Manual Review
Check the contract balance in `usd` if it's enough to cover the credit if it's not enough mint the exact amount need to cover the credit, this will ensure there's no excess USD left in the contract.
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.