You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When invest() calculates slippage, it compares the amount of received assets with fees included to the slippage tolerance, while when divest() does the same it compares the amount of received assets without fees included to the slippage tolerance. These two functions are inconsistent and this could lead to higher slippage than expected in divest() when fees are factored in.
Technical Details
The Curve docs describe calc_token_amount(), which is used in divest(), with the following:
This calculation accounts for slippage, but not fees. It should be used as a basis for determining expected amounts when calling add_liquidity or remove_liquidity_imbalance, but should not be considered to be precise!
This means that in invest(), the slippage calculation compares _credit, the initial 3CRV token amount, with amount * ratio, which is the 3CRV value after slippage and fees. In contrast, divest() compares _debt, the initial 3CRV token amount, with meta_amount * ratio, which is the 3CRV value after slippage but without fees.
Impact
Low. The strategy may experience more slippage than expected when divesting from the metapool due to the calculation omitting fees.
Recommendation
Standardize the approach to calculating acceptable slippage when depositing or withdrawing from the metapool. Consider using calc_token_amount() in both invest() and divest().
The text was updated successfully, but these errors were encountered:
When
invest()
calculates slippage, it compares the amount of received assets with fees included to the slippage tolerance, while whendivest()
does the same it compares the amount of received assets without fees included to the slippage tolerance. These two functions are inconsistent and this could lead to higher slippage than expected indivest()
when fees are factored in.Technical Details
The Curve docs describe
calc_token_amount()
, which is used indivest()
, with the following:This means that in
invest()
, the slippage calculation compares_credit
, the initial 3CRV token amount, withamount * ratio
, which is the 3CRV value after slippage and fees. In contrast,divest()
compares_debt
, the initial 3CRV token amount, withmeta_amount * ratio
, which is the 3CRV value after slippage but without fees.Impact
Low. The strategy may experience more slippage than expected when divesting from the metapool due to the calculation omitting fees.
Recommendation
Standardize the approach to calculating acceptable slippage when depositing or withdrawing from the metapool. Consider using
calc_token_amount()
in bothinvest()
anddivest()
.The text was updated successfully, but these errors were encountered: