-
Notifications
You must be signed in to change notification settings - Fork 91
Open
Description
Problem
TRON TRC20 tokens (e.g., USDT, USDC on TRON) are classified under CURRENCY.ERC20 and differentiated only by their network field being tron or nile. This causes:
- Broken request creation: After request-token-list#27 correctly set Tron currency type to
TRC20, the SDK's CurrencyManager rejects it because it doesn't handle that type. A bandaid override was applied in the Request API to unblock usage. - Semantic inaccuracy: TRC20 is a TRON-native standard, not ERC20.
- Scattered special-case handling: Multiple files check
network === 'tron' || network === 'nile'within ERC20 code paths. - Confusion for integrators: "ERC20 on TRON" really means TRC20.
TronChains.tsincorrectly registers TRON chains underCURRENCY.ETH.
Impact
Tron request creation is currently broken without the API-level bandaid. The SDK stores incorrect currency types (ERC20 instead of TRC20) in the API database and Protocol (IPFS), which will cause issues when Tron is re-enabled on the frontend.
Proposed Solution
Introduce CURRENCY.TRC20 as a first-class currency type across the SDK packages:
- Core Types (
packages/types) — AddTRC20toCURRENCYenum, addTRC20Currency/TRC20CurrencyInputtypes, addTRC20_FEE_PROXY_CONTRACTpayment network ID, removeTronChainNamefromERC20Currency.network - Currency Management (
packages/currency) — Create TRC20 token list module, fixTronChains.tsto useCURRENCY.TRC20, updateCurrencyManagerto handle TRC20 infromAddress,fromStorageCurrency,toStorageCurrency,validateAddress,getDefaultList - Advanced Logic (
packages/advanced-logic) — CreateTrc20FeeProxyPaymentNetworkextension, remove TRON-specific logic from ERC20 extension, register TRC20 extension inAdvancedLogic - Payment Detection (
packages/payment-detection) — AddTRC20section inPaymentNetworkFactory, remove TRON entries from ERC20 section, updateTronFeeProxyPaymentDetectorto use new TRC20 payment network ID - Payment Processing (
packages/payment-processor) — Add TRC20 guards, updatetrc20-fee-proxy.tsvalidation - Request Client (
packages/request-client.js) — Verify end-to-end with newCURRENCY.TRC20type - Testing — Unit tests for each package + integration test for create/pay/detect flow
Full implementation plan: https://www.notion.so/requestnetwork/Implementation-Steps-Native-TRC20-Currency-Type-for-TRON-3279821d9d8f80ebb7eaec66fa0dd92e
Considerations
- Backward compatibility: Existing requests stored with
ERC20type for Tron tokens will need to still be readable.fromStorageCurrencyshould handle both oldERC20and newTRC20records for Tron networks. - API bandaid: The Request API currently overrides the token list to use ERC20 for Tron. This bandaid should be removed once this SDK fix is merged.
- Frontend: Tron is disabled on the Dashboard frontend. It should not be re-enabled until this fix lands, otherwise new requests will have incorrect currency types in storage.
- The changes are well-scoped and understood. Testing is the most time-consuming part — the SDK has decent test coverage that should help.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
🔖 Sprint Backlog (To do)