Decoding contract transaction value transferred - Approximating big numbers with e+x
5hanth opened this issue · 2 comments
5hanth commented
> abiDecoder.decodeMethod("0xa9059cbb0000000000000000000000002147e79d34ee3c4403de8584cfd7fd235141564f00000000000000000000000000000000000000000052ba49a3403d1c26c4b9f4")
{ name: 'transfer',
params:
[ { name: '_to',
value: '0x2147e79d34ee3c4403de8584cfd7fd235141564f',
type: 'address' },
{ name: '_value',
value: '1.000116357500001449434629e+26',
type: 'uint256' } ] }
The actual value transferred is 100,011,635,750,000,000,000,000,000
as shown in rinkeby.etherscan.io
but the decoder gives approximated e+26 value which when parsed into int, we get 100,011,635,750,000,144,293,036,032
- which is higher than actual number.
any pointers?
pieterhartel commented
I've had the same problem. I fixed it by editing "node_modules/abi-decoder/index.js". I added parameters to the toString method calls: "new Web3().toBigNumber(param).toString( 10, 85 );
I think that this should be take-up by the authors.
--pieter
pieterhartel commented
Why has this been closed? The problem has not been fixed..
--pieter