- Changed CCIP Router address from `0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e` to `0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817` across multiple documentation files. - Updated WETH9 Bridge address from `0x89dd12025bfCD38A168455A44B400e913ED33BE2` to `0xcacfd227A040002e49e2e01626363071324f820a`. - Ensured all references to the new addresses are consistent throughout the documentation. This update reflects the latest deployment configurations and ensures accurate contract references for ChainID 138.
4.2 KiB
WETH9 and WETH10 Issues and Fixes
Date: $(date)
Status: ✅ All Issues Documented and Fixes Provided
Issues Identified
WETH9 Issues
-
decimals() returns 0 ⚠️
- Impact: Display issues in wallets (MetaMask shows incorrect format)
- Severity: Low (display only, doesn't affect functionality)
- Status: Known WETH9 limitation
-
Function signature search limitation ⚠️
- Impact: None (functions work correctly)
- Severity: None (heuristic limitation only)
- Status: Not a real issue
WETH10 Issues
-
No tokens minted yet ℹ️
- Impact: Contract is empty (0 supply, 0 balance)
- Severity: None (normal for unused contract)
- Status: Expected behavior
-
decimals() returns 18 ✅
- Status: Correct! No issue here
Solutions and Fixes
Fix 1: Token Metadata Files
Since WETH9 and WETH10 are pre-deployed contracts that cannot be modified, we create token metadata files for wallets to use correct decimals.
WETH9 Token Metadata
File: docs/WETH9_TOKEN_METADATA.json
{
"chainId": 138,
"address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"name": "Wrapped Ether",
"symbol": "WETH",
"decimals": 18,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png"
}
WETH10 Token Metadata
File: docs/WETH10_TOKEN_METADATA.json
{
"chainId": 138,
"address": "0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9f",
"name": "Wrapped Ether v10",
"symbol": "WETH10",
"decimals": 18,
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png"
}
Fix 2: Updated Token List
File: docs/METAMASK_TOKEN_LIST_FIXED.json
Includes both WETH9 and WETH10 with correct decimals (18).
Fix 3: Helper Scripts
Script: scripts/get-token-info.sh
Provides correct token information including decimals override.
Script: scripts/fix-wallet-display.sh
Instructions and commands to fix wallet display issues.
Fix 4: Documentation Updates
All documentation updated to include:
- How to manually set decimals in wallets
- Token metadata files
- Workaround instructions
Implementation
Step 1: Create Token Metadata Files
Token metadata files have been created with correct decimals.
Step 2: Update Token Lists
Token lists have been updated to include correct decimals.
Step 3: Create Helper Scripts
Helper scripts have been created to work around the decimals issue.
Step 4: Update Documentation
All documentation has been updated with fixes and workarounds.
Usage Instructions
For MetaMask Users
-
Import Token Manually:
- Go to MetaMask → Import Tokens
- Enter contract address
- Important: Set decimals to 18 (not 0)
- Add token
-
Use Token List:
- Add token list URL (if hosted)
- Tokens will appear with correct decimals
For Developers
-
Use Token Metadata Files:
- Load metadata from
docs/WETH9_TOKEN_METADATA.json - Use decimals: 18 (not from contract)
- Load metadata from
-
In Code:
// Always use 18 decimals for WETH9/WETH10 const decimals = 18; // Don't read from contract const balance = await contract.balanceOf(address); const formatted = ethers.utils.formatUnits(balance, 18);
Verification
WETH9 Status
- ✅ Contract exists and functional
- ✅ 1:1 backing maintained (8 ETH = 8 WETH9)
- ⚠️ decimals() returns 0 (fixed with metadata)
- ✅ All functions work correctly
WETH10 Status
- ✅ Contract exists and functional
- ✅ decimals() returns 18 (correct!)
- ℹ️ No tokens minted yet (normal)
- ✅ All functions work correctly
Summary
All issues have been addressed:
- ✅ WETH9 decimals issue: Fixed with metadata files and documentation
- ✅ WETH10: No issues (decimals correct)
- ✅ Token lists updated
- ✅ Helper scripts created
- ✅ Documentation complete
The contracts are functional. The only issue is a display problem with WETH9 decimals, which is fixed with proper metadata.
Last Updated: $(date)