The _executeOpenOperation() function in Stratax.sol records the borrow token balance before borrowing from Aave, borrows tokens, swaps them via the 1inch router, and then requires the post-swap borrow token balance to exactly equal the pre-borrow balance. This == comparison is a recognised anti-pattern in DeFi protocols that interact with DEX aggregators.
When the 1inch swap is executed with the PARTIAL_FILL flag enabled, the router may consume less than the full desc.amount and return unused tokens to the caller. In this case, the strict equality check fails and the entire flash loan transaction reverts. The 1inch API may return swap data with partial fill enabled depending on market conditions, particularly for illiquid pairs or large amounts.
Notably, the _executeUnwindOperation() function does not impose an equivalent strict equality check on its post-swap balance. It only verifies that the return amount covers the flash loan debt using a tolerant >= comparison. This asymmetry between the two operations suggests the strict equality in the open operation is overly restrictive rather than an intentional design choice.
The contract already has a separate minReturnAmount check inside _call1InchSwap() that provides slippage protection. The strict balance check adds an additional, more fragile constraint on top of this existing safeguard.
This issue has a low impact as no funds are at risk since the transaction reverts atomically. The effect is a denial-of-service on position creation for swap routes where partial fills occur. This issue has a low likelihood as the primary failure scenario requires the 1inch API to return swap data with the PARTIAL_FILL flag, which is not the default behaviour for most token pairs. The likelihood increases for illiquid pairs, large swap amounts, or tokens with unusual decimal counts.
Replace the strict equality check with a tolerant comparison that permits a small dust threshold of remaining borrow tokens. Define a constant DUST_THRESHOLD (for example, 100 wei) and require that the remaining borrow tokens after the swap do not exceed this threshold. Alternatively, remove the strict equality check entirely and rely on the existing minReturnAmount check inside _call1InchSwap() for economic protection, since it already ensures the swap produced sufficient output tokens.
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.