Algo Ssstablecoinsss

AI First Flight #2
Beginner FriendlyDeFi
EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

price view functions revert on unregistered tokens

Root + Impact

Description

  • Normal behavior: the read-only price helpers get_usd_value and get_token_amount_from_usd should handle any ERC20 address gracefully — e.g. by reverting with an explicit "unsupported token" error for tokens the protocol does not support.

  • The issue: both view functions look up token_address_to_price_feed[token] and immediately call AggregatorV3Interface(price_feed).stale_check_latest_round_data(). For a token that was never registered as collateral, the mapping returns empty(address), so the call becomes a staticcall to address(0) which reverts with no error message. Off-chain callers, integrators, and users get a bare revert instead of a meaningful error.

Risk

  • Reason 1 // Anyone (integrator or UI) can pass an arbitrary ERC20 address that is not in token_address_to_price_feed.

  • Reason 2 // The zero-address staticcall reverts unconditionally — there is no fallback path for unsupported tokens.

  • Impact 1 // View-only revert: no state impact, no fund loss.

  • Impact 2 // Poor error UX: integrators cannot distinguish "unsupported token" from other failures without decoding internals.

Proof of Concept

Call get_usd_value(randomERC20, 1e18) where randomERC20 was never passed to the constructor's collateral/prices arrays: the call reverts on the address(0) staticcall instead of reverting with an explicit unsupported-token error.

Recommended Mitigation

Add an explicit check before the external call:

def get_usd_value(token: address, amount: uint256) -> uint256:
+ price_feed: address = self.token_address_to_price_feed[token]
+ assert price_feed != empty(address), "DSCEngine__UnsupportedToken"
- price_feed: address = self.token_address_to_price_feed[token]
price: int256 = staticcall AggregatorV3Interface(price_feed).stale_check_latest_round_data()
Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge about 1 hour ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!