token - (Etherscan API,web3 vs Etherscan 网站)为什么不同的令牌值?
问题描述
交易哈希:0x70a584e4a2eb38cf7d6d48e215f6ac105b17ecfd97cd7091c4079bb961c2aa4c
[Etherscan 网站]
https://etherscan.io/tx/0x70a584e4a2eb38cf7d6d48e215f6ac105b17ecfd97cd7091c4079bb961c2aa4c
转移值 = 900000000000000000000000 (90,000 C3W)
[Etherscan API]
转移值 = 9000000000000 (0.000009 C3W)
[网络3]
const tx = await web3.eth.getTransaction('0x70a584e4a2eb38cf7d6d48e215f6ac105b17ecfd97cd7091c4079bb961c2aa4c');
const input = tx.input; // '0xa9059cbb0000000000000000000000000d7a0161f798166b2fcc996f03448892c25841930000000000000000000000000000000000000000000000000000082f79cd9000'
/*** convert ***/
转移值 = 9000000000000 (0.000009 C3W)
为什么不一样?哪些数据是正确的?以及如何使用 Web3 或 Etherscan API 获得正确的令牌值?
解决方案
根据etherscan提供的解码输入数据,
# 名称类型数据 0 _到地址 0d7a0161f798166b2fcc996f03448892c2584193 1 _value uint256 9000000000000
我找不到任何问题。
而且,C3W 令牌小数点是 8。
所以,90000 00000000是正确的。
推荐阅读
- java - 将 .txt 文件逐行读入 ArrayList
- c# - WPF 将背景颜色绑定到具有可观察集合的按钮
- css - Angular --prod 问题与border-top-left-radius 和border-bottom-left-radius
- python - 获取所需格式的数据
- batch-file - 使用 .bat 文件运行指向特定 .cmm 文件的 .exe 并让它询问我输出 .cmm 文件的名称?
- python - 更改 CrosshairTool 线条样式
- swift - 具体数据获取 Firebase 数据库
- oracle - 如何处理 ssis 表达式中的 oracle regexp_like
- python-3.x - 用户输入不延迟程序
- scala - sbt无法同步项目,因为无法编译