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

Supported tokens #11

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Conversation

aelmanaa
Copy link

@aelmanaa aelmanaa commented Jan 5, 2025

Add CCIP Supported Tokens Discovery Command

This PR adds a new command to discover and display tokens that are supported for CCIP cross-chain transfers between two chains.

Features

  • New supported-tokens command to check CCIP-supported tokens
  • Pagination support for large token sets
  • Parallel processing of pool support checks
  • Token metadata fetching (name, symbol, decimals)
  • Comprehensive error handling and reporting
  • Multiple output formats (pretty, json, log)

Implementation Details

  • Moved command to dedicated file in src/commands/supported-tokens.ts
  • Added configurable constants for performance tuning
  • Structured metadata output including:
    • Chain information
    • Statistics
    • Timestamps
    • Success/failure counts
  • Error collection for failed token checks
  • Rate-limiting consideration with parallel pool checks

Usage

Check supported tokens between chains

npx tsx src/index.ts supported-tokens <source> <router> <dest> [--format <format>]

Example

npx tsx src/index.ts supported-tokens ethereum-mainnet 0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D avalanche-mainnet

@aelmanaa aelmanaa requested a review from a team as a code owner January 5, 2025 17:00
Copy link
Collaborator

@andrevmatos andrevmatos left a comment

Choose a reason for hiding this comment

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

Some comments.
After they're addressed, we can merge, and I'll make a follow-up to migrate the rest of the commands to the commands module.
Thank you!

coverage-summary.txt Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/abi/TokenPool_1_5.ts Outdated Show resolved Hide resolved
src/lib/types.ts Show resolved Hide resolved
@andrevmatos andrevmatos self-requested a review January 13, 2025 15:52
@aelmanaa aelmanaa requested a review from andrevmatos January 17, 2025 17:43
Comment on lines +43 to +91
export const CCIPContractTypeBurnMintTokenPool = 'BurnMintTokenPool'
export type CCIPContractTypeBurnMintTokenPool = typeof CCIPContractTypeBurnMintTokenPool
export const CCIPContractTypeBurnMintTokenPoolAndProxy = 'BurnMintTokenPoolAndProxy'
export type CCIPContractTypeBurnMintTokenPoolAndProxy =
typeof CCIPContractTypeBurnMintTokenPoolAndProxy
export const CCIPContractTypeBurnMintTokenPoolWithTax = 'BurnMintTokenPoolWithTax'

export const CCIPContractTypeBurnWithFromMintTokenPool = 'BurnWithFromMintTokenPool'
export type CCIPContractTypeBurnWithFromMintTokenPool =
typeof CCIPContractTypeBurnWithFromMintTokenPool

export const CCIPContractTypeBurnWithFromMintTokenPoolAndProxy = 'BurnWithFromMintTokenPoolAndProxy'
export type CCIPContractTypeBurnWithFromMintTokenPoolAndProxy =
typeof CCIPContractTypeBurnWithFromMintTokenPoolAndProxy

export type CCIPContractTypeBurnMintTokenPoolWithTax =
typeof CCIPContractTypeBurnMintTokenPoolWithTax
export const CCIPContractTypeBurnWithFromMintRebasingTokenPool = 'BurnWithFromMintRebasingTokenPool'
export type CCIPContractTypeBurnWithFromMintRebasingTokenPool =
typeof CCIPContractTypeBurnWithFromMintRebasingTokenPool
export const CCIPContractTypeLockReleaseTokenPool = 'LockReleaseTokenPool'
export type CCIPContractTypeLockReleaseTokenPool = typeof CCIPContractTypeLockReleaseTokenPool
export const CCIPContractTypeLockReleaseTokenPoolAndProxy = 'LockReleaseTokenPoolAndProxy'
export type CCIPContractTypeLockReleaseTokenPoolAndProxy =
typeof CCIPContractTypeLockReleaseTokenPoolAndProxy
export const CCIPContractTypeUSDCTokenPool = 'USDCTokenPool'
export type CCIPContractTypeUSDCTokenPool = typeof CCIPContractTypeUSDCTokenPool

export const CCIPContractTypeTokenPool = [
CCIPContractTypeBurnMintTokenPool,
CCIPContractTypeBurnMintTokenPoolAndProxy,
CCIPContractTypeBurnMintTokenPoolWithTax,
CCIPContractTypeBurnWithFromMintRebasingTokenPool,
CCIPContractTypeLockReleaseTokenPool,
CCIPContractTypeLockReleaseTokenPoolAndProxy,
CCIPContractTypeUSDCTokenPool,
CCIPContractTypeBurnWithFromMintTokenPoolAndProxy,
CCIPContractTypeBurnWithFromMintTokenPool,
]
export type CCIPContractTypeTokenPool =
| CCIPContractTypeBurnMintTokenPool
| CCIPContractTypeLockReleaseTokenPool
| CCIPContractTypeLockReleaseTokenPoolAndProxy
| CCIPContractTypeUSDCTokenPool
| CCIPContractTypeBurnWithFromMintRebasingTokenPool
| CCIPContractTypeBurnMintTokenPoolAndProxy
| CCIPContractTypeBurnMintTokenPoolWithTax
| CCIPContractTypeBurnWithFromMintTokenPoolAndProxy
| CCIPContractTypeBurnWithFromMintTokenPool
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we really need these contract types here?
When I created them, it was with the assumption that token pools were not strictly part of the ccip core contracts. They can even be implemented by 3Ps, and not comply with our interfaces at all.
I'd rather leave them to some self-contained command, and not tie them directly into lib.

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.

2 participants