sherlock-audit / 2024-02-jala-swap-judging

6 stars 4 forks source link

thisvishalsingh - thisvishalsingh - Manipulation of `setFlashFee` in `JalaFactory.sol` #254

Closed sherlock-admin closed 7 months ago

sherlock-admin commented 7 months ago

thisvishalsingh

medium

thisvishalsingh - Manipulation of setFlashFee in JalaFactory.sol

thisvishalsingh

Manipulation of setFlashFee in JalaFactory.sol

Summary

Admin can setFlashFee up to 100%. This is bad for users, fees should have a reasonable upper limit, e.g. 30% to prevent potential griefing.

Vulnerability Detail

https://github.com/sherlock-audit/2024-02-jala-swap/blob/main/jalaswap-dex-contract/contracts/JalaFactory.sol#L81-L85

I think this is bad for users, as you need extra trust on an admin to not exploit this, and smart contracts should aim for as little external trust as possible.

Impact

Code Snippet

https://github.com/sherlock-audit/2024-02-jala-swap/blob/main/jalaswap-dex-contract/contracts/JalaFactory.sol#L81

Tool used

Manual Review

Recommendation

Implement a reasonable upper limit, e.g. 30%. Consider using a timelock, so that users have time to react and adjust. In that way, users would know the fees they are agreeing with.

Duplicate of #57