code-423n4 / 2023-11-shellprotocol-findings

7 stars 7 forks source link

Handling Potential Slippage Due to Truncation #255

Closed c4-bot-2 closed 9 months ago

c4-bot-2 commented 9 months ago

Lines of code

https://github.com/code-423n4/2023-11-shellprotocol/blob/485de7383cdf88284ee6bcf2926fb7c19e9fb257/src/adapters/CurveTricryptoAdapter.sol#L227

Vulnerability details

Impact

The potential slippage issue arises from the precision loss during decimal conversion in the primitiveOutputAmount function. When interacting with the Curve Tricrypto Pool, especially involving tokens with different decimal precisions, truncation can lead to a smaller outputAmount than expected. This discrepancy might cause transactions to fail due to slippage checks, impacting user experience and transaction efficiency.

Proof of Concept

Consider a user swapping tokens in the Shell Protocol:

Tools Used

Recommended Mitigation Steps

Assessed type

Decimal

c4-pre-sort commented 9 months ago

raymondfam marked the issue as insufficient quality report

c4-pre-sort commented 9 months ago

raymondfam marked the issue as duplicate of #87

c4-judge commented 9 months ago

0xA5DF marked the issue as unsatisfactory: Invalid