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

Get a function type with function selector

To get the function type and pass it as an argument to another function, you can use the function name itself. For internal functions, you can use the function name itself, such as functionName, and for external functions, use this.functionName. You can see an example of it in the Using internal function types and Using external function types sections.

All of the public and external functions have special members available, called selector, which returns the first 4 bytes of the function signature as bytes4. You can use selector, as shown in the following example code:

contract SelectorExample {    //Returns first 4 bytes of method signature 0x2c383a9f    function method() public pure returns (bytes4 ...
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