gas

[L-02] It is not specified which token is not allowed

Reward

Total

26.44 USDC

11.02 USDC
Selected
15.43 USDC
Selected Submission

[L-02] It is not specified which token is not allowed

Severity

Low Risk

Relevant GitHub Links

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L55

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L104

Summary

The error DSCEngine__NotAllowedToken() should include the address of the disallowed token, to make it easier for the user or dev to see what token is throwing the error.

Vulnerability Details

The use of errors should describe the situation that presents the error, in this case the error DSCEngine__NotAllowedToken() error does not include the address of the token that is not allowed, even when the modifier that uses it is passed this address by parameter.

Impact

Low

Tools Used

Manual code review

Recommendations

Change for :

- `error DSCEngine__NotAllowedToken()`
+ `error DSCEngine__NotAllowedToken(address token)`

and

   modifier isAllowedToken(address token) {
        if (s_priceFeeds[token] == address(0)) {
-            revert DSCEngine__NotAllowedToken();
+            revert DSCEngine__NotAllowedToken(token);
        }
        _;
    }