Since you are using UUPSUpgradable
, your contract is deployed as a UUPS proxy.
UUPS proxies do not use a proxy admin, so admin.transferProxyAdminOwnership(gnosisSafe);
is not the right way to transfer its ownership.
Instead, just use instance.transferOwnership(gnosisSafe)
(your contract needs to implement _authorizeUpgrade()
to restrict upgrades to only the owner or another role or address if appropriate)