In StabilityBranch.sol:initiateSwap(), the calculation of expectedAmountOut considers only the current vault assets, debt, and amountIn, but ignores protocol fees. Though in StabilityBranch.sol:fulfillSwap(), contract subtracts fees from amountOut and verifies that amountOut - fees does not exceed the initially expected amountOut.
In initiateSwap() contract does not take into account protocol fees for amountOut check:
But in fulfillSwap() contract subtracts fees from amountOut for the check:
The user may omit fees when specifying amountOut, but the contract will still allow them to initiate swap. In result will be cancelled swap and user will have to pay baseFee to refund.
Manual Review
Take in to account protocol fees for amountOut check in initiateSwap().
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.