sherlock-audit / 2024-03-arrakis-judging

0 stars 0 forks source link

0xrobsol - Inadequate Liquidity Management During Discounted HOT Swaps #77

Closed sherlock-admin3 closed 1 month ago

sherlock-admin3 commented 1 month ago

0xrobsol

high

Inadequate Liquidity Management During Discounted HOT Swaps

Summary

The automated market maker (AMM) system incorporates a function _hotSwap to handle Hybrid Order Type (HOT) swaps. Ive identified a potential issue where the AMM fails to update liquidity parameters during these swaps, even though other aspects such as fees and spot prices are updated. This issue is specifically pronounced in the context of discounted HOT swaps.

Vulnerability Detail

In the _hotSwap function, when executing a swap classified as a discounted HOT, the system updates various parameters including fee settings and the spot price. However, it neglects to update the liquidity metrics, which are crucial for maintaining accurate and fair trading conditions within the AMM. This oversight could lead to discrepancies between the actual liquidity available and the liquidity levels used in trading calculations, potentially impacting price accuracy and market stability.

Impact

The absence of liquidity updates during significant transaction scenarios like discounted HOT swaps can lead to several issues:

Code Snippet

https://github.com/sherlock-audit/2024-03-arrakis/blob/main/valantis-hot/src/HOT.sol#L974-L989

Tool used

Manual Review

Recommendation

Modify the _hotSwap function to include updates to liquidity metrics alongside other updates during discounted HOT swaps. This ensures that all relevant market parameters reflect current conditions.