Skip to Content
Mastering Blockchain Programming with Solidity
book

Mastering Blockchain Programming with Solidity

by Jitendra Chittoda
August 2019
Intermediate to advanced
486 pages
13h 52m
English
Packt Publishing
Content preview from Mastering Blockchain Programming with Solidity

The transferFrom function

The transferFrom() function transfers the tokens from an owner's account to the receiver account, but only if the transaction initiator has sufficient allowance that has been previously approved by the owner to the transaction initiator. To transfer the tokens using the transferFrom() function, approver must have called the approve() function prior. As per the standard, the transferFrom() function must fire the Transfer event upon the successful execution and transfer of tokens. The transfer of 0 (zero) value must also be treated as a valid transfer and should fire the Transfer event.

The ERC20 standard API is as follows:

function transferFrom(address from, address to, uint256 value) external returns (bool success ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Ethereum

Mastering Ethereum

Andreas M. Antonopoulos, Gavin Wood
Complete Cryptocurrency and Blockchain Course | Learn Solidity

Complete Cryptocurrency and Blockchain Course | Learn Solidity

Ravinder Deol, Codestars By Rob Percival, Thomas Wiesner

Publisher Resources

ISBN: 9781839218262Supplemental Content