Skip to content

feat: add support for ETH-BASE and derived assets#254

Merged
CharlVS merged 4 commits intodevfrom
feat/eth-base-support
Oct 26, 2025
Merged

feat: add support for ETH-BASE and derived assets#254
CharlVS merged 4 commits intodevfrom
feat/eth-base-support

Conversation

@takenagain
Copy link
Copy Markdown
Contributor

@takenagain takenagain commented Oct 24, 2025

Summary by CodeRabbit

  • New Features

    • Added support for Base protocol across token activation and transaction history features.
    • Base chain transaction endpoints now available for address and token history queries.
  • Chores

    • Updated bundled coins repository configuration.
    • Removed support for FTM20 and KRC20 in transaction history lookups.

@takenagain takenagain self-assigned this Oct 24, 2025
@takenagain takenagain added the enhancement New feature or request label Oct 24, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 24, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds support for a new Base chain coin subclass (CoinSubClass.base) throughout the Komodo DeFi SDK, including enum definitions, activation strategies, transaction history handling, and protocol parsing. Updates bundled coins repository commit hash.

Changes

Cohort / File(s) Summary
Configuration Update
packages/komodo_defi_framework/app_build/build_config.json
Updated coins.bundled_coins_repo_commit hash from 9d99819... to 3d23cb5...
Activation Strategies
packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/custom_erc20_activation_strategy.dart, erc20_activation_strategy.dart, eth_task_activation_strategy.dart, eth_with_tokens_activation_strategy.dart
Added CoinSubClass.base to supportedProtocols set in each strategy class
Transaction History
packages/komodo_defi_sdk/lib/src/transaction_history/strategies/etherscan_transaction_history_strategy.dart
Removed ftm20/krc20 support entries; added Base chain endpoint handling with new _ethBaseUrl and _ethBaseTokenUrl getters; updated switch logic in _getBaseEndpoint to route CoinSubClass.base cases
Type Definitions
packages/komodo_defi_types/lib/src/coin_classes/coin_subclasses.dart
Added CoinSubClass.base enum value; updated ticker, iconTicker, formatted, and color getters with Base case branches; added tokenStandardSuffix extension mapping; included CoinSubClass.base in evmCoinSubClasses set
Protocol Parsing
packages/komodo_defi_types/lib/src/coin_classes/protocol_class.dart
Updated ProtocolClass.fromJson to route CoinSubClass.base to Erc20Protocol.fromJson alongside existing ERC20-like types

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Areas requiring extra attention:
    • Etherscan transaction history strategy: verify removal of ftm20/krc20 doesn't break existing functionality and new Base URL endpoints are correctly configured
    • Consistency check across all activation strategies to ensure CoinSubClass.base is properly integrated
    • Base chain color value (0xFF0052FF) and all string mappings (ticker, suffix) match intended branding
    • Protocol routing in protocol_class.dart correctly classifies Base as ERC20-compatible

Possibly related PRs

Suggested reviewers

  • smk762
  • CharlVS

Poem

🐰 A base chain hops into our SDK,
With colors bright and blue,
From activation to history we see,
New paths for tokens true,
The Base is here, let ERC20 cheer! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: add support for ETH-BASE and derived assets" directly and accurately reflects the primary changes in the changeset. The modifications consistently add support for a new CoinSubClass.base enum value across multiple files, including activation strategies, transaction history handling, type definitions, and protocol routing. The term "ETH-BASE" refers to the BASE chain Layer 2 network, and "derived assets" accurately describes the token support being added. The title is concise, specific, and clearly communicates the main objective without being vague or overly broad.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 24, 2025

Visit the preview URL for this PR (updated for commit ba4f8b9):

https://kdf-sdk--pr254-feat-eth-base-suppor-gypvy7mq.web.app

(expires Sat, 01 Nov 2025 08:12:19 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 9c1b6e6c010cf0b965c455ba7a69c4aedafa8a1d

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 24, 2025

Visit the preview URL for this PR (updated for commit ba4f8b9):

https://komodo-playground--pr254-feat-eth-base-suppor-9x617tev.web.app

(expires Sat, 01 Nov 2025 08:13:24 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 2bfedd77fdea45b25ba7c784416e81f177aa5c47

@smk762
Copy link
Copy Markdown
Contributor

smk762 commented Oct 25, 2025

@smk762
Copy link
Copy Markdown
Contributor

smk762 commented Oct 25, 2025

We should also remove the endpoints for FTM and KCC - they are not currently on offer via etherscan https://docs.etherscan.io/supported-chains

@takenagain
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 25, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@takenagain takenagain force-pushed the feat/eth-base-support branch from e9b5af8 to ba4f8b9 Compare October 25, 2025 08:07
@takenagain
Copy link
Copy Markdown
Contributor Author

The required URLs are:

Thanks, I added the URLs in a171d19.

We should also remove the endpoints for FTM and KCC - they are not currently on offer via etherscan https://docs.etherscan.io/supported-chains

Done in ba4f8b9. I also removed Huobi ECO (or Heco in the SDK) in accordance with #3127, seeing as it is also not listed in the supported chains list.

@takenagain takenagain marked this pull request as ready for review October 25, 2025 08:12
Copilot AI review requested due to automatic review settings October 25, 2025 08:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for the Base blockchain protocol (ETH-BASE) and its derived assets to the Komodo DeFi framework. The changes enable Base chain integration across token activation flows and transaction history queries.

Key Changes:

  • Added CoinSubClass.base enum value and associated metadata (color, name, token standard)
  • Integrated Base protocol into activation strategies for ETH-based tokens
  • Added Base transaction history endpoints (base_tx_history and base20_tx_history)

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
coin_subclasses.dart Defines Base enum value and implements all required metadata methods
protocol_class.dart Adds Base to the list of supported EVM protocols
etherscan_transaction_history_strategy.dart Adds Base transaction history endpoints and removes deprecated FTM20/KRC20/HECO endpoints
eth_with_tokens_activation_strategy.dart Includes Base in supported protocols for activation
eth_task_activation_strategy.dart Includes Base in supported protocols for activation
erc20_activation_strategy.dart Includes Base in supported protocols for activation
custom_erc20_activation_strategy.dart Includes Base in supported protocols for activation
build_config.json Updates bundled coins repository commit reference

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@takenagain takenagain requested review from CharlVS and smk762 October 25, 2025 08:16
@CharlVS
Copy link
Copy Markdown
Collaborator

CharlVS commented Oct 25, 2025

@cursor please review

@cursor
Copy link
Copy Markdown

cursor bot commented Oct 25, 2025

Review summary

  • Base integration looks consistent across types, protocol parsing, activation strategies, and Etherscan history endpoints. FTM/KCC/HECO Etherscan endpoints are removed as requested. LGTM with two small nits.

Evidence

  • Etherscan routing includes Base for both chain and token endpoints:
  String? _getBaseEndpoint(AssetId id) {
    final isParentChain = id.parentId == null;
    return switch (id.subClass) {
      CoinSubClass.bep20 when isParentChain => _bnbUrl,
      CoinSubClass.bep20 => _bnbTokenUrl,
      CoinSubClass.matic when isParentChain => _maticUrl,
      CoinSubClass.matic => _maticTokenUrl,
      CoinSubClass.avx20 when isParentChain => _avaxUrl,
      CoinSubClass.avx20 => _avaxTokenUrl,
      CoinSubClass.moonriver when isParentChain => _mvrUrl,
      CoinSubClass.moonriver => _mvrTokenUrl,
      CoinSubClass.erc20 when isParentChain => _ethUrl,
      CoinSubClass.erc20 => _ethTokenUrl,
      CoinSubClass.arbitrum when isParentChain => _arbUrl,
      CoinSubClass.arbitrum => _arbTokenUrl,
      CoinSubClass.base when isParentChain => _ethBaseUrl,
      CoinSubClass.base => _ethBaseTokenUrl,
      CoinSubClass.rskSmartBitcoin => _rskUrl,
      CoinSubClass.moonbeam => _glmrUrl,
      CoinSubClass.ethereumClassic => _etcUrl,
      _ => null,
    };
  }
  String get _arbUrl => '$_baseUrl/v2/arb_tx_history';
  String get _avaxUrl => '$_baseUrl/v2/avax_tx_history';
  String get _ethBaseUrl => '$_baseUrl/v2/base_tx_history';
  String get _bnbUrl => '$_baseUrl/v2/bnb_tx_history';
  String get _ethUrl => '$_baseUrl/v2/eth_tx_history';
  String get _maticUrl => '$_baseUrl/v2/matic_tx_history';
  String get _mvrUrl => '$_baseUrl/v2/movr_tx_history';

  String get _arbTokenUrl => '$_baseUrl/v2/arb20_tx_history';
  String get _avaxTokenUrl => '$_baseUrl/v2/avx20_tx_history';
  String get _ethBaseTokenUrl => '$_baseUrl/v2/base20_tx_history';
  String get _bnbTokenUrl => '$_baseUrl/v2/bep20_tx_history';
  String get _ethTokenUrl => '$_baseUrl/v2/erc20_tx_history';
  String get _maticTokenUrl => '$_baseUrl/v2/plg20_tx_history';
  String get _mvrTokenUrl => '$_baseUrl/v2/mvr20_tx_history';
  • Types include Base across enum, display, color, suffix, and EVM set:
enum CoinSubClass {
  moonbeam,
  ftm20,
  arbitrum,
  base,
  @Deprecated('No longer active. Will be removed in the future.')
  slp,
  sia,
  String get ticker {
    switch (this) {
      case CoinSubClass.moonbeam:
        return 'MOON';
      case CoinSubClass.ftm20:
        return 'FTM';
      case CoinSubClass.arbitrum:
        return 'ARB';
      case CoinSubClass.base:
        return 'BASE';
  String get iconTicker {
    switch (this) {
      case CoinSubClass.moonbeam:
        return 'GLMR';
      case CoinSubClass.ftm20:
        return 'FTM';
      case CoinSubClass.arbitrum:
        return 'ARB';
      case CoinSubClass.base:
        return 'BASE';
  String get formatted {
    switch (this) {
      case CoinSubClass.moonbeam:
        return 'Moonbeam';
      case CoinSubClass.ftm20:
        return 'Fantom';
      case CoinSubClass.arbitrum:
        return 'Arbitrum';
      case CoinSubClass.base:
        return 'Base';
  Color? get color {
    switch (this) {
      case CoinSubClass.moonbeam:
        return const Color(0xFFE4147C); // glmr: "#e4147c"
      case CoinSubClass.ftm20:
        return const Color(0xFF14B4EC); // ftm: "#14b4ec"
      case CoinSubClass.arbitrum:
        return const Color(0xFF28A0F0); // arb: "#28a0f0"
      case CoinSubClass.base:
        return const Color(0xFF0052FF); // base: "#0052ff"
extension CoinSubClassTokenStandard on CoinSubClass {
  /// Canonical short token/network standard suffix used for parent asset
  /// disambiguation in display names. Returns null when no suffix should
  /// be appended for the given subclass.
  String? get tokenStandardSuffix {
    switch (this) {
      case CoinSubClass.erc20:
        return 'ERC20';
      case CoinSubClass.bep20:
        return 'BEP20';
      case CoinSubClass.qrc20:
        return 'QRC20';
      case CoinSubClass.ftm20:
        return 'FTM20';
      case CoinSubClass.arbitrum:
        return 'ARB20';
      case CoinSubClass.base:
        return 'BASE';
const Set<CoinSubClass> evmCoinSubClasses = {
  CoinSubClass.avx20,
  CoinSubClass.bep20,
  CoinSubClass.ftm20,
  CoinSubClass.matic,
  CoinSubClass.hrc20,
  CoinSubClass.arbitrum,
  CoinSubClass.base,
  • Protocol parsing maps Base to ERC20-compatible:
      return switch (primaryType) {
        CoinSubClass.utxo || CoinSubClass.smartChain => UtxoProtocol.fromJson(
          configToUse,
          supportedProtocols: otherTypes,
        ),
        // ...
        CoinSubClass.avx20 ||
        CoinSubClass.bep20 ||
        CoinSubClass.ftm20 ||
        CoinSubClass.matic ||
        CoinSubClass.hrc20 ||
        CoinSubClass.arbitrum ||
        CoinSubClass.base ||
        CoinSubClass.moonriver ||
        CoinSubClass.moonbeam ||
        CoinSubClass.ethereumClassic ||
        CoinSubClass.ubiq ||
        CoinSubClass.krc20 ||
        CoinSubClass.ewt ||
        CoinSubClass.hecoChain ||
        CoinSubClass.rskSmartBitcoin ||
        CoinSubClass.erc20 => Erc20Protocol.fromJson(json),
  • Activation strategies include Base:
  @override
  Set<CoinSubClass> get supportedProtocols => {
    CoinSubClass.erc20,
    CoinSubClass.bep20,
    CoinSubClass.ftm20,
    CoinSubClass.matic,
    CoinSubClass.avx20,
    CoinSubClass.hrc20,
    CoinSubClass.moonbeam,
    CoinSubClass.moonriver,
    CoinSubClass.ethereumClassic,
    CoinSubClass.ubiq,
    CoinSubClass.krc20,
    CoinSubClass.ewt,
    CoinSubClass.hecoChain,
    CoinSubClass.rskSmartBitcoin,
    CoinSubClass.arbitrum,
    CoinSubClass.base,
  };

Nits / suggestions

  • Naming: consider _baseChainUrl and _baseChainTokenUrl instead of _ethBaseUrl/_ethBaseTokenUrl to avoid confusion with _baseUrl and align with reviewer suggestion. Not blocking.
  • Token infos URL: I don’t see a client-side use of v1/token_infos/base20/:contract. If needed, add a helper in EtherscanProtocolHelper:
String get _baseTokenInfoUrl => '$_baseUrl/v1/token_infos/base20';
Uri tokenInfoUrl(String contract) => Uri.parse('$_baseTokenInfoUrl/$contract');

All else looks good to ship.


Open in Cursor Open in Web

Learn more about Cursor Agents

Copy link
Copy Markdown
Contributor

@smk762 smk762 left a comment

Choose a reason for hiding this comment

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

@CharlVS CharlVS merged commit fac0d3d into dev Oct 26, 2025
7 of 8 checks passed
@CharlVS CharlVS deleted the feat/eth-base-support branch October 26, 2025 11:24
@coderabbitai coderabbitai bot mentioned this pull request Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants