Is it possible to use delegate call in an implementation contract of transparent upgradable proxy?

I'm trying to make my contracts upgradable with solidity, openzeppelin transparent upgradable proxies but I have some functions that use delegate calls, I found this in the documents, but I don't understand if I can use delegate calls in my functions when I add the modifier or I can't use it in any case: https://docs.openzeppelin.com/upgrades-plugins/1.x/faq#delegatecall-selfdestruct

Also, I see that the AddressUpgradable.sol deletes the delegate call functionality.

Could someone please tell me if I can use it or not?
I don't have any self-destruct code anywhere, I just need to allow the users to use delegate call.

:1234: Code to reproduce

    function _multicall(bytes[] calldata _data)
        internal
        virtual
        returns (bytes[] memory)
    {
        uint256 _dataLength = _data.length;
        bytes[] memory results = new bytes[](_dataLength);

        for (uint256 i; i < _dataLength; i++) {
            results[i] = Address.functionDelegateCall(
                address(this),
                _data[i]
            );
        }

        return results;
    }

:computer: Environment

Delegatecall is dangerous if it can result in triggering a selfdestruct, as mentioned in https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#potentially-unsafe-operations. If your function can only delegate calls to the same contract, and there are no selfdestructs in the contract or its dependencies, then that can be considered safe.

There is also a MulticallUpgradeable.sol that does pretty much the same thing as your function, although it is external.

1 Like