Use `Contract.fallback_function`

pull/1757/head
webthethird 2 years ago
parent af6727c561
commit 26f80cfcf0
  1. 5
      slither/utils/upgradeability.py

@ -350,8 +350,7 @@ def get_proxy_implementation_var(proxy: Contract) -> Optional[Variable]:
Returns: Returns:
(`Variable`) | None : The variable, ideally a StateVariable, which stores the proxy's implementation address. (`Variable`) | None : The variable, ideally a StateVariable, which stores the proxy's implementation address.
""" """
available_functions = proxy.available_functions_as_dict() if not proxy.is_upgradeable_proxy or not proxy.fallback_function:
if not proxy.is_upgradeable_proxy or not available_functions["fallback()"]:
return None return None
delegate = find_delegate_in_fallback(proxy) delegate = find_delegate_in_fallback(proxy)
@ -375,7 +374,7 @@ def find_delegate_in_fallback(proxy: Contract) -> Optional[Variable]:
(`Variable`) | None : The variable being passed as the destination argument in a delegatecall in the fallback. (`Variable`) | None : The variable being passed as the destination argument in a delegatecall in the fallback.
""" """
delegate: Optional[Variable] = None delegate: Optional[Variable] = None
fallback = proxy.available_functions_as_dict()["fallback()"] fallback = proxy.fallback_function
for node in fallback.all_nodes(): for node in fallback.all_nodes():
for ir in node.irs: for ir in node.irs:
if isinstance(ir, LowLevelCall) and ir.function_name == "delegatecall": if isinstance(ir, LowLevelCall) and ir.function_name == "delegatecall":

Loading…
Cancel
Save