Encoding function call data from upgradeable contract itself

This particular section of the article shows how to encode the function call data from node and then pass it to contract. However, I have a use case where I have to encode the call data from contract itself. Is that possible?

P.S. I had asked about this before here but had no response. So I am just rephrasing my question in a different way.

1 Like

Hello @sharma66mahesh! You can use Solidity’s native ABI Encoding and Decoding Functions.

Here is an example from OpenZeppelin Contracts:

    bytes memory returndata = to.functionCall(abi.encodeWithSelector(
    ), "ERC721: transfer to non ERC721Receiver implementer");

I’m closing Is there a way to encode/decode the initializer function with its arguments as a duplicate.