2

I'm using simple transfer function like below.

  function _transfer(address _from, address _to, uint256 _value) internal {                
    balances[_from] = balances[_from].sub(_value); // Subtract from the sender
        balances[_to] = balances[_to].add(_value); // Add the same to the recipient
    Transfer(_from, _to, _value);
}

The token amount of argument is received as uint256 data type so that I can't transfer the custom token as float data type even I deployed my token as 18 Decimals. For example, I want to transfer the amount of token like 0.00001, 0.00000002. I noticed the ufixed data type currently on Solidity 0.4.21 but I can't test on Remix with 0.4.21 version and fixed type. How can I transfer my token with ufixed data type?

| improve this question | | | | |
2

If your token has 18 decimal places then "one token" is represented by the number 1000000000000000000. (A one with 18 zeros after it.)

So to transfer 0.00001 tokens, you would use the number 10000000000000.

| improve this answer | | | | |

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.