Reading my input data on etherscan, I see each value as hex values. Which is fine to read the addresses. But I would like to read the amounts [1]
&& [3]
as numbers.
Contract Method
Function: trade(address tokenGet, uint256 amountGet, address tokenGive, uint256 amountGive, uint256 expires, uint256 nonce, address user, uint8 v, bytes32 r, bytes32 s, uint256 amount)
input data
MethodID: 0x0a19b14a
[0]:0000000000000000000000000000000000000000000000000000000000000000
[1]:000000000000000000000000000000000000000000000016d8fceafcef3c0000
[2]:000000000000000000000000340d2bde5eb28c1eed91b2f790723e3b160613b7
[3]:00000000000000000000000000000000000000000008b7363b040ca2bb600000
I made a transaction etherdelta where I bought 25
tokens. So the expected transformed value of the input data [1]
should be 25
or 25 * 10^18
(in wei) or at least any multiple of 25*10^x
.
Question
How to convert the hex to the expected value?
Tries
Using ethereum input decoder shows me the same values as on etherscan.io
converting to Ascii gives garbage (as recommended here: How to decode input data from a transaction?)
web3.utils.hexToNumberString
&web3.utils.hexToNumber
errconsole.log(0x000000000000000000000000000000000000000000000016d8fceafcef3c0000)
shows some arbitrary value