NamedContract
¶
- class moccasin.named_contract.NamedContract(contract_name: str, force_deploy: bool | None = None, abi: str | None = None, abi_from_explorer: bool | None = None, deployer_script: str | Path | None = None, address: str | None = None, deployer: VyperDeployer | ZksyncDeployer | None = None, recently_deployed_contract: VyperContract | ZksyncContract | None = None)¶
Bases:
object
A class to represent a named contract.
This class holds data about NamedContracts from the configuration and manages their deployment.
- Parameters:
contract_name (str) – The name of the contract
force_deploy (bool | None) – Whether to force deployment of the contract
abi (str | None) – The ABI of the contract
abi_from_explorer (bool | None) – Whether to fetch the ABI from the explorer
deployer_script (str | Path | None) – The path to the deployer script
address (str | None) – The address of the contract
deployer (VyperDeployer | ZksyncDeployer | None) – The deployer instance for the contract
recently_deployed_contract (VyperContract | ZksyncContract | None) – The recently deployed contract instance
- contract_name: str¶
- force_deploy: bool | None = None¶
- abi: str | None = None¶
- abi_from_explorer: bool | None = None¶
- deployer_script: str | Path | None = None¶
- address: str | None = None¶
- deployer: VyperDeployer | ZksyncDeployer | None = None¶
- recently_deployed_contract: VyperContract | ZksyncContract | None = None¶
- set_defaults(other: NamedContract)¶
Set default values from another NamedContract instance if they are not already set.
- Parameters:
other (NamedContract) – Another NamedContract instance to copy defaults from
- reset()¶
Reset the deployer and recently deployed contract to None.
- get(key: str, otherwise: Any)¶
Get a NamedContract attribute value or return a default if the attribute is not set.
- Parameters:
key (str) – The attribute name to get
otherwise (Any) – The default value to return if the attribute is not set
- Returns:
The attribute value or the default value
- Return type:
Any