I have a token with 18 decimals, I'm using the OpenZeppelin StandardToken example and have figured out that when I want to send value I have to keep the decimals in count as such: _value * 10**decimals.

uint decimals = 18
transfer(_receivers[i], (_amount[i] * 10**decimals));

This will send the correct amount of tokens. But I don't want to calculate the decimals every place I use the transfer function.. Is it frowned upon to change the OpenZeppelin transfer() function to set the value there to

_value *10**18

Or is there an other way that is better?

1 Answer 1


You can just create a temporary variable and calculate the product before passig the value to the trasnfer function. There is not problem doing that.

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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