Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(legacy): add DTC chain and tokens #120

Merged
merged 2 commits into from
Jan 2, 2025
Merged

feat(legacy): add DTC chain and tokens #120

merged 2 commits into from
Jan 2, 2025

Conversation

somebodyLi
Copy link
Contributor

@somebodyLi somebodyLi commented Dec 31, 2024

Summary by CodeRabbit

Release Notes v3.10.2

  • New Features

    • Added support for a new Ethereum network with chain ID 9798
    • Introduced 9 new tokens for the new network, including HLT, dUSDT, dBTC, and others
  • Improvements

    • Updated Polygon network symbol from "MATIC" to "POL"
    • Expanded network and token configuration
  • Version

    • Firmware version bumped from 3.10.1 to 3.10.2

Copy link

coderabbitai bot commented Dec 31, 2024

Walkthrough

The pull request introduces support for a new Ethereum-based network with chain ID 9798, referred to as DTT. This update involves expanding the networks and tokens arrays in the firmware, updating version information, and adding network-specific configurations. The changes include adding a new network entry, updating network symbols, and incorporating nine new tokens associated with the new chain ID.

Changes

File Changes
legacy/firmware/ethereum_networks.c - Increased NETWORKS_COUNT from 7 to 8
- Added new network entry for DTT (chain ID 9798)
- Updated Polygon network symbol from "MATIC" to "POL"
legacy/firmware/ethereum_networks_onekey.h.mako - Added case for chain ID 9798 in ASSIGN_ETHEREUM_SUFFIX
- Updated is_ethereum_slip44 and ethereum_slip44_by_chain_id functions
legacy/firmware/ethereum_onekey.h - Added case for chain ID 9798 in ASSIGN_ETHEREUM_NAME macro
legacy/firmware/ethereum_tokens.c - Increased TOKENS_COUNT from 24 to 33
- Added 9 new tokens with chain ID 9798 (HLT, BV, dUSDT, dBTC, dETH, DOS, CNV, FEC, STC08375)
legacy/firmware/ethereum_tokens_onekey.h.mako - Updated TOKENS_COUNT macro to include 9 additional tokens
legacy/firmware/version.h - Incremented patch version from 3.10.1 to 3.10.2
- Updated version-related constants

Sequence Diagram

sequenceDiagram
    participant Firmware
    participant NetworkConfig
    participant TokenConfig
    
    Firmware->>NetworkConfig: Add DTT Network (Chain ID 9798)
    NetworkConfig-->>Firmware: Network Configuration Updated
    
    Firmware->>TokenConfig: Add 9 New Tokens
    TokenConfig-->>Firmware: Token List Expanded
    
    Firmware->>Firmware: Update Version to 3.10.2
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb12d12 and 676d59e.

📒 Files selected for processing (7)
  • legacy/firmware/ethereum_networks.c (2 hunks)
  • legacy/firmware/ethereum_networks_onekey.h.mako (3 hunks)
  • legacy/firmware/ethereum_onekey.h (1 hunks)
  • legacy/firmware/ethereum_tokens.c (2 hunks)
  • legacy/firmware/ethereum_tokens_onekey.c.mako (1 hunks)
  • legacy/firmware/ethereum_tokens_onekey.h.mako (1 hunks)
  • legacy/firmware/version.h (1 hunks)
🔇 Additional comments (20)
legacy/firmware/ethereum_tokens_onekey.h.mako (1)

10-10: Looks good.
This aligns the token count with the nine new token entries. Ensure your build system agrees with this macro update throughout the code.

legacy/firmware/ethereum_networks_onekey.h.mako (3)

38-38: Verify consistent naming.
We see “DTT” as the suffix but “DTC” in the comment. Ensure the naming is correct and consistent across the code.


47-47: Approved.
This includes the new slip44 for chain 9798 in the function. Looks accurate.


59-59: Matches chain ID.
Returning 9798 here lines up well with the new chain.

legacy/firmware/ethereum_tokens_onekey.c.mako (1)

11-19: Tokens added successfully.
You added nine tokens tied to chain 9798. Addresses look properly sized. Decimals and symbols seem fine.

legacy/firmware/ethereum_networks.c (3)

7-7: Correct to increment count.
We now have eight networks. This matches the new chain addition.


49-51: Symbol changed to "POL".
Confirm it aligns with current naming for Polygon.


52-55: New network entry.
Chain 9798 is added with symbol "DTT" and empty name. That’s consistent with your macro additions.

legacy/firmware/ethereum_onekey.h (1)

86-88: Looks good.
Nice addition of the DTC chain. This matches the new chain ID.

legacy/firmware/ethereum_tokens.c (10)

8-8: Correct token count increase.
You updated the count from 24 to 33. This matches the nine new tokens.


227-235: HLT token entry seems fine.
Chain ID is consistent with DTC. Decimals match the expected precision.


236-244: BV token entry.
Similar structure, no issues.


245-253: dUSDT token entry.
Decimals of 6 look correct for USDT-like tokens.


254-262: dBTC token entry.
Decimals of 8 align with BTC’s standard.


263-271: dETH token entry.
Uses 18 decimals, consistent with typical ERC-20.


272-280: DOS token entry.
All good.


281-289: CNV token entry.
Everything matches the pattern.


290-298: FEC token entry.
Decimals = 4, no red flags.


299-307: STC08375 token entry.
Decimals = 0, no apparent issues.

legacy/firmware/version.h (1)

11-14: Patch version update.
The bump to 3.10.2 with ONEKEY_VERSION_HEX set to 0x3A02 is consistent.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or Summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@somebodyLi somebodyLi enabled auto-merge (squash) January 2, 2025 09:12
@somebodyLi somebodyLi merged commit 2519c34 into master Jan 2, 2025
3 of 6 checks passed
@somebodyLi somebodyLi deleted the dct branch January 2, 2025 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants