(Etherscan API,web3与Etherscan网站)为什么不同的令牌值?

问题描述 投票:0回答:1

事务哈希:0x70a584e4a2eb38cf7d6d48e215f6ac105b17ecfd97cd7091c4079bb961c2aa4c


[Etherscan网站]

https://etherscan.io/tx/0x70a584e4a2eb38cf7d6d48e215f6ac105b17ecfd97cd7091c4079bb961c2aa4c

转移价值= 90000000000000000000000(90,000 C3W)


[Etherscan API]

http://api.etherscan.io/api?apikey=BCNCEPNBI3ZDJX5ICTXW7IFEQASR2VUERK&module=account&action=tokentx&contractAddress=0x19055B944806fba2717dc694CF0173a1EB2D1604&address=0x0d7a0161f798166b2fcc996f03448892c2584193&sort=asc&startNumber=7417794&endNumber=7417804&page=1&offset=10000

转移价值= 9000000000000(0.000009 C3W)


[WEB3]

const tx = await web3.eth.getTransaction('0x70a584e4a2eb38cf7d6d48e215f6ac105b17ecfd97cd7091c4079bb961c2aa4c');
const input = tx.input; // '0xa9059cbb0000000000000000000000000d7a0161f798166b2fcc996f03448892c25841930000000000000000000000000000000000000000000000000000082f79cd9000'
/*** convert ***/

转移价值= 9000000000000(0.000009 C3W)

为什么不同?哪些数据正确?以及如何使用Web3或Etherscan API获取正确的令牌值?

token web3 erc20 etherscan
1个回答
0
投票

根据etherscan提供的解码输入数据,

#   Name    Type    Data
0   _to     address 0d7a0161f798166b2fcc996f03448892c2584193
1   _value  uint256 9000000000000

我找不到任何问题。

并且,C3W令牌小数为8。 所以,9000000000000是对的。

© www.soinside.com 2019 - 2024. All rights reserved.