DeFiFoundrySolidity
16,653 OP
View results
Submission Details
Severity: medium
Invalid

claimAndSwap may fail due to incorrect validation

Summary

The claimAndSwap function relies on swapUnderlyingToAsset to swap tokens. However, the condition in _swapUnderlyingToAsset:

require(minOut > _amount, "minOut too low");

is flawed and may prevent valid swaps. This issue can cause the claimAndSwap function to fail unnecessarily, especially when the output token is of lower value or a different denomination compared to the input token.

Vulnerability Details

The problematic condition in _swapUnderlyingToAsset enforces that minOut must always be greater than _amount. This logic assumes that the output token will always have a higher or equal value to the input token, which is not universally true.

Pegged tokens like WETH and ALETH, which are designed to have a 1:1 value relationship, should allow equal-value swaps without requiring a premium. However, the current logic in the code enforces that minOut > _amount, which unnecessarily blocks valid 1:1 swaps (e.g., swapping 10 WETH for 10 ALETH). This restriction can result in failed transactions even when the swap is fair and aligns with the pegged value. Furthermore, if the protocol's intention is to enforce a premium for swaps, this behavior should be explicitly documented to avoid confusion, as it contradicts the expected 1:1 pegged behavior

Impact

The unnecessary restriction on 1:1 swaps can lead to failed transactions, disrupting protocol usability and potentially causing inefficiencies or user dissatisfaction.

Tools Used

Manual Review

Recommendations

require(minOut >= _amount, "minOut too low");
Updates

Appeal created

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.