Early Viridian Haddock
High
Block https://github.com/sherlock-audit/2024-11-telcoin/blob/main/telcoin-audit/contracts/stablecoin/StablecoinHandler.sol#L148-L156 is in charge to collect fees but it won't transfer the fee amount is either ss.stablecoinFeeCurrency
or ss.stablecoinFeeSafe
are equal to address(0)
The logic is broken because only in the case where ss.stablecoinFeeCurrency
AND ss.stablecoinFeeSafe
are != address(0)
, then fees are collected, while the logic should be:
- check if
feeAmount > 0
- if true, revert if
ss.stablecoinFeeCurrency
orss.stablecoinFeeSafe
are ==address(0)
- collect fees
see #mitigation
No response
No response
No response
No response
No response
Replace block https://github.com/sherlock-audit/2024-11-telcoin/blob/main/telcoin-audit/contracts/stablecoin/StablecoinHandler.sol#L148-L156 with:
if (ss.feeAmount > 0) {
if (ss.stablecoinFeeCurrency == address(0)) revert ZeroValueInput("<ERROR MESSAGE HERE>");
if (ss.stablecoinFeeSafe == address(0)) revert ZeroValueInput("<ERROR MESSAGE HERE>");
ERC20PermitUpgradeable(ss.stablecoinFeeCurrency).safeTransferFrom(
wallet,
ss.stablecoinFeeSafe,
ss.feeAmount
);
}