Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: create and use disk-cache utilities for contracts-cache items #2416

Merged
merged 5 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/userguides/contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ or
```python
from ape import project


def main():
my_contract = project.MyContract.deployments[-1]
my_contract = project.MyContract.deployments[-1]
```

`my_contract` will be of type `ContractInstance`.
Expand Down
4 changes: 2 additions & 2 deletions src/ape/api/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self, *args, **kwargs):
@classmethod
def validate_gas_limit(cls, value):
if value is None:
if not cls.network_manager.active_provider:
if not cls.network_manager.connected:
raise NetworkError("Must be connected to use default gas config.")

value = cls.network_manager.active_provider.network.gas_limit
Expand All @@ -82,7 +82,7 @@ def validate_gas_limit(cls, value):
return None # Delegate to `ProviderAPI.estimate_gas_cost`

elif value == "max":
if not cls.network_manager.active_provider:
if not cls.network_manager.connected:
raise NetworkError("Must be connected to use 'max'.")

return cls.network_manager.active_provider.max_gas
Expand Down
2 changes: 1 addition & 1 deletion src/ape/contracts/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ def from_receipt(

# Cache creation.
creation = ContractCreation.from_receipt(receipt)
cls.chain_manager.contracts._local_contract_creation[address] = creation
cls.chain_manager.contracts.contract_creations[address] = creation

return instance

Expand Down
Loading
Loading