August 2019
Intermediate to advanced
486 pages
13h 52m
English
As we have seen, the ERC20 standard token implementation functions also return the transaction status as a Boolean. It's good practice to check for the return status of the function call to ensure that the transaction was successful. It is the developer's responsibility to enclose these function calls with require() to ensure that, when the intended ERC20 function call returns false, the caller transaction also fails. However, it is mostly missed by developers when they carry out checks; in effect, the transaction would always succeed, even if the token transfer didn't. The following is an example of enclosing a token transfer call and an approve call within the require() function:
//When ...