Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to improve the the liquidity add calculations #13

Open
DeFiFoFum opened this issue Dec 5, 2023 · 0 comments
Open

Possible to improve the the liquidity add calculations #13

DeFiFoFum opened this issue Dec 5, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@DeFiFoFum
Copy link
Contributor

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

@DeFiFoFum DeFiFoFum added the enhancement New feature or request label Dec 5, 2023
DeFiFoFum added a commit that referenced this issue Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant