Skip to content

Commit

Permalink
fix: populate with fallback handler abi
Browse files Browse the repository at this point in the history
  • Loading branch information
banteg committed Jun 28, 2023
1 parent 2c74f5f commit f9a8a59
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ape_safe/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ def address(self) -> AddressType:
@cached_property
def contract(self) -> ContractInstance:
safe_contract = self.chain_manager.contracts.instance_at(self.address)
if fallback_abi := self.fallback_handler and self.fallback_handler.contract_type.dict()["abi"]:
contract_type = safe_contract.contract_type.dict()
if set(fallback_abi) in set(contract_type["abi"]):
return safe_contract
if self.fallback_handler:
contract_signatures = {x.signature for x in safe_contract.contract_type.abi}
fallback_signatures = {x.signature for x in self.fallback_handler.contract_type.abi}
if fallback_signatures < contract_signatures:
return safe_contract # for some reason this never gets hit

contract_type["abi"].extend(fallback_abi)
contract_type = safe_contract.contract_type.dict()
fallback_type = self.fallback_handler.contract_type.dict()
contract_type["abi"].extend(fallback_type["abi"])
return self.chain_manager.contracts.instance_at(
self.address, contract_type=ContractType.parse_obj(contract_type)
)
Expand Down

0 comments on commit f9a8a59

Please sign in to comment.