Network
¶
- class moccasin.config.Network(name: str, url: str | None = None, chain_id: int | None = None, is_fork: bool = False, is_zksync: bool = False, default_account_name: str | None = None, unsafe_password_file: pathlib._local.Path | None = None, save_abi_path: str | None = None, explorer_uri: str | None = None, explorer_api_key: str | None = None, explorer_type: str | None = None, named_contracts: dict[str, moccasin.named_contract.NamedContract] = <factory>, prompt_live: bool = True, save_to_db: bool = True, live_or_staging: bool = True, db_path: str | pathlib._local.Path = ':memory:', extra_data: dict[str, typing.Any] = <factory>, _network_env: Union[ForwardRef('NetworkEnv'), ForwardRef('Env'), ForwardRef('ZksyncEnv'), NoneType] = None)¶
Bases:
object
- property alias: str¶
- chain_id: int | None = None¶
- static convert_deployment_to_contract(deployment: Deployment) ABIContract ¶
- create_and_set_or_set_boa_env(**kwargs) NetworkEnv | Env | ZksyncEnv ¶
- db_path: str | Path = ':memory:'¶
- default_account_name: str | None = None¶
- explorer_api_key: str | None = None¶
- explorer_type: str | None = None¶
- explorer_uri: str | None = None¶
- extra_data: dict[str, Any]¶
- get_default_account() MoccasinAccount | Any ¶
Returns an ‘account-like’ object.
- get_deployer_from_contract_name(config: Config, contract_name: str) VyperDeployer | ZksyncDeployer ¶
- get_deployments_checked(contract_name: str | None = None, limit: int | None = None, chain_id: int | str | None = None, config_or_db_path: Config | Path | str | None = None) list[Deployment] ¶
- get_deployments_unchecked(contract_name: str | None = None, limit: int | None = None, chain_id: int | str | None = None, config_or_db_path: Config | Path | str | None = None) list[Deployment] ¶
- get_latest_contract_checked(contract_name: str | None = None, chain_id: int | str | None = None) ABIContract | None ¶
- get_latest_contract_unchecked(contract_name: str | None = None, chain_id: int | str | None = None) ABIContract | None ¶
- get_latest_deployment_checked(contract_name: str | None = None, chain_id: int | str | None = None) Deployment | None ¶
- get_latest_deployment_unchecked(contract_name: str | None = None, chain_id: int | str | None = None) Deployment | None ¶
- get_named_contract(contract_name: str) NamedContract | None ¶
- get_named_contracts() dict ¶
- get_or_deploy_contract(*args, **kwargs) VyperContract | ZksyncContract | ABIContract ¶
- get_or_deploy_named(contract_name: str, force_deploy: bool = False, abi: str | Path | list | VyperDeployer | VyperContract | ZksyncContract | ZksyncDeployer | ABIContractFactory | ABIContract | None = None, abi_from_explorer: bool | None = None, deployer_script: str | Path | None = None, address: str | None = None) VyperContract | ZksyncContract | ABIContract ¶
Returns or deploys a VyperContract, ZksyncContract, or ABIContract based on the name and address in the config file, or passed to this function.
- The following arguments are mutually exclusive:
abi
abi_from_explorer
- Args:
contract_name: the contract name or deployer for the contract.
force_deploy: if True, will deploy the contract even if the contract has an address in the config file.
abi: the ABI of the contract. Can be a list, string path to file, string of the ABI, VyperDeployer, VyperContract, ZksyncDeployer, ZksyncContract, ABIContractFactory, or ABIContract.
abi_from_explorer: if True, will fetch the ABI from the explorer.
deployer_script: If no address is given, this is the path to deploy the contract.
address: The address of the contract.
- Returns:
VyperContract | ZksyncContract | ABIContract: The deployed contract instance, or a blank contract if the contract is not found.
- get_or_deploy_named_contract(*args, **kwargs) VyperContract | ZksyncContract | ABIContract ¶
A wrapper around get_or_deploy_named that is more explicit about the contract being deployed.
- get_verifier_class() Any ¶
- has_explorer() bool ¶
- has_matching_integrity(deployment: Deployment, contract_name: str | None, config: Config | None = None) bool ¶
- property identifier: str¶
- instantiate_contract(*args, **kwargs) VyperContract | ZksyncContract | ABIContract ¶
An alias for get_or_deploy_named_contract.
- is_fork: bool = False¶
- is_local_or_forked_network() bool ¶
Returns True if network is: 1. pyevm 2. eravm 3. A fork
- is_matching_boa() bool ¶
Returns True if the current network is the active network in boa. This is a good way to test if you’ve overriden boa as the “active” network.
- is_zksync: bool = False¶
- live_or_staging: bool = True¶
- manifest_contract(contract_name: str, force_deploy: bool = False, address: str | None = None, checked: bool = False) VyperContract | ZksyncContract | ABIContract ¶
A wrapper around get_or_deploy_named_contract that is more explicit about the contract being deployed.
- manifest_named(*args, **kwargs) VyperContract | ZksyncContract | ABIContract ¶
A wrapper around get_or_deploy_named that is more explicit about the contract being deployed.
- manifest_named_contract(*args, **kwargs) VyperContract | ZksyncContract | ABIContract ¶
A wrapper around get_or_deploy_named that is more explicit about the contract being deployed.
- moccasin_verify(contract: VyperContract | ZksyncContract) VerificationResult ¶
Verifies a contract using your moccasin.toml config.
- name: str¶
- named_contracts: dict[str, NamedContract]¶
- prompt_live: bool = True¶
- save_abi_path: str | None = None¶
- save_to_db: bool = True¶
- set_boa_eoa(account: MoccasinAccount)¶
- set_kwargs(**kwargs)¶
- unsafe_password_file: Path | None = None¶
- url: str | None = None¶