Skip to content

Commit

Permalink
chore: remove ethpm functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdefinitelyahuman committed Feb 2, 2024
1 parent bb42c60 commit 754662e
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 1,046 deletions.
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: 1 addition & 2 deletions brownie/project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
check_for_project,
compile_source,
from_brownie_mix,
from_ethpm,
get_loaded_projects,
load,
new,
Expand All @@ -13,4 +12,4 @@

__all__ = ["run"]

__console_dir__ = ["run", "new", "from_brownie_mix", "from_ethpm", "load", "compile_source"]
__console_dir__ = ["run", "new", "from_brownie_mix", "load", "compile_source"]
Loading

0 comments on commit 754662e

Please sign in to comment.