Skip to content

feat: add IoTeX Mainnet to Price API supported chains#8930

Open
Jevin-F wants to merge 3 commits into
MetaMask:mainfrom
iotexproject:feat/add-iotex-price-support
Open

feat: add IoTeX Mainnet to Price API supported chains#8930
Jevin-F wants to merge 3 commits into
MetaMask:mainfrom
iotexproject:feat/add-iotex-price-support

Conversation

@Jevin-F
Copy link
Copy Markdown

@Jevin-F Jevin-F commented May 29, 2026

Explanation

Native IOTX (and IoTeX ERC20s) show no price in MetaMask today. eip155:4689 (IoTeX Mainnet) is absent from the Price API's /v2/supportedNetworks allowlist (fullSupport, spotPricesV2, spotPricesV3), so CodefiTokenPricesServiceV2.fetchTokenPrices filters IoTeX assets out before any price request is made — the wallet UI shows no conversion rate for IOTX or any IoTeX token.

This PR adds the client-side mapping for IoTeX, following the exact pattern used for the Stable network in #8185. Native IOTX has no direct CoinGecko native-coin mapping via slip44, but its canonical price equals wrapped IOTX (WIOTX), so we route native IOTX through the WIOTX ERC20 contract:

  • SPOT_PRICES_SUPPORT_INFO['0x1251'] = 'eip155:4689/erc20:0xa00744882684c3e4747faefd68d283ea44099d03'
  • chainIdToNativeTokenAddress['0x1251'] = '0xa00744882684c3e4747faefd68d283ea44099d03'
  • MULTICALL_CONTRACT_BY_CHAINID['0x1251'] = '0xcA11bde05977b3631167028862bE2a173976CA11' (canonical Multicall3, verified deployed on IoTeX)

The Price API backend already resolves the WIOTX contract price today:

GET /v3/spot-prices?assetIds=eip155:4689/erc20:0xa00744882684c3e4747faefd68d283ea44099d03&vsCurrency=usd  -> WIOTX $0.00398  (== coingecko "iotex")
GET /v3/spot-prices?assetIds=eip155:4689/slip44:304&vsCurrency=usd                                         -> null  (native not mapped)

CoinGecko also already indexes IoTeX as an asset platform ({ id: "iotex", chain_identifier: 4689, native_coin_id: "iotex" }).

The it.each(SUPPORTED_CHAIN_IDS) parameterized test in codefi-v2.test.ts automatically covers the new entry.

Companion backend request (required for prices to surface)

Since #7716, the supported-chain filter uses the live /v2/supportedNetworks list, not the hardcoded SPOT_PRICES_SUPPORT_INFO. For native IOTX prices to actually show, eip155:4689 must be added to supportedNetworks.partialSupport.spotPricesV2 and spotPricesV3 in the Price API (va-mmcx-price-api). The evidence above shows the price path already works end-to-end via the WIOTX contract — this is a zero-risk allowlist entry, not new plumbing. Same companion-PR workflow as #8487 (Injective) and #8524 (Forma).

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Small additive config entries in existing maps; no auth, transaction, or business-logic changes. Full pricing still gated by backend allowlist.

Overview
Adds IoTeX Mainnet (0x1251 / chain 4689) to the Codefi v2 token price mappings in codefi-v2.ts so native IOTX and IoTeX assets can be priced like other supported networks.

Native IOTX is routed through the WIOTX ERC-20 contract (0xa007…9d03) in both SPOT_PRICES_SUPPORT_INFO and chainIdToNativeTokenAddress, matching the Stable/USDT0 pattern when slip44 native pricing is unavailable. The assets-controllers changelog records the new chain support.

End-user spot prices still depend on the Price API allowing eip155:4689 on /v2/supportedNetworks (companion backend change, as noted in the PR).

Reviewed by Cursor Bugbot for commit 408fdf5. Bugbot is set up for automated code reviews on this repo. Configure here.

@Jevin-F Jevin-F marked this pull request as ready for review May 29, 2026 08:19
@Jevin-F Jevin-F requested review from a team as code owners May 29, 2026 08:19
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 28e29bd. Configure here.

Comment thread packages/assets-controllers/src/multicall.ts Outdated
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.

1 participant