Closed sherlock-admin closed 10 months ago
Invalid, mtFeeRate
is in 18 decimals. From the example given, 1% will represent 1e16, so 7,8e2 * 1e16 / 1e18 will not round down to zero. Additionally, GEMINIUSD is likely not supported since it is a token of non-standard behavior with 2 decimals place not explicitly mentioned. For USDC and USDT, it is unilikely to round down given the extremely minute amounts required as they are both scaled to 6 decimals.
Angry_Mustache_Man
medium
Fee amount charged by the Protocol can be circumvented for low-decimal Stablecoins
Summary
When Quote token is a low-decimal ERC20 Stablecoin , the fee collected by the protocol in
GSPTrader.sol#querySellBase
can be circumvented to 0 for smaller deposits.Vulnerability Detail
Let's consider the example where Base Token is USDC and Quote Token is a token like GeminiUSD which is a token with 300M+ market cap, which is widely used StableCoin. Now see this piece of code:
Let's say the
mtFeeRate
is about 1% and let's say an amount of 8 DAI(8e18) has been put to sale which would give the receiveQuoteAmount to be about 7.8 GeminiUSD(7.8e2). In this case the fee calculated will be round to zero.Impact
The protocol doesn't collect fees from Vaults with low decimal StableCoin as the Quote Tokens .
Code Snippet
https://github.com/sherlock-audit/2023-12-dodo-gsp/blob/main/dodo-gassaving-pool/contracts/GasSavingPool/impl/GSPTrader.sol#L224C3-L244C6
Tool used
Manual Review
Recommendation
Consider adding zero checks for these cases and if the fee circumvents to 0,then use a constant fee for those cases