Is there any way to fake the selector pointer for an arbitrary contract address call with abi.encodeWithSelector?

For example, I want to call a particular contract's deposit(...) method, but the contract calls sender.putFunds.selector like:

    (bool success, bytes memory result) = address(sender).call(
      abi.encodeWithSelector(ICaller(sender).putFunds.selector, callData)

Is there any way I can force it to call deposit(...) instead of putFunds(...), considering I have full control of the sender param which is retrieved as an input?

E.g., somehow faking the ABI so that it picks the function that I want.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.