calculateOpenParams uses collateralTokenDec and borrowTokenDec from TradeDetails in all value conversions: totalCollateralValueUSD, borrowAmount, and borrowValueInCollateral. These decimals drive the entire leverage and borrow calculation.
The caller provides decimals directly; the function does not validate them against the actual token decimals from IERC20(token).decimals(). A wrong value (e.g. 18 for USDC which has 6 decimals) produces incorrect flashLoanAmount, borrowAmount, and fails the borrowValueInCollateral >= minRequiredAfterSwap check or creates suboptimal positions.
Likelihood (low):
Frontends typically read decimals from the token contract; manual or cached values can be wrong.
Integrators or scripts may hardcode decimals incorrectly for new tokens.
Impact (low):
Wrong decimals → incorrect borrowAmount and flashLoanAmount → failed createLeveragedPosition (revert at health factor or swap check) or suboptimal under-leveraged positions.
Owner leaves value on the table or wastes gas on reverting transactions.
Severity (low):
Fetch decimals from the token contracts instead of trusting caller input:
Optionally remove collateralTokenDec and borrowTokenDec from TradeDetails for this function, or document that they are ignored when fetched on-chain.
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.