Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions packages/komodo_ui/lib/src/defi/asset/asset_logo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,18 @@ class AssetLogo extends StatelessWidget {

final isChildAsset = resolvedId?.isChildAsset ?? false;

// Use the parent coin ticker for child assets so that token logos display
// the network they belong to (e.g. ETH for ERC20 tokens).
final protocolTicker = isChildAsset ? resolvedId?.parentId?.id : null;
final shouldShowProtocolIcon = isChildAsset && protocolTicker != null;
// Also overlay protocol icon for specific parent assets like ETH-BASE and ETH-ARB20.
final bool isParentWithOverlay =
resolvedId != null &&
!isChildAsset &&
(resolvedId.id == 'ETH-BASE' || resolvedId.id == 'ETH-ARB20');
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded asset IDs 'ETH-BASE' and 'ETH-ARB20' create a maintainability issue. If more parent EVM chain assets (like ETH-MATIC, ETH-AVX20, etc.) need similar overlay treatment, they would need to be added individually to this condition.

Consider a more scalable approach such as:

  1. Using a property/flag on the AssetId or CoinSubClass to indicate if a parent asset should display a protocol overlay
  2. Checking if the asset is a parent EVM chain asset (using evmCoinSubClasses.contains(resolvedId.subClass))
  3. Creating a set of subclasses that should display overlays when they are parent assets

Example:

final isParentWithOverlay = resolvedId != null &&
    !isChildAsset &&
    evmCoinSubClasses.contains(resolvedId.subClass) &&
    resolvedId.id.startsWith('ETH-');

This would automatically handle any ETH-prefixed parent asset on EVM-compatible chains without requiring individual hardcoding.

Suggested change
(resolvedId.id == 'ETH-BASE' || resolvedId.id == 'ETH-ARB20');
evmCoinSubClasses.contains(resolvedId.subClass) &&
resolvedId.id.startsWith('ETH-');

Copilot uses AI. Check for mistakes.

// Use the network icon for child assets (to show the chain) and for the
// specified parent assets which should display their protocol overlays.
final protocolTicker =
(isChildAsset || isParentWithOverlay) ? resolvedId?.subClass.iconTicker : null;
final shouldShowProtocolIcon =
(isChildAsset || isParentWithOverlay) && protocolTicker != null;

final mainIcon =
resolvedId != null
Expand Down
Loading