Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

caventa - Curve token swap will likely to fail because fee and slippage consideration are excluded #108

Closed
sherlock-admin2 opened this issue Nov 29, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin2
Copy link
Contributor

sherlock-admin2 commented Nov 29, 2023

caventa

medium

Curve token swap will likely to fail because fee and slippage consideration are excluded

Summary

Token swap in Curve Finance will likely to fail because it does not consider fee and slippage.

Vulnerability Detail

The code does not account for slippage or trading fees. It uses the output from get_dy to directly set the minimum acceptable output in the exchange function. However, get_dy only provides an estimate and does not include potential slippage or fees incurred during the swap.

Impact

Due to the lack of slippage and fee consideration, there's a significant risk that the actual output of the swap will be less than the input amount, leading the transaction to fail. This can result in wasted gas fees and a failed swap.

Code Snippet

https://github.com/sherlock-audit/2023-11-convergence/blob/main/sherlock-cvg/contracts/utils/SdtUtilities.sol#L150-L152
https://github.com/sherlock-audit/2023-11-convergence/blob/main/sherlock-cvg/contracts/utils/SdtUtilities.sol#L93-L96

Tool used

Manual Review

Recommendation

Introduce a slippage tolerance percentage to calculate the minimum acceptable output amount.

Duplicate of #180

@github-actions github-actions bot closed this as completed Dec 2, 2023
@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Dec 2, 2023
@sherlock-admin2 sherlock-admin2 changed the title Bright Blue Worm - Curve token swap will likely to fail because fee and slippage consideration are excluded caventa - Curve token swap will likely to fail because fee and slippage consideration are excluded Dec 24, 2023
@sherlock-admin2 sherlock-admin2 added the Reward A payout will be made for this issue label Dec 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant