In the case of calling a function with signature
foo(uint256) from contract
A, I could use this construction in solidity:
address(A).call(abi.encodeWithSignature("foo(uint256)", 100)); // or alternatively with: bytes4 selector = bytes4(keccak256("foo(uint256)")); address(A).call(abi.encodeWithSelector(selector, 100));
However, I would like to make a call from within
A to a given selector. Is there a way to do that (other than
address(this).call(...), which also only works if
foo is external)? I know that the EVM has opcodes for JUMP and IJUMP to navigate within the bytecode of a contract, but can one pass a selector to such an opcode and is there a solidity way of doing it?