0

I'm trying to understand every fields in an erc20 transfers. But I don't find any informations about the currency of the value field :

https://etherscan.io/tokentxns

Can someone explain me ?

  • 1
    It represents the amount of tokens transferred. – Jaime Aug 8 '18 at 14:21
1

The value is the units of a token transferred in that transaction.

Note that the units are similar to ethereum, in the sense that the base unit is what we would normally look for after the decimal.

For example, for the ZRX token, the base unit is the same as for ether, 1 wei.

Therefore, a transfer of 1 ZRX will have an event log value of 1*10^18, or 1000000000000000000.

1

If T is the name of the ERC-20 token you are looking at, then to find the number of T tokens involved in the transaction, take value and divide by 10^decimals. decimals is a value set by the programmer in the contract itself.

Why not have value directly represent the number of T tokens? Because the EVM doesn’t handle floating-point values, programmers instead use fixed-point numbers. For example, if decimals is 2, then value is divided by 10^2=100. So if value is 1234, this represents 12.34 T tokens. Thus, decimals determines how divisible a token is into fractions of that token.

  • 1
    value is the number of T tokens, divided by 10^decimals Shouldn't this be multiplied? – Raghav Sood Aug 8 '18 at 15:44
  • @RaghavSood you are correct. – lungj Aug 8 '18 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.