The judgment condition of ctx.isFillPriceValid
in SettlementBranch::fillOffchainOrders()
is wrong, and the result is opposite to the expected one.
The current code logic is:
For buy orders (ctx.isBuyOrder == true), the code requires that the transaction price (ctx.fillPriceX18) must be greater than or equal to the target price (ctx.offchainOrder.targetPrice). This means that the actual transaction price may be higher than the target price.
For sell orders (ctx.isBuyOrder == false), the code requires that the transaction price (ctx.fillPriceX18) must be less than or equal to the target price (ctx.offchainOrder.targetPrice). This means that the actual transaction price may be lower than the target price.
it does not match the annotation content verification.
This is contrary to the conventional trading logic. Normally:
Buy orders should require that the transaction price is not higher than the target price, that is, the transaction price should be less than or equal to the target price.
Sell orders should require that the transaction price is not lower than the target price, that is, the transaction price should be greater than or equal to the target price.
The judgment condition of ctx.isFillPriceValid
in SettlementBranch::fillOffchainOrders()
is wrong, and the result is opposite to the expected one.
Manual Review
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.