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

Remove ethPM functionality #1734

Merged
merged 3 commits into from
Feb 2, 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
180 changes: 0 additions & 180 deletions brownie/_cli/ethpm.py

This file was deleted.

2 changes: 1 addition & 1 deletion brownie/_cli/pm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Options:
--help -h Display this message

Manager for packages installed from ethPM and Github. Installed packages can
Manager for packages installed from Github. Installed packages can
be added as dependencies and imported into your own projects.

See https://eth-brownie.readthedocs.io/en/stable/package-manager.html for
Expand Down
2 changes: 1 addition & 1 deletion brownie/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
BROWNIE_FOLDER = Path(__file__).parent
DATA_FOLDER = Path.home().joinpath(".brownie")

DATA_SUBFOLDERS = ("accounts", "ethpm", "packages")
DATA_SUBFOLDERS = ("accounts", "packages")

EVM_EQUIVALENTS = {"atlantis": "byzantium", "agharta": "petersburg"}

Expand Down
27 changes: 0 additions & 27 deletions brownie/data/ethpm-config.yaml

This file was deleted.

94 changes: 7 additions & 87 deletions brownie/network/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
decode_typed_error,
parse_errors_from_abi,
)
from brownie.project import compiler, ethpm
from brownie.project import compiler
from brownie.project.flattener import Flattener
from brownie.typing import AccountsType, TransactionReceiptType
from brownie.utils import color
Expand Down Expand Up @@ -168,7 +168,6 @@ def decode_input(self, calldata: Union[str, bytes]) -> Tuple[str, Any]:


class ContractContainer(_ContractBase):

"""List-like container class that holds all Contract instances of the same
type, and is used to deploy new instances of that contract.

Expand Down Expand Up @@ -859,8 +858,7 @@ def __init__(
Recreate a `Contract` object from the local database.

The init method is used to access deployments that have already previously
been stored locally. For new deployments use `from_abi`, `from_ethpm` or
`from_etherscan`.
been stored locally. For new deployments use `from_abi` or `from_etherscan`.

Arguments
---------
Expand All @@ -874,8 +872,7 @@ def __init__(

if args or kwargs:
warnings.warn(
"Initializing `Contract` in this manner is deprecated."
" Use `from_abi` or `from_ethpm` instead.",
"Initializing `Contract` in this manner is deprecated." " Use `from_abi` instead.",
DeprecationWarning,
)
kwargs["owner"] = owner
Expand Down Expand Up @@ -915,27 +912,10 @@ def _deprecated_init(
manifest_uri: Optional[str] = None,
owner: Optional[AccountsType] = None,
) -> None:
if manifest_uri and abi:
raise ValueError("Contract requires either abi or manifest_uri, but not both")
if manifest_uri is not None:
manifest = ethpm.get_manifest(manifest_uri)
abi = manifest["contract_types"][name]["abi"]
if address is None:
address_list = ethpm.get_deployment_addresses(manifest, name)
if not address_list:
raise ContractNotFound(
f"'{manifest['package_name']}' manifest does not contain"
f" a deployment of '{name}' on this chain"
)
if len(address_list) > 1:
raise ValueError(
f"'{manifest['package_name']}' manifest contains more than one "
f"deployment of '{name}' on this chain, you must specify an address:"
f" {', '.join(address_list)}"
)
address = address_list[0]
name = manifest["contract_types"][name]["contract_name"]
elif not address:
if manifest_uri:
raise ValueError("ethPM functionality removed")

if not address:
raise TypeError("Address cannot be None unless creating object from manifest")

build = {"abi": abi, "contractName": name, "type": "contract"}
Expand Down Expand Up @@ -976,64 +956,6 @@ def from_abi(
_add_deployment(self)
return self

@classmethod
def from_ethpm(
cls,
name: str,
manifest_uri: str,
address: Optional[str] = None,
owner: Optional[AccountsType] = None,
persist: bool = True,
) -> "Contract":
"""
Create a new `Contract` object from an ethPM manifest.

Arguments
---------
name : str
Name of the contract.
manifest_uri : str
erc1319 registry URI where the manifest is located
address : str optional
Address where the contract is deployed. Only required if the
manifest contains more than one deployment with the given name
on the active chain.
owner : Account, optional
Contract owner. If set, transactions without a `from` field
will be performed using this account.
"""
manifest = ethpm.get_manifest(manifest_uri)

if address is None:
address_list = ethpm.get_deployment_addresses(manifest, name)
if not address_list:
raise ContractNotFound(
f"'{manifest['package_name']}' manifest does not contain"
f" a deployment of '{name}' on this chain"
)
if len(address_list) > 1:
raise ValueError(
f"'{manifest['package_name']}' manifest contains more than one "
f"deployment of '{name}' on this chain, you must specify an address:"
f" {', '.join(address_list)}"
)
address = address_list[0]

manifest["contract_types"][name]["contract_name"]
build = {
"abi": manifest["contract_types"][name]["abi"],
"contractName": name,
"natspec": manifest["contract_types"][name]["natspec"],
"type": "contract",
}

self = cls.__new__(cls)
_ContractBase.__init__(self, None, build, manifest["sources"]) # type: ignore
_DeployedContractBase.__init__(self, address, owner)
if persist:
_add_deployment(self)
return self

@classmethod
def from_explorer(
cls,
Expand Down Expand Up @@ -1298,7 +1220,6 @@ def alias(self) -> Optional[str]:


class ProjectContract(_DeployedContractBase):

"""Methods for interacting with a deployed contract as part of a Brownie project."""

def __init__(
Expand Down Expand Up @@ -1861,7 +1782,6 @@ def __call__(self, *args: Tuple, silent: bool = False) -> TransactionReceiptType


class ContractCall(_ContractMethod):

"""
A public view or pure contract method.

Expand Down
3 changes: 0 additions & 3 deletions brownie/network/web3.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@


class Web3(_Web3):

"""Brownie Web3 subclass"""

def __init__(self) -> None:
super().__init__(HTTPProvider("null"))
self.enable_unstable_package_management_api()
self.provider = None
self._mainnet_w3: Optional[_Web3] = None
self._genesis_hash: Optional[str] = None
Expand Down Expand Up @@ -142,7 +140,6 @@ def _mainnet(self) -> _Web3:
if not self._mainnet_w3:
uri = _expand_environment_vars(mainnet["host"])
self._mainnet_w3 = _Web3(HTTPProvider(uri))
self._mainnet_w3.enable_unstable_package_management_api()
return self._mainnet_w3

@property
Expand Down
Loading
Loading