Concerning the transfer() function of a StandardToken: Since DAO "white hack" I know that it's important for contract security to substract the value first and then add it to the recipients balance. My assumption was that the same is true for transferFrom(). But as I compared a few different token contracts, I found there's no consistency:

HackerGold - first sub then add

FirstBlood – first add then sub


Which one is correct?

1 Answer 1


The order doesn't matter unless there is a inter-contract call or transactions between these statements.

To be safe side, and if you don't understand how contracts call each other, always sub first.

Your Answer

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

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