SettlementBranch::fillOffchainOrders
function documentation is to allow traders trading account's position (buy order), the fill price must be less than or equal to the target price, if it decreases the trading account's position (sell order), the fill price must be greater than or equal to the target price.\
SettlementBranch::fillOffchainOrders
function does not perform the implementation as in the documentation. Traders would not be able to make profit because orders can not be filled.
if the order increases the trading account's position (buy order), the fill price must be less than or // equal to the target price, if it decreases the trading account's position (sell order), the fill price // must be greater than or equal to the target price.
This can enable a malicious trader to make profit because orders can not be filled.
manual review plus foundry test
ctx.isFillPriceValid = (!ctx.isBuyOrder && ctx.offchainOrder.targetPrice <= ctx.fillPriceX18.intoUint256()) || (ctx.isBuyOrder && ctx.offchainOrder.targetPrice >= ctx.fillPriceX18.intoUint256());
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.