Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: skip cache when local
Browse files Browse the repository at this point in the history
antazoey committed Jan 27, 2025
1 parent 0a5468c commit 9c88e37
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ape/managers/chain.py
Original file line number Diff line number Diff line change
@@ -969,10 +969,11 @@ def get_receipt(self, transaction_hash: str) -> ReceiptAPI:

def get_code(self, address: "AddressType") -> "ContractCode":
network = self.provider.network
self._code.setdefault(network.ecosystem.name, {})
self._code[network.ecosystem.name].setdefault(network.name, {})
if address in self._code[network.ecosystem.name][network.name]:
return self._code[network.ecosystem.name][network.name][address]
if not network.is_local:
self._code.setdefault(network.ecosystem.name, {})
self._code[network.ecosystem.name].setdefault(network.name, {})
if address in self._code[network.ecosystem.name][network.name]:
return self._code[network.ecosystem.name][network.name][address]

# Get from RPC for the first time.
code = self.provider.get_code(address)

0 comments on commit 9c88e37

Please sign in to comment.