The getSlipAdustment implementation of Utils is inconsistent with the Thorchain liquidity model. The slip adjustment in Utils is calculated as (1 - ABS((B t - b T)/((2 b + B) (t + T)))). However, the slip adjustment in the Thorchain model is defined as (1 - ABS((B t - b T)/((b + B) (t + T)))), without the constant 2. The inconsistency could cause users to get different number of LP tokens when adding liquidity.
Handle
shw
Vulnerability details
Impact
The
getSlipAdustment
implementation ofUtils
is inconsistent with the Thorchain liquidity model. The slip adjustment inUtils
is calculated as(1 - ABS((B t - b T)/((2 b + B) (t + T))))
. However, the slip adjustment in the Thorchain model is defined as(1 - ABS((B t - b T)/((b + B) (t + T))))
, without the constant 2. The inconsistency could cause users to get different number of LP tokens when adding liquidity.Proof of Concept
Referenced code: Utils.sol#L97 Utils.sol#L101
Recommended Mitigation Steps
Remove the constant 2 at line 101. By the way, there is a typo in the function name, which should be
getSlipAdjustment
instead.