The contract implements a swap function which allows users to swap out some of their collateral tokens to other ones. The calculateMinimumAmountOut calculates the minimum amount that must be expected from the swap in order to stay solvent. We see the issue in the following line.
Here we see the swap value is calculated using the function tokenToEur. However the euroCollateral function is implemented differently as shown.
Here the price is calculated from a time weighted average. The issue is that if this average price is lower than the current price used in the tokenToEur
function, then the euroCollateral value can be lower than the tokenToEur value, reverting the swap. So users trying to swap out all of their collateral will be facing failed transactions.
Due to the difference in pricing methogs, swpas utilizing the full collateral value can revert.
Broken swap functionality in the vaults
Manual Review
Either use tokenToEurAvg in both places, or use tokenToEur in both places.
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.