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 :
Can someone explain me ?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
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
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 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.