Skip to content

Implement token-to-icon mappings (mapTokensBatch) #4

@igor53627

Description

@igor53627

Summary

The IconRegistry contract has a tokenToIcon mapping that maps token addresses (with chain IDs) to icon slugs. This mapping is currently empty and needs to be populated.

Context

  • Contract: 0x342e808c40D8E00656fEd124CA11aEcBB96c61Fc (mainnet)
  • The contract already has 9,869 icons uploaded
  • Chain ID mappings are set up (184 chains via chainToIcon)
  • Token mappings need a similar approach

Requirements

1. Add mapTokensBatch function to contract

The current contract only has mapToken for single mappings. For efficiency, we need:

function mapTokensBatch(
    address[] calldata tokens,
    uint256[] calldata chainIds,
    string[] calldata slugs
) external onlyOwner

2. Create token mapping data source

Need to build a canonical list of token → icon mappings. Possible sources:

  • DefiLlama token lists
  • CoinGecko API
  • Trust Wallet assets
  • Custom curation

3. Create deployment script

Similar to setup-chain-mappings.ts:

  • Read token list from JSON
  • Check which mappings already exist
  • Batch deploy new mappings
  • Use Turnkey for signing

Estimated Scope

  • ~10,000+ token mappings across multiple chains
  • Contract upgrade to add batch function
  • New token-mappings.json data file
  • setup-token-mappings.ts script

Open Questions

  1. Should we use the same icon for a token across all chains (e.g., USDC on Ethereum = USDC on Arbitrum)?
  2. Do we need versioning for token icons?
  3. Should we integrate with an existing token list standard (Uniswap, etc.)?

Pending oracle review for architecture recommendations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions