web3p / web3.php

A php interface for interacting with the Ethereum blockchain and ecosystem. Native ABI parsing and smart contract interactions.
MIT License
1.15k stars 540 forks source link

How to customize token quantity sending? Number of decimal tokens or number of certificate tokens #326

Open qingshuiling opened 1 year ago

qingshuiling commented 1 year ago

How to send 1.555 tokens or 54.1332 tokens? Is there a way to control the number of custom tokens sent?

LubomirKurpel commented 9 months ago

In terms of EVM there are no decimals in tokens at all. However, most of the tokens have 18 decimals, meaning if you want to send 1.555 tokens you need to send 1.555*10^18 value. To check how many decimans token you are interacting with has, simply navigate to etherscan and check "decimals()" function in read contract tab.