_handleReturn()
estimates the usedFee
by using the max possible gas limit:
This is not necessarily the fee amount which GMX refunds back to Gamma via the refundExecutionFee() callback. Gamma can readily calculate the actual amount refunded by GMX and use that to refund the user but instead it refunds only the amount in excess of max possible callbackGasLimit
via depositInfo[counter].executionFee - usedFee
.
This will almost always lead to no refunds for the user while Gamma itself benefits from the refunds.
User fee refunds not based on actual usage and in majority of txs, users will be given back nothing while Gamma itself keeps on receiving refunds from GMX.
Introduce accounting for the refund received from GMX and use that to base the user's refund calculation on inside _handleReturn()
.
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.