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
The _zap function uses 50:50 split of amountIn of tokenIn to supply to the uniswap v2 pool. This is highly unefficient strategy. In this strategy, there are also chances of unutilized assets remaining in user's balance.
Two major problems arise when swapping from one asset to another:
Swap fee (0.3% for Uniswap) - With swap fee, the user receives slightly less amount of the swap out asset.
The new reserve's asset ratio - The swap alters the reserve ratio, increasing the amount of supplied asset and decreasing the amount of the withdrawn asset.
Thus, the optimal swap amount needs to take into account these issues. In this article, they explored formula (with proofs!) to solve the optimal swap amount for supplying one-sided liquidity.
For further context, zapper also used the formula mentioned in the above article for depositing single sided liquidity in uniswap v2 pools.
recommendation
Consider using the formula proved in above article to zap into uniswap v2 pools efficiently.
locations
code/contracts/SoulZap_UniV2.sol#L272-L273
code/contracts/SoulZap_UniV2.sol#L281-L307
severity
Medium
Secure3 Audit - Issue 47 Acknowledged
description
The _zap function uses 50:50 split of amountIn of tokenIn to supply to the uniswap v2 pool. This is highly unefficient strategy. In this strategy, there are also chances of unutilized assets remaining in user's balance.
Two major problems arise when swapping from one asset to another:
Swap fee (0.3% for Uniswap) - With swap fee, the user receives slightly less amount of the swap out asset.
The new reserve's asset ratio - The swap alters the reserve ratio, increasing the amount of supplied asset and decreasing the amount of the withdrawn asset.
Thus, the optimal swap amount needs to take into account these issues. In this article, they explored formula (with proofs!) to solve the optimal swap amount for supplying one-sided liquidity.
For further context, zapper also used the formula mentioned in the above article for depositing single sided liquidity in uniswap v2 pools.
recommendation
Consider using the formula proved in above article to zap into uniswap v2 pools efficiently.
locations
code/contracts/SoulZap_UniV2.sol#L272-L273
code/contracts/SoulZap_UniV2.sol#L281-L307
severity
Medium
category
Logical
secure3_internal_use
updated_at: 2023-11-30 14:02:36
html_url: https://github.com/Secure3Audit/review_Apebond/issues/39
The text was updated successfully, but these errors were encountered: