calculateOpenParams chains multiple arithmetic operations where intermediate division truncates before a subsequent multiplication. In Solidity, integer division floors the result — dividing before multiplying compounds truncation errors across the calculation chain.
Likelihood:
Triggered on every call to calculateOpenParams — all position openings are affected
Precision loss is larger for tokens with fewer decimals (USDC at 6 decimals) and larger collateral amounts
Impact:
Borrow amount is systematically understated — users receive less leverage than calculated
The require(borrowValueInCollateral >= minRequiredAfterSwap) check at line 441 can fail incorrectly due to truncation on small amounts
At 1𝑀+𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛𝑠𝑖𝑧𝑒𝑠,𝑐𝑜𝑚𝑝𝑜𝑢𝑛𝑑𝑒𝑑𝑡𝑟𝑢𝑛𝑐𝑎𝑡𝑖𝑜𝑛𝑐𝑎𝑛𝑟𝑒𝑝𝑟𝑒𝑠𝑒𝑛𝑡1M+positionsizes,compoundedtruncationcanrepresent100–$200 in underborrow per transaction
Reorder the arithmetic to perform all multiplications in a single expression before the final division. This preserves the full precision of intermediate values and eliminates the compounding truncation that occurs when dividing to an intermediate variable and then multiplying again.
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.
The contest is complete and the rewards are being distributed.