Questions tagged [function-selector]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
3 views

Why EIP-165 consider 0xffffffff value to be invalid id?

EIP-165 aims to provide a way for a contract to communicate whether it has implemented a certain interface or not. The standard defines the interface identifier as the XOR of all function selectors in ...
0
votes
1answer
20 views

How to load the first 4 bytes from a bytes calldata var?

It is common for calldata to be encoded as bytes calldata when developing contracts in Solidity. I need to extract the function selector from such a bytes var. What's the best way to load the first 4 ...
1
vote
0answers
218 views

Function selector computed differently for libraries?

As documented in various places, the function selector is computed as the first four bytes of the keccak256 hash of the function header, which consists of the function name followed by the list of ...
2
votes
1answer
2k views

explanation of appending .selector in solidity smart contracts

I'm trying to understand what .selector means when appended to logic wrapped up inside of functions definitions. I've tried to read the section in soliditydocs, but it doesn't seem to answer my ...
0
votes
2answers
98 views

What is the advantage of the function selector?

I can't understand the advantage of function selector. Following link What is a function selctor? uses function selector to invoke a function of another contract but it uses the statements: ...
10
votes
1answer
2k views

What is a function selector?

I am reading an article, it says: To enable deployment on the Ethereum platform, the contract functions are compiled into EVM bytecode and a piece of code called function selector is added, ...
3
votes
1answer
404 views

Function selector of function that takes enum as argument

If a function takes an enum as a parameter function foo(MyEnum arg1, uint256 arg2) public returns (bool); how do I properly compute the function selector for that function?
3
votes
1answer
277 views

Function selector for constructor & fallback function?

According to https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI, function selector is hashed from function name and list of its arguments put inside (). For example, with function deposit(...
27
votes
4answers
24k views

Calling function from deployed contract

I want to know how to instantiate an existing contract deployed on the blockchain using its address. e.g: contract A { function f1() {} } A is deployed on the blockchain, and in contract B I ...